54 lines
1.0 KiB
JavaScript
54 lines
1.0 KiB
JavaScript
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 桌布项
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
const SvcItem = require( "nx.fx.sv.expand.item" )
|
||
|
|
|
||
|
|
cc.Class( {
|
||
|
|
|
||
|
|
extends: SvcItem,
|
||
|
|
|
||
|
|
properties: {},
|
||
|
|
|
||
|
|
// 数据重置
|
||
|
|
rebind: function( _idx, _data, _key ) {
|
||
|
|
|
||
|
|
this._super( _idx, _data, _key );
|
||
|
|
|
||
|
|
// 刷新
|
||
|
|
this.fresh();
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 聚焦获得
|
||
|
|
onFocus: function() {
|
||
|
|
nx.gui.setActive( this, "on", true );
|
||
|
|
nx.gui.setActive( this, "off", false );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 聚焦失去
|
||
|
|
outFocus: function() {
|
||
|
|
nx.gui.setActive( this, "on", false );
|
||
|
|
nx.gui.setActive( this, "off", true );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 设置使用中
|
||
|
|
setUsed: function( _used ) {
|
||
|
|
nx.gui.setActive( this, "used", _used );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 刷新
|
||
|
|
fresh: function() {
|
||
|
|
|
||
|
|
this.outFocus();
|
||
|
|
this.setUsed( false );
|
||
|
|
|
||
|
|
let path = cc.path.join( "resDB/desktop", "s" +this.mdata.id );
|
||
|
|
nx.gui.setSpriteFrame( this, "img", path );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
} );
|