ItemMsg.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { _decorator, Label, Node, tween, UIOpacity } from 'cc';
  2. import { BaseView } from '../../../framework/layer/BaseView';
  3. import { StringUtil } from '../../../framework/util/StringUtil';
  4. import { ItemEnum } from '../../common/InterfaceAddEnum';
  5. import { Framework } from '../../../framework/Framework';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('ItemMsg')
  8. export class ItemMsg extends BaseView {
  9. @property({ type: Label, tooltip: "关闭提示" })
  10. closeTips: Label = null;
  11. @property({ type: Label, tooltip: "标题" })
  12. titleTx: Label = null;
  13. @property({ type: Node, tooltip: "标题区域" })
  14. titleNode: Node = null;
  15. @property({ type: Node, tooltip: "基础信息区域" })
  16. msgNode: Node = null;
  17. @property({ type: Node, tooltip: "描述区域" })
  18. descNode: Node = null;
  19. @property({ type: Node, tooltip: "属性展示区域" })
  20. attrNode: Node = null;
  21. @property({ type: Node, tooltip: "批量操作区域" })
  22. batchNode: Node = null;
  23. @property({ type: Node, tooltip: "操作区域" })
  24. operateNode: Node = null;
  25. protected onLoad() {
  26. super.onLoad();
  27. this.closeTips.string = StringUtil.getLanguageData('点击空白关闭');
  28. this.closeTips.node.getComponent(UIOpacity).opacity = 0;
  29. }
  30. protected onDestroy() {
  31. }
  32. //UI开打时会调用,如果有初始化代码应该放到此函数
  33. onOpen(data) {
  34. tween(this.closeTips.node.getComponent(UIOpacity))
  35. .to(1, { opacity: 255 })
  36. .to(1.2, { opacity: 10 })
  37. .union()
  38. .repeatForever()
  39. .start()
  40. if(data.type == ItemEnum.material){
  41. }else if(data.type == ItemEnum.equip){
  42. }
  43. }
  44. //UI关闭时会调用,该函数在onDestroy前调用
  45. onClose() {
  46. }
  47. //框架管理UI层级时会调用,可根据UI情况修改
  48. onShow() {
  49. super.onShow();
  50. }
  51. //框架管理UI层级时会调用,可根据UI情况修改
  52. onHide() {
  53. super.onHide();
  54. }
  55. //UI事件处理
  56. private onTouchButton(event: Event) {
  57. //Framework.audio.playEffect(AudioID.Click);
  58. let target: any = event.target;
  59. if (target.name == 'mask') {
  60. Framework.layer.close(this);
  61. }
  62. }
  63. }