87 lines
2.0 KiB
JavaScript
87 lines
2.0 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '2b99abyjX1NdrnAQuIVtOdQ', 'cmp.personal.avatar.item');
|
||
|
|
// Scripts/mod/personal/cmps/cmp.personal.avatar.item.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 头像选择项
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
var SVCItem = require("nx.fx.sv.expand.item");
|
||
|
|
cc.Class({
|
||
|
|
"extends": SVCItem,
|
||
|
|
properties: {
|
||
|
|
nodBG: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodIcon: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodUsed: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodLocked: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodFocus: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 显示
|
||
|
|
onEnable: function onEnable() {},
|
||
|
|
// 数据重置
|
||
|
|
rebind: function rebind(_idx, _data, _key) {
|
||
|
|
this._super(_idx, _data, _key);
|
||
|
|
this.nodFocus.active = false;
|
||
|
|
|
||
|
|
// 刷新
|
||
|
|
this.setData(_data);
|
||
|
|
},
|
||
|
|
// 聚焦获得
|
||
|
|
onFocus: function onFocus() {
|
||
|
|
this.nodFocus.active = true;
|
||
|
|
},
|
||
|
|
// 聚焦失去
|
||
|
|
outFocus: function outFocus() {
|
||
|
|
this.nodFocus.active = false;
|
||
|
|
},
|
||
|
|
// 置空
|
||
|
|
setEmpty: function setEmpty() {
|
||
|
|
nx.gui.setActive(this.nodUsed, "", false);
|
||
|
|
nx.gui.setActive(this.nodLocked, "", false);
|
||
|
|
nx.gui.setSpriteFrame(this.nodIcon, "", null);
|
||
|
|
},
|
||
|
|
// 设置使用中
|
||
|
|
setUsed: function setUsed(_used) {
|
||
|
|
this.nodUsed.active = _used;
|
||
|
|
},
|
||
|
|
// 重置
|
||
|
|
setData: function setData(_data) {
|
||
|
|
this.mdata = _data;
|
||
|
|
|
||
|
|
// 无效
|
||
|
|
if (nx.dt.objEmpty(this.mdata) || !nx.dt.numPositive(this.mdata.id, false)) {
|
||
|
|
this.setEmpty();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
this.setUsed(false);
|
||
|
|
nx.gui.setActive(this.nodLocked, "", this.mdata.lock);
|
||
|
|
nx.bridge.setIcon(this.nodIcon, "", this.mdata.icon);
|
||
|
|
|
||
|
|
// 未解锁
|
||
|
|
// if( !this.mdata.have ) {
|
||
|
|
// let tip = nx.text.getKey( this.mdata.cfgs.tips );
|
||
|
|
// nx.gui.setString( this.nodLocked, "txt", tip );
|
||
|
|
// }
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|