5cc3ce28e30e8e416eb47ff816c05a8fc1f78292.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Button, Component, Label, Node, tween, v3, gui, UINotify, Hall, UI_Main, _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 _reportPossibleCrUseOfgui(extras) {
  10. _reporterNs.report("gui", "../../../core/ui/ui", _context.meta, extras);
  11. }
  12. function _reportPossibleCrUseOfUINotify(extras) {
  13. _reporterNs.report("UINotify", "../../../module_basic/ui_notify/UINotify", _context.meta, extras);
  14. }
  15. function _reportPossibleCrUseOfHall(extras) {
  16. _reporterNs.report("Hall", "db://assets/Scripts/Hall", _context.meta, extras);
  17. }
  18. function _reportPossibleCrUseOfUI_Main(extras) {
  19. _reporterNs.report("UI_Main", "../UI_Main/UI_Main", _context.meta, extras);
  20. }
  21. function _reportPossibleCrUseOfLayout_Main(extras) {
  22. _reporterNs.report("Layout_Main", "../UI_Main/Layout_Main", _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. gui = _unresolved_2.gui;
  40. }, function (_unresolved_3) {
  41. UINotify = _unresolved_3.UINotify;
  42. }, function (_unresolved_4) {
  43. Hall = _unresolved_4.Hall;
  44. }, function (_unresolved_5) {
  45. UI_Main = _unresolved_5.UI_Main;
  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. // import { GameLink } from '../../game/GameLink';
  53. // import { UI_ad_get } from '../ad_get/UI_ad_get';
  54. // import { LvDir } from '../../game/Lv';
  55. ({
  56. ccclass,
  57. property
  58. } = _decorator);
  59. _export("UI_Item", UI_Item = (_dec = ccclass('UI_Item'), _dec2 = property(Label), _dec3 = property(Node), _dec(_class = (_class2 = class UI_Item extends Component {
  60. constructor() {
  61. super(...arguments);
  62. _initializerDefineProperty(this, "type", _descriptor, this);
  63. _initializerDefineProperty(this, "count", _descriptor2, this);
  64. _initializerDefineProperty(this, "ad", _descriptor3, this);
  65. this._c = 0;
  66. }
  67. start() {
  68. if (this.type == 0) return;
  69. this.show(this.type, (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  70. error: Error()
  71. }), Hall) : Hall).getInstance().player.get_item(this.type));
  72. if (this.node.getComponent(Button)) {
  73. this.node.on(Node.EventType.TOUCH_END, this.onClick, this);
  74. }
  75. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  76. error: Error()
  77. }), Hall) : Hall).getInstance().player.event.on((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  78. error: Error()
  79. }), Hall) : Hall).getInstance().player.event.key.item_count, this.show, this);
  80. }
  81. onDestroy() {
  82. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  83. error: Error()
  84. }), Hall) : Hall).getInstance().player.event.off((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  85. error: Error()
  86. }), Hall) : Hall).getInstance().player.event.key.item_count, this.show, this);
  87. }
  88. show(type, count) {
  89. if (type != this.type) return;
  90. if (this._c != count) {
  91. tween(this.node).to(0.05, {
  92. scale: v3(1.2, 1.2, 1)
  93. }).to(0.1, {
  94. scale: v3(1, 1, 1)
  95. }).start();
  96. if (count < this._c) {// if (type == 1) {
  97. // ch.audio.playOneShot('sounds/sfx_item1');
  98. // } else if (type == 2) {
  99. // ch.audio.playOneShot('sounds/sfx_item2');
  100. // } else {
  101. // ch.audio.playOneShot('sounds/sfx_item3');
  102. // }
  103. }
  104. }
  105. this._c = count;
  106. this.count.string = count == 0 ? '+' : count.toString();
  107. if (type == 1) {// if (GameLink.getInst().lv.dir == LvDir.none) {
  108. // this.node.active = false;
  109. // } else {
  110. // this.node.active = true;
  111. // }
  112. } //this.ad.active = count <= 0;
  113. } //
  114. onClick(evt) {
  115. var _this = this;
  116. return _asyncToGenerator(function* () {
  117. if (_this._c <= 0) {
  118. if (_this.type == 3) {
  119. var flag = false;
  120. for (var element of (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
  121. error: Error()
  122. }), gui) : gui).get(_crd && UI_Main === void 0 ? (_reportPossibleCrUseOfUI_Main({
  123. error: Error()
  124. }), UI_Main) : UI_Main).getLayout().Container.node_isIdiom) {
  125. console.log(element);
  126. if (element == true) {
  127. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  128. error: Error()
  129. }), Hall) : Hall).getInstance().player.use_item(_this.type);
  130. flag = true;
  131. break;
  132. }
  133. }
  134. if (!flag) (_crd && UINotify === void 0 ? (_reportPossibleCrUseOfUINotify({
  135. error: Error()
  136. }), UINotify) : UINotify).show('槽中无可清除的方块');
  137. } // gui.show(UI_ad_get, this.type);
  138. } else {
  139. if (_this.type == 3) {
  140. var _flag = false;
  141. for (var _element of (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
  142. error: Error()
  143. }), gui) : gui).get(_crd && UI_Main === void 0 ? (_reportPossibleCrUseOfUI_Main({
  144. error: Error()
  145. }), UI_Main) : UI_Main).getLayout().Container.node_isIdiom) {
  146. console.log(_element);
  147. if (_element == true) {
  148. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  149. error: Error()
  150. }), Hall) : Hall).getInstance().player.use_item(_this.type);
  151. _flag = true;
  152. break;
  153. }
  154. }
  155. if (!_flag) (_crd && UINotify === void 0 ? (_reportPossibleCrUseOfUINotify({
  156. error: Error()
  157. }), UINotify) : UINotify).show('槽中无可清除的方块');
  158. } else {
  159. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  160. error: Error()
  161. }), Hall) : Hall).getInstance().player.use_item(_this.type);
  162. }
  163. }
  164. })();
  165. }
  166. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "type", [property], {
  167. configurable: true,
  168. enumerable: true,
  169. writable: true,
  170. initializer: function initializer() {
  171. return 0;
  172. }
  173. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "count", [_dec2], {
  174. configurable: true,
  175. enumerable: true,
  176. writable: true,
  177. initializer: null
  178. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "ad", [_dec3], {
  179. configurable: true,
  180. enumerable: true,
  181. writable: true,
  182. initializer: null
  183. })), _class2)) || _class));
  184. _cclegacy._RF.pop();
  185. _crd = false;
  186. }
  187. };
  188. });
  189. //# sourceMappingURL=5cc3ce28e30e8e416eb47ff816c05a8fc1f78292.js.map