73 lines
1.8 KiB
JavaScript
73 lines
1.8 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '052149idBRBHrfwBz1Larn0', 'cmp.act.heronewchal.wnd');
|
||
|
|
// Scripts/mod/acts/heroNewChallenge/cmp.act.heronewchal.wnd.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 星之試煉
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
var ActPage = require("act.page.base");
|
||
|
|
var PathTool = require("pathtool");
|
||
|
|
cc.Class({
|
||
|
|
"extends": ActPage,
|
||
|
|
properties: {
|
||
|
|
items: {
|
||
|
|
"default": [],
|
||
|
|
type: [cc.Node]
|
||
|
|
},
|
||
|
|
timeTxt: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 初始化
|
||
|
|
build: function build(_data) {
|
||
|
|
this._super(_data);
|
||
|
|
this.fake_data = game.configs.fake_battle_data;
|
||
|
|
// 活动监听
|
||
|
|
this.mod.vbind(this, [["EncounterData", this.freshInfos.bind(this)]]);
|
||
|
|
},
|
||
|
|
onEnable: function onEnable() {
|
||
|
|
this.mod.send31000(this.data.camp_id);
|
||
|
|
},
|
||
|
|
// 销毁
|
||
|
|
onDestroy: function onDestroy() {
|
||
|
|
// 活动监听解除
|
||
|
|
if (this.mod) {
|
||
|
|
this.mod.vunbind(this);
|
||
|
|
}
|
||
|
|
this._super();
|
||
|
|
},
|
||
|
|
freshInfos: function freshInfos(data) {
|
||
|
|
if (nx.dt.objEmpty(data)) return;
|
||
|
|
var barriers = data.barriers;
|
||
|
|
barriers.sort(Utils.tableLowerSorter(["id"]));
|
||
|
|
var cur_day = 1;
|
||
|
|
for (var index in barriers) {
|
||
|
|
if (barriers[index].status1 == 1) {
|
||
|
|
cur_day = barriers[index].id;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
this.mod.setCurDay(cur_day + 1);
|
||
|
|
for (var i in barriers) {
|
||
|
|
var d = barriers[i];
|
||
|
|
var item = this.items[d.id - 1];
|
||
|
|
if (item) {
|
||
|
|
var cmp = nx.gui.getComponent(item, "", "cmp.act.heronewchal.item");
|
||
|
|
if (cmp) {
|
||
|
|
cmp.setData(d);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//时间
|
||
|
|
var act_data = nx.bridge.acts.queryThemeBySource(478);
|
||
|
|
nx.gui.setCdTxt(this.timeTxt, "", act_data.end_time - act_data.start_time);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|