"use strict"; cc._RF.push(module, '339faU/OaJNMZdF4mtKbhQO', 'cmp.holy.pray.uplev'); // Scripts/mod/pray/cmp/cmp.holy.pray.uplev.js "use strict"; var BridgeWindow = require("bridge.window"); var BackPackController = require("backpack_controller"); var PrayMod = require("pray.mod"); var HeavenEvent = require("heaven_event"); cc.Class({ "extends": BridgeWindow, properties: { nodRate: { "default": null, type: cc.Node }, nodMat: { "default": null, type: cc.Node }, nodNowLevel: { "default": null, type: cc.Node }, nodNextLevel: { "default": null, type: cc.Node } }, onLoad: function onLoad() { this.bindGEvent(HeavenEvent.Update_Dial_Base_Data, this.freshInfo.bind(this)); }, // 重载:参数打开 onOpenConfigs: function onOpenConfigs(_params) { this.freshInfo(_params); }, freshInfo: function freshInfo(_params) { this.lev = _params.lev; this.group_id = _params.group_id; var ncfg = game.configs.holy_eqm_lottery_data.data_lev_up[this.lev + 1]; var cfg = game.configs.holy_eqm_lottery_data.data_pro_show[this.lev]; var nfg = game.configs.holy_eqm_lottery_data.data_pro_show[this.lev + 1]; var rates = []; for (var i in cfg) { var rate = cfg[i]; rates.push(rate); } var nrates = []; // if( nfg ){ // } for (var _i in nfg) { var _rate = nfg[_i]; nrates.push(_rate); } nx.gui.gocChildren(this.nodRate, "", rates.length); var chd = this.nodRate.children; for (var _i2 = 0; _i2 < chd.length; _i2++) { var nod = chd[_i2]; var _rate2 = rates[_i2]; if (_rate2) { nx.gui.setString(nod, "name", _rate2.name); nx.gui.setString(nod, "rate", _rate2.pro + "%"); nx.gui.setString(nod, "next", nrates[_i2] ? nrates[_i2].pro + "%" : _rate2.pro + "%"); } } nx.gui.setString(this.nodNowLevel, "", nx.text.format("StatueNowLv", this.lev)); nx.gui.setString(this.nodNextLevel, "", nx.dt.arrEmpty(nrates) ? nx.text.getKey("tip_heroMaxed") : nx.text.format("NextLevel", this.lev + 1)); var desc = nx.gui.find(this.nodMat, "desc"); nx.gui.setString(desc, "desc", ncfg ? nx.text.format("StatueUpDesc", ncfg.open_cond, _params.all_count, ncfg.open_cond) : ""); this.canUpLev = ncfg && ncfg.open_cond <= _params.all_count; var str = !ncfg ? "" : ncfg.open_cond <= _params.all_count ? nx.text.getKey("elfin_hatch_unlock_10") : nx.text.getKey("elfin_hatch_unlock_9"); nx.gui.setString(desc, "status", str); var BC = BackPackController.getInstance(); var nodMat = nx.gui.find(this.nodMat, "mat"); var chdMat = nodMat.children; this.mat = []; for (var j = 0; j < chdMat.length; j++) { var _nod = chdMat[j]; var mat = ncfg ? ncfg.items[j] : []; if (nx.dt.arrEmpty(mat)) { nx.gui.setActive(_nod, "", false); continue; } var enough = true; var have = BC.getModel().getItemNumByBid(mat[0]); if (have < mat[1]) { this.mat.push(mat[0]); enough = false; } nx.bridge.setIconS(_nod, "icon", mat[0]); nx.gui.setString(_nod, "count", nx.dt.shortCount(have) + "/" + mat[1]); nx.gui.setColor(_nod, "count", !enough ? cc.Color.RED : cc.Color.WHITE); nx.gui.setActive(_nod, "", true); } nx.gui.setActive(this.nodMat, "op", ncfg); nx.gui.setActive(this.nodMat, "max", !ncfg); }, onTouchUpLev: function onTouchUpLev() { var pray = PrayMod.getInstance(); if (nx.dt.arrNEmpty(this.mat) || !this.canUpLev) { nx.tbox("lab_guild_request_item_tip8"); return; } pray.sender25233(this.group_id); }, // 重载:关闭前 onPreClosed: function onPreClosed() {} }); cc._RF.pop();