60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '3350eglr0VJt6FhVyqSRDAj', 'heaven_chapter_vo');
|
||
|
|
// Scripts/mod/pve/heaven/heaven_chapter_vo.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
// var HeroController = require("hero_controller");
|
||
|
|
var BridgeClass = require("bridge.class");
|
||
|
|
var HeavenEvent = require('heaven_event');
|
||
|
|
var HeavenChapterVo = cc.Class({
|
||
|
|
"extends": BridgeClass,
|
||
|
|
ctor: function ctor() {},
|
||
|
|
__init: function __init() {
|
||
|
|
this.id = 0; // 章节id
|
||
|
|
this.all_star = 0; // 总星数
|
||
|
|
this.award_info = {}; // 星数奖励数据
|
||
|
|
this.is_finish = HeavenConst.Chapter_Pass_Status.NotPass; // 通关状态
|
||
|
|
|
||
|
|
this.red_status = false; // 章节奖励红点
|
||
|
|
},
|
||
|
|
|
||
|
|
updateData: function updateData(data) {
|
||
|
|
for (var key in data) {
|
||
|
|
var value = data[key];
|
||
|
|
this[key] = value;
|
||
|
|
}
|
||
|
|
this.checkChapterRedStatus();
|
||
|
|
this.dispatchUpdateAttrByKey();
|
||
|
|
},
|
||
|
|
dispatchUpdateAttrByKey: function dispatchUpdateAttrByKey() {
|
||
|
|
gcore.GlobalEvent.fire(HeavenEvent.Update_Chapter_Vo_Event, this.id);
|
||
|
|
},
|
||
|
|
checkChapterRedStatus: function checkChapterRedStatus() {
|
||
|
|
this.red_status = false;
|
||
|
|
for (var k in this.award_info) {
|
||
|
|
var v = this.award_info[k];
|
||
|
|
if (v.flag == 1) {
|
||
|
|
this.red_status = true;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
//章节奖励红点状态
|
||
|
|
getRedStatus: function getRedStatus() {
|
||
|
|
return this.red_status;
|
||
|
|
},
|
||
|
|
__delete: function __delete() {}
|
||
|
|
});
|
||
|
|
|
||
|
|
// // 实例化单利
|
||
|
|
// HeavenChapterVo.getInstance = function () {
|
||
|
|
// if (!this.instance) {
|
||
|
|
// this.instance = new this();
|
||
|
|
// }
|
||
|
|
// return this.instance;
|
||
|
|
// }
|
||
|
|
|
||
|
|
// module.exports = HeavenChapterVo;
|
||
|
|
|
||
|
|
cc._RF.pop();
|