8a36d34e259ef0ace0dadf9cac99728c2fd19455.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7", "__unresolved_8", "__unresolved_9"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Node, Label, BaseExp, List, autoBind, userIns, BoomerangItem, uiMgr, Constants, MsgHints, ITEM_TYPE, ResUtil, _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _descriptor2, _descriptor3, _crd, ccclass, property, BuyBoomerangUI;
  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 _reportPossibleCrUseOfBaseExp(extras) {
  8. _reporterNs.report("BaseExp", "../core/base/BaseExp", _context.meta, extras);
  9. }
  10. function _reportPossibleCrUseOfList(extras) {
  11. _reporterNs.report("List", "../third/List", _context.meta, extras);
  12. }
  13. function _reportPossibleCrUseOfautoBind(extras) {
  14. _reporterNs.report("autoBind", "../extend/AutoBind", _context.meta, extras);
  15. }
  16. function _reportPossibleCrUseOfuserIns(extras) {
  17. _reporterNs.report("userIns", "../data/UserData", _context.meta, extras);
  18. }
  19. function _reportPossibleCrUseOfBoomerangItem(extras) {
  20. _reporterNs.report("BoomerangItem", "../items/item/BoomerangItem", _context.meta, extras);
  21. }
  22. function _reportPossibleCrUseOfuiMgr(extras) {
  23. _reporterNs.report("uiMgr", "../core/manager/UIManager", _context.meta, extras);
  24. }
  25. function _reportPossibleCrUseOfConstants(extras) {
  26. _reporterNs.report("Constants", "../data/Constants", _context.meta, extras);
  27. }
  28. function _reportPossibleCrUseOfTossBoomerangUI(extras) {
  29. _reporterNs.report("TossBoomerangUI", "./TossBoomerangUI", _context.meta, extras);
  30. }
  31. function _reportPossibleCrUseOfMsgHints(extras) {
  32. _reporterNs.report("MsgHints", "../utils/MsgHints", _context.meta, extras);
  33. }
  34. function _reportPossibleCrUseOfITEM_TYPE(extras) {
  35. _reporterNs.report("ITEM_TYPE", "../utils/ResUtil", _context.meta, extras);
  36. }
  37. function _reportPossibleCrUseOfResUtil(extras) {
  38. _reporterNs.report("ResUtil", "../utils/ResUtil", _context.meta, extras);
  39. }
  40. return {
  41. setters: [function (_unresolved_) {
  42. _reporterNs = _unresolved_;
  43. }, function (_cc) {
  44. _cclegacy = _cc.cclegacy;
  45. __checkObsolete__ = _cc.__checkObsolete__;
  46. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  47. _decorator = _cc._decorator;
  48. Node = _cc.Node;
  49. Label = _cc.Label;
  50. }, function (_unresolved_2) {
  51. BaseExp = _unresolved_2.BaseExp;
  52. }, function (_unresolved_3) {
  53. List = _unresolved_3.default;
  54. }, function (_unresolved_4) {
  55. autoBind = _unresolved_4.autoBind;
  56. }, function (_unresolved_5) {
  57. userIns = _unresolved_5.userIns;
  58. }, function (_unresolved_6) {
  59. BoomerangItem = _unresolved_6.BoomerangItem;
  60. }, function (_unresolved_7) {
  61. uiMgr = _unresolved_7.uiMgr;
  62. }, function (_unresolved_8) {
  63. Constants = _unresolved_8.Constants;
  64. }, function (_unresolved_9) {
  65. MsgHints = _unresolved_9.default;
  66. }, function (_unresolved_10) {
  67. ITEM_TYPE = _unresolved_10.ITEM_TYPE;
  68. ResUtil = _unresolved_10.ResUtil;
  69. }],
  70. execute: function () {
  71. _crd = true;
  72. _cclegacy._RF.push({}, "fcacd+AOchJAajjIBQO0OZt", "BuyBoomerangUI", undefined);
  73. __checkObsolete__(['_decorator', 'Node', 'Label', 'EventTouch']);
  74. ({
  75. ccclass,
  76. property
  77. } = _decorator); //购买飞镖
  78. _export("BuyBoomerangUI", BuyBoomerangUI = (_dec = ccclass('BuyBoomerangUI'), _dec2 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  79. error: Error()
  80. }), autoBind) : autoBind)({
  81. type: _crd && List === void 0 ? (_reportPossibleCrUseOfList({
  82. error: Error()
  83. }), List) : List,
  84. tooltip: "飞票列表"
  85. }), _dec3 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  86. error: Error()
  87. }), autoBind) : autoBind)({
  88. type: Label,
  89. tooltip: "飞镖个数文本"
  90. }), _dec4 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  91. error: Error()
  92. }), autoBind) : autoBind)({
  93. type: Node,
  94. tooltip: "飞镖按钮"
  95. }), _dec(_class = (_class2 = class BuyBoomerangUI extends (_crd && BaseExp === void 0 ? (_reportPossibleCrUseOfBaseExp({
  96. error: Error()
  97. }), BaseExp) : BaseExp) {
  98. constructor() {
  99. super(...arguments);
  100. _initializerDefineProperty(this, "prop_scrollView", _descriptor, this);
  101. _initializerDefineProperty(this, "boomerang_num_lable", _descriptor2, this);
  102. _initializerDefineProperty(this, "boomerang_btn", _descriptor3, this);
  103. //飞镖商店数据
  104. this.dartDatas = [];
  105. }
  106. show() {
  107. this.hasAnim = true;
  108. this.closeOnBlank = false;
  109. var toss = (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  110. error: Error()
  111. }), uiMgr) : uiMgr).getPageComponent((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  112. error: Error()
  113. }), Constants) : Constants).popUIs.tossBoomerangUI);
  114. if (toss && toss.shoot_btn) {
  115. toss.shoot_btn.parent.active = false;
  116. } //设置飞镖个数
  117. this.boomerang_num_lable.string = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  118. error: Error()
  119. }), userIns) : userIns).data.boomerang;
  120. this.loadDartData();
  121. }
  122. /**
  123. * 飞镖商店数据
  124. */
  125. loadDartData() {
  126. this.dartDatas = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  127. error: Error()
  128. }), userIns) : userIns).boomerangShopTable;
  129. this.prop_scrollView.numItems = this.dartDatas.length;
  130. }
  131. /**
  132. * 设置飞镖商店数据
  133. * @param item item节点
  134. * @param idx 数据信息
  135. */
  136. setDartItemData(item, idx) {
  137. var com = item.getComponent(_crd && BoomerangItem === void 0 ? (_reportPossibleCrUseOfBoomerangItem({
  138. error: Error()
  139. }), BoomerangItem) : BoomerangItem);
  140. com.init(this.dartDatas[idx], this.buyClicked.bind(this));
  141. }
  142. /**
  143. * 购买飞镖
  144. */
  145. buyClicked(data, clikTarget) {
  146. var [id, num] = data.price_1.split("_");
  147. var sData = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  148. error: Error()
  149. }), userIns) : userIns).itemTable.find(e => e.id == id); //是否升级
  150. var isSucced = false;
  151. if (sData.id === 1001) {
  152. //金币钻石
  153. if ((_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  154. error: Error()
  155. }), userIns) : userIns).data.gold < num) {
  156. (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
  157. error: Error()
  158. }), MsgHints) : MsgHints).show("Insufficient gold!");
  159. } else {
  160. (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  161. error: Error()
  162. }), userIns) : userIns).data.gold -= num;
  163. isSucced = true;
  164. }
  165. } else if (sData.id === 1002) {
  166. //钻石
  167. if ((_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  168. error: Error()
  169. }), userIns) : userIns).data.diamond < num) {
  170. (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
  171. error: Error()
  172. }), MsgHints) : MsgHints).show("Insufficient diamonds!");
  173. } else {
  174. (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  175. error: Error()
  176. }), userIns) : userIns).data.diamond -= num;
  177. isSucced = true;
  178. }
  179. }
  180. if (isSucced) {
  181. (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
  182. error: Error()
  183. }), ResUtil) : ResUtil).flyAnim((_crd && ITEM_TYPE === void 0 ? (_reportPossibleCrUseOfITEM_TYPE({
  184. error: Error()
  185. }), ITEM_TYPE) : ITEM_TYPE).Boomerang, clikTarget, this.boomerang_btn, data.quantity, 50, b => {});
  186. (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  187. error: Error()
  188. }), userIns) : userIns).data.boomerang += data.quantity; //设置飞镖个数
  189. this.boomerang_num_lable.string = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  190. error: Error()
  191. }), userIns) : userIns).data.boomerang;
  192. var toss = (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  193. error: Error()
  194. }), uiMgr) : uiMgr).getPageComponent((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  195. error: Error()
  196. }), Constants) : Constants).popUIs.tossBoomerangUI);
  197. if (toss) {
  198. toss.setBoomerang();
  199. }
  200. }
  201. }
  202. /**
  203. * 按钮点击事件
  204. * @param event 事件
  205. * @param param 参数
  206. */
  207. onBtnClicked(event, param) {
  208. var btnName = event.target.name;
  209. if (btnName === 'close_btn') {
  210. var toss = (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  211. error: Error()
  212. }), uiMgr) : uiMgr).getPageComponent((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  213. error: Error()
  214. }), Constants) : Constants).popUIs.tossBoomerangUI);
  215. if (toss && toss.shoot_btn) {
  216. toss.shoot_btn.parent.active = true;
  217. }
  218. (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  219. error: Error()
  220. }), uiMgr) : uiMgr).hide((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  221. error: Error()
  222. }), Constants) : Constants).popUIs.buyBoomerangUI);
  223. }
  224. }
  225. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "prop_scrollView", [_dec2], {
  226. configurable: true,
  227. enumerable: true,
  228. writable: true,
  229. initializer: null
  230. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "boomerang_num_lable", [_dec3], {
  231. configurable: true,
  232. enumerable: true,
  233. writable: true,
  234. initializer: null
  235. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "boomerang_btn", [_dec4], {
  236. configurable: true,
  237. enumerable: true,
  238. writable: true,
  239. initializer: null
  240. })), _class2)) || _class));
  241. _cclegacy._RF.pop();
  242. _crd = false;
  243. }
  244. };
  245. });
  246. //# sourceMappingURL=8a36d34e259ef0ace0dadf9cac99728c2fd19455.js.map