129 lines
3.4 KiB
JavaScript
129 lines
3.4 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '5381ai1+n1OfoIPm5yCpPKk', 'cmp.act.heroupstar.wnd');
|
||
|
|
// Scripts/mod/acts/heroupstar/cmp.act.heroupstar.wnd.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 升星有禮
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
var NxSpine = require("nx.fx.spine");
|
||
|
|
var NxExpand = require("nx.fx.sv.expand");
|
||
|
|
var PathTool = require("pathtool");
|
||
|
|
var TipsController = require("tips_controller");
|
||
|
|
var HeroUpstarMod = require("act.heroupstar.mod");
|
||
|
|
// const ActPopup = require( "act.popup.base" );
|
||
|
|
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
|
||
|
|
},
|
||
|
|
list: {
|
||
|
|
"default": null,
|
||
|
|
type: NxExpand
|
||
|
|
},
|
||
|
|
limitTime: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
heroTip: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 初始化
|
||
|
|
// onLoad: function( ) {
|
||
|
|
// this.mod = HeroUpstarMod.getInstance();
|
||
|
|
// this.upstar_data = game.configs.holiday_upstars_new_data;
|
||
|
|
// // 活动监听
|
||
|
|
// this.mod.vbind( this, [
|
||
|
|
// [ "heroUpstarAwards", this.freshList.bind( this ) ],
|
||
|
|
// ] );
|
||
|
|
// },
|
||
|
|
|
||
|
|
// onOpenConfigs(_params){
|
||
|
|
// this._super( _params );
|
||
|
|
// this.list.svcKey = this.mod.data.source;
|
||
|
|
// this.mod.send29211();
|
||
|
|
// },
|
||
|
|
|
||
|
|
// onPreClosed(){
|
||
|
|
// this.list.rebuild([]);
|
||
|
|
|
||
|
|
// // 活动监听解除
|
||
|
|
// if( this.mod ) {
|
||
|
|
// this.mod.vunbind( this );
|
||
|
|
// }
|
||
|
|
// },
|
||
|
|
|
||
|
|
build: function build(_data) {
|
||
|
|
this._super(_data);
|
||
|
|
this.upstar_data = game.configs.holiday_upstars_new_data;
|
||
|
|
// 活动监听
|
||
|
|
this.mod.vbind(this, [["heroUpstarAwards", this.freshList.bind(this)]]);
|
||
|
|
},
|
||
|
|
onEnable: function onEnable() {
|
||
|
|
this.list.svcKey = this.mod.data.source;
|
||
|
|
this.mod.send29211(this.mod.data.camp_id);
|
||
|
|
},
|
||
|
|
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.rebuild(award_list);
|
||
|
|
|
||
|
|
//先設置已經選擇的英雄
|
||
|
|
var partner_bid = this.mod.getChooseHero().bid;
|
||
|
|
var cfg = game.configs.partner_data.data_partner_base[partner_bid];
|
||
|
|
if (partner_bid) {
|
||
|
|
nx.gui.hideAllChildren(this, "left/tag");
|
||
|
|
this.empNd.active = false;
|
||
|
|
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"));
|
||
|
|
}
|
||
|
|
nx.gui.setCdTxt(this.limitTime, "", this.mod.getLimitTime() - client.socket.getTime());
|
||
|
|
nx.gui.setString(this.heroTip, "", cc.js.formatStr(nx.text.getKey("HeroUpTag"), cfg ? cfg.name : ""));
|
||
|
|
},
|
||
|
|
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();
|