import { _decorator, Component, Node, Label, Color } from 'cc'; import { ClientEvent } from '../clientEvent'; import { Constant } from '../constant'; import { GameMng } from '../GameMng'; import { UIButton } from '../gcommon/UIButton'; import { msgManager } from '../socket/msgManager'; const { ccclass, property } = _decorator; @ccclass('chat_text_cell') export class chat_text_cell extends Component { @property(Node) lab_str: Node = null; // text:string = "" id:string = "" start() { UIButton.BindClick(this.node,()=>{ if( this.id !=""){ msgManager.send_chat(this.id,this.text) ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_BTN_HIDE_CHAT) } },this) } show(id:string,str:string){ let user_name = str.split(":")[0]; var color = new Color() if(user_name===GameMng._userData.user_name){ this.lab_str.getComponent(Label).color = color.fromHEX("#FFFFFF") }else{ this.lab_str.getComponent(Label).color = color.fromHEX("#9BA3DD") } this.text = str; this.id = id; this.lab_str.getComponent(Label).string = str; } update(deltaTime: number) { } }