Files

82 lines
2.0 KiB
JavaScript
Raw Permalink Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '2c169gh2vxD6qfU3lcz54GK', 'cmp.act.fund.item');
// Scripts/mod/acts/fund/cmp.act.fund.item.js
"use strict";
var ItemBase = require("nx.fx.sv.expand.item");
var ActFund = require("cmp.act.fund");
cc.Class({
"extends": ItemBase,
properties: {
lev: {
"default": null,
type: cc.Node
},
lockNd: {
"default": null,
type: cc.Node
},
maskNd: {
"default": null,
type: cc.Node
},
free: {
"default": null,
type: cc.Node
},
fund: {
"default": null,
type: cc.Node
},
fabItem: {
"default": null,
type: cc.Prefab
},
actCmp: {
"default": null,
type: ActFund
},
rmbTip: {
"default": null,
type: cc.Node
}
},
// LIFE-CYCLE CALLBACKS:
rebind: function rebind(_index, _data, _key) {
this._super(_index, _data, _key);
this.setData(_data);
},
setData: function setData(data) {
if (nx.dt.objEmpty(data)) return;
nx.gui.setString(this.lev, "", data.aim);
var awards = data.item_list;
if (!this.freeItem) {
this.freeItem = cc.instantiate(this.fabItem);
this.freeItem.parent = this.free;
}
var freeCmp = nx.gui.getComponent(this.freeItem, "", "cmp.item.base");
if (freeCmp) {
freeCmp.rebind(0, awards[0], "");
}
if (!this.fundItem) {
this.fundItem = cc.instantiate(this.fabItem);
this.fundItem.parent = this.fund;
}
var fundCmp = nx.gui.getComponent(this.fundItem, "", "cmp.item.base");
if (fundCmp) {
fundCmp.rebind(1, awards[1], "");
}
nx.gui.setActive(this.maskNd, "", data.status >= 2);
nx.gui.setActive(this.lockNd, "", this.actCmp.buy_status == 0);
if (this.actCmp.buy_status == 1) {
//已购买
nx.gui.setActive(this.node, "2", data.status == 2);
nx.gui.setActive(this.rmbTip, "", data.status == 4);
} else {
nx.gui.setActive(this.node, "2", false);
}
}
});
cc._RF.pop();