ModOpenUI.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 {IUserGuide} from '../interface/UIInterface'
  9. import {FunctionsConfig} from '../config/FunctionsConfig'
  10. import {EVENT} from '../enums/Enum'
  11. const {ccclass, property} = cc._decorator
  12. @ccclass
  13. @observer
  14. export class ModOpenUI extends BaseUI {
  15. @node('layout/item')
  16. item: cc.Node
  17. callback: Function
  18. onShow(args: IUserGuide, fromUI: number) {
  19. this.callback = args.callback
  20. let modIDs = args.path.split('_')
  21. let nodes = ccUtils.instantChildren(this.item, modIDs.length)
  22. for (let i = 0; i < modIDs.length; i++) {
  23. let cfg = FunctionsConfig[modIDs[i]]
  24. ccUtils.setLabel(cfg.name, nodes[i], 'name')
  25. this.loadTexImg(`Public/modeIcon/${cfg.icon}`, nodes[i], 'icon')
  26. cc.tween(cc.find('effect', nodes[i])).by(-1, {angle: -1}).repeatForever().start()
  27. }
  28. }
  29. onHide(): any {
  30. Mgr.event.removeAll(this)
  31. this.callback && this.callback()
  32. if (!Mgr.global.curGuideStep) Mgr.event.trigger(EVENT.mainPopAnyUI)
  33. }
  34. //UI或者其他函数=======================================
  35. //网络事件=======================================
  36. //触发事件=======================================
  37. // 点击事件=======================================
  38. }