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 s = t("App"), o = t("List"), a = t("BaseView"), n = (t("ViewConst"), t("GameConst")), r = t("GameUtils"), l = t("MainCat"), h = t("RoleService"), c = t("CostumeConst"), d = t("CostumeController"), u = t("CostumeBagEquipItem"), p = t("CostumeBagItem"), {ccclass: f, property: g} = cc._decorator; t = class extends a.default { constructor() { super(...arguments), (this.itemList = null), (this.equipCostumeNode = null), (this.moneyRateLab = null), (this.mergeBtn = null), (this.catNode = null), (this.MoneyRateTipNode = null), (this.mainCat = null), (this.bgType = 0), (this.items = null), (this.costumeBagEquipItems = []); } initUI() { super.initUI(); for (const e of this.equipCostumeNode.children) this.costumeBagEquipItems.push(e.getComponent(u.CostumeBagEquipItem)); const t = h.default.ins.getNewMainCat(); this.catNode.addChild(t), (t.position = cc.Vec2.ZERO), (this.mainCat = t.getComponent(l.default)); } open() { super.open(), this.updateList(!0), this.updateEquip(), this.addEvent(); } close() { super.close(), s.default.NotificationCenter.removeAll(this), h.default.ins.removeNewMainCat(this.mainCat.node), (this.mainCat = null); } addEvent() { s.default.NotificationCenter.addListener(n.GameNotificationConst.LV_UP_COSTUME, this.onLvUpCostume, this), s.default.NotificationCenter.addListener(n.GameNotificationConst.EQUIP_COSTUME, this.onEquipCostume, this), s.default.NotificationCenter.addListener( n.GameNotificationConst.UNEQUIP_COSTUME, this.onUnequipCostume, this ), s.default.NotificationCenter.addListener( n.GameNotificationConst.REFUND_COSTUME, this.onUnequipCostume, this ), s.default.NotificationCenter.addListener(n.GameNotificationConst.MERGE_COSTUME, this.onMergeCostume, this); } onEquipCostume(t) { this.updateEquipCostumeByParts(t.cfg.parts), this.updateList(!0); } onMergeCostume(t, e) { this.updateList(), this.updateEquip(); } updateEquipCostumeByParts(t) { const e = d.default.ins.getModel(); this.costumeBagEquipItems[t - 1].setData(e.equipItems[t]), (this.moneyRateLab.string = `+${e.attr.getAttrValue(c.CostumeAbilityType.base, 0)}%`); } onRefundCostume(t) { t.isEquip ? this.updateEquipCostumeByParts(t.cfg.parts) : this.updateList(); } onUnequipCostume(t) { this.updateEquipCostumeByParts(t.cfg.parts), this.updateList(!0); } onLvUpCostume(t) { t.isEquip ? this.updateEquipCostumeByParts(t.cfg.parts) : this.updateList(); } updateEquip() { const e = d.default.ins.getModel(); let i = this.costumeBagEquipItems.length; for (let t = 0; t < i; t++) { const i = this.costumeBagEquipItems[t], s = e.equipItems[t + 1]; i.setData(s); } (this.MoneyRateTipNode.active = 0 < i), (this.moneyRateLab.string = `+${e.attr.getAttrValue(c.CostumeAbilityType.base, 0)}%`); } onTouchMergeBtn() { s.default.ViewManager.open(27); } updateList(t = !1) { const e = d.default.ins.getModel(), i = (this.items = e.items.concat()); for (const s in e.equipItems) this.items.remove(e.equipItems[s]); this.items.sort(r.sortCostume), (this.itemList.numItems = i.length), t && this.mainCat.updateSlot(e.equipItems); } onRenderItem(t, e) { const i = t.getComponent(p.CostumeBagItem), s = this.items[e]; (i.recommendNode.active = s.recommend), i.setData(s); } onTouchMoneyRateTip() { s.default.ViewManager.open(46); } }; e([g({type: o.default})], t.prototype, "itemList", void 0), e([g({type: cc.Node})], t.prototype, "equipCostumeNode", void 0), e([g({type: cc.Label})], t.prototype, "moneyRateLab", void 0), e([g({type: cc.Button})], t.prototype, "mergeBtn", void 0), e([g(cc.Node)], t.prototype, "catNode", void 0), e([g(cc.Node)], t.prototype, "MoneyRateTipNode", void 0), (t = e([f], t)), (i.default = t);