emote.ts 982 B

123456789101112131415161718192021222324252627282930
  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. const { ccclass, property } = _decorator;
  7. @ccclass('emote')
  8. export class emote extends Component {
  9. emote_index:number = 0;
  10. start() {
  11. UIButton.BindClick(this.node,()=>{
  12. console.log("emote_index",this.emote_index)
  13. ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_SHOW_SELF_EMOTE,this.emote_index)
  14. ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_SHOW_RIVAL_EMOTE,this.emote_index)
  15. ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_BTN_HIDE_CHAT)
  16. },this)
  17. }
  18. update(deltaTime: number) {
  19. }
  20. show(index:number){
  21. this.emote_index = index;
  22. ResMng.LoadEmote("Game_Images_chat_emote_exp_"+index,this.node.getComponent(Sprite))
  23. }
  24. }