81 lines
2.3 KiB
JavaScript
81 lines
2.3 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'd08daF4gnhNIr637Bl6EAlq', 'act.growthrush.mod');
|
|
// Scripts/mod/acts/growthrush/act.growthrush.mod.js
|
|
|
|
"use strict";
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* 活动: 開服冲級
|
|
*
|
|
******************************************************************************/
|
|
|
|
var ActBase = require("act.base");
|
|
var GrowthRush = cc.Class({
|
|
"extends": ActBase,
|
|
// 初始化配置数据
|
|
initConfig: function initConfig() {
|
|
// 视图附着
|
|
nx.plugin.add(this, ["view"]);
|
|
this.vattach("Acts");
|
|
},
|
|
// 注册协议接受事件
|
|
registerProtocals: function registerProtocals() {
|
|
this.RegisterProtocal(21200, this.growthRushDataBack.bind(this)); // 升级/冲级礼包状态
|
|
this.RegisterProtocal(21201, this.getGiftBack.bind(this)); // 請求子活動相關,來取相關的顯示數據
|
|
},
|
|
|
|
// 从服务器初始化数据
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var cfgs = [this.data.config //付費活動
|
|
];
|
|
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
// this.reqBaseData( _cb );
|
|
nx.dt.fnInvoke(_cb, true);
|
|
});
|
|
},
|
|
// 请求活动信息
|
|
reqBaseData: function reqBaseData(_cb) {
|
|
this.reqGrowthRushData(_cb);
|
|
},
|
|
// ============================================================
|
|
// 升级有礼
|
|
// ============================================================
|
|
|
|
// 请求升/冲级有礼相关
|
|
reqGrowthRushData: function reqGrowthRushData(_cb) {
|
|
var protocal = {};
|
|
this.SendProtocal(21200, protocal);
|
|
},
|
|
// 请求相關配置信息
|
|
growthRushDataBack: function growthRushDataBack(_data) {
|
|
var get = 0;
|
|
var cfg = gdata(this.data.config, "data_level_welfare");
|
|
_data.gifts.forEach(function (_aim) {
|
|
if (_aim.status == 1 && cfg[_aim.id].num != _aim.num) {
|
|
get++;
|
|
}
|
|
_aim.sortid = _aim.status == 1 ? _aim.status - 1 : _aim.status + 1;
|
|
});
|
|
this.vset("growthrush", _data);
|
|
this.openTip("reward", get != 0);
|
|
},
|
|
reqGetGift: function reqGetGift(_id) {
|
|
var protocal = {};
|
|
protocal.id = _id;
|
|
this.SendProtocal(21201, protocal);
|
|
},
|
|
// 请求相關配置信息
|
|
getGiftBack: function getGiftBack(_data) {
|
|
var msg = _data.msg;
|
|
if (!nx.dt.strEmpty(msg)) {
|
|
nx.tbox(msg);
|
|
}
|
|
}
|
|
});
|
|
|
|
// 模块导出
|
|
module.exports = GrowthRush;
|
|
|
|
cc._RF.pop(); |