82 lines
2.3 KiB
JavaScript
82 lines
2.3 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'fa34bdDR/NGAqF6DfsLH6Zt', 'act.hundreddraw.mod');
|
|
// Scripts/mod/acts/hundreddraw/act.hundreddraw.mod.js
|
|
|
|
"use strict";
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* 活动: 開服百抽
|
|
*
|
|
*
|
|
******************************************************************************/
|
|
|
|
var ActBase = require("act.base");
|
|
var FID = require("bridge.function.ids");
|
|
var ActHundredDraw = cc.Class({
|
|
"extends": ActBase,
|
|
// 初始化配置数据
|
|
initConfig: function initConfig() {
|
|
// 视图附着
|
|
nx.plugin.add(this, ["view"]);
|
|
this.vattach("Acts");
|
|
},
|
|
// 注册协议接受事件
|
|
registerProtocals: function registerProtocals() {
|
|
this.RegisterProtocal(21110, this.getBaseInfo.bind(this)); // 百抽活動信息
|
|
this.RegisterProtocal(21111, this.getRewardBack.bind(this)); // 領取對應天數的首充禮包
|
|
},
|
|
|
|
// 从服务器初始化数据
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var _this = this;
|
|
var cfgs = [this.data.config //付費活動
|
|
];
|
|
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
_this.reqBaseData(_cb);
|
|
// nx.dt.fnInvoke( _cb, true );
|
|
});
|
|
},
|
|
|
|
// ============================================================
|
|
// 百抽操作 以及相關紅點處理
|
|
// ============================================================
|
|
|
|
// 请求百抽相關 基本數據
|
|
reqBaseData: function reqBaseData(_cb) {
|
|
this.SendProtocal(21110, {}, _cb);
|
|
},
|
|
// 请求首充信息返回
|
|
getBaseInfo: function getBaseInfo(_data) {
|
|
var list = _data.status_list;
|
|
var count = 0;
|
|
if (nx.dt.arrNEmpty(list)) {
|
|
list.sort(function (a, b) {
|
|
return a.day - b.day;
|
|
});
|
|
list.forEach(function (_item) {
|
|
if (_item.status2 == 1 || _item.status1 == 1) {
|
|
count++;
|
|
}
|
|
});
|
|
}
|
|
this.vset("HundredDraw", _data);
|
|
this.openTip("reward", count > 0);
|
|
},
|
|
// 领取 每日簽到獎勵
|
|
reqGetDailyReward: function reqGetDailyReward(_data, _cb) {
|
|
var data = {
|
|
day: _data.day,
|
|
type: _data.type
|
|
};
|
|
this.SendProtocal(21111, data, _cb);
|
|
},
|
|
// 领取奖励返回
|
|
getRewardBack: function getRewardBack(_data) {}
|
|
});
|
|
|
|
// 模块导出
|
|
module.exports = ActHundredDraw;
|
|
|
|
cc._RF.pop(); |