"use strict"; cc._RF.push(module, '0304dNF8dJKUKeV8KlHsmjF', 'cmp.act.limitstar.wnd'); // Scripts/mod/acts/upstar/cmp/cmp.act.limitstar.wnd.js "use strict"; /****************************************************************** * * 限定招募五选一升星活动 * ******************************************************************/ var NxSpine = require("nx.fx.spine"); var NxExpand = require("nx.fx.sv.expand"); var PathTool = require("pathtool"); var HeroVo = require("hero_vo"); var TipsController = require("tips_controller"); var ActPage = require("act.page.base"); cc.Class({ "extends": ActPage, properties: { empNd: { "default": null, type: cc.Node }, roleNd: { "default": null, type: cc.Node }, role: { "default": null, type: NxSpine }, roleTag: { "default": null, type: cc.Node }, btnLock: { "default": null, type: cc.Node }, list: { "default": null, type: NxExpand }, fabHero: { "default": null, type: cc.Prefab }, limitTime: { "default": null, type: cc.Node } }, // 初始化 build: function build(_data) { this._super(_data); this.upstar_data = game.configs.holiday_upstars_new_data; // 活动监听 this.mod.vbind(this, [["limitUpstarAwards", this.freshList.bind(this)]]); }, onEnable: function onEnable() { this.list.svcKey = this.data.source; this.mod.send29220(); this.mod.send29221(); }, onDisable: function onDisable() { this.list.rebuild([]); }, // 销毁 onDestroy: function onDestroy() { // 活动监听解除 if (this.mod) { this.mod.vunbind(this); } this._super(); }, freshList: function freshList(award_list) { var _this = this; if (!award_list || award_list.length == 0) return; this.list.svcKey = this.data.source; this.list.rebuild(award_list); //先設置已經選擇的英雄 var partner_bid = this.mod.getChooseHero().bid; var cfg = game.configs.partner_data.data_partner_base[partner_bid]; if (cfg) { nx.gui.hideAllChildren(this, "left/tag"); this.empNd.active = false; if (!this.select_hero) { this.select_hero = cc.instantiate(this.fabHero); this.select_hero.parent = this.roleTag; } var cmp = nx.gui.getComponent(this.select_hero, "", "cmp.item.base"); if (cmp) { var hero = new HeroVo(); hero.bid = this.mod.getChooseHero().bid; hero.star = this.mod.getChooseHero().star; hero.camp_type = cfg.camp_type; cmp.rebind(0, hero, ""); } var res_path = PathTool.getSpinePath(cfg.bustid, "show", false); this.role.load(res_path, function (_e) { if (!_e) { _this.role.action("action1", true); } else { _this.role.stop(); } }); } else { this.empNd.active = true; nx.gui.setSpriteFrame(this.empNd, "", cc.path.join("resDB/empty", "half_show")); if (!this.select_hero) { this.select_hero = cc.instantiate(this.fabHero); this.select_hero.parent = this.roleTag; } var _cmp = nx.gui.getComponent(this.select_hero, "", "cmp.item.base"); if (_cmp) { _cmp.rebind(0, {}, ""); } } if (this.mod.getIsLock() == 1) { this.btnLock.active = false; } nx.gui.setCdTxt(this.limitTime, "", this.mod.getLimitTime() - client.socket.getTime()); }, setLockHeroInfo: function setLockHeroInfo(data) { if (nx.dt.objEmpty(data)) return; if (this.mod.getIsLock() == 1) return; //已鎖定 //先設置已經選擇的英雄 //打開英雄選擇界面 nx.bridge.createPanel("WndActUpstarHero", { plist: data.partner_list, mod: this.mod, acts_type: this.data.source }); }, onClickSelectHero: function onClickSelectHero() { if (this.mod.getIsLock() == 1) return; //已鎖定 var data = this.mod.vget("limitHeros"); if (nx.dt.objEmpty(data)) return; if (data.partner_list == 0) { return nx.tbox("NotAbortHero"); } else { //打開英雄選擇界面 nx.bridge.createPanel("WndActUpstarHero", { plist: data.partner_list, mod: this.mod, acts_type: this.data.source }); } }, onClickLock: function onClickLock() { var _this2 = this; var str = nx.text.getKey("ActUpstarLock_"); nx.mbox(str, ["cancel", "confirm"], function (_key, _box) { _box.close(); if (_key == "confirm") { _this2.mod.send29223(function (_data) { if (!_data) return; _this2.btnLock.active = false; }); } }); }, onClickRule: function onClickRule() { var TC = TipsController.getInstance(); if (TC) { var config = gdata("holiday_upstars_new_data", "data_const", "desc"); TC.showTextPanel(null, config.desc); } } }); cc._RF.pop();