/****************************************************************** * * 家园主题项 * ******************************************************************/ cc.Class( { extends: cc.Component, properties: { }, // 设置 setData: function( _data ) { this.data = _data; // 空 if( nx.dt.objEmpty( _data ) ) { this.node.active = false; return; } this.node.active = true; // 背景图 let path = cc.path.join( "prefab/home/ui", "bg_theme" + _data.state ); nx.gui.setSpriteFrame( this, "bg", path ); // 图标 path = PathTool.queryIconPath( _data.theme_icon ); nx.gui.setSpriteFrame( this, "icon", path ); // 名字 nx.gui.setString( this, "name", nx.text.getKey( _data.name ) ); // nx.gui.setActive( this, "touch", _data.state == 1 ); this.setFocus( _data.state == 2 ); }, // 聚焦 setFocus: function( _open ) { nx.gui.setActive( this, "focus", _open ); }, // 点击 onTouch: function() { if( nx.dt.objEmpty( this.data ) ) { return; } // 未解锁 if( this.data.state == 0 ) { nx.tbox( "HomeThemeChange" ); return; } nx.bridge.vset( "HomeTheme", this.data.theme_id ); }, } );