ItemMsg.ts 1.9 KB

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