MessageUI.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /** @format */
  2. import {node, observer} from '../../mobx/observer'
  3. import {BaseUI} from '../BaseUI'
  4. import {ccUtils} from '../../utils/ccUtils'
  5. import {IMessage} from '../../interface/UIInterface'
  6. import {LANGUAGE_TYPE} from '../../enums/Enum'
  7. const {ccclass, property} = cc._decorator
  8. @ccclass
  9. @observer
  10. export class MessageUI extends BaseUI {
  11. sureFunc: Function = null
  12. @node('layout/button_cancel')
  13. btnCancel: cc.Node = null
  14. onShow(args: IMessage, fromUI: number) {
  15. this.sureFunc = args.sureFuc
  16. this.btnCancel.active = !args.isHideCancel
  17. ccUtils.setLabel(args.tip, this.node, 'lb')
  18. ccUtils.setLabel(args.sureLb ? args.sureLb : LANGUAGE_TYPE.confirm, this.node, 'layout/btn_sure/lb')
  19. }
  20. onHide(): any {}
  21. //网络事件=======================================
  22. //触发事件=======================================
  23. // @render
  24. // showRender() {}
  25. // 点击事件=======================================
  26. onSureClick() {
  27. this.hide()
  28. this.sureFunc && this.sureFunc()
  29. }
  30. }