08cac39f0901cc5e070076b585ff479c2b3b9eda.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7", "__unresolved_8", "__unresolved_9", "__unresolved_10", "__unresolved_11"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Node, Label, List, Utils, userIns, GunItem, autoBind, BaseExp, GunAttrItem, GunTypeItem, uiMgr, Constants, MsgHints, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _crd, ccclass, property, ArsenalUI;
  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 _reportPossibleCrUseOfList(extras) {
  9. _reporterNs.report("List", "../third/List", _context.meta, extras);
  10. }
  11. function _reportPossibleCrUseOfUtils(extras) {
  12. _reporterNs.report("Utils", "../utils/Utils", _context.meta, extras);
  13. }
  14. function _reportPossibleCrUseOfuserIns(extras) {
  15. _reporterNs.report("userIns", "../data/UserData", _context.meta, extras);
  16. }
  17. function _reportPossibleCrUseOfGunItem(extras) {
  18. _reporterNs.report("GunItem", "../items/item/GunItem", _context.meta, extras);
  19. }
  20. function _reportPossibleCrUseOfautoBind(extras) {
  21. _reporterNs.report("autoBind", "../extend/AutoBind", _context.meta, extras);
  22. }
  23. function _reportPossibleCrUseOfBaseExp(extras) {
  24. _reporterNs.report("BaseExp", "../core/base/BaseExp", _context.meta, extras);
  25. }
  26. function _reportPossibleCrUseOfGunAttrItem(extras) {
  27. _reporterNs.report("GunAttrItem", "../items/item/GunAttrItem", _context.meta, extras);
  28. }
  29. function _reportPossibleCrUseOfGunTypeItem(extras) {
  30. _reporterNs.report("GunTypeItem", "../items/item/GunTypeItem", _context.meta, extras);
  31. }
  32. function _reportPossibleCrUseOfuiMgr(extras) {
  33. _reporterNs.report("uiMgr", "../core/manager/UIManager", _context.meta, extras);
  34. }
  35. function _reportPossibleCrUseOfConstants(extras) {
  36. _reporterNs.report("Constants", "../data/Constants", _context.meta, extras);
  37. }
  38. function _reportPossibleCrUseOfMsgHints(extras) {
  39. _reporterNs.report("MsgHints", "../utils/MsgHints", _context.meta, extras);
  40. }
  41. return {
  42. setters: [function (_unresolved_) {
  43. _reporterNs = _unresolved_;
  44. }, function (_cc) {
  45. _cclegacy = _cc.cclegacy;
  46. __checkObsolete__ = _cc.__checkObsolete__;
  47. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  48. _decorator = _cc._decorator;
  49. Node = _cc.Node;
  50. Label = _cc.Label;
  51. }, function (_unresolved_2) {
  52. List = _unresolved_2.default;
  53. }, function (_unresolved_3) {
  54. Utils = _unresolved_3.Utils;
  55. }, function (_unresolved_4) {
  56. userIns = _unresolved_4.userIns;
  57. }, function (_unresolved_5) {
  58. GunItem = _unresolved_5.GunItem;
  59. }, function (_unresolved_6) {
  60. autoBind = _unresolved_6.autoBind;
  61. }, function (_unresolved_7) {
  62. BaseExp = _unresolved_7.BaseExp;
  63. }, function (_unresolved_8) {
  64. GunAttrItem = _unresolved_8.GunAttrItem;
  65. }, function (_unresolved_9) {
  66. GunTypeItem = _unresolved_9.GunTypeItem;
  67. }, function (_unresolved_10) {
  68. uiMgr = _unresolved_10.uiMgr;
  69. }, function (_unresolved_11) {
  70. Constants = _unresolved_11.Constants;
  71. }, function (_unresolved_12) {
  72. MsgHints = _unresolved_12.default;
  73. }],
  74. execute: function () {
  75. _crd = true;
  76. _cclegacy._RF.push({}, "8d2c6im4+tP95EQaOIZ0YX1", "ArsenalUI", undefined);
  77. __checkObsolete__(['_decorator', 'Node', 'Label', 'EventTouch']);
  78. ({
  79. ccclass,
  80. property
  81. } = _decorator);
  82. _export("ArsenalUI", ArsenalUI = (_dec = ccclass('ArsenalUI'), _dec2 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  83. error: Error()
  84. }), autoBind) : autoBind)({
  85. type: _crd && List === void 0 ? (_reportPossibleCrUseOfList({
  86. error: Error()
  87. }), List) : List,
  88. tooltip: "枪的属性列表"
  89. }), _dec3 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  90. error: Error()
  91. }), autoBind) : autoBind)({
  92. type: _crd && List === void 0 ? (_reportPossibleCrUseOfList({
  93. error: Error()
  94. }), List) : List,
  95. tooltip: "枪的类型列表"
  96. }), _dec4 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  97. error: Error()
  98. }), autoBind) : autoBind)({
  99. type: _crd && List === void 0 ? (_reportPossibleCrUseOfList({
  100. error: Error()
  101. }), List) : List,
  102. tooltip: "枪的列表"
  103. }), _dec5 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  104. error: Error()
  105. }), autoBind) : autoBind)({
  106. type: Label,
  107. tooltip: "枪的名字"
  108. }), _dec6 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  109. error: Error()
  110. }), autoBind) : autoBind)({
  111. type: Label,
  112. tooltip: "枪的类型的名字"
  113. }), _dec7 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  114. error: Error()
  115. }), autoBind) : autoBind)({
  116. type: Node,
  117. tooltip: "模型摄像机"
  118. }), _dec(_class = (_class2 = class ArsenalUI extends (_crd && BaseExp === void 0 ? (_reportPossibleCrUseOfBaseExp({
  119. error: Error()
  120. }), BaseExp) : BaseExp) {
  121. constructor() {
  122. super(...arguments);
  123. _initializerDefineProperty(this, "gun_atts_scrollView", _descriptor, this);
  124. _initializerDefineProperty(this, "gun_type_scrollView", _descriptor2, this);
  125. _initializerDefineProperty(this, "gun_scrollView", _descriptor3, this);
  126. _initializerDefineProperty(this, "gun_name_label", _descriptor4, this);
  127. _initializerDefineProperty(this, "type_name_label", _descriptor5, this);
  128. _initializerDefineProperty(this, "model_camera", _descriptor6, this);
  129. //枪的属性数据
  130. this.gunAttrList = [];
  131. //枪的类型数据
  132. this.gunTypeList = [];
  133. //每个类型下的枪的数据
  134. this.gunList = [];
  135. //玩家选择的类型 默认用户使用的枪的所在的类型
  136. this.curTypeData = null;
  137. //用户当前选择的枪 默认用户当前使用的枪
  138. this.curGunData = null;
  139. }
  140. start() {
  141. this.hasAnim = false;
  142. this.closeOnBlank = false;
  143. }
  144. show() {
  145. this.model_camera.active = true;
  146. this.curGunData = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  147. error: Error()
  148. }), userIns) : userIns).getCurUseGun();
  149. this.loadArsenalData();
  150. }
  151. hide() {
  152. this.model_camera.active = false;
  153. }
  154. /**
  155. * 加载武器库数据 选中的类型数据
  156. * @param typeData 选择的类型 默认用户选中的第一把枪的类型
  157. */
  158. loadArsenalData(typeData) {
  159. var _typeData;
  160. if (typeData === void 0) {
  161. typeData = null;
  162. }
  163. //列表2、枪的类型列表、查询玩家拥有的枪的类型 按type分组 从每个分组中取出第一个元素
  164. var groupedByType = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  165. error: Error()
  166. }), userIns) : userIns).playerGunsTable.reduce((acc, gun) => {
  167. if (!acc[gun.type]) {
  168. acc[gun.type] = [];
  169. }
  170. acc[gun.type].push(gun);
  171. return acc;
  172. }, {});
  173. if (this.gunTypeList.length <= 0) {
  174. this.gunTypeList = Object.values(groupedByType).map(group => {
  175. var _this$curGunData;
  176. var typeData = group[0]; //判断该类型是否解锁(用户是否拥有该类型的枪)
  177. var unlocked = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  178. error: Error()
  179. }), userIns) : userIns).data.guns.some(gun => gun.type === typeData.type); //判断是否选中类型(与当前使用枪械类型一致)
  180. var selected = typeData.type === ((_this$curGunData = this.curGunData) == null ? void 0 : _this$curGunData.type);
  181. return _extends({}, typeData, {
  182. unlocked: unlocked,
  183. selected: selected
  184. });
  185. });
  186. }
  187. this.gun_type_scrollView.numItems = this.gunTypeList.length;
  188. this.curTypeData = (_typeData = typeData) != null ? _typeData : this.gunTypeList.find(gun => gun.type === this.curGunData.type); //枪的名字
  189. this.gun_name_label.string = this.curGunData.name_lang; //枪的类型的名字
  190. this.type_name_label.string = this.curTypeData.type_name; //列表3、类型的下的枪的类表、查询该类型下玩家拥有的枪
  191. var hasGunList = (_crd && Utils === void 0 ? (_reportPossibleCrUseOfUtils({
  192. error: Error()
  193. }), Utils) : Utils).clone((_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  194. error: Error()
  195. }), userIns) : userIns).data.guns).filter(gun => gun.type === this.curTypeData.type).map(gun => _extends({}, gun, {
  196. unlocked: true,
  197. selected: gun.id == this.curGunData.id
  198. })); //添加解锁状态;
  199. //添加未解锁的枪
  200. var unlockGuns = (_crd && Utils === void 0 ? (_reportPossibleCrUseOfUtils({
  201. error: Error()
  202. }), Utils) : Utils).clone((_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  203. error: Error()
  204. }), userIns) : userIns).playerGunsTable).filter(gun => gun.type === this.curTypeData.type && !hasGunList.some(g => g.id === gun.id)).map(gun => _extends({}, gun, {
  205. unlocked: false,
  206. selected: false
  207. })); //合并已解锁和未解锁的枪械列表
  208. this.gunList = [...hasGunList, ...unlockGuns];
  209. this.gun_scrollView.numItems = this.gunList.length; //模型摄像机下的枪
  210. this.model_camera.children.forEach(child => {
  211. child.active = this.curGunData.prb_name + "_gun" === child.name;
  212. }); //列表1、选择枪的属性列表
  213. this.gunAttrList = [];
  214. var values = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  215. error: Error()
  216. }), userIns) : userIns).gunAttrKeys.map(key => this.curGunData[key]);
  217. values.forEach((value, i) => {
  218. var _playerGunAttsTable$f;
  219. var attr_name = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  220. error: Error()
  221. }), userIns) : userIns).gunAttrKeys[i]; //里面包括属性总的值和最大等级值 totalValue maxLevel
  222. var mData = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  223. error: Error()
  224. }), userIns) : userIns).getGunMaxValue(this.curGunData, attr_name);
  225. this.gunAttrList.push(_extends({
  226. attr_name: attr_name,
  227. attr_value: value,
  228. attr_icon: this.curGunData[attr_name + "_icon"]
  229. }, mData, {
  230. attribute_lang: (_playerGunAttsTable$f = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  231. error: Error()
  232. }), userIns) : userIns).playerGunAttsTable.find(e => e.attribute_name == attr_name)) == null ? void 0 : _playerGunAttsTable$f.attribute_lang
  233. }));
  234. });
  235. this.gun_atts_scrollView.numItems = this.gunAttrList.length;
  236. }
  237. /**
  238. * 选择枪的属性列表的数据
  239. * @param item item节点
  240. * @param idx 数据信息
  241. */
  242. setGunAttsItemData(item, idx) {
  243. var com = item.getComponent(_crd && GunAttrItem === void 0 ? (_reportPossibleCrUseOfGunAttrItem({
  244. error: Error()
  245. }), GunAttrItem) : GunAttrItem);
  246. com.init(this.gunAttrList[idx]);
  247. }
  248. /**
  249. * 选择枪列表的数据
  250. * @param item item节点
  251. * @param idx 数据信息
  252. */
  253. setGunListItemData(item, idx) {
  254. var com = item.getComponent(_crd && GunItem === void 0 ? (_reportPossibleCrUseOfGunItem({
  255. error: Error()
  256. }), GunItem) : GunItem);
  257. com.init(this.gunList[idx], gunData => {
  258. this.curGunData = gunData;
  259. this.loadArsenalData(this.curTypeData);
  260. });
  261. }
  262. /**
  263. * 选择枪的类型的数据
  264. * @param item item节点
  265. * @param idx 数据信息
  266. */
  267. setGunTypeItemData(item, idx) {
  268. var com = item.getComponent(_crd && GunTypeItem === void 0 ? (_reportPossibleCrUseOfGunTypeItem({
  269. error: Error()
  270. }), GunTypeItem) : GunTypeItem);
  271. com.init(this.gunTypeList[idx], typeData => {
  272. this.gunTypeList.forEach(e => e.selected = e.id == typeData.id);
  273. this.loadArsenalData(typeData);
  274. });
  275. }
  276. /**
  277. * 按钮点击事件
  278. * @param event 事件
  279. * @param param 参数
  280. */
  281. onBtnClicked(event, param) {
  282. super.onBtnClicked(event, param);
  283. var btnName = event.target.name;
  284. if (btnName === 'upgrade_btn') {
  285. //升级枪的按钮
  286. if (!this.curGunData) {
  287. (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
  288. error: Error()
  289. }), MsgHints) : MsgHints).show('Gun data not found');
  290. return;
  291. }
  292. this.model_camera.active = false;
  293. (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  294. error: Error()
  295. }), uiMgr) : uiMgr).show((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  296. error: Error()
  297. }), Constants) : Constants).popUIs.upgradeGunUI, [this.curGunData]);
  298. }
  299. }
  300. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "gun_atts_scrollView", [_dec2], {
  301. configurable: true,
  302. enumerable: true,
  303. writable: true,
  304. initializer: null
  305. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "gun_type_scrollView", [_dec3], {
  306. configurable: true,
  307. enumerable: true,
  308. writable: true,
  309. initializer: null
  310. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "gun_scrollView", [_dec4], {
  311. configurable: true,
  312. enumerable: true,
  313. writable: true,
  314. initializer: null
  315. }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "gun_name_label", [_dec5], {
  316. configurable: true,
  317. enumerable: true,
  318. writable: true,
  319. initializer: null
  320. }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "type_name_label", [_dec6], {
  321. configurable: true,
  322. enumerable: true,
  323. writable: true,
  324. initializer: null
  325. }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "model_camera", [_dec7], {
  326. configurable: true,
  327. enumerable: true,
  328. writable: true,
  329. initializer: null
  330. })), _class2)) || _class));
  331. _cclegacy._RF.pop();
  332. _crd = false;
  333. }
  334. };
  335. });
  336. //# sourceMappingURL=08cac39f0901cc5e070076b585ff479c2b3b9eda.js.map