6a8af0f15958f7b90e4c55917282aae8bec7ce55.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, GameUILayers, gui, ui_base, ModuleDef, Layout_Store, ani_ui, Hall, UINotify, _dec, _class, _crd, ccclass, property, UI_Store;
  4. function _reportPossibleCrUseOfGameUILayers(extras) {
  5. _reporterNs.report("GameUILayers", "../../../core/ui/ui", _context.meta, extras);
  6. }
  7. function _reportPossibleCrUseOfgui(extras) {
  8. _reporterNs.report("gui", "../../../core/ui/ui", _context.meta, extras);
  9. }
  10. function _reportPossibleCrUseOfui_base(extras) {
  11. _reporterNs.report("ui_base", "../../../core/ui/ui_base", _context.meta, extras);
  12. }
  13. function _reportPossibleCrUseOfModuleDef(extras) {
  14. _reporterNs.report("ModuleDef", "../../../Scripts/ModuleDef", _context.meta, extras);
  15. }
  16. function _reportPossibleCrUseOfLayout_Store(extras) {
  17. _reporterNs.report("Layout_Store", "./Layout_Store", _context.meta, extras);
  18. }
  19. function _reportPossibleCrUseOfani_ui(extras) {
  20. _reporterNs.report("ani_ui", "../UI_Main/UI_Main", _context.meta, extras);
  21. }
  22. function _reportPossibleCrUseOfHall(extras) {
  23. _reporterNs.report("Hall", "../../hall/Hall", _context.meta, extras);
  24. }
  25. function _reportPossibleCrUseOfUINotify(extras) {
  26. _reporterNs.report("UINotify", "../../../module_basic/ui_notify/UINotify", _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. }, function (_unresolved_2) {
  37. GameUILayers = _unresolved_2.GameUILayers;
  38. gui = _unresolved_2.gui;
  39. }, function (_unresolved_3) {
  40. ui_base = _unresolved_3.default;
  41. }, function (_unresolved_4) {
  42. ModuleDef = _unresolved_4.ModuleDef;
  43. }, function (_unresolved_5) {
  44. Layout_Store = _unresolved_5.Layout_Store;
  45. }, function (_unresolved_6) {
  46. ani_ui = _unresolved_6.ani_ui;
  47. }, function (_unresolved_7) {
  48. Hall = _unresolved_7.Hall;
  49. }, function (_unresolved_8) {
  50. UINotify = _unresolved_8.UINotify;
  51. }],
  52. execute: function () {
  53. _crd = true;
  54. _cclegacy._RF.push({}, "60b3bv9XPZJKYK+7QPAcISg", "UI_Store", undefined);
  55. __checkObsolete__(['_decorator', 'Component', 'Node']);
  56. ({
  57. ccclass,
  58. property
  59. } = _decorator);
  60. _export("UI_Store", UI_Store = (_dec = ccclass('UI_Store'), _dec(_class = class UI_Store extends (_crd && ui_base === void 0 ? (_reportPossibleCrUseOfui_base({
  61. error: Error()
  62. }), ui_base) : ui_base) {
  63. constructor() {
  64. super((_crd && ModuleDef === void 0 ? (_reportPossibleCrUseOfModuleDef({
  65. error: Error()
  66. }), ModuleDef) : ModuleDef).GAME, 'ui/UI_Store/Store', (_crd && GameUILayers === void 0 ? (_reportPossibleCrUseOfGameUILayers({
  67. error: Error()
  68. }), GameUILayers) : GameUILayers).HUD, _crd && Layout_Store === void 0 ? (_reportPossibleCrUseOfLayout_Store({
  69. error: Error()
  70. }), Layout_Store) : Layout_Store);
  71. }
  72. async onCreated() {
  73. const layout = this.getLayout();
  74. (_crd && ani_ui === void 0 ? (_reportPossibleCrUseOfani_ui({
  75. error: Error()
  76. }), ani_ui) : ani_ui)(layout.Close_Btn.node.parent);
  77. this.onButtonEvent(layout.Close_Btn, async button => {
  78. (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
  79. error: Error()
  80. }), gui) : gui).close(UI_Store);
  81. });
  82. for (let i = 0; i < layout.Free_Gets.length; i++) {
  83. this.onButtonEvent(layout.Free_Gets[i], async button => {
  84. //看广告领取奖励
  85. if (i != 0) {
  86. const res = await chsdk.playRewardAd('获得道具' + layout.Type[i]);
  87. if (res) {
  88. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  89. error: Error()
  90. }), Hall) : Hall).getInstance().player.set_watch_ad_num(1);
  91. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  92. error: Error()
  93. }), Hall) : Hall).getInstance().player.add_item(layout.Type[i], 1);
  94. }
  95. } else {
  96. const res = await chsdk.playRewardAd('获得金币');
  97. if (res) {
  98. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  99. error: Error()
  100. }), Hall) : Hall).getInstance().player.set_watch_ad_num(1);
  101. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  102. error: Error()
  103. }), Hall) : Hall).getInstance().player.set_coin((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  104. error: Error()
  105. }), Hall) : Hall).getInstance().player.get_coin() + 100);
  106. this.show_Coin();
  107. }
  108. }
  109. }, this);
  110. }
  111. for (let i = 0; i < layout.Coin_Gets.length; i++) {
  112. this.onButtonEvent(layout.Coin_Gets[i], async button => {
  113. //花费金币购买物品
  114. if ((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  115. error: Error()
  116. }), Hall) : Hall).getInstance().player.get_coin() >= layout.Value[i]) {
  117. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  118. error: Error()
  119. }), Hall) : Hall).getInstance().player.add_item(layout.Type[i + 1], 1);
  120. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  121. error: Error()
  122. }), Hall) : Hall).getInstance().player.set_coin((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  123. error: Error()
  124. }), Hall) : Hall).getInstance().player.get_coin() - layout.Value[i]);
  125. this.show_Coin();
  126. } else {
  127. (_crd && UINotify === void 0 ? (_reportPossibleCrUseOfUINotify({
  128. error: Error()
  129. }), UINotify) : UINotify).show("金币不足");
  130. }
  131. }, this);
  132. }
  133. this.show_Coin();
  134. }
  135. show_Coin() {
  136. const layout = this.getLayout();
  137. layout.Coin_Num.string = (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  138. error: Error()
  139. }), Hall) : Hall).getInstance().player.get_coin().toString();
  140. }
  141. }) || _class));
  142. _cclegacy._RF.pop();
  143. _crd = false;
  144. }
  145. };
  146. });
  147. //# sourceMappingURL=6a8af0f15958f7b90e4c55917282aae8bec7ce55.js.map