"use strict"; cc._RF.push(module, 'aaf920PAW9C2a8lJvEOT/EW', 'pop.levelup.wnd'); // Scripts/mod/tips/popup/pop.levelup.wnd.js "use strict"; /****************************************************************** * * 升级弹窗 * ******************************************************************/ var BridgeWindow = require("bridge.window"); var FxSpine = require("nx.fx.spine"); var ItemLayout = require("cmp.item.layout"); cc.Class({ "extends": BridgeWindow, properties: { spAnim: { "default": null, type: FxSpine }, labLevel: { "default": null, type: cc.Label }, lstRewards: { "default": null, type: ItemLayout }, nodUnlock: { "default": null, type: cc.Node } }, // 重载:参数打开 onOpenConfigs: function onOpenConfigs(_params) { var _this = this; this.lvFrom = _params.old_lev || 0; this.lvTo = _params.lev || 0; var cfgs = game.configs.role_data.data_role_attr[this.lvTo]; if (nx.dt.objEmpty(cfgs)) { this.scheduleOnce(function () { _this.close(); }, 0.1); return; } // 升级奖励 this.rewards = cfgs.reward || []; // 解锁描述 if (nx.dt.strEmpty(cfgs.title)) { nx.gui.setSpriteFrame(this.nodUnlock, "icon", ""); nx.gui.setString(this.nodUnlock, "desc", ""); } else { var path = cc.path.join("resDB/opens", cfgs.icon); nx.gui.setSpriteFrame(this.nodUnlock, "icon", path); // let desc = nx.text.format( "LevelUpUnLock", cfgs.ext_desc, cfgs.title ); nx.gui.setString(this.nodUnlock, "desc", nx.text.getKey(cfgs.desc)); nx.gui.setString(this.nodUnlock, "name", nx.text.getKey(cfgs.title)); nx.gui.setString(this.nodUnlock, "open", nx.text.getKey(cfgs.ext_desc)); } // 第一阶段 this.doStep1(); // 音效 nx.audio.playSFX("audios/effects/level", false); }, // 第一阶段 doStep1: function doStep1() { var _this2 = this; nx.gui.setActive(this, "panel/touch", false); nx.gui.setActive(this.nodUnlock, "", false); this.labLevel.string = this.lvFrom; nx.tween.fadeIn(this.labLevel, "", 0.3); this.lstRewards.rebuild([]); this.spAnim.action("action", false, function (_key, _name) { // console.log( _key, _name ); if (_key == "up" || _key == "zi") { _this2.labLevel.string = _this2.lvTo; return; } if (_key == "huode") { _this2.lstRewards.rebuild(_this2.rewards); return; } if (_key == "gongneng") { nx.gui.setActive(_this2.nodUnlock, "", true); _this2.scheduleOnce(function () { var node = nx.gui.setActive(_this2, "panel/touch", true); nx.tween.fadeIn(node, "", 0.5); }, 0.5); return; } if (_key == "complete") { _this2.doStep2(); return; } }, 2.0); }, // 第二阶段 doStep2: function doStep2() { this.spAnim.action("action2", true); }, // 关闭 onTouchClose: function onTouchClose() { this.checkPlot(); this.close(); }, // 等级引导相关 checkPlot: function checkPlot() { // 引导未开启 if (!nx.bridge.plot) { return; } // 进行中 var cur = nx.bridge.plot.vget("id"); if (nx.dt.strNEmpty(cur)) { return; } var queue = nx.dt.objClone(nx.bridge.plot.configs.base.level); var check = function check() { if (nx.dt.arrEmpty(queue)) { return; } nx.bridge.plot.fire(queue.shift(), function (_ret, _data) { if (!_ret) { check(); } }); }; check(); } }); cc._RF.pop();