69 lines
2.1 KiB
JavaScript
69 lines
2.1 KiB
JavaScript
|
|
const SVCItem = require( "nx.fx.sv.expand.item" );
|
||
|
|
const TrainingcampController = require( "trainingcamp_controller" );
|
||
|
|
|
||
|
|
cc.Class({
|
||
|
|
extends: SVCItem,
|
||
|
|
|
||
|
|
properties: {
|
||
|
|
|
||
|
|
nodBg: { default: null, type: cc.Node, displayName: "背景显示" },
|
||
|
|
nodBaseInfo: { default: null, type: cc.Node, displayName: "基本信息" },
|
||
|
|
nodStatus: { default: null, type: cc.Node, displayName: "完成状态" },
|
||
|
|
nodLocked: { default: null, type: cc.Node, displayName: "锁定显示" },
|
||
|
|
},
|
||
|
|
|
||
|
|
// 数据重置
|
||
|
|
rebind: function( _idx, _data, _key ) {
|
||
|
|
|
||
|
|
this._super( _idx, _data, _key );
|
||
|
|
|
||
|
|
// 刷新
|
||
|
|
this.setData( _data );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 设置相关的显示数据
|
||
|
|
setData: function( _data ){
|
||
|
|
|
||
|
|
if( !this.mdata ){
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
nx.gui.setString( this.nodBaseInfo, "id/txt", "0" + this.mdata.id );
|
||
|
|
nx.gui.setString( this.nodBaseInfo, "desc", this.mdata.name );
|
||
|
|
|
||
|
|
|
||
|
|
let icon = this.mdata.reward[0][0];
|
||
|
|
nx.bridge.setIconS( this, "rewards/icon", icon );
|
||
|
|
nx.gui.setString( this, "rewards/count", this.mdata.reward[0][1] );
|
||
|
|
|
||
|
|
nx.gui.setActive( this.nodLocked, "", this.mdata.open == 0 );
|
||
|
|
nx.gui.setActive( this.nodStatus, "get", this.mdata.finish && !this.mdata.complete );
|
||
|
|
nx.gui.setActive( this.nodStatus, "goto", !this.mdata.finish );
|
||
|
|
nx.gui.setActive( this.nodStatus, "finish", this.mdata.complete );
|
||
|
|
|
||
|
|
|
||
|
|
let nod = nx.gui.find( this.nodStatus, "goto/plot" );
|
||
|
|
if( nod && nx.bridge.plot && nx.bridge.plot.isDoing() ){
|
||
|
|
nx.gui.setActive( nod, "", this.mdata.id == 1 );
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
EnterTrain: function(){
|
||
|
|
|
||
|
|
let id = this.mdata ? this.mdata.id : 1;
|
||
|
|
TrainingcampController.getInstance().send27602( id );
|
||
|
|
// console.log ( "当前的传入数据" + JSON.stringify( this.mdata ) );
|
||
|
|
// // open panel
|
||
|
|
// nx.bridge.createPanel( "WndTrainingCampMore", this.mdata );
|
||
|
|
// nx.bridge.closePanel( "WndTrainingCamp" );
|
||
|
|
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
onTouchGet: function(){
|
||
|
|
|
||
|
|
TrainingcampController.getInstance().send27604( this.mdata.id );
|
||
|
|
}
|
||
|
|
|
||
|
|
});
|