Files
fc/dev/project/assets/Scripts/mod/personal/cmps/cmp.swap.desktop.item.js
T

54 lines
1.0 KiB
JavaScript
Raw Normal View History

2026-05-23 22:10:14 +08:00
/******************************************************************
*
* 桌布项
*
******************************************************************/
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 );
},
} );