mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交素材
This commit is contained in:
28
JisolGameCocos/assets/script/ui/Home/Chat/MainChatIcon.ts
Normal file
28
JisolGameCocos/assets/script/ui/Home/Chat/MainChatIcon.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import ChatData from '../../../data/ChatData';
|
||||
import { GUIChatMessageDTO } from '../../../consts/GActionType';
|
||||
import { Label } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainChatIcon')
|
||||
export class MainChatIcon extends Component {
|
||||
|
||||
@property(Label)
|
||||
text:Label;
|
||||
|
||||
onLoad(){
|
||||
//监听消息
|
||||
ChatData.getIns().on(this.onMessage.bind(this),this);
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
ChatData.getIns().off(this.onMessage.bind(this),this);
|
||||
}
|
||||
|
||||
onMessage(info:GUIChatMessageDTO){
|
||||
this.text.string = `${info.playerName} : ${info.message.message}`
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "792ecb74-f351-4d1e-ab12-37b671bb4172",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user