var t = require; var e = module; var i = exports; e = (this && this.__decorate) || function (t, e, i, s) { var o, a = arguments.length, n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s); else for (var r = t.length - 1; 0 <= r; r--) (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n); return 3 < a && n && Object.defineProperty(e, i, n), n; }; Object.defineProperty(i, "__esModule", {value: !0}); const o = t("App"), s = t("BaseView"), a = (t("ViewConst"), t("MachineLvUpAni")), n = t("GameConst"), r = t("CostumeConst"), l = t("CostumeController"), h = t("CostumeSpecialItem"), {ccclass: c, property: d} = cc._decorator; t = class extends s.default { constructor() { super(...arguments), (this.bgNode = null), (this.itemBgSpr = null), (this.iconSpr = null), (this.costumeTypeSpr = null), (this.arrowListNode = null), (this.lvLab = null), (this.nextLab = null), (this.curLab = null), (this.equipBtn = null), (this.equipLab = null), (this.upLvBtn = null), (this.costLab = null), (this.refundBtn = null), (this.lvUpTipLab = null), (this.bgType = 1), (this.refundIconSpr = null), (this.refundBtnLab = null), (this.titleLab = null), (this.specialItems = []), (this.item = null); } initUI() { super.initUI(); } open(t) { super.open(), (this.item = t), this.updateData(), (this.titleLab.string = this.item.getName()); t = null != this.item.data.uuid; (this.equipBtn.node.active = t), (this.refundBtn.node.active = t), (this.upLvBtn.node.active = t), (this.lvUpTipLab.node.active = t), (this.bgNode.height = t ? 980 : 880); } updateData() { const t = this.item; t.isEquip ? (this.equipLab.string = "卸下") : (this.equipLab.string = "装备"), t.isMaxLv() ? ((this.upLvBtn.interactable = !1), (this.costLab.string = "MAX"), (this.nextLab.string = `+${t.getValue()}%`)) : ((this.nextLab.string = `+${t.getNextLvValue()}%`), (this.costLab.string = t.cost + "")), this.updateRefundBtnState(), (this.lvLab.string = `Lv.${t.data.lv}/${t.gradeCfg.max_level}`), (this.curLab.string = `+${t.getValue()}%`), o.default.CommonUtils.setSpriteFrameByBundle(n.BundleType.MAP_ICON, t.getIcon(), this.iconSpr), o.default.CommonUtils.setSpriteFrameByBundle(n.BundleType.MAP_ICON, t.getTypeIcon(), this.costumeTypeSpr), o.default.CommonUtils.setSpriteFrame(r.getRarityUrlByGrade(t.data.grade), this.itemBgSpr); var e = t.canUpgradeGrade(); this.specialItems[0].setData( t.getSpecialAbilityStr1(), 0, t.data.grade >= r.RarityType.rare, e && this.item.data.grade + 1 == r.RarityType.rare ), this.specialItems[1].setData( t.getSpecialAbilityStr2(), 1, t.data.grade >= r.RarityType.epic, e && this.item.data.grade + 1 == r.RarityType.epic ), this.specialItems[2].setData( t.getSpecialAbilityStr3(), 2, t.data.grade >= r.RarityType.legendary, e && this.item.data.grade + 1 == r.RarityType.legendary ), this.specialItems[3].setData( t.getSpecialAbilityStr4(), 3, t.data.grade >= r.RarityType.mystic, e && this.item.data.grade + 1 == r.RarityType.mystic ); var i = r.getGradeLv(t.data.grade); const s = this.arrowListNode.children; for (let t = 0; t < s.length; t++) s[t].active = t < i; } updateRefundBtnState() { var t = this.item; this.refundBtn.interactable = 1 < t.data.lv; t = 1 < t.data.lv ? this.refundBtn.normalMaterial : this.refundBtn.grayMaterial; this.refundIconSpr.setMaterial(0, t), this.refundBtnLab.setMaterial(0, t); } onTouchEquipBtn() { this.item.isEquip ? l.default.ins.unequipCostume(this.item.cfg.parts, !0, !0) : l.default.ins.equipCostume(this.item.data.uuid, !0), this.closeView(); } onToucRefundBtn() { o.default.ViewManager.open(33, this.item); } onTouchLvUpBtn() { if (l.default.ins.lvUp(this.item.data.uuid)) { this.updateData(); const e = this.itemBgSpr.node; let t = o.default.NodePoolMsr.machineLvUpAni.pop(); e.addChild(t), t.getComponent(a.default).playAni(); } } onTouchGradeBtn(t, e) { 0 <= this.item.data.uuid && o.default.ViewManager.open(34, this.item, parseInt(e)); } }; e([d({type: cc.Node})], t.prototype, "bgNode", void 0), e([d({type: cc.Sprite})], t.prototype, "itemBgSpr", void 0), e([d({type: cc.Sprite})], t.prototype, "iconSpr", void 0), e([d({type: cc.Sprite})], t.prototype, "costumeTypeSpr", void 0), e([d({type: cc.Node})], t.prototype, "arrowListNode", void 0), e([d({type: cc.Label})], t.prototype, "lvLab", void 0), e([d({type: cc.Label})], t.prototype, "nextLab", void 0), e([d({type: cc.Label})], t.prototype, "curLab", void 0), e([d({type: cc.Button})], t.prototype, "equipBtn", void 0), e([d({type: cc.Label})], t.prototype, "equipLab", void 0), e([d({type: cc.Button})], t.prototype, "upLvBtn", void 0), e([d({type: cc.Label})], t.prototype, "costLab", void 0), e([d({type: cc.Button})], t.prototype, "refundBtn", void 0), e([d({type: cc.Label})], t.prototype, "lvUpTipLab", void 0), e([d({type: cc.Sprite})], t.prototype, "refundIconSpr", void 0), e([d({type: cc.Label})], t.prototype, "refundBtnLab", void 0), e([d(cc.Label)], t.prototype, "titleLab", void 0), e([d(h.default)], t.prototype, "specialItems", void 0), (t = e([c], t)), (i.default = t);