123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3"], function (_export, _context) {
- "use strict";
- var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Sprite, Label, ProgressBar, Node, ListItem, ResUtil, userIns, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _crd, ccclass, property, UpgradeItem;
- 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 _reportPossibleCrUseOfListItem(extras) {
- _reporterNs.report("ListItem", "../../third/ListItem", _context.meta, extras);
- }
- function _reportPossibleCrUseOfResUtil(extras) {
- _reporterNs.report("ResUtil", "../../utils/ResUtil", _context.meta, extras);
- }
- function _reportPossibleCrUseOfuserIns(extras) {
- _reporterNs.report("userIns", "../../data/UserData", _context.meta, extras);
- }
- return {
- setters: [function (_unresolved_) {
- _reporterNs = _unresolved_;
- }, function (_cc) {
- _cclegacy = _cc.cclegacy;
- __checkObsolete__ = _cc.__checkObsolete__;
- __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
- _decorator = _cc._decorator;
- Sprite = _cc.Sprite;
- Label = _cc.Label;
- ProgressBar = _cc.ProgressBar;
- Node = _cc.Node;
- }, function (_unresolved_2) {
- ListItem = _unresolved_2.default;
- }, function (_unresolved_3) {
- ResUtil = _unresolved_3.ResUtil;
- }, function (_unresolved_4) {
- userIns = _unresolved_4.userIns;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "58119Xb2Q5HDJm3BiboEXdY", "UpgradeItem", undefined);
- __checkObsolete__(['_decorator', 'Sprite', 'Label', 'ProgressBar', 'EventTouch', 'Node', 'utils']);
- ({
- ccclass,
- property
- } = _decorator); //枪的属性数据
- _export("UpgradeItem", UpgradeItem = (_dec = ccclass('UpgradeItem'), _dec2 = property({
- type: Sprite,
- tooltip: "枪的属性图片"
- }), _dec3 = property({
- type: ProgressBar,
- tooltip: "属性值的最大进度"
- }), _dec4 = property({
- type: Label,
- tooltip: "属性值的数据文本"
- }), _dec5 = property({
- type: Label,
- tooltip: "枪的属性多语言名字"
- }), _dec6 = property({
- type: Node,
- tooltip: "广告按钮"
- }), _dec7 = property({
- type: Node,
- tooltip: "视频按钮"
- }), _dec8 = property({
- type: Node,
- tooltip: "金币和钻石按钮"
- }), _dec9 = property({
- type: Node,
- tooltip: "最大等级按钮"
- }), _dec(_class = (_class2 = class UpgradeItem extends (_crd && ListItem === void 0 ? (_reportPossibleCrUseOfListItem({
- error: Error()
- }), ListItem) : ListItem) {
- constructor() {
- super(...arguments);
- _initializerDefineProperty(this, "attr_sp", _descriptor, this);
- _initializerDefineProperty(this, "progressBar", _descriptor2, this);
- _initializerDefineProperty(this, "atts_label", _descriptor3, this);
- _initializerDefineProperty(this, "attribute_lang_lable", _descriptor4, this);
- _initializerDefineProperty(this, "ad_free_btn", _descriptor5, this);
- _initializerDefineProperty(this, "video_btn", _descriptor6, this);
- _initializerDefineProperty(this, "prop_btn", _descriptor7, this);
- _initializerDefineProperty(this, "max_btn", _descriptor8, this);
- this.data = null;
- this.cb = null;
- }
- start() {
- this.ad_free_btn.active = false;
- this.video_btn.active = false;
- this.prop_btn.active = true;
- this.max_btn.active = false;
- }
- /**
- * 点击了按钮
- */
- onBtnClicked(event, param) {
- var _this$cb;
- if (!this.data) return;
- var idx = Number(param);
- (_this$cb = this.cb) == null || _this$cb.call(this, this.data, idx, event.target);
- }
- /**
- * 数据填充
- * @param data 数据
- * @param cb 回调
- */
- init(data, cb) {
- if (!data) return;
- this.data = data;
- this.cb = cb; //设置属性图标
- (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
- error: Error()
- }), ResUtil) : ResUtil).setSpriteFrame(data.attr_icon, this.attr_sp); //设置进度条
- this.progressBar.progress = data.attr_value / data.totalValue; //设置属性数值文本
- this.atts_label.string = data.attr_value + "/" + data.totalValue; //设置多语言属性名称
- this.attribute_lang_lable.string = data.attribute_lang; //升级需要消耗的材料
- var parts = data.nextExpenditure.split("_");
- var stuff = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
- error: Error()
- }), userIns) : userIns).itemTable.find(e => e.id == parts[0]);
- if (stuff) {
- //设置材料图标
- (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
- error: Error()
- }), ResUtil) : ResUtil).setSpriteFrame(stuff.icon, this.prop_btn.getChildByName("icon")); //设置材料数量文本
- this.prop_btn.getChildByName("num_lable").getComponent(Label).string = "x" + parts[1];
- } //判断是否可以升级
- this.prop_btn.active = !data.isMaxLevel;
- this.max_btn.active = data.isMaxLevel;
- }
- }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "attr_sp", [_dec2], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "progressBar", [_dec3], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "atts_label", [_dec4], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "attribute_lang_lable", [_dec5], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "ad_free_btn", [_dec6], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "video_btn", [_dec7], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "prop_btn", [_dec8], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "max_btn", [_dec9], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- })), _class2)) || _class));
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=7e40211e166a442d615c7b065faa4011025c2112.js.map
|