ItemMsg.ts 1.7 KB

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