121 lines
3.3 KiB
JavaScript
121 lines
3.3 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '25364A2ympEBLwNiSUNP0Dn', 'act.heronewchal.mod');
|
||
|
|
// Scripts/mod/acts/heroNewChallenge/act.heronewchal.mod.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/*******************************************************************************
|
||
|
|
*
|
||
|
|
* 活动: 星之試煉
|
||
|
|
*
|
||
|
|
*
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
var ActBase = require("act.base");
|
||
|
|
var HeroNewChalMod = cc.Class({
|
||
|
|
"extends": ActBase,
|
||
|
|
// 初始化配置数据
|
||
|
|
initConfig: function initConfig() {
|
||
|
|
// 视图附着
|
||
|
|
nx.plugin.add(this, ["view"]);
|
||
|
|
this.vattach("Acts");
|
||
|
|
},
|
||
|
|
// 注册协议接受事件
|
||
|
|
registerProtocals: function registerProtocals() {
|
||
|
|
this.RegisterProtocal(31000, this.handle31000.bind(this)); //挑戰基本信息
|
||
|
|
this.RegisterProtocal(31001, this.handle31001.bind(this)); //開始挑戰
|
||
|
|
this.RegisterProtocal(31002, this.handle31002.bind(this)); //領獎
|
||
|
|
},
|
||
|
|
|
||
|
|
// 从服务器初始化数据
|
||
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
||
|
|
var cfgs = ["fake_battle_data"];
|
||
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
||
|
|
nx.dt.fnInvoke(_cb, true);
|
||
|
|
});
|
||
|
|
},
|
||
|
|
//任務完成情況
|
||
|
|
send31000: function send31000(camp_id, _cb) {
|
||
|
|
this.SendProtocal(31000, {
|
||
|
|
camp_id: camp_id
|
||
|
|
}, _cb);
|
||
|
|
},
|
||
|
|
handle31000: function handle31000(_data) {
|
||
|
|
if (!this.isGoodData(_data)) {
|
||
|
|
this.vset("EncounterData", {});
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
this.setCampId(_data.camp_id);
|
||
|
|
this.setNextDay(_data.next_day);
|
||
|
|
this.vset("EncounterData", _data);
|
||
|
|
// 提示刷新
|
||
|
|
// this.freshTips( _data );
|
||
|
|
},
|
||
|
|
//挑戰
|
||
|
|
send31001: function send31001(params, _cb) {
|
||
|
|
this.SendProtocal(31001, {
|
||
|
|
camp_id: this.camp_id,
|
||
|
|
id: params.id,
|
||
|
|
formation_type: params.formation_type,
|
||
|
|
pos_info: params.pos_info,
|
||
|
|
hallows_id: params.hallows_id
|
||
|
|
}, _cb);
|
||
|
|
},
|
||
|
|
handle31001: function handle31001(_data) {
|
||
|
|
if (!this.isGoodData(_data)) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
//领取
|
||
|
|
send31002: function send31002(id, _cb) {
|
||
|
|
this.SendProtocal(31002, {
|
||
|
|
camp_id: this.camp_id,
|
||
|
|
id: id
|
||
|
|
}, _cb);
|
||
|
|
},
|
||
|
|
handle31002: function handle31002(_data) {
|
||
|
|
// nx.bridge.acts.reqActsRewards();
|
||
|
|
if (!this.isGoodData(_data)) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setNextDay: function setNextDay(day) {
|
||
|
|
this.next_day = day;
|
||
|
|
},
|
||
|
|
getNextDay: function getNextDay() {
|
||
|
|
return this.next_day || 0;
|
||
|
|
},
|
||
|
|
setCurDay: function setCurDay(id) {
|
||
|
|
this.cur_id = id;
|
||
|
|
},
|
||
|
|
getCurDay: function getCurDay() {
|
||
|
|
return this.cur_id || 1;
|
||
|
|
},
|
||
|
|
setCampId: function setCampId(camp_id) {
|
||
|
|
this.camp_id = camp_id;
|
||
|
|
},
|
||
|
|
getCampId: function getCampId() {
|
||
|
|
return this.camp_id;
|
||
|
|
} // ============================================================
|
||
|
|
// 活动红点提示
|
||
|
|
// ============================================================
|
||
|
|
// // 红点提示更新
|
||
|
|
// freshTips: function() {
|
||
|
|
// let can = false;
|
||
|
|
// let list = this.vget( "sign15" ) || [];
|
||
|
|
// for( let i = 0; i < list.length; ++i ) {
|
||
|
|
// // 0不可领取 1可领取 2已领取
|
||
|
|
// let task = list[i];
|
||
|
|
// if( task && task.status == 1 ) {
|
||
|
|
// can = true;
|
||
|
|
// break;
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// this.openTip( "reward", can );
|
||
|
|
// },
|
||
|
|
});
|
||
|
|
|
||
|
|
// 模块导出
|
||
|
|
module.exports = HeroNewChalMod;
|
||
|
|
|
||
|
|
cc._RF.pop();
|