79 lines
1.9 KiB
JavaScript
79 lines
1.9 KiB
JavaScript
const SVCItem = require( "nx.fx.sv.expand.item" );
|
|
const NxSpine = require( "nx.fx.spine" );
|
|
const RoleController = require( "role_controller" );
|
|
|
|
cc.Class({
|
|
|
|
extends: SVCItem,
|
|
|
|
properties: {
|
|
|
|
nodRole : { default: null, type : NxSpine },
|
|
nodWorship : { default: null, type : cc.Node },
|
|
nodName : { default: null, type : cc.Node },
|
|
nodLook : { default: null, type : cc.Node },
|
|
},
|
|
|
|
// 数据重置
|
|
rebind: function( _idx, _data, _key ) {
|
|
|
|
this._super( _idx, _data, _key );
|
|
// 刷新
|
|
this.setData( _data );
|
|
|
|
},
|
|
|
|
setData: function( _data ){
|
|
|
|
this.mdata = _data;
|
|
this.freshInfo();
|
|
},
|
|
|
|
freshInfo: function(){
|
|
|
|
if( !this.mdata ){
|
|
return;
|
|
}
|
|
nx.gui.setString( this.nodName, "", this.mdata.name );
|
|
nx.gui.setString( this.nodWorship, "", this.mdata.worship );
|
|
let ufg = game.configs.looks_data.data_data[this.mdata.lookid];
|
|
let model = "";
|
|
if( ufg ){
|
|
model = PathTool.getSpinePath( ufg.model, ufg.model, false );
|
|
}
|
|
|
|
if( this.nodRole ){
|
|
// 战斗迷你
|
|
this.nodRole.load( model, ( _e ) => {
|
|
if( !_e ) {
|
|
this.nodRole.action( "stand2", true );
|
|
} else {
|
|
this.nodRole.stop();
|
|
}
|
|
} );
|
|
}
|
|
|
|
let btn = nx.gui.getComponent( this.nodWorship, "", cc.Button );
|
|
|
|
if( btn ){
|
|
btn.interactable = this.mdata.worship_status == 0 ;
|
|
}
|
|
|
|
},
|
|
|
|
onTouchWorship: function(){
|
|
|
|
if( this.mdata.worship_status > 0 ){
|
|
nx.tbox( nx.text.getKey( "lab_arena_loop_rank_worshiped" ) );
|
|
return;
|
|
}
|
|
let RC = RoleController.getInstance();
|
|
if( RC ){
|
|
RC.sender10316( this.mdata.rid, this.mdata.srv_id, this.mdata.rank );
|
|
}
|
|
|
|
},
|
|
|
|
|
|
});
|