5cc3ce28e30e8e416eb47ff816c05a8fc1f78292.js 12 KB

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