Files

123 lines
3.4 KiB
JavaScript
Raw Permalink Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '43d5fQ08jhJJr6KVctmm03/', 'act.limitChallenge.mod');
// Scripts/mod/acts/limitChallenge/act.limitChallenge.mod.js
"use strict";
/*******************************************************************************
*
* 活动: 限定挑戰
*
*
******************************************************************************/
var ActBase = require("act.base");
var LimitChallenge = cc.Class({
"extends": ActBase,
// 初始化配置数据
initConfig: function initConfig() {
// 视图附着
nx.plugin.add(this, ["view"]);
this.vattach("Acts");
},
// 注册协议接受事件
registerProtocals: function registerProtocals() {
this.RegisterProtocal(31010, this.handle31010.bind(this)); //限定挑戰基本信息
this.RegisterProtocal(31011, this.handle31011.bind(this)); //開始挑戰
this.RegisterProtocal(31012, this.handle31012.bind(this)); //領獎
this.RegisterProtocal(31013, this.handle31013.bind(this)); //排行榜
this.RegisterProtocal(31014, this.handle31014.bind(this)); //掃蕩
},
// 从服务器初始化数据
reqBaseFromServer: function reqBaseFromServer(_cb) {
var cfgs = ["limit_challenge_data"];
var _data = this.vget("LimitChallengeInfos");
_data[this.data.camp_id] = {};
this.vset("LimitChallengeInfos", _data);
this.loadConfigs(cfgs, function (_ret, _data) {
nx.dt.fnInvoke(_cb, true);
});
},
// ============================================================
// 消息
// ============================================================
// 请求信息
reqLimitData: function reqLimitData(_camp_id, _cb) {
this.SendProtocal(31010, {
camp_id: _camp_id
}, _cb);
},
// 请求相關配置信息
handle31010: function handle31010(_data) {
if (!this.isGoodData(_data)) {
return;
}
var old_data = this.vget("LimitChallengeInfos");
old_data[_data.camp_id] = _data;
this.vset("LimitChallengeInfos", old_data);
this.setCurCamp(_data.camp_id);
},
reqBat: function reqBat(_camp_id, _cb) {
this.SendProtocal(31011, {
camp_id: _camp_id
}, _cb);
},
// 请求相關配置信息
handle31011: function handle31011(_data) {
if (!this.isGoodData(_data)) {
return;
}
},
// 请求獎勵
reqAward: function reqAward(_camp_id, _cb) {
this.SendProtocal(31012, {
camp_id: _camp_id
}, _cb);
},
// 请求相關配置信息
handle31012: function handle31012(_data) {
if (!this.isGoodData(_data)) {
return;
}
},
// 请求排行榜
reqRank: function reqRank(_camp_id, _cb) {
this.SendProtocal(31013, {
camp_id: _camp_id
}, _cb);
},
// 请求相關配置信息
handle31013: function handle31013(_data) {
if (!this.isGoodData(_data)) {
return;
}
this.vset("LimitChallengeRanks", _data);
},
reqBatClear: function reqBatClear(_camp_id, _cb) {
this.SendProtocal(31014, {
camp_id: _camp_id
}, _cb);
},
// 请求相關配置信息
handle31014: function handle31014(_data) {
if (!this.isGoodData(_data)) {
return;
}
if (_data.flag == 1) {
nx.tbox("startower_tip3");
}
},
setCurCamp: function setCurCamp(camp_id) {
this.cur_camp_id = camp_id;
},
getCurCamp: function getCurCamp() {
return this.cur_camp_id;
}
});
// 模块导出
module.exports = LimitChallenge;
cc._RF.pop();