"use strict"; cc._RF.push(module, '71fabUIedhH1IKyBUkbEiRu', 'cmp.home.theme.item'); // Scripts/mod/home/cmps/cmp.home.theme.item.js "use strict"; /****************************************************************** * * 家园主题项 * ******************************************************************/ cc.Class({ "extends": cc.Component, properties: {}, // 设置 setData: function setData(_data) { this.data = _data; // 空 if (nx.dt.objEmpty(_data)) { this.node.active = false; return; } this.node.active = true; // 背景图 var 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 setFocus(_open) { nx.gui.setActive(this, "focus", _open); }, // 点击 onTouch: function onTouch() { if (nx.dt.objEmpty(this.data)) { return; } // 未解锁 if (this.data.state == 0) { nx.tbox("HomeThemeChange"); return; } nx.bridge.vset("HomeTheme", this.data.theme_id); } }); cc._RF.pop();