0c13a1c2326cd560901a58814afa34de7ffadbdc.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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, MsgHints, Constants, stateMgr, UpgradeItem, uiMgr, _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _crd, ccclass, property, UpgradeGunUI;
  4. function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
  5. 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 }); }
  6. 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; }
  7. 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.'); }
  8. function _reportPossibleCrUseOfBaseExp(extras) {
  9. _reporterNs.report("BaseExp", "../core/base/BaseExp", _context.meta, extras);
  10. }
  11. function _reportPossibleCrUseOfList(extras) {
  12. _reporterNs.report("List", "../third/List", _context.meta, extras);
  13. }
  14. function _reportPossibleCrUseOfautoBind(extras) {
  15. _reporterNs.report("autoBind", "../extend/AutoBind", _context.meta, extras);
  16. }
  17. function _reportPossibleCrUseOfuserIns(extras) {
  18. _reporterNs.report("userIns", "../data/UserData", _context.meta, extras);
  19. }
  20. function _reportPossibleCrUseOfMsgHints(extras) {
  21. _reporterNs.report("MsgHints", "../utils/MsgHints", _context.meta, extras);
  22. }
  23. function _reportPossibleCrUseOfConstants(extras) {
  24. _reporterNs.report("Constants", "../data/Constants", _context.meta, extras);
  25. }
  26. function _reportPossibleCrUseOfstateMgr(extras) {
  27. _reporterNs.report("stateMgr", "../core/manager/StateManager", _context.meta, extras);
  28. }
  29. function _reportPossibleCrUseOfUpgradeItem(extras) {
  30. _reporterNs.report("UpgradeItem", "../items/item/UpgradeItem", _context.meta, extras);
  31. }
  32. function _reportPossibleCrUseOfuiMgr(extras) {
  33. _reporterNs.report("uiMgr", "../core/manager/UIManager", _context.meta, extras);
  34. }
  35. function _reportPossibleCrUseOfArsenalUI(extras) {
  36. _reporterNs.report("ArsenalUI", "./ArsenalUI", _context.meta, extras);
  37. }
  38. return {
  39. setters: [function (_unresolved_) {
  40. _reporterNs = _unresolved_;
  41. }, function (_cc) {
  42. _cclegacy = _cc.cclegacy;
  43. __checkObsolete__ = _cc.__checkObsolete__;
  44. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  45. _decorator = _cc._decorator;
  46. Node = _cc.Node;
  47. Label = _cc.Label;
  48. }, function (_unresolved_2) {
  49. BaseExp = _unresolved_2.BaseExp;
  50. }, function (_unresolved_3) {
  51. List = _unresolved_3.default;
  52. }, function (_unresolved_4) {
  53. autoBind = _unresolved_4.autoBind;
  54. }, function (_unresolved_5) {
  55. userIns = _unresolved_5.userIns;
  56. }, function (_unresolved_6) {
  57. MsgHints = _unresolved_6.default;
  58. }, function (_unresolved_7) {
  59. Constants = _unresolved_7.Constants;
  60. }, function (_unresolved_8) {
  61. stateMgr = _unresolved_8.stateMgr;
  62. }, function (_unresolved_9) {
  63. UpgradeItem = _unresolved_9.UpgradeItem;
  64. }, function (_unresolved_10) {
  65. uiMgr = _unresolved_10.uiMgr;
  66. }],
  67. execute: function () {
  68. _crd = true;
  69. _cclegacy._RF.push({}, "247c72EjOJKwrNfkJ+UppoA", "UpgradeGunUI", undefined);
  70. __checkObsolete__(['_decorator', 'Node', 'Label']);
  71. ({
  72. ccclass,
  73. property
  74. } = _decorator);
  75. _export("UpgradeGunUI", UpgradeGunUI = (_dec = ccclass('UpgradeGunUI'), _dec2 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  76. error: Error()
  77. }), autoBind) : autoBind)({
  78. type: _crd && List === void 0 ? (_reportPossibleCrUseOfList({
  79. error: Error()
  80. }), List) : List,
  81. tooltip: "枪的属性数据"
  82. }), _dec3 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  83. error: Error()
  84. }), autoBind) : autoBind)({
  85. type: Label,
  86. tooltip: "金币文本"
  87. }), _dec4 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  88. error: Error()
  89. }), autoBind) : autoBind)({
  90. type: Label,
  91. tooltip: "钻石文本"
  92. }), _dec5 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  93. error: Error()
  94. }), autoBind) : autoBind)({
  95. type: Node,
  96. tooltip: "模型摄像机"
  97. }), _dec(_class = (_class2 = class UpgradeGunUI extends (_crd && BaseExp === void 0 ? (_reportPossibleCrUseOfBaseExp({
  98. error: Error()
  99. }), BaseExp) : BaseExp) {
  100. constructor() {
  101. super(...arguments);
  102. _initializerDefineProperty(this, "gun_attr_scrollView", _descriptor, this);
  103. _initializerDefineProperty(this, "gold_lable", _descriptor2, this);
  104. _initializerDefineProperty(this, "diamond_lable", _descriptor3, this);
  105. _initializerDefineProperty(this, "model_camera", _descriptor4, this);
  106. //升级数据
  107. this.gunAttrList = [];
  108. //枪数据
  109. this.curGunData = null;
  110. }
  111. start() {
  112. this.hasAnim = false;
  113. this.closeOnBlank = false; //注册动态变化值
  114. (_crd && stateMgr === void 0 ? (_reportPossibleCrUseOfstateMgr({
  115. error: Error()
  116. }), stateMgr) : stateMgr).registerUI((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  117. error: Error()
  118. }), Constants) : Constants).gold, this.gold_lable);
  119. (_crd && stateMgr === void 0 ? (_reportPossibleCrUseOfstateMgr({
  120. error: Error()
  121. }), stateMgr) : stateMgr).registerUI((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  122. error: Error()
  123. }), Constants) : Constants).diamond, this.diamond_lable);
  124. }
  125. show() {
  126. this.model_camera.active = true;
  127. var gunData = arguments.length <= 0 ? undefined : arguments[0]; //加载选中的枪
  128. this.loadUpgradeData(gunData.id);
  129. }
  130. hide() {
  131. this.model_camera.active = false;
  132. var arsenalUI = (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  133. error: Error()
  134. }), uiMgr) : uiMgr).getPageComponent((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  135. error: Error()
  136. }), Constants) : Constants).popUIs.arsenalUI);
  137. arsenalUI.model_camera.active = true;
  138. }
  139. /**
  140. * 加载枪的数据
  141. */
  142. loadUpgradeData(id) {
  143. this.curGunData = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  144. error: Error()
  145. }), userIns) : userIns).data.guns.find(gun => gun.id === id); //模型摄像机下的枪
  146. this.model_camera.children.forEach(child => {
  147. child.active = this.curGunData.prb_name + "_gun" === child.name;
  148. }); //选择枪的属性列表
  149. this.gunAttrList = [];
  150. var values = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  151. error: Error()
  152. }), userIns) : userIns).gunAttrKeys.map(key => this.curGunData[key]);
  153. values.forEach((value, i) => {
  154. var _playerGunAttsTable$f;
  155. var attr_name = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  156. error: Error()
  157. }), userIns) : userIns).gunAttrKeys[i]; // 生成消耗字段的key(使用驼峰命名转换)
  158. var attr = attr_name.replace(/^\w/, c => c.toUpperCase());
  159. var expendKey = "next" + attr + "Expenditure";
  160. var uniqueIdKey = attr_name + "UniqueId";
  161. var attrLevelKey = attr_name + "Level"; //里面包括属性总的值和最大等级值 totalValue maxLevel
  162. var mData = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  163. error: Error()
  164. }), userIns) : userIns).getGunMaxValue(this.curGunData, attr_name);
  165. this.gunAttrList.push(_extends({
  166. attr_name: attr_name,
  167. attr_value: value,
  168. attr_icon: this.curGunData[attr_name + "_icon"]
  169. }, mData, {
  170. attribute_lang: (_playerGunAttsTable$f = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  171. error: Error()
  172. }), userIns) : userIns).playerGunAttsTable.find(e => e.attribute_name == attr_name)) == null ? void 0 : _playerGunAttsTable$f.attribute_lang,
  173. nextExpenditure: this.curGunData[expendKey] || '',
  174. unique_id: this.curGunData[uniqueIdKey] || '',
  175. level: this.curGunData[attrLevelKey] || 1
  176. }));
  177. });
  178. this.gun_attr_scrollView.numItems = this.gunAttrList.length;
  179. }
  180. /**
  181. * 选择枪的属性升级列表的数据
  182. * @param item item节点
  183. * @param idx 数据信息
  184. */
  185. setGunAttsItemData(item, idx) {
  186. var com = item.getComponent(_crd && UpgradeItem === void 0 ? (_reportPossibleCrUseOfUpgradeItem({
  187. error: Error()
  188. }), UpgradeItem) : UpgradeItem);
  189. com.init(this.gunAttrList[idx], this.clicked.bind(this));
  190. }
  191. /**
  192. * item上的按钮点击事件
  193. * @param data 数据
  194. * @param idx 点击按钮的下标 1、免费看广告 2、金币 3、钻石
  195. * @param clikTarget 点击对象
  196. */
  197. clicked(data, idx, clikTarget) {
  198. if (data.isMaxLevel) {
  199. (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
  200. error: Error()
  201. }), MsgHints) : MsgHints).show("This gun " + data.attr_name + " is at the maximum level!");
  202. } else {
  203. var [id, num] = data.nextExpenditure.split("_");
  204. var sData = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  205. error: Error()
  206. }), userIns) : userIns).itemTable.find(e => e.id == id); //是否升级
  207. var isSucced = false;
  208. if (idx === 1) {//免费看广告
  209. } else if (idx === 3) {
  210. //金币钻石
  211. if (sData.id === 1001) {
  212. if ((_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  213. error: Error()
  214. }), userIns) : userIns).data.gold < num) {
  215. (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
  216. error: Error()
  217. }), MsgHints) : MsgHints).show("Insufficient gold!");
  218. } else {
  219. (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  220. error: Error()
  221. }), userIns) : userIns).data.gold -= num;
  222. isSucced = true;
  223. }
  224. } else if (sData.id === 1002) {
  225. //钻石
  226. if ((_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  227. error: Error()
  228. }), userIns) : userIns).data.diamond < num) {
  229. (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
  230. error: Error()
  231. }), MsgHints) : MsgHints).show("Insufficient diamonds!");
  232. } else {
  233. (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  234. error: Error()
  235. }), userIns) : userIns).data.diamond -= num;
  236. isSucced = true;
  237. }
  238. }
  239. }
  240. if (isSucced) {
  241. //升级
  242. (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  243. error: Error()
  244. }), userIns) : userIns).upgradeGun(this.curGunData, data.attr_name); //刷新数据
  245. this.loadUpgradeData(this.curGunData.id);
  246. }
  247. }
  248. }
  249. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "gun_attr_scrollView", [_dec2], {
  250. configurable: true,
  251. enumerable: true,
  252. writable: true,
  253. initializer: null
  254. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "gold_lable", [_dec3], {
  255. configurable: true,
  256. enumerable: true,
  257. writable: true,
  258. initializer: null
  259. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "diamond_lable", [_dec4], {
  260. configurable: true,
  261. enumerable: true,
  262. writable: true,
  263. initializer: null
  264. }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "model_camera", [_dec5], {
  265. configurable: true,
  266. enumerable: true,
  267. writable: true,
  268. initializer: null
  269. })), _class2)) || _class));
  270. _cclegacy._RF.pop();
  271. _crd = false;
  272. }
  273. };
  274. });
  275. //# sourceMappingURL=0c13a1c2326cd560901a58814afa34de7ffadbdc.js.map