var t = require; var e = module; var i = exports; var s, o = (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}), (i.PayAbilityType = void 0); const a = t("App"), n = t("Toast"), r = t("ControllerConst"), l = (t("PlatformBase"), t("AdRewardConst")), h = t("AbilityInfoData"), c = t("GlobalAttr"), d = t("BaseService"), u = t("CurrencyService"); let p = null; var f, {ccclass: e} = cc._decorator, t = (s = class extends d.default { constructor() { super(...arguments), (this.define = null), (this.datas = null), (this.dataMap = {}), (this.cfgs = null), (this.saveData = null); } onLoad() { (s.ins = this).cfgs = a.default.ConfigManager.getConfig("AbilityInfo"); } unlockAll() { this.datas.concat(); } unlockAbility(t, e = 0) { const i = this.dataMap[t]; return i.canUnlock() ? (i.unlock(), this.updateData(i.cfg.idx), u.default.ins.diamondChange(-i.installCost), a.default.AnalyticMgr.recordDiamondCost(4, -i.installCost), !0) : (n.default.launch("钻石不足!"), !1); } updateData(t) { switch (t) { case f.get_tips_chance: p.calTipChance(); break; case f.gems_chance_at_ad: p.calGemsChanceAtAd(); break; case f.ad_booster_effect: p.calAdBoosterEffect(), a.default.ControllerManager.applyFunc( r.ControllerConst.AdReward, l.AdRewardConst.UPDATE_AD_RATE ); break; case f.offline_revenue: p.calOfflineRevenue(); break; case f.tips_rate: p.calTipRate(); break; case f.offline_reward_time: p.calOfflineRewardTime(); break; case f.ad_booster_duration: p.calAdBoosterDuration(); break; case f.customer_move_speed: p.calCustomerMoveSpeed(); break; case f.ad_reward_revenue: p.calAdRewardRevenue(); } } lvUp(t, e = !1) { const i = this.dataMap[t]; if (i.isMaxLevel()) return n.default.launch("已达最大等级!"), !1; if (i.canLvUp() || e) { const t = i.cost; return i.levelUp(), this.updateData(i.cfg.idx), u.default.ins.diamondChange(-t), !0; } return n.default.launch("钻石不足!"), !1; } init() { var e = this.cfgs; this.datas = []; const i = a.default.ControllerManager.getControllerModel(r.ControllerConst.Game); i.data.AbilityInfo || (i.data.AbilityInfo = []), (this.saveData = i.data.AbilityInfo); var s = e.length; for (let t = 0; t < s; t++) { const i = new h.default(); (this.datas[t] = i), (this.dataMap[e[t].idx] = i), this.saveData[t] || (this.saveData[t] = {lv: 0}), i.init(e[t], this.saveData[t]); } p = c.default.ins; } desotrySelf() {} }); (t.ins = null), (t = s = o([e], t)), (i.default = t = s), ((i = f = i.PayAbilityType || (i.PayAbilityType = {}))[(i.get_tips_chance = 1)] = "get_tips_chance"), (i[(i.gems_chance_at_ad = 2)] = "gems_chance_at_ad"), (i[(i.ad_booster_effect = 3)] = "ad_booster_effect"), (i[(i.offline_revenue = 4)] = "offline_revenue"), (i[(i.tips_rate = 5)] = "tips_rate"), (i[(i.offline_reward_time = 6)] = "offline_reward_time"), (i[(i.ad_booster_duration = 7)] = "ad_booster_duration"), (i[(i.customer_move_speed = 8)] = "customer_move_speed"), (i[(i.ad_reward_revenue = 9)] = "ad_reward_revenue");