Files
fc/dev/project/library/imports/11/1185088a-5523-42f9-b116-100e5e602efd.js
2026-05-24 10:21:26 +08:00

59 lines
1.6 KiB
JavaScript

"use strict";
cc._RF.push(module, '11850iKVSNC+bEWEA5eYC79', 'cmp.heaven.item.award');
// Scripts/mod/pve/heaven/cmp/cmp.heaven.item.award.js
"use strict";
var ItemBase = require("nx.fx.sv.expand.item");
var ItemLay = require("cmp.common.itemlayout");
var HEACT = require("heaven_controller");
cc.Class({
"extends": ItemBase,
properties: {
items: {
"default": null,
type: ItemLay
},
desc: {
"default": null,
type: cc.Node
},
btnGet: {
"default": null,
type: cc.Node
},
ndGot: {
"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)) {
this.items.rebuild([]);
return;
}
this.items.rebuild(data.award);
var chapter_data = HEACT.getInstance().getModel().getChapterDataById(data.id);
var award_info = chapter_data.award_info;
if (award_info) {
for (var i in award_info) {
if (award_info[i].id == data.award_id) {
nx.gui.setActive(this.btnGet, "", award_info[i].flag == 1);
nx.gui.setActive(this.ndGot, "", award_info[i].flag == 2);
}
}
}
nx.gui.setString(this.desc, "", cc.js.formatStr(nx.text.getKey("HeaChapStars"), data.limit_star, chapter_data.all_star, data.limit_star));
},
clickAward: function clickAward() {
if (!this.mdata) return;
HEACT.getInstance().sender25215(this.mdata.id, this.mdata.award_id);
} // update (dt) {},
});
cc._RF.pop();