Files
fc/dev/project/library/imports/71/71fab508-79d8-47d4-82b2-05491b12246e.js
T

60 lines
1.3 KiB
JavaScript
Raw Normal View History

2026-05-24 10:21:26 +08:00
"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();