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

@@ -1,7 +1,7 @@
import Singleton from "../../../extensions/ngame/assets/ngame/util/Singleton";
import { app } from "../App";
import { GAction } from "../consts/GAction";
import { GActionType, GUIChatMessage } from "../consts/GActionType";
import { GActionType, GUIChatMessage, GUIChatMessageDTO } from "../consts/GActionType";
import BaseData from "./BaseData";
//聊天数据
@@ -10,18 +10,18 @@ export default class ChatData extends BaseData{
static Event = "ChatData_Event_Message";
//世界消息列表
datas:string[] = [];
datas:GUIChatMessageDTO[] = [];
onInit() {
//监听聊天消息
app.socket.on(GAction.CHAT_RECEIVE_MESSAGE,this.onChatReceiveMessage,this,GActionType.GUIChatMessage);
app.socket.on(GAction.CHAT_RECEIVE_MESSAGE,this.onChatReceiveMessage,this,GActionType.GUIChatMessageDTO);
}
//接受聊天消息
onChatReceiveMessage(info:GUIChatMessage){
onChatReceiveMessage(info:GUIChatMessageDTO){
console.log(`ChatData - onChatReceiveMessage`,info.message);
this.datas.push(info.message);
this.datas.push(info);
app.event.emit(ChatData.Event,info);
}