99 lines
3.0 KiB
JavaScript
99 lines
3.0 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '452f8g0aKdDgKeucad+B+tX', 'act.optionalparty.mod');
|
||
|
|
// Scripts/mod/acts/optionalparty/act.optionalparty.mod.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/*******************************************************************************
|
||
|
|
*
|
||
|
|
* 活动: 自選陣容
|
||
|
|
*
|
||
|
|
*
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
var ActBase = require("act.base");
|
||
|
|
var FID = require("bridge.function.ids");
|
||
|
|
var ActOptionalParty = cc.Class({
|
||
|
|
"extends": ActBase,
|
||
|
|
// 初始化配置数据
|
||
|
|
initConfig: function initConfig() {
|
||
|
|
// 视图附着
|
||
|
|
nx.plugin.add(this, ["view"]);
|
||
|
|
this.vattach("Acts");
|
||
|
|
},
|
||
|
|
// 注册协议接受事件
|
||
|
|
registerProtocals: function registerProtocals() {
|
||
|
|
this.RegisterProtocal(16614, this.getOptionalPartyData.bind(this)); // 請求子活動相關,來取相關的顯示數據
|
||
|
|
this.RegisterProtocal(16615, this.handle16604.bind(this)); // 請求領取子活動獎勵相關,來取相關的顯示數據
|
||
|
|
this.RegisterProtocal(21003, this.handle21003.bind(this)); // 21003 isopen = 2 彈出對應的限時特惠禮包
|
||
|
|
},
|
||
|
|
|
||
|
|
// 从服务器初始化数据
|
||
|
|
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.reqOptionalPartyData(_cb);
|
||
|
|
},
|
||
|
|
// ============================================================
|
||
|
|
// 自選陣容
|
||
|
|
// ============================================================
|
||
|
|
|
||
|
|
// 请求 自選陣容信息
|
||
|
|
reqOptionalPartyData: function reqOptionalPartyData(_cb) {
|
||
|
|
this.SendProtocal(16614, {}, _cb);
|
||
|
|
},
|
||
|
|
// 请求設置 自選陣容 夥伴--- camp_id
|
||
|
|
reqSetOptionalParty: function reqSetOptionalParty(_camp, _partner_id, _cb) {
|
||
|
|
this.SendProtocal(16615, {
|
||
|
|
partner_ids: [{
|
||
|
|
id: _camp,
|
||
|
|
partner_id: _partner_id
|
||
|
|
}]
|
||
|
|
}, _cb);
|
||
|
|
},
|
||
|
|
// 请求領取 自選陣容 夥伴--- camp_id
|
||
|
|
reqGetOptionalPartyAward: function reqGetOptionalPartyAward(_camp) {
|
||
|
|
this.SendProtocal(16616, {
|
||
|
|
id: _camp
|
||
|
|
});
|
||
|
|
},
|
||
|
|
// 陣容信息 返回
|
||
|
|
getOptionalPartyData: function getOptionalPartyData(_data) {
|
||
|
|
this.vset("optionalparty", _data);
|
||
|
|
var num = 0;
|
||
|
|
_data.partner_ids.forEach(function (_partner) {
|
||
|
|
if (_partner.status == 1) {
|
||
|
|
num++;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
this.openTip("reward", num > 0 || _data.remain_sec > 0 && nx.dt.arrEmpty(_data.partner_ids));
|
||
|
|
},
|
||
|
|
// 请求相關配置信息
|
||
|
|
handle16604: function handle16604(_data) {},
|
||
|
|
handle21003: function handle21003(_data) {
|
||
|
|
if (!_data || nx.dt.objEmpty(_data) || !nx.bridge.acts) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if (_data.is_open == 3) {
|
||
|
|
var actinfo = nx.bridge.acts.queryAct(this.data.camp_id);
|
||
|
|
if (nx.dt.objEmpty(actinfo)) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
nx.bridge.vset("DailyLimit", _data.is_open);
|
||
|
|
// nx.bridge.createPanel( "WndActMySteryShop" );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
// 模块导出
|
||
|
|
module.exports = ActOptionalParty;
|
||
|
|
|
||
|
|
cc._RF.pop();
|