123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- 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) {
- "use strict";
- 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;
- 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); }
- 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 }); }
- 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; }
- 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.'); }
- function _reportPossibleCrUseOfList(extras) {
- _reporterNs.report("List", "../third/List", _context.meta, extras);
- }
- function _reportPossibleCrUseOfUtils(extras) {
- _reporterNs.report("Utils", "../utils/Utils", _context.meta, extras);
- }
- function _reportPossibleCrUseOfuserIns(extras) {
- _reporterNs.report("userIns", "../data/UserData", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGunItem(extras) {
- _reporterNs.report("GunItem", "../items/item/GunItem", _context.meta, extras);
- }
- function _reportPossibleCrUseOfautoBind(extras) {
- _reporterNs.report("autoBind", "../extend/AutoBind", _context.meta, extras);
- }
- function _reportPossibleCrUseOfBaseExp(extras) {
- _reporterNs.report("BaseExp", "../core/base/BaseExp", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGunAttrItem(extras) {
- _reporterNs.report("GunAttrItem", "../items/item/GunAttrItem", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGunTypeItem(extras) {
- _reporterNs.report("GunTypeItem", "../items/item/GunTypeItem", _context.meta, extras);
- }
- function _reportPossibleCrUseOfuiMgr(extras) {
- _reporterNs.report("uiMgr", "../core/manager/UIManager", _context.meta, extras);
- }
- function _reportPossibleCrUseOfConstants(extras) {
- _reporterNs.report("Constants", "../data/Constants", _context.meta, extras);
- }
- function _reportPossibleCrUseOfMsgHints(extras) {
- _reporterNs.report("MsgHints", "../utils/MsgHints", _context.meta, extras);
- }
- return {
- setters: [function (_unresolved_) {
- _reporterNs = _unresolved_;
- }, function (_cc) {
- _cclegacy = _cc.cclegacy;
- __checkObsolete__ = _cc.__checkObsolete__;
- __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
- _decorator = _cc._decorator;
- Node = _cc.Node;
- Label = _cc.Label;
- }, function (_unresolved_2) {
- List = _unresolved_2.default;
- }, function (_unresolved_3) {
- Utils = _unresolved_3.Utils;
- }, function (_unresolved_4) {
- userIns = _unresolved_4.userIns;
- }, function (_unresolved_5) {
- GunItem = _unresolved_5.GunItem;
- }, function (_unresolved_6) {
- autoBind = _unresolved_6.autoBind;
- }, function (_unresolved_7) {
- BaseExp = _unresolved_7.BaseExp;
- }, function (_unresolved_8) {
- GunAttrItem = _unresolved_8.GunAttrItem;
- }, function (_unresolved_9) {
- GunTypeItem = _unresolved_9.GunTypeItem;
- }, function (_unresolved_10) {
- uiMgr = _unresolved_10.uiMgr;
- }, function (_unresolved_11) {
- Constants = _unresolved_11.Constants;
- }, function (_unresolved_12) {
- MsgHints = _unresolved_12.default;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "8d2c6im4+tP95EQaOIZ0YX1", "ArsenalUI", undefined);
- __checkObsolete__(['_decorator', 'Node', 'Label', 'EventTouch']);
- ({
- ccclass,
- property
- } = _decorator);
- _export("ArsenalUI", ArsenalUI = (_dec = ccclass('ArsenalUI'), _dec2 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: _crd && List === void 0 ? (_reportPossibleCrUseOfList({
- error: Error()
- }), List) : List,
- tooltip: "枪的属性列表"
- }), _dec3 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: _crd && List === void 0 ? (_reportPossibleCrUseOfList({
- error: Error()
- }), List) : List,
- tooltip: "枪的类型列表"
- }), _dec4 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: _crd && List === void 0 ? (_reportPossibleCrUseOfList({
- error: Error()
- }), List) : List,
- tooltip: "枪的列表"
- }), _dec5 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: Label,
- tooltip: "枪的名字"
- }), _dec6 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: Label,
- tooltip: "枪的类型的名字"
- }), _dec7 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
- error: Error()
- }), autoBind) : autoBind)({
- type: Node,
- tooltip: "模型摄像机"
- }), _dec(_class = (_class2 = class ArsenalUI extends (_crd && BaseExp === void 0 ? (_reportPossibleCrUseOfBaseExp({
- error: Error()
- }), BaseExp) : BaseExp) {
- constructor() {
- super(...arguments);
- _initializerDefineProperty(this, "gun_atts_scrollView", _descriptor, this);
- _initializerDefineProperty(this, "gun_type_scrollView", _descriptor2, this);
- _initializerDefineProperty(this, "gun_scrollView", _descriptor3, this);
- _initializerDefineProperty(this, "gun_name_label", _descriptor4, this);
- _initializerDefineProperty(this, "type_name_label", _descriptor5, this);
- _initializerDefineProperty(this, "model_camera", _descriptor6, this);
- //枪的属性数据
- this.gunAttrList = [];
- //枪的类型数据
- this.gunTypeList = [];
- //每个类型下的枪的数据
- this.gunList = [];
- //玩家选择的类型 默认用户使用的枪的所在的类型
- this.curTypeData = null;
- //用户当前选择的枪 默认用户当前使用的枪
- this.curGunData = null;
- }
- start() {
- this.hasAnim = false;
- this.closeOnBlank = false;
- }
- show() {
- this.model_camera.active = true;
- this.curGunData = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).getCurUseGun();
- this.loadArsenalData();
- }
- hide() {
- this.model_camera.active = false;
- }
- /**
- * 加载武器库数据 选中的类型数据
- * @param typeData 选择的类型 默认用户选中的第一把枪的类型
- */
- loadArsenalData(typeData) {
- var _typeData;
- if (typeData === void 0) {
- typeData = null;
- }
- //列表2、枪的类型列表、查询玩家拥有的枪的类型 按type分组 从每个分组中取出第一个元素
- var groupedByType = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).playerGunsTable.reduce((acc, gun) => {
- if (!acc[gun.type]) {
- acc[gun.type] = [];
- }
- acc[gun.type].push(gun);
- return acc;
- }, {});
- if (this.gunTypeList.length <= 0) {
- this.gunTypeList = Object.values(groupedByType).map(group => {
- var _this$curGunData;
- var typeData = group[0]; //判断该类型是否解锁(用户是否拥有该类型的枪)
- var unlocked = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).data.guns.some(gun => gun.type === typeData.type); //判断是否选中类型(与当前使用枪械类型一致)
- var selected = typeData.type === ((_this$curGunData = this.curGunData) == null ? void 0 : _this$curGunData.type);
- return _extends({}, typeData, {
- unlocked: unlocked,
- selected: selected
- });
- });
- }
- this.gun_type_scrollView.numItems = this.gunTypeList.length;
- this.curTypeData = (_typeData = typeData) != null ? _typeData : this.gunTypeList.find(gun => gun.type === this.curGunData.type); //枪的名字
- this.gun_name_label.string = this.curGunData.name_lang; //枪的类型的名字
- this.type_name_label.string = this.curTypeData.type_name; //列表3、类型的下的枪的类表、查询该类型下玩家拥有的枪
- var hasGunList = (_crd && Utils === void 0 ? (_reportPossibleCrUseOfUtils({
- error: Error()
- }), Utils) : Utils).clone((_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).data.guns).filter(gun => gun.type === this.curTypeData.type).map(gun => _extends({}, gun, {
- unlocked: true,
- selected: gun.id == this.curGunData.id
- })); //添加解锁状态;
- //添加未解锁的枪
- var unlockGuns = (_crd && Utils === void 0 ? (_reportPossibleCrUseOfUtils({
- error: Error()
- }), Utils) : Utils).clone((_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).playerGunsTable).filter(gun => gun.type === this.curTypeData.type && !hasGunList.some(g => g.id === gun.id)).map(gun => _extends({}, gun, {
- unlocked: false,
- selected: false
- })); //合并已解锁和未解锁的枪械列表
- this.gunList = [...hasGunList, ...unlockGuns];
- this.gun_scrollView.numItems = this.gunList.length; //模型摄像机下的枪
- this.model_camera.children.forEach(child => {
- child.active = this.curGunData.prb_name + "_gun" === child.name;
- }); //列表1、选择枪的属性列表
- this.gunAttrList = [];
- var values = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).gunAttrKeys.map(key => this.curGunData[key]);
- values.forEach((value, i) => {
- var _playerGunAttsTable$f;
- var attr_name = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).gunAttrKeys[i]; //里面包括属性总的值和最大等级值 totalValue maxLevel
- var mData = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).getGunMaxValue(this.curGunData, attr_name);
- this.gunAttrList.push(_extends({
- attr_name: attr_name,
- attr_value: value,
- attr_icon: this.curGunData[attr_name + "_icon"]
- }, mData, {
- attribute_lang: (_playerGunAttsTable$f = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).playerGunAttsTable.find(e => e.attribute_name == attr_name)) == null ? void 0 : _playerGunAttsTable$f.attribute_lang
- }));
- });
- this.gun_atts_scrollView.numItems = this.gunAttrList.length;
- }
- /**
- * 选择枪的属性列表的数据
- * @param item item节点
- * @param idx 数据信息
- */
- setGunAttsItemData(item, idx) {
- var com = item.getComponent(_crd && GunAttrItem === void 0 ? (_reportPossibleCrUseOfGunAttrItem({
- error: Error()
- }), GunAttrItem) : GunAttrItem);
- com.init(this.gunAttrList[idx]);
- }
- /**
- * 选择枪列表的数据
- * @param item item节点
- * @param idx 数据信息
- */
- setGunListItemData(item, idx) {
- var com = item.getComponent(_crd && GunItem === void 0 ? (_reportPossibleCrUseOfGunItem({
- error: Error()
- }), GunItem) : GunItem);
- com.init(this.gunList[idx], gunData => {
- this.curGunData = gunData;
- this.loadArsenalData(this.curTypeData);
- });
- }
- /**
- * 选择枪的类型的数据
- * @param item item节点
- * @param idx 数据信息
- */
- setGunTypeItemData(item, idx) {
- var com = item.getComponent(_crd && GunTypeItem === void 0 ? (_reportPossibleCrUseOfGunTypeItem({
- error: Error()
- }), GunTypeItem) : GunTypeItem);
- com.init(this.gunTypeList[idx], typeData => {
- this.gunTypeList.forEach(e => e.selected = e.id == typeData.id);
- this.loadArsenalData(typeData);
- });
- }
- /**
- * 按钮点击事件
- * @param event 事件
- * @param param 参数
- */
- onBtnClicked(event, param) {
- super.onBtnClicked(event, param);
- var btnName = event.target.name;
- if (btnName === 'upgrade_btn') {
- //升级枪的按钮
- if (!this.curGunData) {
- (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
- error: Error()
- }), MsgHints) : MsgHints).show('Gun data not found');
- return;
- }
- this.model_camera.active = false;
- (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
- error: Error()
- }), uiMgr) : uiMgr).show((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
- error: Error()
- }), Constants) : Constants).popUIs.upgradeGunUI, [this.curGunData]);
- }
- }
- }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "gun_atts_scrollView", [_dec2], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "gun_type_scrollView", [_dec3], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "gun_scrollView", [_dec4], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "gun_name_label", [_dec5], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "type_name_label", [_dec6], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "model_camera", [_dec7], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- })), _class2)) || _class));
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=08cac39f0901cc5e070076b585ff479c2b3b9eda.js.map
|