763dcb86513069be85d26f144b1026f18455031a.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Button, Component, Label, Node, tween, v3, ch, gui, GameLink, UI_ad_get, LvDir, _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2, _descriptor3, _crd, ccclass, property, ui_item;
  4. function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
  5. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
  6. function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
  7. function _reportPossibleCrUseOfch(extras) {
  8. _reporterNs.report("ch", "../../../ch/ch", _context.meta, extras);
  9. }
  10. function _reportPossibleCrUseOfgui(extras) {
  11. _reporterNs.report("gui", "../../../core/ui/ui", _context.meta, extras);
  12. }
  13. function _reportPossibleCrUseOfGameLink(extras) {
  14. _reporterNs.report("GameLink", "../../game/GameLink", _context.meta, extras);
  15. }
  16. function _reportPossibleCrUseOfUI_ad_get(extras) {
  17. _reporterNs.report("UI_ad_get", "../ad_get/UI_ad_get", _context.meta, extras);
  18. }
  19. function _reportPossibleCrUseOfLvDir(extras) {
  20. _reporterNs.report("LvDir", "../../game/Lv", _context.meta, extras);
  21. }
  22. return {
  23. setters: [function (_unresolved_) {
  24. _reporterNs = _unresolved_;
  25. }, function (_cc) {
  26. _cclegacy = _cc.cclegacy;
  27. __checkObsolete__ = _cc.__checkObsolete__;
  28. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  29. _decorator = _cc._decorator;
  30. Button = _cc.Button;
  31. Component = _cc.Component;
  32. Label = _cc.Label;
  33. Node = _cc.Node;
  34. tween = _cc.tween;
  35. v3 = _cc.v3;
  36. }, function (_unresolved_2) {
  37. ch = _unresolved_2.ch;
  38. }, function (_unresolved_3) {
  39. gui = _unresolved_3.gui;
  40. }, function (_unresolved_4) {
  41. GameLink = _unresolved_4.GameLink;
  42. }, function (_unresolved_5) {
  43. UI_ad_get = _unresolved_5.UI_ad_get;
  44. }, function (_unresolved_6) {
  45. LvDir = _unresolved_6.LvDir;
  46. }],
  47. execute: function () {
  48. _crd = true;
  49. _cclegacy._RF.push({}, "12c662bVNFDxoVeaMUS/AvG", "ui_item", undefined);
  50. __checkObsolete__(['_decorator', 'Button', 'Component', 'instantiate', 'Label', 'Node', 'Sprite', 'SpriteFrame', 'tween', 'v3']);
  51. __checkObsolete__(['Enum']);
  52. ({
  53. ccclass,
  54. property
  55. } = _decorator);
  56. _export("ui_item", ui_item = (_dec = ccclass('ui_item'), _dec2 = property(Label), _dec3 = property(Node), _dec(_class = (_class2 = class ui_item extends Component {
  57. constructor(...args) {
  58. super(...args);
  59. _initializerDefineProperty(this, "type", _descriptor, this);
  60. _initializerDefineProperty(this, "count", _descriptor2, this);
  61. _initializerDefineProperty(this, "ad", _descriptor3, this);
  62. this._c = 0;
  63. }
  64. start() {
  65. if (this.type == 0) return;
  66. this.show(this.type, (_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
  67. error: Error()
  68. }), GameLink) : GameLink).getInst().player.get_item(this.type));
  69. if (this.node.getComponent(Button)) {
  70. this.node.on(Node.EventType.TOUCH_END, this.onClick, this);
  71. }
  72. (_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
  73. error: Error()
  74. }), GameLink) : GameLink).getInst().player.event.on((_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
  75. error: Error()
  76. }), GameLink) : GameLink).getInst().player.event.key.item_count, this.show, this);
  77. }
  78. onDestroy() {
  79. (_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
  80. error: Error()
  81. }), GameLink) : GameLink).getInst().player.event.off((_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
  82. error: Error()
  83. }), GameLink) : GameLink).getInst().player.event.key.item_count, this.show, this);
  84. }
  85. show(type, count) {
  86. if (type != this.type) return;
  87. if (this._c != count) {
  88. tween(this.node).to(0.05, {
  89. scale: v3(1.2, 1.2, 1)
  90. }).to(0.1, {
  91. scale: v3(1, 1, 1)
  92. }).start();
  93. if (count < this._c) {
  94. if (type == 1) {
  95. (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
  96. error: Error()
  97. }), ch) : ch).audio.playOneShot('sounds/sfx_item1');
  98. } else if (type == 2) {
  99. (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
  100. error: Error()
  101. }), ch) : ch).audio.playOneShot('sounds/sfx_item2');
  102. } else {
  103. (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
  104. error: Error()
  105. }), ch) : ch).audio.playOneShot('sounds/sfx_item3');
  106. }
  107. }
  108. }
  109. this._c = count;
  110. this.count.string = count == 0 ? '+' : count.toString();
  111. if (type == 1) {
  112. if ((_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
  113. error: Error()
  114. }), GameLink) : GameLink).getInst().lv.dir == (_crd && LvDir === void 0 ? (_reportPossibleCrUseOfLvDir({
  115. error: Error()
  116. }), LvDir) : LvDir).none) {
  117. this.node.active = false;
  118. } else {
  119. this.node.active = true;
  120. }
  121. } //this.ad.active = count <= 0;
  122. } //
  123. async onClick(evt) {
  124. if (this._c <= 0) {
  125. (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
  126. error: Error()
  127. }), gui) : gui).show(_crd && UI_ad_get === void 0 ? (_reportPossibleCrUseOfUI_ad_get({
  128. error: Error()
  129. }), UI_ad_get) : UI_ad_get, this.type);
  130. } else {
  131. (_crd && GameLink === void 0 ? (_reportPossibleCrUseOfGameLink({
  132. error: Error()
  133. }), GameLink) : GameLink).getInst().player.use_item(this.type);
  134. }
  135. }
  136. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "type", [property], {
  137. configurable: true,
  138. enumerable: true,
  139. writable: true,
  140. initializer: function () {
  141. return 0;
  142. }
  143. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "count", [_dec2], {
  144. configurable: true,
  145. enumerable: true,
  146. writable: true,
  147. initializer: null
  148. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "ad", [_dec3], {
  149. configurable: true,
  150. enumerable: true,
  151. writable: true,
  152. initializer: null
  153. })), _class2)) || _class));
  154. _cclegacy._RF.pop();
  155. _crd = false;
  156. }
  157. };
  158. });
  159. //# sourceMappingURL=763dcb86513069be85d26f144b1026f18455031a.js.map