chat_text_cell.ts 879 B

123456789101112131415161718192021222324252627282930313233
  1. import { _decorator, Component, Node, Label } from 'cc';
  2. import { ClientEvent } from '../clientEvent';
  3. import { Constant } from '../constant';
  4. import { UIButton } from '../gcommon/UIButton';
  5. const { ccclass, property } = _decorator;
  6. @ccclass('chat_text_cell')
  7. export class chat_text_cell extends Component {
  8. @property(Node)
  9. lab_str: Node = null; //
  10. text:string = ""
  11. start() {
  12. UIButton.BindClick(this.node,()=>{
  13. ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_SHOW_SELF_CHAT,this.text)
  14. ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_SHOW_RIVAL_CHAT,this.text)
  15. ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_BTN_HIDE_CHAT)
  16. },this)
  17. }
  18. show(str:string){
  19. this.text = str;
  20. this.lab_str.getComponent(Label).string = str;
  21. }
  22. update(deltaTime: number) {
  23. }
  24. }