76 lines
2.3 KiB
JavaScript
76 lines
2.3 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '058c1e4Gz9PY6JyhTCoVsXT', 'cmp.act.optionalgift.item');
|
||
|
|
// Scripts/mod/acts/optionalgift/cmp/cmp.act.optionalgift.item.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var ItemBase = require("cmp.item.base");
|
||
|
|
var BackPackConst = require("backpack_const");
|
||
|
|
var HeroControl = require("hero_controller");
|
||
|
|
var BTT = BackPackConst.item_type;
|
||
|
|
cc.Class({
|
||
|
|
"extends": ItemBase,
|
||
|
|
properties: {
|
||
|
|
nodCannot: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
freshAll: function freshAll() {
|
||
|
|
var nod = nx.gui.find(this.node, "bg");
|
||
|
|
nx.gui.setActive(this.nodCannot, "", false);
|
||
|
|
this.mdata.canshow = 0;
|
||
|
|
// this.setGray( nod, 0 );
|
||
|
|
this._super();
|
||
|
|
},
|
||
|
|
// 单设:数量
|
||
|
|
setCount: function setCount(_count) {
|
||
|
|
// 碎片获取合成配置,显示进度
|
||
|
|
if (this.nodCount && this.info && this.info.type == BTT.PARTNER_DEBRIS) {
|
||
|
|
var cfg = gdata("partner_data", "data_get_compound_info", this.info.item_id);
|
||
|
|
if (nx.dt.objNEmpty(cfg)) {
|
||
|
|
this.nodCount.string = _count + "/" + cfg.num;
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
this._super(_count);
|
||
|
|
},
|
||
|
|
// 单设:品质
|
||
|
|
setQuality: function setQuality(_qa) {
|
||
|
|
if (this.nodBG) {
|
||
|
|
var qa = null;
|
||
|
|
if (nx.dt.numPositive(_qa)) {
|
||
|
|
var _show = _qa < BackPackConst.quality.golden ? _qa : BackPackConst.quality.red;
|
||
|
|
qa = cc.path.join("coms/images", "bg_qa" + _show);
|
||
|
|
}
|
||
|
|
nx.gui.setSpriteFrame(this.nodBG, "", qa);
|
||
|
|
if (!qa) {
|
||
|
|
nx.gui.getComponent(this.nodBG, "", cc.Sprite).curKey = "";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setGray: function setGray(_nod, _mat) {
|
||
|
|
var nod = _nod;
|
||
|
|
var sp = nx.gui.getComponent(nod, "qa", cc.Sprite);
|
||
|
|
var isp = nx.gui.getComponent(nod, "icon", cc.Sprite);
|
||
|
|
var ssp = nx.gui.getComponent(nod, "stars", cc.Sprite);
|
||
|
|
var rt = nx.gui.getComponent(nod, "rt/img", cc.Sprite);
|
||
|
|
var material = _mat == 1 ? cc.Material.getBuiltinMaterial('2d-gray-sprite') : cc.Material.getBuiltinMaterial('2d-sprite');
|
||
|
|
sp.setMaterial(0, material);
|
||
|
|
isp.setMaterial(0, material);
|
||
|
|
ssp.setMaterial(0, material);
|
||
|
|
rt.setMaterial(0, material);
|
||
|
|
},
|
||
|
|
setCannotSelect: function setCannotSelect(_show) {
|
||
|
|
var num = 0;
|
||
|
|
var nod = nx.gui.find(this.node, "bg");
|
||
|
|
if (this.nodCannot) {
|
||
|
|
num = _show ? 1 : 0;
|
||
|
|
this.setGray(nod, num);
|
||
|
|
nx.gui.setActive(this.nodCannot, "", false);
|
||
|
|
}
|
||
|
|
this.mdata.canshow = num;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|