Files
fc/dev/project/library/imports/28/28204813-cb7a-4c54-88d6-8e5b8455e5e2.js
T

61 lines
1.7 KiB
JavaScript
Raw Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '28204gTy3pMVIjWjluEVeXi', 'cmp.heaven.item.chapter');
// Scripts/mod/pve/heaven/cmp/cmp.heaven.item.chapter.js
"use strict";
var ItemBase = require("nx.fx.sv.expand.item");
var HEACT = require("heaven_controller");
var HeavenEvent = require("heaven_event");
cc.Class({
"extends": ItemBase,
properties: {
chapter: {
"default": null,
type: cc.Node
},
star: {
"default": null,
type: cc.Node
},
progress: {
"default": null,
type: cc.ProgressBar
},
mask: {
"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.chapter, "", cc.js.formatStr(nx.text.getKey("HeaChapter"), data.id));
this.chapter_data = HEACT.getInstance().getModel().getChapterDataById(data.id);
if (!this.chapter_data) {
this.star.active = false;
this.progress.node.active = false;
this.mask.active = true;
nx.gui.setString(this.mask, "txt", cc.js.formatStr(nx.text.getKey("LockMaxDun"), data.id - 1));
} else {
nx.gui.setString(this.star, "num", this.chapter_data.all_star + "/30");
this.progress.progress = this.chapter_data.all_star / 30;
}
},
clickAwards: function clickAwards() {
if (!this.mdata) return;
nx.bridge.createPanel("WndHeavenAward", {
id: this.mdata.id
});
},
clickGotoChapter: function clickGotoChapter() {
if (!this.mdata) return;
gcore.GlobalEvent.fire(HeavenEvent.Add_Chapter_Data_Event, this.mdata.id);
} // update (dt) {},
});
cc._RF.pop();