246 lines
6.9 KiB
JavaScript
246 lines
6.9 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '06738Wbf31KpY+5mWRT9BuH', 'pray.mod');
|
|
// Scripts/mod/pray/pray.mod.js
|
|
|
|
"use strict";
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* 活动: 月签到
|
|
*
|
|
*
|
|
******************************************************************************/
|
|
|
|
var BridgeController = require("bridge.controller");
|
|
var MainUiController = require("mainui_controller");
|
|
var HeavenEvent = require("heaven_event");
|
|
var Pray = cc.Class({
|
|
"extends": BridgeController,
|
|
// 初始化配置数据
|
|
initConfig: function initConfig() {
|
|
this.showLst = [{
|
|
"type": 23,
|
|
"lst": []
|
|
}, {
|
|
"type": 24,
|
|
"lst": []
|
|
}, {
|
|
"type": 25,
|
|
"lst": []
|
|
}, {
|
|
"type": 26,
|
|
"lst": []
|
|
}];
|
|
this.score = 0;
|
|
},
|
|
// 注册协议接受事件
|
|
registerProtocals: function registerProtocals() {
|
|
this.RegisterProtocal(25217, this.handle25217.bind(this)); // 神装抽奖返回
|
|
this.RegisterProtocal(25218, this.handle25218.bind(this)); // 神装抽奖记录
|
|
this.RegisterProtocal(25219, this.handle25219.bind(this)); // 神装相关数据
|
|
this.RegisterProtocal(25230, this.handle25230.bind(this)); // 设置神装抽奖许愿(成功推送25219)
|
|
this.RegisterProtocal(25231, this.handle25231.bind(this)); // 领取保底礼包(成功推送25219)
|
|
this.RegisterProtocal(25232, this.handle25232.bind(this)); // 战力前五神装总评分
|
|
this.RegisterProtocal(25233, this.handle25233.bind(this)); // 請求升級神像等級
|
|
this.RegisterProtocal(25234, this.handle25234.bind(this)); // 自動售出選項
|
|
},
|
|
|
|
// 从服务器初始化数据
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var _this = this;
|
|
// 配置加载
|
|
var cfgs = ["holy_eqm_lottery_data" // 未知,找不到文件
|
|
];
|
|
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
_this.reqPrayData(_cb);
|
|
});
|
|
},
|
|
reqPrayData: function reqPrayData(_cb) {
|
|
this.SendProtocal(25219, {}, _cb);
|
|
this.sender25232();
|
|
var cfgs = game.configs.holy_eqm_lottery_data.data_wish_show;
|
|
for (var i in cfgs) {
|
|
var data = cfgs[i];
|
|
switch (data.type) {
|
|
case this.showLst[0].type:
|
|
{
|
|
this.showLst[0].lst.push(data);
|
|
}
|
|
;
|
|
break;
|
|
case this.showLst[1].type:
|
|
{
|
|
this.showLst[1].lst.push(data);
|
|
}
|
|
;
|
|
break;
|
|
case this.showLst[2].type:
|
|
{
|
|
this.showLst[2].lst.push(data);
|
|
}
|
|
;
|
|
break;
|
|
case this.showLst[3].type:
|
|
{
|
|
this.showLst[3].lst.push(data);
|
|
}
|
|
;
|
|
break;
|
|
}
|
|
}
|
|
|
|
// console.log( "許願列表" + JSON.stringify( this.showLst ) );
|
|
},
|
|
|
|
getShow: function getShow() {
|
|
return this.showLst;
|
|
},
|
|
// 请求神装抽奖
|
|
sender25217: function sender25217(group_id, times, recruit_type) {
|
|
var protocal = {};
|
|
protocal.group_id = group_id;
|
|
protocal.times = times;
|
|
protocal.recruit_type = recruit_type;
|
|
this.SendProtocal(25217, protocal);
|
|
},
|
|
// 请求抽奖日志
|
|
sender25218: function sender25218(type, group_id) {
|
|
var protocal = {};
|
|
protocal.type = type;
|
|
protocal.group_id = group_id;
|
|
this.SendProtocal(25218, protocal);
|
|
},
|
|
// 神装抽奖
|
|
handle25217: function handle25217(data) {
|
|
if (data) {
|
|
var items = [];
|
|
for (var i in data.rewards || {}) {
|
|
var v = data.rewards[i];
|
|
items[i] = {};
|
|
items[i].bid = v.base_id;
|
|
items[i].num = v.num;
|
|
items[i].id = v.id;
|
|
}
|
|
MainUiController.getInstance().openGetItemView(true, items, {
|
|
op: "pray",
|
|
options: this.getOptions()
|
|
});
|
|
}
|
|
},
|
|
// 神装抽奖记录
|
|
handle25218: function handle25218(data) {
|
|
if (data) {
|
|
// if( data.type == 1 ) {
|
|
// // 个人
|
|
// this.model.setMyselfDialRecordData( data.log_list )
|
|
// } else if( data.type == 2 ) {
|
|
// // 全服
|
|
// this.model.setAllDialRecordData( data.log_list, data.group_id )
|
|
// }
|
|
// gcore.GlobalEvent.fire(
|
|
// HeavenEvent.Update_Dial_Record_Data,
|
|
// data.type,
|
|
// data.group_id
|
|
// )
|
|
}
|
|
},
|
|
// 神装相关数据
|
|
handle25219: function handle25219(data) {
|
|
if (data) {
|
|
nx.bridge.vset("HolyPray", data.recruit_list);
|
|
var dataNew = {};
|
|
data.recruit_list.forEach(function (_data) {
|
|
if (_data.is_open == 1) {
|
|
dataNew = _data;
|
|
}
|
|
});
|
|
nx.mTip.openTip("heaven.pray.free", dataNew.free_times == 1);
|
|
// this.model.setHeavenDailData( data.recruit_list )
|
|
gcore.GlobalEvent.fire(HeavenEvent.Update_Dial_Base_Data, dataNew);
|
|
}
|
|
},
|
|
// 请求设置神装抽奖许愿(成功推送25219)
|
|
sender25230: function sender25230(group_id, lucky_holy_eqm) {
|
|
var protocal = {};
|
|
protocal.group_id = group_id;
|
|
protocal.lucky_holy_eqm = lucky_holy_eqm;
|
|
this.SendProtocal(25230, protocal);
|
|
},
|
|
// 设置神装抽奖许愿(成功推送25219)
|
|
handle25230: function handle25230(data) {
|
|
if (data) {
|
|
if (data.flag == 1) {
|
|
nx.bridge.closePanel("WndHolyPrayWish");
|
|
}
|
|
// message(data.msg)
|
|
}
|
|
},
|
|
|
|
// 请求领取保底礼包(成功推送25219)
|
|
sender25231: function sender25231(group_id, id) {
|
|
var protocal = {};
|
|
protocal.group_id = group_id;
|
|
protocal.id = id;
|
|
this.SendProtocal(25231, protocal);
|
|
},
|
|
// 领取保底礼包(成功推送25219)
|
|
handle25231: function handle25231(data) {
|
|
if (data) {
|
|
// message(data.msg)
|
|
}
|
|
},
|
|
// 请求战力前五神装总评分
|
|
sender25232: function sender25232() {
|
|
var protocal = {};
|
|
this.SendProtocal(25232, protocal);
|
|
},
|
|
// 战力前五神装总评分
|
|
handle25232: function handle25232(data) {
|
|
if (data) {
|
|
this.score = data.score;
|
|
}
|
|
},
|
|
// 請求升級神像等級
|
|
sender25233: function sender25233(group_id) {
|
|
var protocal = {};
|
|
protocal.group_id = group_id;
|
|
this.SendProtocal(25233, protocal);
|
|
},
|
|
// 請求升級神像等級
|
|
handle25233: function handle25233(data) {
|
|
// if( data ) {
|
|
// this.model.setAllScore( data.score )
|
|
// }
|
|
},
|
|
// 请求存儲選項
|
|
sender25234: function sender25234(groups) {
|
|
var protocal = {};
|
|
protocal.options = groups;
|
|
this.SendProtocal(25234, protocal);
|
|
},
|
|
// 请求存儲選項
|
|
handle25234: function handle25234(data) {
|
|
this.options = data.options;
|
|
nx.bridge.closePanel("WndHolyEqmAutoSell");
|
|
// if( data ) {
|
|
// this.model.setAllScore( data.score )
|
|
// }
|
|
},
|
|
|
|
getChoices: function getChoices() {
|
|
var choice = ["1 Star", "2 Star", "3 Star", "4 Star", "5 Star", "Normal", "Good", "Best"];
|
|
return choice;
|
|
},
|
|
getOptions: function getOptions() {
|
|
return this.options || [];
|
|
},
|
|
getScore: function getScore() {
|
|
return this.score;
|
|
}
|
|
});
|
|
|
|
// 模块导出
|
|
module.exports = Pray;
|
|
|
|
cc._RF.pop(); |