"use strict";
|
cc._RF.push(module, '56374yq0MVOq5n5TehZh9Lc', 'task_vo');
|
// Scripts/mod/task/task_vo.js
|
|
"use strict";
|
|
/*-----------------------------------------------------+
|
* 任务的真实数据
|
* @author zys
|
+-----------------------------------------------------*/
|
var TaskConst = require("task_const");
|
|
var TaskEvent = require("task_event");
|
|
var TaskVo = cc.Class({
|
"extends": gcore.BaseEvent,
|
ctor: function ctor() {
|
this.id = arguments[0];
|
this.type = arguments[1] || TaskConst.type.quest;
|
|
if (this.type == TaskConst.type.quest) {
|
this.config = gdata("quest_data", "data_get", [this.id]);
|
} else if (this.type == TaskConst.type.feat) {
|
this.config = gdata("feat_data", "data_get", [this.id]);
|
} else if (this.type == TaskConst.type.action) {}
|
|
this.finish = TaskConst.task_status.un_finish;
|
this.finish_sort = 0;
|
},
|
_delete: function _delete() {},
|
//根据任务完成状态获取任务的描述
|
getTaskContent: function getTaskContent() {
|
return this.config.desc; // return splitDataStr(this.config.desc);
|
},
|
//获取任务的名
|
getTaskName: function getTaskName() {
|
if (this.config) return this.config.name || "";else return "";
|
},
|
//设置这个任务是否处于完成提交状态
|
setCompletedStatus: function setCompletedStatus(status) {
|
this.finish = status;
|
this.setFinishSort();
|
this.dispatchUpdate();
|
},
|
//更新任务数据
|
updateData: function updateData(data) {
|
this.finish = data.finish;
|
this.progress = data.progress;
|
this.setFinishSort();
|
this.dispatchUpdate();
|
},
|
dispatchUpdate: function dispatchUpdate() {
|
this.fire(TaskEvent.UpdateSingleQuest, this.id);
|
},
|
setFinishSort: function setFinishSort() {
|
if (this.finish == TaskConst.task_status.un_finish) {
|
this.finish_sort = 1;
|
} else if (this.finish == TaskConst.task_status.finish) {
|
this.finish_sort = 0;
|
} else if (this.finish == TaskConst.task_status.completed) {
|
this.finish_sort = 2;
|
} else {
|
this.finish_sort = 3;
|
}
|
}
|
});
|
module.exports = TaskVo;
|
|
cc._RF.pop();
|