85 lines
2.2 KiB
JavaScript
85 lines
2.2 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '97656KPunhMfJbM+O2/MrG5', 'cmp.act.startravel.item.task');
|
||
|
|
// Scripts/mod/acts/startravel/cmp/cmp.act.startravel.item.task.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var ItemBase = require("nx.fx.sv.expand.item");
|
||
|
|
var ItemLay = require("cmp.common.itemlayout");
|
||
|
|
var WndStartravel = require("cmp.act.startravel");
|
||
|
|
cc.Class({
|
||
|
|
"extends": ItemBase,
|
||
|
|
properties: {
|
||
|
|
lay: {
|
||
|
|
"default": null,
|
||
|
|
type: ItemLay
|
||
|
|
},
|
||
|
|
desc: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
bar: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.ProgressBar
|
||
|
|
},
|
||
|
|
barNum: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
"goto": {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
get: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
done: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
wndCmp: {
|
||
|
|
"default": null,
|
||
|
|
type: WndStartravel
|
||
|
|
}
|
||
|
|
},
|
||
|
|
rebind: function rebind(_index, _data, _key) {
|
||
|
|
this._super(_index, _data, _key);
|
||
|
|
this.setData(_data);
|
||
|
|
},
|
||
|
|
setData: function setData(data) {
|
||
|
|
if (nx.dt.objEmpty(data)) {
|
||
|
|
this.lay.rebuild([]);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
var cfg = null;
|
||
|
|
if (data.type == 7) {
|
||
|
|
//日任務
|
||
|
|
cfg = game.configs.holiday_new_war_order_data.data_day_task_list[this.wndCmp.mod.getCurPeriod()];
|
||
|
|
} else {
|
||
|
|
//周任務
|
||
|
|
cfg = game.configs.holiday_new_war_order_data.data_week_task_list[this.wndCmp.mod.getCurPeriod()];
|
||
|
|
}
|
||
|
|
this.task_data = cfg[data.id];
|
||
|
|
nx.gui.setString(this.desc, "", this.task_data.desc);
|
||
|
|
nx.gui.setString(this.barNum, "", cc.js.formatStr("%s/%s", data.value, data.target_val));
|
||
|
|
this.bar.progress = data.value / data.target_val;
|
||
|
|
this.lay.rebuild(this.task_data.award);
|
||
|
|
nx.gui.setActive(this["goto"], "", data.finish == 0);
|
||
|
|
nx.gui.setActive(this.get, "", data.finish == 1);
|
||
|
|
nx.gui.setActive(this.done, "", data.finish == 2);
|
||
|
|
},
|
||
|
|
onDisable: function onDisable() {},
|
||
|
|
onClickJump: function onClickJump() {
|
||
|
|
if (this.task_data.jump_id) {
|
||
|
|
nx.bridge.jumper.jump2Window(this.task_data.jump_id);
|
||
|
|
nx.bridge.closePanel("WndActStarTravel");
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onClickAward: function onClickAward() {
|
||
|
|
if (!this.mdata) return;
|
||
|
|
this.wndCmp.mod.reqTask(this.mdata.id);
|
||
|
|
} // update (dt) {},
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|