emote.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { _decorator, Component, Node, Sprite } from 'cc';
  2. import { ClientEvent } from '../clientEvent';
  3. import { Constant } from '../constant';
  4. import { ResMng } from '../gcommon/ResMng';
  5. import { UIButton } from '../gcommon/UIButton';
  6. import { msgManager } from '../socket/msgManager';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('emote')
  9. export class emote extends Component {
  10. emote_index:number = 0;
  11. id:string = "";
  12. start() {
  13. UIButton.BindClick(this.node,()=>{
  14. console.log("emote_index",this.emote_index)
  15. msgManager.send_chat(this.id,"")
  16. // ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_SHOW_SELF_EMOTE,this.emote_index)
  17. // ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_SHOW_RIVAL_EMOTE,this.emote_index)
  18. ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_BTN_HIDE_CHAT)
  19. },this)
  20. }
  21. update(deltaTime: number) {
  22. }
  23. show(id:string,index:number){
  24. console.log("emote",index)
  25. this.id = id;
  26. this.emote_index = index;
  27. ResMng.LoadEmote("Game_Images_chat_emote_exp_"+index,this.node.getComponent(Sprite))
  28. }
  29. }