This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-01-05 02:15:38 +08:00
parent 0556449f0a
commit c0cfcf98fc
14 changed files with 1004 additions and 67 deletions

View File

@@ -5,7 +5,7 @@ import { instantiate } from 'cc';
import { Label } from 'cc';
import { EditBox } from 'cc';
import { GUI } from '../../UIConfig';
import { GUIChatMessage } from '../../../consts/GActionType';
import { GUIChatMessage, GUIChatMessageDTO } from '../../../consts/GActionType';
import { Widget } from 'cc';
import JScrollExceedHide from '../../../../../extensions/ngame/assets/ngame/util/components/JScrollExceedHide';
import { JNGLayerBase } from '../../../components/JNComponent';
@@ -46,9 +46,7 @@ export class MainChatView extends JNGLayerBase {
let messages = ChatData.getIns().datas;
messages.forEach(message => {
let node = instantiate(this.chatPrefab);
node.getComponent(Label).string = message;
this.content.addChild(node);
this.onMessage(message);
})
}
@@ -68,11 +66,12 @@ export class MainChatView extends JNGLayerBase {
}
//接受到消息
onMessage(info:GUIChatMessage){
onMessage(info:GUIChatMessageDTO){
//插入数据
let node = instantiate(this.chatPrefab);
node.getComponent(Label).string = info.message;
node.getComponent(Label).string = `${info.playerName} : ${info.message.message}`;
this.content.addChild(node);
this.scheduleOnce(() => {
this.getComponentInChildren(JScrollExceedHide).onUpdate();