MainUI.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /** @format */
  2. import {UI} from '../enums/UI'
  3. import {BaseUI} from './BaseUI'
  4. import {Data, Mgr} from '../GameControl'
  5. import {ccUtils} from '../utils/ccUtils'
  6. import {observer, render, node, label, editBox, list} from '../mobx/observer'
  7. import {msgCmd} from '../proto/msg_cmd'
  8. import {GOODS} from '../enums/Enum'
  9. import {roleUpgradeRsp} from '../proto/game'
  10. import {IRewardNty} from '../interface/UIInterface'
  11. const {ccclass, property} = cc._decorator
  12. @ccclass
  13. @observer
  14. export class MainUI extends BaseUI {
  15. onShow(args, fromUI: number) {
  16. Mgr.ui.showTop(this, [GOODS.coin, GOODS.diamond])
  17. Mgr.ui.showFoot(this)
  18. Mgr.net.add(msgCmd.cmd_role_upgrade_rsp, this, this.onRoleUpgradeRsp)
  19. //Mgr.net.send(msgCmd.cmd_role_upgrade)
  20. }
  21. onHide(): any {
  22. Mgr.event.removeAll(this)
  23. }
  24. //UI或者其他函数=======================================
  25. //网络事件=======================================
  26. onRoleUpgradeRsp(data: roleUpgradeRsp, reward: IRewardNty) {
  27. Data.user.level = data.level
  28. Data.user.exp = data.exp
  29. //显示升级提示
  30. Mgr.ui.show(UI.RoleUpgradeUI, reward)
  31. }
  32. //触发事件=======================================
  33. // @render
  34. // showRender() {}
  35. // 点击事件=======================================
  36. // onClick() {}
  37. }