84 lines
1.8 KiB
JavaScript
84 lines
1.8 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '28cb6DCv91IUY2xLWDzTj3T', 'cmp.personal.figure.item');
|
||
|
|
// Scripts/mod/personal/cmps/cmp.personal.figure.item.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 皮肤选择项
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
var SVCItem = require("nx.fx.sv.expand.item");
|
||
|
|
cc.Class({
|
||
|
|
"extends": SVCItem,
|
||
|
|
properties: {
|
||
|
|
nodAvatar: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodName: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodLocker: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodFocus: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 显示
|
||
|
|
onLoad: function onLoad() {
|
||
|
|
// 置空
|
||
|
|
this.setEmpty();
|
||
|
|
},
|
||
|
|
// 数据重置
|
||
|
|
rebind: function rebind(_idx, _data, _key) {
|
||
|
|
this._super(_idx, _data, _key);
|
||
|
|
|
||
|
|
// 刷新
|
||
|
|
this.setData(_data);
|
||
|
|
},
|
||
|
|
// 聚焦获得
|
||
|
|
onFocus: function onFocus() {
|
||
|
|
this.nodFocus.active = true;
|
||
|
|
},
|
||
|
|
// 聚焦失去
|
||
|
|
outFocus: function outFocus() {
|
||
|
|
this.nodFocus.active = false;
|
||
|
|
},
|
||
|
|
// 置空
|
||
|
|
setEmpty: function setEmpty() {
|
||
|
|
this.nodAvatar.active = false;
|
||
|
|
this.nodLocker.active = false;
|
||
|
|
this.nodFocus.active = false;
|
||
|
|
nx.gui.setString(this.nodName, "", "");
|
||
|
|
nx.gui.setActive(this, "used", false);
|
||
|
|
},
|
||
|
|
// 重置
|
||
|
|
setData: function setData(_data) {
|
||
|
|
this.mdata = _data;
|
||
|
|
|
||
|
|
// 置空
|
||
|
|
if (nx.dt.objEmpty(_data) || !nx.dt.numPositive(_data.id, false)) {
|
||
|
|
this.setEmpty();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
this.nodFocus.active = false;
|
||
|
|
this.nodLocker.active = !_data.unlock;
|
||
|
|
|
||
|
|
// 头像框
|
||
|
|
this.nodAvatar.active = true;
|
||
|
|
nx.bridge.setIcon(this.nodAvatar, "img", _data.icon);
|
||
|
|
|
||
|
|
// 名字
|
||
|
|
var name = nx.dt.strCut(nx.text.getKey(_data.name), 12);
|
||
|
|
nx.gui.setString(this.nodName, "txt", name);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|