Files
fc/dev/project/library/imports/3d/3d98dbd9-1101-4c97-9ad6-e36f60f4e008.js
2026-05-24 10:21:26 +08:00

69 lines
2.0 KiB
JavaScript

"use strict";
cc._RF.push(module, '3d98dvZEQFMl5rW429g9OAI', 'cmp.act.training7.gift');
// Scripts/mod/acts/training7/cmp.act.training7.gift.js
"use strict";
var ItemBase = require("cmp.item.base");
var Act7Mod = require("act.training7.mod");
cc.Class({
"extends": ItemBase,
properties: {
dayNd: {
"default": null,
type: cc.Node
},
tipNd: {
"default": null,
type: cc.Node
},
goalBtn: {
"default": null,
type: cc.Node
}
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start: function start() {},
setGoal: function setGoal(goal_data) {
this.goal_data = goal_data;
},
freshAll: function freshAll() {
this._super();
//设置天数
var index = this.goal_data.id % 100;
this.today = index;
nx.gui.setString(this.dayNd, "num", cc.js.formatStr(nx.text.getKey("action_str16"), index));
var last_score = Act7Mod.getInstance().getLastScore();
if (last_score >= this.goal_data.goal) {
nx.gui.setActive(this.goalBtn, "", true);
nx.gui.setActive(this.tipNd, "", true);
}
var finish_list = Act7Mod.getInstance().getSevenGoalBoxList();
if (finish_list) {
for (var i in finish_list) {
if (finish_list[i].goal_id == this.goal_data.id) {
nx.gui.setActive(this.nodFocus.node, "", finish_list[i].status == 2);
if (finish_list[i].status == 2) {
nx.gui.setActive(this.tipNd, "", false);
}
}
}
}
},
onTouchGoal: function onTouchGoal() {
var _this = this;
if (nx.dt.objEmpty(this.goal_data)) return;
var item_cfg = gitemdata(this.goal_data.award[0][0]);
var str = cc.js.formatStr(nx.text.getKey("lab_taskHuoyue"), item_cfg.name, this.goal_data.award[0][1]);
nx.mbox(str, ["cancel", "confirm"], function (_key, _box) {
_box.close();
if (_key == "confirm") {
Act7Mod.getInstance().sender13602(5, _this.today, _this.goal_data.id, 0);
}
});
} // update (dt) {},
});
cc._RF.pop();