Files

84 lines
2.4 KiB
JavaScript
Raw Permalink Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '436e2andoNJFokcCMRLNaG5', 'cmp.arena.loopc.reward.item');
// Scripts/mod/pvp/arena/cmp/cmp.arena.loopc.reward.item.js
"use strict";
var ArenaController = require("arena_controller");
cc.Class({
"extends": cc.Component,
properties: {
nodCanget: {
"default": null,
type: cc.Node
},
nodGot: {
"default": null,
type: cc.Node
},
nodShow: {
"default": null,
type: cc.Node
},
nodClose: {
"default": null,
type: cc.Node
}
},
setData: function setData(_data, _idx, _get) {
this.mdata = _data;
this.index = _idx;
this.getInfo = _get;
this.setReward();
this.setState();
},
setState: function setState() {
if (nx.dt.objNEmpty(this.getInfo)) {
var glist = this.getInfo.got.num_list;
var gotlst = [];
glist.forEach(function (item) {
if (item) {
gotlst.push(item.num);
}
});
// this.nodCanget
nx.gui.setColor(this, "point", this.getInfo.got.had_combat_num >= this.mdata.num ? cc.Color.WHITE : cc.Color.BLACK);
nx.gui.setActive(this.nodCanget, "", this.getInfo.got.had_combat_num >= this.mdata.num);
nx.gui.setActive(this.nodGot, "", nx.dt.arrMember(gotlst, this.mdata.num));
nx.gui.setActive(this.nodCanget, "tip", this.getInfo.got.had_combat_num >= this.mdata.num && !nx.dt.arrMember(gotlst, this.mdata.num));
} else {
nx.gui.setColor(this, "point", cc.Color.BLACK);
nx.gui.setActive(this.nodCanget, "", false);
}
},
setReward: function setReward() {
// {"num":70,"items":[[37002,1]]}
nx.gui.setString(this, "point", this.mdata.num);
var nod = nx.gui.getComponent(this.nodShow, "bg/award", "cmp.common.itemlayout");
if (nod) {
nod.rebuild(this.mdata.items);
}
},
showReward: function showReward() {
var nod = this.node.parent;
if (nod) {
var chd = nod.children;
for (var i = 0; i < chd.length; i++) {
var n = chd[i];
if (i != this.index) {
nx.gui.setActive(n, "show", false);
}
}
}
nx.gui.setActive(this.nodShow, "", !this.nodShow.active);
nx.gui.setActive(this.nodClose, "", this.nodShow.active == true);
},
getReward: function getReward() {
var AC = ArenaController.getInstance();
if (AC) {
AC.sender20209(this.mdata.num);
}
}
});
cc._RF.pop();