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"), a = t("GameText"), n = (t("ViewConst"), t("GlobalAttr")), r = t("AbilityInfoService"), { ccclass: s, property: l, menu: h } = cc._decorator; t = class extends cc.Component { constructor() { super(...arguments), (this.lockNode = null), (this.lockDescNode = null), (this.lockIconSpr = null), (this.unlockBtn = null), (this.unlockBtnLab = null), (this.unlockIcon = null), (this.unlockNode = null), (this.lvLab = null), (this.descRichText = null), (this.rateRichText = null), (this.costLab = null), (this.costBtn = null), (this.maxLabNode = null), (this.iconSpr = null), (this.data = null); } setData(t) { (this.data = t).isUnlock() ? ((this.lockNode.active = !1), (this.unlockNode.active = !0), this.updateUI()) : ((this.lockNode.active = !0), (this.unlockNode.active = !1), o.default.CommonUtils.setSpriteFrame(this.data.getAvilityLockIconUrl(), this.lockIconSpr)); } showUnlockBtn() { (this.unlockBtn.active = !0), (this.lockDescNode.active = !1), 0 === this.data.cfg.unlock_cost ? ((this.unlockIcon.active = !1), (this.unlockBtnLab.string = "免费"), (this.unlockBtnLab.node.x = 0)) : (this.unlockBtnLab.string = this.data.cfg.unlock_cost.toString()); } updateUI() { (this.lvLab.string = `Level ${this.data.curLevel}`), o.default.CommonUtils.setSpriteFrame(this.data.getAvilityIconUrl(), this.iconSpr), (this.costLab.string = this.data.cost.toString()); var t = this.data.isMaxLevel(); (this.costBtn.active = !t), (this.maxLabNode.active = t); let e = this.data.value, i = this.data.nextLvValue; this.data.cfg.idx == r.PayAbilityType.ad_booster_effect && ((i = Math.floor(i - e + 100 * n.default.ins.ad_booster_effect) / 100), (e = n.default.ins.ad_booster_effect)); let s = "X"; this.data.cfg.idx == r.PayAbilityType.get_tips_chance || this.data.cfg.idx == r.PayAbilityType.gems_chance_at_ad ? (s = "%") : this.data.cfg.idx != r.PayAbilityType.ad_booster_effect && ((e /= 100), (i /= 100)), (this.descRichText.string = a.GameText.getTextByStr(this.data.cfg.desc).format(e)), t ? ((this.rateRichText.node.active = !1), (this.descRichText.node.y = -42)) : (this.rateRichText.string = `${e}${s}>${i}${s}`); } onTouchCostBtn() { r.default.ins.lvUp(this.data.cfg.idx) && this.updateUI(); } onTouchUnlockBtn() { if (r.default.ins.unlockAbility(this.data.cfg.idx)) { (this.lockNode.active = !1), (this.unlockNode.active = !0), this.updateUI(); let t = o.default.ViewManager.getView(22); t && t.updateUI(); } } }; e([l(cc.Node)], t.prototype, "lockNode", void 0), e([l(cc.Node)], t.prototype, "lockDescNode", void 0), e([l(cc.Sprite)], t.prototype, "lockIconSpr", void 0), e([l(cc.Node)], t.prototype, "unlockBtn", void 0), e([l(cc.Label)], t.prototype, "unlockBtnLab", void 0), e([l(cc.Node)], t.prototype, "unlockIcon", void 0), e([l(cc.Node)], t.prototype, "unlockNode", void 0), e([l(cc.Label)], t.prototype, "lvLab", void 0), e([l(cc.RichText)], t.prototype, "descRichText", void 0), e([l(cc.RichText)], t.prototype, "rateRichText", void 0), e([l(cc.Label)], t.prototype, "costLab", void 0), e([l(cc.Node)], t.prototype, "costBtn", void 0), e([l(cc.Node)], t.prototype, "maxLabNode", void 0), e([l(cc.Sprite)], t.prototype, "iconSpr", void 0), (t = e([s], t)), (i.default = t);