77 lines
2.0 KiB
JavaScript
77 lines
2.0 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'd96593yzfRBJZU3lYLerJVT', 'cmp.personal.clerk.select.item');
|
||
|
|
// Scripts/mod/personal/cmps/cmp.personal.clerk.select.item.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 秘书选择项
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
var SVCItem = require("nx.fx.sv.expand.item");
|
||
|
|
var HeroConst = require("hero_const");
|
||
|
|
var HCT = HeroConst.CampType;
|
||
|
|
cc.Class({
|
||
|
|
"extends": SVCItem,
|
||
|
|
properties: {},
|
||
|
|
// 数据重置
|
||
|
|
rebind: function rebind(_idx, _data, _key) {
|
||
|
|
this._super(_idx, _data, _key);
|
||
|
|
|
||
|
|
// 刷新
|
||
|
|
this.setData(_data);
|
||
|
|
nx.gui.setActive(this, "focus", false);
|
||
|
|
},
|
||
|
|
// 聚焦获得
|
||
|
|
onFocus: function onFocus() {
|
||
|
|
nx.gui.setActive(this, "focus", true);
|
||
|
|
},
|
||
|
|
// 聚焦失去
|
||
|
|
outFocus: function outFocus() {
|
||
|
|
nx.gui.setActive(this, "focus", false);
|
||
|
|
},
|
||
|
|
// 置空
|
||
|
|
setEmpty: function setEmpty() {
|
||
|
|
nx.gui.setActive(this, "focus", false);
|
||
|
|
nx.gui.setSpriteFrame(this, "head/camp", null);
|
||
|
|
nx.gui.setSpriteFrame(this, "mask/bg", null);
|
||
|
|
nx.gui.setSpriteFrame(this, "mask/img", null);
|
||
|
|
},
|
||
|
|
// 重置
|
||
|
|
setData: function setData(_data, _lock) {
|
||
|
|
var _this = this;
|
||
|
|
if (_lock === void 0) {
|
||
|
|
_lock = false;
|
||
|
|
}
|
||
|
|
this.mdata = _data;
|
||
|
|
var clerk = _data;
|
||
|
|
if (!clerk) {
|
||
|
|
this.setEmpty();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 阵营标记
|
||
|
|
var camp = clerk.partner.camp_type || HCT.eWater;
|
||
|
|
var path = cc.path.join("coms/images", "camps" + camp);
|
||
|
|
nx.gui.setSpriteFrame(this, "head/camp", path);
|
||
|
|
|
||
|
|
// 阵营背景
|
||
|
|
path = cc.path.join("coms/camps", "bg" + camp);
|
||
|
|
nx.gui.setSpriteFrame(this, "mask/bg", path);
|
||
|
|
|
||
|
|
// 阵营边框
|
||
|
|
path = cc.path.join("coms/camps", "frame" + camp);
|
||
|
|
nx.gui.setSpriteFrame(this, "frame", path);
|
||
|
|
|
||
|
|
// 角色
|
||
|
|
nx.gui.setSpriteFrame(this, "mask/img", clerk.cfg.img_half_small, function (_ret) {
|
||
|
|
if (!_ret) {
|
||
|
|
nx.gui.setSpriteFrame(_this, "mask/img", "resDB/empty/half_show3");
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|