254 lines
7.3 KiB
JavaScript
254 lines
7.3 KiB
JavaScript
|
|
/*******************************************************************************
|
||
|
|
*
|
||
|
|
* 活动: 月签到
|
||
|
|
*
|
||
|
|
*
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
const BridgeController = require( "bridge.controller" );
|
||
|
|
const MainUiController = require( "mainui_controller" );
|
||
|
|
const HeavenEvent = require( "heaven_event" );
|
||
|
|
|
||
|
|
const Pray = cc.Class( {
|
||
|
|
|
||
|
|
extends: BridgeController,
|
||
|
|
|
||
|
|
// 初始化配置数据
|
||
|
|
initConfig: function() {
|
||
|
|
this.showLst = [ {"type": 23, "lst": [] },{"type": 24,
|
||
|
|
"lst": []}, {"type": 25, "lst": [] },{"type": 26, "lst": [] }
|
||
|
|
];
|
||
|
|
this.score = 0;
|
||
|
|
},
|
||
|
|
|
||
|
|
// 注册协议接受事件
|
||
|
|
registerProtocals: function() {
|
||
|
|
|
||
|
|
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( _cb ) {
|
||
|
|
|
||
|
|
// 配置加载
|
||
|
|
let cfgs = [
|
||
|
|
"holy_eqm_lottery_data", // 未知,找不到文件
|
||
|
|
];
|
||
|
|
this.loadConfigs( cfgs, ( _ret, _data ) => {
|
||
|
|
this.reqPrayData( _cb );
|
||
|
|
} );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
reqPrayData( _cb ) {
|
||
|
|
this.SendProtocal( 25219, {}, _cb );
|
||
|
|
this.sender25232();
|
||
|
|
let cfgs = game.configs.holy_eqm_lottery_data.data_wish_show;
|
||
|
|
|
||
|
|
for (let i in cfgs ) {
|
||
|
|
let 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(){
|
||
|
|
|
||
|
|
return this.showLst;
|
||
|
|
},
|
||
|
|
|
||
|
|
// 请求神装抽奖
|
||
|
|
sender25217: function( group_id, times, recruit_type ) {
|
||
|
|
let protocal = {}
|
||
|
|
protocal.group_id = group_id
|
||
|
|
protocal.times = times
|
||
|
|
protocal.recruit_type = recruit_type
|
||
|
|
this.SendProtocal( 25217, protocal )
|
||
|
|
},
|
||
|
|
|
||
|
|
// 请求抽奖日志
|
||
|
|
sender25218: function( type, group_id ) {
|
||
|
|
let protocal = {}
|
||
|
|
protocal.type = type
|
||
|
|
protocal.group_id = group_id
|
||
|
|
this.SendProtocal( 25218, protocal )
|
||
|
|
},
|
||
|
|
|
||
|
|
// 神装抽奖
|
||
|
|
handle25217: function( data ) {
|
||
|
|
if( data ) {
|
||
|
|
let items = [];
|
||
|
|
for( const i in data.rewards || {} ) {
|
||
|
|
const 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( 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( data ) {
|
||
|
|
if( data ) {
|
||
|
|
|
||
|
|
nx.bridge.vset( "HolyPray", data.recruit_list );
|
||
|
|
let dataNew = {};
|
||
|
|
|
||
|
|
data.recruit_list.forEach( _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( group_id, lucky_holy_eqm ) {
|
||
|
|
let protocal = {}
|
||
|
|
protocal.group_id = group_id
|
||
|
|
protocal.lucky_holy_eqm = lucky_holy_eqm
|
||
|
|
this.SendProtocal( 25230, protocal )
|
||
|
|
},
|
||
|
|
|
||
|
|
// 设置神装抽奖许愿(成功推送25219)
|
||
|
|
handle25230: function( data ) {
|
||
|
|
if( data ) {
|
||
|
|
if( data.flag == 1 ){
|
||
|
|
nx.bridge.closePanel( "WndHolyPrayWish" );
|
||
|
|
}
|
||
|
|
// message(data.msg)
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// 请求领取保底礼包(成功推送25219)
|
||
|
|
sender25231: function( group_id, id ) {
|
||
|
|
let protocal = {}
|
||
|
|
protocal.group_id = group_id
|
||
|
|
protocal.id = id
|
||
|
|
this.SendProtocal( 25231, protocal )
|
||
|
|
},
|
||
|
|
|
||
|
|
// 领取保底礼包(成功推送25219)
|
||
|
|
handle25231: function( data ) {
|
||
|
|
if( data ) {
|
||
|
|
// message(data.msg)
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// 请求战力前五神装总评分
|
||
|
|
sender25232: function() {
|
||
|
|
let protocal = {}
|
||
|
|
this.SendProtocal( 25232, protocal )
|
||
|
|
},
|
||
|
|
|
||
|
|
// 战力前五神装总评分
|
||
|
|
handle25232: function( data ) {
|
||
|
|
if( data ) {
|
||
|
|
this.score = data.score;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// 請求升級神像等級
|
||
|
|
sender25233: function( group_id ) {
|
||
|
|
let protocal = {};
|
||
|
|
protocal.group_id = group_id;
|
||
|
|
this.SendProtocal( 25233, protocal );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 請求升級神像等級
|
||
|
|
handle25233: function( data ) {
|
||
|
|
// if( data ) {
|
||
|
|
// this.model.setAllScore( data.score )
|
||
|
|
// }
|
||
|
|
},
|
||
|
|
|
||
|
|
// 请求存儲選項
|
||
|
|
sender25234: function( groups ) {
|
||
|
|
let protocal = {};
|
||
|
|
protocal.options = groups;
|
||
|
|
this.SendProtocal( 25234, protocal );
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
// 请求存儲選項
|
||
|
|
handle25234: function( data ) {
|
||
|
|
|
||
|
|
this.options = data.options;
|
||
|
|
nx.bridge.closePanel( "WndHolyEqmAutoSell" );
|
||
|
|
// if( data ) {
|
||
|
|
// this.model.setAllScore( data.score )
|
||
|
|
// }
|
||
|
|
},
|
||
|
|
|
||
|
|
getChoices: function(){
|
||
|
|
|
||
|
|
let choice = [ "1 Star","2 Star","3 Star","4 Star","5 Star","Normal","Good", "Best" ];
|
||
|
|
return choice;
|
||
|
|
},
|
||
|
|
|
||
|
|
getOptions: function(){
|
||
|
|
return this.options || [];
|
||
|
|
},
|
||
|
|
|
||
|
|
getScore: function(){
|
||
|
|
return this.score;
|
||
|
|
}
|
||
|
|
|
||
|
|
} );
|
||
|
|
|
||
|
|
// 模块导出
|
||
|
|
module.exports = Pray;
|