Files
fc/dev/project/library/imports/a9/a98e74b5-7d47-45ee-aa91-dd137b72577a.js
2026-05-24 10:21:26 +08:00

101 lines
3.1 KiB
JavaScript

"use strict";
cc._RF.push(module, 'a98e7S1fUdF7qqR3RN7cld6', 'act.dispatchact.mod');
// Scripts/mod/acts/dispatchact/act.dispatchact.mod.js
"use strict";
/*******************************************************************************
*
* 活动: 派遣
*
*
******************************************************************************/
var ActBase = require("act.base");
var DisPatchAct = cc.Class({
"extends": ActBase,
// 初始化配置数据
initConfig: function initConfig() {
// 视图附着
nx.plugin.add(this, ["view"]);
this.vattach("Acts");
},
// 注册协议接受事件
registerProtocals: function registerProtocals() {
this.RegisterProtocal(16603, this.handle16603.bind(this)); // 請求子活動相關,來取相關的顯示數據
this.RegisterProtocal(16604, this.handle16604.bind(this)); // 請求領取子活動獎勵相關,來取相關的顯示數據
this.RegisterProtocal(16612, this.handle16612.bind(this)); // 請求領取子活動獎勵相關,來取相關的顯示數據
this.RegisterProtocal(16613, this.handle16613.bind(this)); // 請求領取子活動獎勵相關,來取相關的顯示數據
},
// 从服务器初始化数据
reqBaseFromServer: function reqBaseFromServer(_cb) {
var _this = this;
var cfgs = [this.data.config //付費活動
];
this.loadConfigs(cfgs, function (_ret, _data) {
_this.reqBaseData(_cb);
_this.reqGetActivePoints();
// nx.dt.fnInvoke( _cb, true );
});
},
// 请求活动信息
reqBaseData: function reqBaseData(_cb) {
this.reqDisPatchActData(_cb);
},
// ============================================================
// 派遣
// ============================================================
// 派遣 信息
reqDisPatchActData: function reqDisPatchActData(_cb) {
this.SendProtocal(16603, {
bid: this.data.camp_id
}, _cb);
},
// 请求領取快速作戰獎勵
reqGetTouchCoinGift: function reqGetTouchCoinGift(_aim) {
this.SendProtocal(16604, {
bid: this.data.camp_id,
aim: _aim,
arg: 0
});
},
// 请求相關配置信息
handle16603: function handle16603(_data) {
if (_data.bid == this.data.camp_id) {
_data.aim_list.sort(function (a, b) {
return a.aim - b.aim;
});
_data.aim_list.forEach(function (_aim) {
_aim.sortid = _aim.status == 1 ? _aim.status - 1 : _aim.status + 1;
});
this.vset("dispatchact", _data);
}
},
// 请求相關配置信息
handle16604: function handle16604(_data) {},
// 请求活動 活躍積分
reqGetActivePoints: function reqGetActivePoints() {
this.SendProtocal(16612, {});
},
// 请求活動活躍積分
handle16612: function handle16612(_data) {
this.vset("activepoints", _data);
},
// 请求活動 活躍積分寶箱
reqGetActiveReward: function reqGetActiveReward(_id) {
this.SendProtocal(16613, {
id: _id
});
},
// 请求領取活動活躍 獎勵
handle16613: function handle16613(_data) {}
});
// 模块导出
module.exports = DisPatchAct;
cc._RF.pop();