114 lines
3.5 KiB
JavaScript
114 lines
3.5 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'c302cLBkzFAWKgs9T/D3aEI', 'act.sevencustom.mod');
|
|
// Scripts/mod/acts/sevencustomization/act.sevencustom.mod.js
|
|
|
|
"use strict";
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* 活动: 七日定制相关
|
|
*
|
|
*
|
|
******************************************************************************/
|
|
|
|
var ActBase = require("act.base");
|
|
var ActSevenCustom = cc.Class({
|
|
"extends": ActBase,
|
|
// 初始化配置数据
|
|
initConfig: function initConfig() {
|
|
// 视图附着
|
|
nx.plugin.add(this, ["view"]);
|
|
this.vattach("Acts");
|
|
},
|
|
// 注册协议接受事件
|
|
registerProtocals: function registerProtocals() {
|
|
this.RegisterProtocal(29900, this.getSevenCustomData.bind(this)); // 請求子活動相關,來取相關的顯示數據
|
|
this.RegisterProtocal(29901, this.setSevenCustomBack.bind(this)); // 請求領取子活動獎勵相關,來取相關的顯示數據
|
|
this.RegisterProtocal(29902, this.setSevenCustomSureBack.bind(this)); // 請求領取子活動獎勵相關,來取相關的顯示數據
|
|
},
|
|
|
|
// 从服务器初始化数据
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var _this = this;
|
|
var cfgs = [this.data.config //付費活動
|
|
];
|
|
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
_this.reqBaseData(_cb);
|
|
});
|
|
},
|
|
// 请求活动信息
|
|
reqBaseData: function reqBaseData(_cb) {
|
|
this.reqOptionalGiftData(_cb);
|
|
},
|
|
// ============================================================
|
|
// 自選陣容
|
|
// ============================================================
|
|
|
|
// 请求 自選陣容信息
|
|
reqOptionalGiftData: function reqOptionalGiftData(_cb) {
|
|
this.SendProtocal(29900, {}, _cb);
|
|
},
|
|
// 请求保存相關 禮包配置
|
|
reqSetGift: function reqSetGift(_cate, _reward, _day, _status) {
|
|
this.SendProtocal(29901, {
|
|
cate: _cate,
|
|
reward: _reward,
|
|
day: _day,
|
|
status: _status
|
|
});
|
|
},
|
|
// 请求領取 自選陣容 夥伴--- camp_id
|
|
reqMakeSureGift: function reqMakeSureGift(_cate, _day) {
|
|
this.SendProtocal(29902, {
|
|
cate: _cate,
|
|
day: _day
|
|
});
|
|
},
|
|
// 七日定制 返回
|
|
getSevenCustomData: function getSevenCustomData(_data) {
|
|
this.vset("sevenCustom", _data);
|
|
var count = 0;
|
|
var day = _data.day;
|
|
var list = _data.data_list;
|
|
list.forEach(function (_item) {
|
|
if (_item.cate == 1) {
|
|
if (!_item.reward_list[day - 1]) {
|
|
count++;
|
|
}
|
|
}
|
|
});
|
|
this.openTip("reward", count > 0);
|
|
/**
|
|
* {"day":2,"data_list":[
|
|
* {"cate":1,"is_activate":1,"reward_list":[{"day":1,"status":3,"item_list":[]},{"day":2,"status":2,"item_list":[{"item_id":11403,"num":1}]}]},
|
|
* {"cate":2,"is_activate":1,"reward_list":[{"day":1,"status":1,"item_list":[{"item_id":11403,"num":5},{"item_id":22,"num":500000}]}]},
|
|
* {"cate":3,"is_activate":0,"reward_list":[]},
|
|
* {"cate":4,"is_activate":0,"reward_list":[]}]}
|
|
*/
|
|
},
|
|
|
|
// 请求 保存设置相關礼包数据 返回
|
|
setSevenCustomBack: function setSevenCustomBack(_data) {
|
|
if (_data.code == 1) {
|
|
nx.bridge.closePanel("WndActSevenCustomSelect");
|
|
}
|
|
if (nx.dt.strNEmpty(_data.msg)) {
|
|
nx.tbox(_data.msg);
|
|
}
|
|
},
|
|
// 请求 确认设置相關礼包数据 返回
|
|
setSevenCustomSureBack: function setSevenCustomSureBack(_data) {
|
|
if (_data.code == 1) {
|
|
nx.bridge.closePanel("WndActSevenCustomSelect");
|
|
}
|
|
if (nx.dt.strNEmpty(_data.msg)) {
|
|
nx.tbox(_data.msg);
|
|
}
|
|
}
|
|
});
|
|
|
|
// 模块导出
|
|
module.exports = ActSevenCustom;
|
|
|
|
cc._RF.pop(); |