5cc3ce28e30e8e416eb47ff816c05a8fc1f78292.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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, UINotify, UI_Main, Hall, _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 _reportPossibleCrUseOfUINotify(extras) {
  14. _reporterNs.report("UINotify", "../../../module_basic/ui_notify/UINotify", _context.meta, extras);
  15. }
  16. function _reportPossibleCrUseOfUI_Main(extras) {
  17. _reporterNs.report("UI_Main", "../UI_Main/UI_Main", _context.meta, extras);
  18. }
  19. function _reportPossibleCrUseOfLayout_Main(extras) {
  20. _reporterNs.report("Layout_Main", "../UI_Main/Layout_Main", _context.meta, extras);
  21. }
  22. function _reportPossibleCrUseOfHall(extras) {
  23. _reporterNs.report("Hall", "../../hall/Hall", _context.meta, extras);
  24. }
  25. return {
  26. setters: [function (_unresolved_) {
  27. _reporterNs = _unresolved_;
  28. }, function (_cc) {
  29. _cclegacy = _cc.cclegacy;
  30. __checkObsolete__ = _cc.__checkObsolete__;
  31. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  32. _decorator = _cc._decorator;
  33. Button = _cc.Button;
  34. Component = _cc.Component;
  35. Label = _cc.Label;
  36. Node = _cc.Node;
  37. tween = _cc.tween;
  38. v3 = _cc.v3;
  39. }, function (_unresolved_2) {
  40. ch = _unresolved_2.ch;
  41. }, function (_unresolved_3) {
  42. gui = _unresolved_3.gui;
  43. }, function (_unresolved_4) {
  44. UINotify = _unresolved_4.UINotify;
  45. }, function (_unresolved_5) {
  46. UI_Main = _unresolved_5.UI_Main;
  47. }, function (_unresolved_6) {
  48. Hall = _unresolved_6.Hall;
  49. }],
  50. execute: function () {
  51. _crd = true;
  52. _cclegacy._RF.push({}, "12c662bVNFDxoVeaMUS/AvG", "UI_Item", undefined);
  53. __checkObsolete__(['_decorator', 'Button', 'Component', 'instantiate', 'Label', 'Node', 'Sprite', 'SpriteFrame', 'tween', 'v3']);
  54. __checkObsolete__(['Enum']);
  55. // import { GameLink } from '../../game/GameLink';
  56. // import { UI_ad_get } from '../ad_get/UI_ad_get';
  57. // import { LvDir } from '../../game/Lv';
  58. ({
  59. ccclass,
  60. property
  61. } = _decorator);
  62. _export("UI_Item", UI_Item = (_dec = ccclass('UI_Item'), _dec2 = property(Label), _dec3 = property(Node), _dec(_class = (_class2 = class UI_Item extends Component {
  63. constructor(...args) {
  64. super(...args);
  65. _initializerDefineProperty(this, "type", _descriptor, this);
  66. _initializerDefineProperty(this, "count", _descriptor2, this);
  67. _initializerDefineProperty(this, "ad", _descriptor3, this);
  68. this._c = 0;
  69. }
  70. start() {
  71. if (this.type == 0) return;
  72. this.show(this.type, (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  73. error: Error()
  74. }), Hall) : Hall).getInstance().player.get_item(this.type));
  75. if (this.node.getComponent(Button)) {
  76. this.node.on(Node.EventType.TOUCH_END, this.onClick, this);
  77. }
  78. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  79. error: Error()
  80. }), Hall) : Hall).getInstance().player.event.on((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  81. error: Error()
  82. }), Hall) : Hall).getInstance().player.event.key.item_count, this.show, this);
  83. }
  84. onDestroy() {
  85. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  86. error: Error()
  87. }), Hall) : Hall).getInstance().player.event.off((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  88. error: Error()
  89. }), Hall) : Hall).getInstance().player.event.key.item_count, this.show, this);
  90. }
  91. show(type, count) {
  92. if (type != this.type) return;
  93. if (this._c != count) {
  94. tween(this.node).to(0.05, {
  95. scale: v3(1.2, 1.2, 1)
  96. }).to(0.1, {
  97. scale: v3(1, 1, 1)
  98. }).start();
  99. if (count < this._c) {// if (type == 1) {
  100. // ch.audio.playOneShot('sounds/sfx_item1');
  101. // } else if (type == 2) {
  102. // ch.audio.playOneShot('sounds/sfx_item2');
  103. // } else {
  104. // ch.audio.playOneShot('sounds/sfx_item3');
  105. // }
  106. }
  107. }
  108. this._c = count;
  109. this.count.string = count == 0 ? '+' : count.toString();
  110. if (type == 1) {// if (GameLink.getInst().lv.dir == LvDir.none) {
  111. // this.node.active = false;
  112. // } else {
  113. // this.node.active = true;
  114. // }
  115. } //this.ad.active = count <= 0;
  116. } //
  117. async onClick(evt) {
  118. if (this._c <= 0) {
  119. if (this.type == 3) {
  120. let flag = false;
  121. for (let element of (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
  122. error: Error()
  123. }), gui) : gui).get(_crd && UI_Main === void 0 ? (_reportPossibleCrUseOfUI_Main({
  124. error: Error()
  125. }), UI_Main) : UI_Main).getLayout().Container.node_isIdiom) {
  126. console.log(element);
  127. if (element == true) {
  128. flag = true;
  129. break;
  130. }
  131. }
  132. if (!flag) (_crd && UINotify === void 0 ? (_reportPossibleCrUseOfUINotify({
  133. error: Error()
  134. }), UINotify) : UINotify).show('槽中无可清除的方块');
  135. }
  136. const ret = await chsdk.playRewardAd('获得道具' + this.type);
  137. if (ret) {
  138. // ch.audio.playOneShot('sounds/sfx_add_item');
  139. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  140. error: Error()
  141. }), Hall) : Hall).getInstance().player.add_item(this.type, 1);
  142. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  143. error: Error()
  144. }), Hall) : Hall).getInstance().player.set_watch_ad_num(1);
  145. (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
  146. error: Error()
  147. }), ch) : ch).audio.resume();
  148. } // gui.show(UI_ad_get, this.type);
  149. } else {
  150. if (this.type == 3) {
  151. let flag = false;
  152. for (let element of (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
  153. error: Error()
  154. }), gui) : gui).get(_crd && UI_Main === void 0 ? (_reportPossibleCrUseOfUI_Main({
  155. error: Error()
  156. }), UI_Main) : UI_Main).getLayout().Container.node_isIdiom) {
  157. console.log(element);
  158. if (element == true) {
  159. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  160. error: Error()
  161. }), Hall) : Hall).getInstance().player.use_item(this.type);
  162. flag = true;
  163. break;
  164. }
  165. }
  166. if (!flag) (_crd && UINotify === void 0 ? (_reportPossibleCrUseOfUINotify({
  167. error: Error()
  168. }), UINotify) : UINotify).show('槽中无可清除的方块');
  169. } else {
  170. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  171. error: Error()
  172. }), Hall) : Hall).getInstance().player.use_item(this.type);
  173. }
  174. }
  175. }
  176. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "type", [property], {
  177. configurable: true,
  178. enumerable: true,
  179. writable: true,
  180. initializer: function () {
  181. return 0;
  182. }
  183. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "count", [_dec2], {
  184. configurable: true,
  185. enumerable: true,
  186. writable: true,
  187. initializer: null
  188. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "ad", [_dec3], {
  189. configurable: true,
  190. enumerable: true,
  191. writable: true,
  192. initializer: null
  193. })), _class2)) || _class));
  194. _cclegacy._RF.pop();
  195. _crd = false;
  196. }
  197. };
  198. });
  199. //# sourceMappingURL=5cc3ce28e30e8e416eb47ff816c05a8fc1f78292.js.map