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