HeroFate.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import { _decorator, Label, tween, UIOpacity } from 'cc';
  2. import { BaseView } from '../../../framework/layer/BaseView';
  3. import { StringUtil } from '../../../framework/util/StringUtil';
  4. import List from '../../../framework/list/List';
  5. import { Framework } from '../../../framework/Framework';
  6. import { Equip } from '../../data/EquipData';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('HeroFate')
  9. export class HeroFate extends BaseView {
  10. @property({ type: Label, tooltip: "关闭提示" })
  11. closeTips: Label = null;
  12. @property({ type: Label, tooltip: "标题" })
  13. titieTx: Label = null;
  14. @property({ type: List, tooltip: "列表" })
  15. itemList: List = null;
  16. private _fettersList = [];
  17. start() {
  18. }
  19. protected onLoad() {
  20. super.onLoad();
  21. this.closeTips.string = StringUtil.getLanguageData('点击空白关闭');
  22. this.titieTx.string = StringUtil.getLanguageData('装备选择');
  23. this.closeTips.node.getComponent(UIOpacity).opacity = 0;
  24. // Framework.event.addEvent(GameEvent.EquipWearChange, () => {
  25. // Framework.layer.close(this);
  26. // }, this);
  27. }
  28. protected onDestroy() {
  29. }
  30. //UI开打时会调用,如果有初始化代码应该放到此函数
  31. onOpen(data) {
  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. if (target.name == 'mask') {
  55. Framework.layer.close(this);
  56. }
  57. }
  58. onEventList(item, idx) {
  59. // item.getComponent(HeroFateItem).refreshItem(this._equipsData[idx], this._curEquip);
  60. }
  61. }