86 lines
2.1 KiB
JavaScript
86 lines
2.1 KiB
JavaScript
/******************************************************************
|
|
* Copyright(C) 2019 - 2020 Nx Studio
|
|
*
|
|
* STEP-UP 召唤主界面
|
|
*
|
|
******************************************************************/
|
|
|
|
const ActPage = require( "act.page.base" );
|
|
const SummonDefine = require( "summon.define" );
|
|
const STModel = require( "act.stepup.mod" );
|
|
const BridgeItemBinder = require( "bridge.binder.item.icon.count" );
|
|
|
|
const Stage = SummonDefine.StepUpStage;
|
|
|
|
cc.Class( {
|
|
|
|
extends: ActPage,
|
|
|
|
properties: {
|
|
nodCoin: { default: null, type: BridgeItemBinder },
|
|
nodScore: { default: null, type: BridgeItemBinder },
|
|
},
|
|
|
|
// 初始化
|
|
build: function( _data ) {
|
|
|
|
this._super( _data );
|
|
|
|
// 置空
|
|
this.setStage( Stage.Empty );
|
|
|
|
// 请求数据
|
|
STModel.getInstance().fetchData( ( _ret, _data ) => {
|
|
|
|
if( !_ret ) {
|
|
nx.tbox( _data );
|
|
return;
|
|
}
|
|
|
|
this.setStage( _data.state );
|
|
|
|
// 耗材绑定
|
|
this.bindCost();
|
|
} );
|
|
|
|
},
|
|
|
|
// 阶段设置
|
|
setStage: function( _stage ) {
|
|
|
|
let configs = STModel.getInstance().getConfig();
|
|
if( !configs ) {
|
|
_stage = Stage.Empty;
|
|
}
|
|
|
|
// nx.gui.setActive( this, "panel/open", _stage == Stage.Open || _stage == Stage.Complete );
|
|
},
|
|
|
|
// 耗材绑定
|
|
bindCost: function() {
|
|
|
|
// 不展示
|
|
let data = STModel.getInstance().getData();
|
|
if( data.state != Stage.Open ) {
|
|
nx.gui.setActive( this.nodCoin, "", false );
|
|
return;
|
|
}
|
|
|
|
nx.gui.setActive( this.nodCoin, "", true );
|
|
let cfgs = STModel.getInstance().getConfig();
|
|
if( cfgs ) {
|
|
let item = cfgs.steps[ 0 ].item_show;
|
|
this.nodCoin.setID( item[ 0 ] );
|
|
}
|
|
|
|
// 积分
|
|
const DATA = game.configs.step_up_recruit_data;
|
|
if( this.nodScore && DATA ) {
|
|
const score = DATA.data_const.score_id;
|
|
this.nodScore.setID( score.val);
|
|
}
|
|
|
|
},
|
|
|
|
} );
|