5cc3ce28e30e8e416eb47ff816c05a8fc1f78292.js 11 KB

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