763dcb86513069be85d26f144b1026f18455031a.js 8.6 KB

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