78 lines
2.0 KiB
JavaScript
78 lines
2.0 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'feb6adI3+9BCKmgtSxrG89A', 'cmp.hallows.item.task');
|
||
|
|
// Scripts/mod/partner/hallows/cmp/cmp.hallows.item.task.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var ItemBase = require("nx.fx.sv.expand.item");
|
||
|
|
var HallowsController = require("hallows_controller");
|
||
|
|
cc.Class({
|
||
|
|
"extends": ItemBase,
|
||
|
|
properties: {
|
||
|
|
base_item: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Prefab
|
||
|
|
},
|
||
|
|
task_desc: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.RichText
|
||
|
|
},
|
||
|
|
complete: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
btn_go: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
btn_get: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// LIFE-CYCLE CALLBACKS:
|
||
|
|
// onLoad () {},
|
||
|
|
start: function start() {},
|
||
|
|
setEmpty: function setEmpty() {
|
||
|
|
this.complete.active = false;
|
||
|
|
this.btn_get.active = false;
|
||
|
|
this.btn_go.active = false;
|
||
|
|
},
|
||
|
|
setData: function setData(data, index, tag) {
|
||
|
|
this.setEmpty();
|
||
|
|
if (nx.dt.objEmpty(data)) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
this.data = data;
|
||
|
|
var task_info = game.configs.hallows_data.data_task[data.id];
|
||
|
|
this.config = task_info;
|
||
|
|
this.task_desc.string = cc.js.formatStr("%s(%s/%s)", task_info.desc, this.data.value || 0, this.data.target_val || 0);
|
||
|
|
if (data.finish == 0) {
|
||
|
|
this.btn_go.active = true;
|
||
|
|
} else if (data.finish == 1) {
|
||
|
|
this.btn_get.active = true;
|
||
|
|
} else if (data.finish == 2) {
|
||
|
|
this.complete.active = true;
|
||
|
|
}
|
||
|
|
var item = cc.instantiate(this.base_item);
|
||
|
|
item.parent = this.node;
|
||
|
|
item.position = cc.v2(-193, 0);
|
||
|
|
item.scale = 0.6;
|
||
|
|
var cmp = item.getComponent("cmp.item.base");
|
||
|
|
cmp.rebind(0, {
|
||
|
|
bid: task_info.items[0][0],
|
||
|
|
num: task_info.items[0][1]
|
||
|
|
}, "");
|
||
|
|
},
|
||
|
|
clickGetItem: function clickGetItem() {
|
||
|
|
if (!this.data.id) return;
|
||
|
|
HallowsController.getInstance().requestSubmitHallowsTask(this.data.id);
|
||
|
|
},
|
||
|
|
clickGoTask: function clickGoTask() {
|
||
|
|
if (this.data && this.config) {
|
||
|
|
nx.bridge.jumper.jump2Window(this.config.source_id);
|
||
|
|
}
|
||
|
|
} // update (dt) {},
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|