84 lines
1.8 KiB
JavaScript
84 lines
1.8 KiB
JavaScript
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 皮肤选择项
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
const SVCItem = require( "nx.fx.sv.expand.item" );
|
||
|
|
|
||
|
|
cc.Class( {
|
||
|
|
|
||
|
|
extends: SVCItem,
|
||
|
|
|
||
|
|
properties: {
|
||
|
|
nodAvatar: { default: null, type: cc.Node },
|
||
|
|
nodName: { default: null, type: cc.Node },
|
||
|
|
nodLocker: { default: null, type: cc.Node },
|
||
|
|
nodFocus: { default: null, type: cc.Node },
|
||
|
|
},
|
||
|
|
|
||
|
|
// 显示
|
||
|
|
onLoad: function() {
|
||
|
|
|
||
|
|
// 置空
|
||
|
|
this.setEmpty();
|
||
|
|
},
|
||
|
|
|
||
|
|
// 数据重置
|
||
|
|
rebind: function( _idx, _data, _key ) {
|
||
|
|
|
||
|
|
this._super( _idx, _data, _key );
|
||
|
|
|
||
|
|
// 刷新
|
||
|
|
this.setData( _data );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 聚焦获得
|
||
|
|
onFocus: function() {
|
||
|
|
this.nodFocus.active = true;
|
||
|
|
},
|
||
|
|
|
||
|
|
// 聚焦失去
|
||
|
|
outFocus: function() {
|
||
|
|
this.nodFocus.active = false;
|
||
|
|
},
|
||
|
|
|
||
|
|
// 置空
|
||
|
|
setEmpty: function() {
|
||
|
|
|
||
|
|
this.nodAvatar.active = false;
|
||
|
|
this.nodLocker.active = false;
|
||
|
|
this.nodFocus.active = false;
|
||
|
|
nx.gui.setString( this.nodName, "", "" );
|
||
|
|
nx.gui.setActive( this, "used", false );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 重置
|
||
|
|
setData: function( _data ) {
|
||
|
|
|
||
|
|
this.mdata = _data;
|
||
|
|
|
||
|
|
// 置空
|
||
|
|
if( nx.dt.objEmpty( _data ) ||
|
||
|
|
!nx.dt.numPositive( _data.id, false ) ) {
|
||
|
|
this.setEmpty();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
this.nodFocus.active = false;
|
||
|
|
this.nodLocker.active = !_data.unlock;
|
||
|
|
|
||
|
|
// 头像框
|
||
|
|
this.nodAvatar.active = true;
|
||
|
|
nx.bridge.setIcon( this.nodAvatar, "img", _data.icon );
|
||
|
|
|
||
|
|
// 名字
|
||
|
|
let name = nx.dt.strCut( nx.text.getKey( _data.name ), 12 );
|
||
|
|
nx.gui.setString( this.nodName, "txt", name );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
} );
|