ChatAndMenu.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { _decorator, Component, Node, Vec3, tween } from 'cc';
  2. import { ClientEvent } from '../clientEvent';
  3. import { Constant } from '../constant';
  4. import { UIButton } from '../gcommon/UIButton';
  5. import GBoardChess from './ChessGame/GBoardChess';
  6. import UIDialog from './UIDialog';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('ChatAndMenu')
  9. export class ChatAndMenu extends Component {
  10. @property(Node)
  11. btn_menu: Node = null;
  12. @property(Node)
  13. btn_chat: Node = null;
  14. @property(Node)
  15. caidan_list:Node=null;//菜单列表
  16. start() {
  17. UIButton.BindClick(this.btn_chat,function(){
  18. ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_BTN_SHOW_CHAT)
  19. }, this)
  20. UIButton.BindClick(this.btn_menu,function(){
  21. if(this.caidan_list.active){
  22. this.caidan_list.active= false;
  23. return
  24. }
  25. this.caidan_list.scale = new Vec3(0,0,0)
  26. this.caidan_list.active = true;
  27. tween()
  28. .target(this.caidan_list)
  29. .to(0.2,{scale:new Vec3(1.1,1.1,1)})
  30. .delay(0.2)
  31. .call(()=>{
  32. this.caidan_list.scale = new Vec3(1,1,1)
  33. })
  34. .start()
  35. }, this)
  36. }
  37. update(deltaTime: number) {
  38. }
  39. }