miduo_client/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua

714 lines
29 KiB
Lua
Raw Normal View History

2020-05-09 13:31:21 +08:00
IndicationManager = {}
local this = IndicationManager
function this.Initialize()
Game.GlobalEvent:AddEvent(Protocal.Connect, this.RegisterMessage)
this.canPopUpBagMaxMessage=false
this.getRewardFromMailMessage=false
end
function this.RegisterMessage(network)
if network.type ~= SocketType.LOGIN then
return
end
local socket = network.socket
-- 监听服务器跨天状态N
socket:RegistNetMessage(MessageTypeProto_pb.FIVE_PLAYER_REFLUSH_INDICATION, this.RefreshUpdateIndication)
--监听红点推送
socket:RegistNetMessage(MessageTypeProto_pb.SEND_RED_POINT_INDICATION, this.ReceiveRedPoint)
socket:RegistNetMessage(MessageTypeProto_pb.UPDATE_BAG_INDICATION, this.BackUpDataBagItemIdNumber)
socket:RegistNetMessage(MessageTypeProto_pb.SEND_CHAT_INFO_INDICATION, this.ReceiveFriendChat)
socket:RegistNetMessage(MessageTypeProto_pb.MISSION_UPDATE_INDICATION, this.RefreshMissionList)
-- 监听服务器推送
socket:RegistNetMessage(MessageTypeProto_pb.ADVENTURE_BOSS_FIND_INDICATION, this.ReceiveChatMsg)
-- 监听Boss被杀
socket:RegistNetMessage(MessageTypeProto_pb.ADVENTURE_BOSS_KILL_INDICATION, this.GetBossInfo)
socket:RegistNetMessage(MessageTypeProto_pb.ALL_GIFTGOODS_INDICATION, this.RefreshGiftGoods)
-- 监听服务器好友删除,好友赠送体力推送 --type 1:申请好友 2: 添加好友
socket:RegistNetMessage(MessageTypeProto_pb.SEND_FRIEND_INFO_INDICATION, this.ReceiveFriendApplication)
-- 监听服务器好友申请,好友添加推送 --type 1:删除好友 2: 赠送体力
socket:RegistNetMessage(MessageTypeProto_pb.SEND_FRIEND_STATE_INDICATION, this.ReceiveFriendDeleteState)
-- 监听商店数据推送
socket:RegistNetMessage(MessageTypeProto_pb.STORE_UPDATE_INDICATION, this.ReceiveShopData)
--刷新活动
socket:RegistNetMessage(MessageTypeProto_pb.ACTIVITY_UPDATE_INDICATION, this.RefreshActivityList)
socket:RegistNetMessage(MessageTypeProto_pb.ACTIVITY_UPDATE_PROGRESS_INDICATION, this.ActivityUpdateProgressIndication)
-- 公会推送
socket:RegistNetMessage(MessageTypeProto_pb.FAMILY_JOIN_INDICATION, this.GuildJoinSuccess)
socket:RegistNetMessage(MessageTypeProto_pb.FAMILY_KICK_INDICATION, this.GuildKickOut)
socket:RegistNetMessage(MessageTypeProto_pb.FAMILY_POSITION_UPDATE_INDICAITON, this.GuildPositionUpdate)
socket:RegistNetMessage(MessageTypeProto_pb.FAMILY_CHANGE_BASE_INDICATION, this.GuildDataUpdate)
socket:RegistNetMessage(MessageTypeProto_pb.FAMILY_WALK_INDICATION, this.GuildWalkUpdate)
socket:RegistNetMessage(MessageTypeProto_pb.FAMILY_QUICK_SET_DEFEND_INDICATION, this.GuildFightDefendUpdate)
socket:RegistNetMessage(MessageTypeProto_pb.FAMILY_FIGHT_MATCHING_SUCCESS_INDICATION, this.GuildFightMatchingSuccess)
socket:RegistNetMessage(MessageTypeProto_pb.FAMILY_DEFEATE_INDICATION, this.GuildFightBeKilled)
socket:RegistNetMessage(MessageTypeProto_pb.FAMILY_REFUSE_JOIN_INDICATION, this.GuildBeRefused)
socket:RegistNetMessage(MessageTypeProto_pb.FamilyFeteRewardProcessIndication, this.GuildFeteRewardProcess)
2020-05-11 09:38:52 +08:00
socket:RegistNetMessage(MessageTypeProto_pb.DEATH_PATH_STATUS_CHANGE_INDICATION, this.GuildRefreshDeathPosStatus)
socket:RegistNetMessage(MessageTypeProto_pb.DEATH_PATH_DO_REWARD_INDICATION, this.GuildDoRewardIndication)
2020-05-09 13:31:21 +08:00
--
socket:RegistNetMessage(MessageTypeProto_pb.UPDATE_USER_EXP_INDICATION, this.UpdateUserExp)
--秘盒跨季度刷新
socket:RegistNetMessage(MessageTypeProto_pb.UPDATE_SECRET_BOX_SEASON_INDICATION, this.UpdateSecretSeasonData)
-- 服务器要让我滚出图
socket:RegistNetMessage(MessageTypeProto_pb.MAP_OUT_INDICATION, this.TimeToFuckOutMap)
-- 刷新事件点时间
socket:RegistNetMessage(MessageTypeProto_pb.ENDLESS_REFRESH_INDICAITON, this.FreshPointShowTime)
-- 支付成功推送
socket:RegistNetMessage(MessageTypeProto_pb.NOTIFY_PAY_SUCCESS_INDICATION, this.PaySuccess)
-- 渠道强制改名推送
socket:RegistNetMessage(MessageTypeProto_pb.PLAYER_BACKCINFO_INDICATION, this.PlayerBackCInfo)
---调查问卷推送
socket:RegistNetMessage(MessageTypeProto_pb.QUESTION_INDICATION, this.RefreshQuestionnaire)
-- 空刷小怪
socket:RegistNetMessage(MessageTypeProto_pb.ENDLESS_MONSTER_REFRESH_INDICATION, this.MapNewAMonster)
-- 血战奖励积分变化刷新
socket:RegistNetMessage(MessageTypeProto_pb.BLOODY_SCORE_CHANGE_INDICATION, this.BloodyScoreChanged)
-- 无尽副本编队数据变化
socket:RegistNetMessage(MessageTypeProto_pb.ENDLESS_MAP_SET_TEAM_INDICATION, this.EndLessTeamChange)
--道具直购
socket:RegistNetMessage(MessageTypeProto_pb.DIRECT_BUY_GOODS_INDICATION, this.DirectBuyGoods)
-- 无尽换期刷新地图信息
socket:RegistNetMessage(MessageTypeProto_pb.ENDLESS_MAP_CHANGE_INDICATION, this.RefreshMapData)
-- 任务重置刷新
socket:RegistNetMessage(MessageTypeProto_pb.TREASURE_REFRESH_INDICATION, this.RestTreasureTaskData)
-- 戒灵秘宝等级推送
socket:RegistNetMessage(MessageTypeProto_pb.TREASURE_LEVELUP_INDICATION, this.RefreshTreasureLevel)
-- 幸运转盘
socket:RegistNetMessage(MessageTypeProto_pb.LUCKWHEEL_POOL_INDICATION, this.ReceiveLuckyTurnData)
-- 战斗胜利更新关卡ID
socket:RegistNetMessage(MessageTypeProto_pb.MAIN_LEVEL_FIGHT_UPDATE_INDICATION, this.FreshFightId)
-- 累充金额推送
socket:RegistNetMessage(MessageTypeProto_pb.REFRESH_RECHARGE_INDICATION, this.RefreshAccuMoneyNum)
-- 巅峰战阶段切换
socket:RegistNetMessage(MessageTypeProto_pb.CHAMPION_PROGRESS_UPDATE_INDICATION, this.TopMatchStageUpdate)
-- 竞猜成功
socket:RegistNetMessage(MessageTypeProto_pb.CHAMPION_GUESS_SUCCESS_INDICATION, this.TopMatchGuessSuccess)
-- 特权解锁
socket:RegistNetMessage(MessageTypeProto_pb.PRIVILLEGE_ADD_INDICATION, this.OnPrivilegeUpdate)
-- 远征更新圣物信息
socket:RegistNetMessage(MessageTypeProto_pb.EXPEDITION_HOLY_BAG_INDICATION, this.RefreshExpeditionHalidom)
-- 远征更新节点和己方信息
socket:RegistNetMessage(MessageTypeProto_pb.EXPEDITION_NOINFO_INDICATION, this.RefreshExpeditionNodeAndHeros)
-- 月卡激活推送
socket:RegistNetMessage(MessageTypeProto_pb.MONTHCARD_INDICATION, this.RefreshMonthCardData)
-- 公会车迟阶段推送
socket:RegistNetMessage(MessageTypeProto_pb.CAR_DELAY_PROGRESS_INDICATION, this.RefreshGuildCarDelayProgressData)
end
function this.RefreshActivityList(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.ActivityUpateIndication()
msg:ParseFromString(data)
ActivityGiftManager.RefreshActivityData(msg)
end
--服务器五点刷新推送相关任务的状态数据
function this.RefreshUpdateIndication(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.FivePlayerUpdateIndication()
msg:ParseFromString(data)
ActivityGiftManager.FiveAMRefreshActivityProgress(msg)
TaskManager.RefreshTypeTaskInfo(msg.userMissionInfo)
VipManager.FiveAMRefreshLocalData(msg.hadTakeDailyBox)
PrivilegeManager.FiveAMRefreshLocalData(msg.privilege)
MapTrialManager.RefreshAttachVipData()
OperatingManager.SetSignInData(msg.SignInInfo)
CheckRedPointStatus(RedPointType.FirstRecharge)
PatFaceManager.SetisFirstLogVal(0)
ShopManager.isOpenNoviceGift=false
ActivityGiftManager.isFirstForSupremeHero=false
BindPhoneNumberManager.InitBindInfo(msg.playerBindPhone)
LuckyTurnTableManager.ReceiveServerDataForFive(msg.posInfos,msg.posInfosAdvance)
OperatingManager.BackSetMonthCardGetStateData(msg.MonthDailyTake)
MyGuildManager.SetMyFeteInfo_FiveRefresh(msg)
-- CarbonManager.dailyChallengeInfo=msg.dailyChallengeInfo
-- LogBlue("Indication 推送数据"..#msg.dailyChallengeInfo)
Timer.New(function()
AdventureManager.RefreshAttachVipData()
Game.GlobalEvent:DispatchEvent(GameEvent.Adventure.OnRefreshNextDayData)
end, 2, 1, true):Start()
--先刷新完数据,再派发事件做界面刷新
Game.GlobalEvent:DispatchEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh)
--刷新极速探险免费次数
Game.GlobalEvent:DispatchEvent(GameEvent.Adventure.OnFastBattleChanged)
--五点刷新拍脸
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnPatFaceRedRefresh)
CheckRedPointStatus(RedPointType.SecretTer_HaveFreeTime)
CheckRedPointStatus(RedPointType.DailyGift)
--五点主动请求远征刷新
NetManager.GetExpeditionRequest()
end
--服务器推送红点信息
function this.ReceiveRedPoint(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.RedPointInfo()
msg:ParseFromString(data)
-- 显示红点
RedpotManager.SetServerRedPointStatus(msg.type, RedPointStatus.Show)
end
--后端更新背包数据
function this.BackUpDataBagItemIdNumber(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.UpdateBagIndication()
msg:ParseFromString(data)
if msg.type == 0 then
--普通背包
for i, v in pairs(msg.item) do
if v and v.itemId then
--Log("服务器推送物品数量变化id = "..v.itemId..", num = "..v.itemNum)
if BagManager.bagDatas[v.itemId] == nil then
BagManager.UpdateBagData(v)
else
BagManager.bagDatas[v.itemId].num = v.itemNum
BagManager.bagDatas[v.itemId].endingTime = v.endingTime
BagManager.bagDatas[v.itemId].nextFlushTime = v.nextFlushTime
end
end
end
elseif msg.type == 1 then
--临时背包
for i, v in pairs(msg.item) do
if v and v.itemId then
if BagManager.mapShotTimeItemData[v.itemId] == nil then
BagManager.InitMapShotTimeBagData(v)
else
BagManager.mapShotTimeItemData[v.itemId].itemNum = v.itemNum
BagManager.mapShotTimeItemData[v.itemId].endingTime = v.endingTime
BagManager.mapShotTimeItemData[v.itemId].nextFlushTime = v.nextFlushTime
end
end
end
Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnTempBagChanged)
end
Game.GlobalEvent:DispatchEvent(GameEvent.Bag.BagGold)
--检测背包红点
CheckRedPointStatus(RedPointType.Bag_HeroDebris)
CheckRedPointStatus(RedPointType.Bag_BoxAndBlueprint)
end
-- 好友数据单独处理
function this.ReceiveFriendChat(buffer)
local data = buffer:DataByte()
local msg = ChatProto_pb.SendChatInfoIndication()
msg:ParseFromString(data)
if msg.type == 1 then
FriendChatManager.ReceiveFriendChat(msg)
elseif msg.type == 2 then
ChatManager.ReceiveFamilyChat(msg)
end
end
--服务器推送相关任务的状态数据
function this.RefreshMissionList(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.MissionUpdateListIndication()
msg:ParseFromString(data)
TaskManager.RefreshTypeTaskInfo(msg.userMissionInfo)
end
-- 接收服务器数据
function this.ReceiveChatMsg(buffer)
--Log("收到新的外敌数据")
local data = buffer:DataByte()
local msg = FightInfoProto_pb.AdventureBossFindIndication()
msg:ParseFromString(data)
--TODO: 服务器主动推送的数据与原数据不同,需特殊处理
-- 只保留三十条数据
table.insert(AdventureManager.adventureChatList, msg.adventureBossInfo)
if #AdventureManager.adventureChatList > 30 then
table.remove(AdventureManager.adventureChatList, 1)
end
-- 是否需要刷新显示标志位
AdventureManager.IsChatListNew = true
-- 聊天数据刷新
Game.GlobalEvent:DispatchEvent(GameEvent.Adventure.OnChatListChanged)
-- 判断新增外敌是否在外敌列表中,不在则保存
local data = AdventureManager.GetEnemyDataByBossId(msg.adventureBossInfo.bossId)
if not data then
table.insert(AdventureManager.adventrueEnemyList, msg.adventureBossInfo)
AdventureManager.SortEnemyList()
-- 数据刷新
Game.GlobalEvent:DispatchEvent(GameEvent.Adventure.OnEnemyListChanged)
end
end
--拉去Boss外敌信息
function this.GetBossInfo(buffer)
local data = buffer:DataByte()
local msg = FightInfoProto_pb.AdventureBossKillIndication()
msg:ParseFromString(data)
AdventureManager.GetAdventureBossFlushRequest(msg)
local removeIndex = nil
for i, v in ipairs(AdventureManager.adventrueEnemyList) do
if v.bossId == msg.bossId then
removeIndex = i
end
end
if removeIndex then
table.remove(AdventureManager.adventrueEnemyList, removeIndex)
AdventureManager.SortEnemyList()
-- 是否需要刷新显示标志位
AdventureManager.IsChatListNew = true
-- 聊天数据刷新
Game.GlobalEvent:DispatchEvent(GameEvent.Adventure.OnChatListChanged)
Game.GlobalEvent:DispatchEvent(GameEvent.Adventure.OnEnemyListChanged)
end
end
function this.RefreshGiftGoods(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.AllGiftGoodsIndication()
msg:ParseFromString(data)
OperatingManager.SetBasicValues(msg.GiftGoodsInfo)
end
-- 接收服务器好友申请,添加
function this.ReceiveFriendApplication(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.sendFriendInfoIndication()
msg:ParseFromString(data)
local friendApplicationData = msg.Friends
if (msg.type == 1) then
GoodFriendManager.OnFriendDataRefresh(3, msg)
--GoodFriendManager.friendApplicationData[friendApplicationData.id] = friendApplicationData
Game.GlobalEvent:DispatchEvent(GameEvent.Friend.OnFriendApplication, GoodFriendManager.friendApplicationData)
end
if (msg.type == 2) then
GoodFriendManager.OnFriendDataRefresh(1, msg)
-- GoodFriendManager.friendAllData[friendApplicationData.id] = friendApplicationData
GoodFriendManager.friendApplicationData[friendApplicationData.id] = nil
RedPointManager.PlayerPrefsSetStr(PlayerManager.uid .. "redPointApplication", 1)
Game.GlobalEvent:DispatchEvent(GameEvent.Friend.OnFriendList, GoodFriendManager.friendAllData)
Game.GlobalEvent:DispatchEvent(GameEvent.Friend.OnFriendApplication, GoodFriendManager.friendApplicationData)
end
CheckRedPointStatus(RedPointType.Friend_Application)
CheckRedPointStatus(RedPointType.Friend_Reward)
end
-- 接收服务器好友删除,赠送体力推送
function this.ReceiveFriendDeleteState(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.SendFriendStateIndication()
msg:ParseFromString(data)
if (msg.type == 1) then
GoodFriendManager.friendAllData[msg.friendId] = nil
--this.friendSearchData[msg.friendId].isHaveApplication=1
Game.GlobalEvent:DispatchEvent(GameEvent.Friend.OnFriendDelete, msg.friendId)
end
if (msg.type == 2) then
GoodFriendManager.friendAllData[msg.friendId].haveReward = 1
end
CheckRedPointStatus(RedPointType.Friend_Reward)
Game.GlobalEvent:DispatchEvent(GameEvent.Friend.OnFriendList, GoodFriendManager.friendAllData)
end
-- 接收商店数据
function this.ReceiveShopData(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.storeUpdateIndication()
msg:ParseFromString(data)
ShopManager.UpdateShopData(msg)
end
-- 加入公会成功推送
function this.GuildJoinSuccess(buffer)
local data = buffer:DataByte()
local msg = Family_pb.FamilyJoinIndicaion()
msg:ParseFromString(data)
local isSelf = msg.familyUserInfo.roleUid == PlayerManager.uid
Log("服务器推送:有人成功加入公会,是不是自己:" .. tostring(isSelf))
if isSelf then
MyGuildManager.SetMyGuildInfo(msg)
MyGuildManager.SetMyMemInfo(msg)
MyGuildManager.SetMyFeteInfo(msg)
-- 初始化一遍数据
MyGuildManager.InitAllData(function()
-- 发送数据更新事件
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.JoinGuildSuccess)
-- 显示tip
GuildManager.AddGuildTip(GUILD_TIP_TYPE.JOIN, msg.familyBaseInfo.name)
end)
else
-- 不是自己暂不做处理
--MyGuildManager.RequestMyGuildMembers()
end
end
-- 被踢出公会推送
function this.GuildKickOut(buffer)
local data = buffer:DataByte()
local msg = Family_pb.KickOutIndication()
msg:ParseFromString(data)
Log("服务器推送:被踢出公会, uid" .. msg.uid)
MyGuildManager.BeKickOut(msg)
end
-- 被踢出公会推送
function this.GuildBeRefused(buffer)
Log("服务器推送:公会申请被拒绝")
local data = buffer:DataByte()
local msg = Family_pb.RefuseJoinFamily()
msg:ParseFromString(data)
GuildManager.AddGuildTip(GUILD_TIP_TYPE.REFUSE, msg.name)
end
-- 职位变更推送
function this.GuildPositionUpdate(buffer)
local data = buffer:DataByte()
local msg = Family_pb.FamilyPositionUpdateIndication()
msg:ParseFromString(data)
Log("服务器推送:公会职位变化, uid = "..msg.uid..", pos = "..msg.position)
MyGuildManager.UpdateGuildPosition(msg)
end
-- 公会信息推送
function this.GuildDataUpdate(buffer)
Log("服务器推送:公会信息改变")
local data = buffer:DataByte()
local msg = Family_pb.FamilyChangeIndication()
msg:ParseFromString(data)
MyGuildManager.SetMyGuildInfo(msg)
end
-- 公会成员行走
function this.GuildWalkUpdate(buffer)
-- 不在公会主界面不接收,打开公会主界面时会刷新
if not UIManager.IsOpen(UIName.GuildMainCityPanel) then
return
end
Log("服务器推送:公会行走信息改变")
local data = buffer:DataByte()
local msg = Family_pb.FamilyWalkIndicaiton()
msg:ParseFromString(data)
MyGuildManager.UpdateWalkData(msg)
end
-- 公会战防守阵容改变推送
function this.GuildFightDefendUpdate(buffer)
-- 不在公会主界面不接收,打开界面时会刷新
if not UIManager.IsOpen(UIName.GuildMainCityPanel) then
return
end
Log("服务器推送:公会战防守阵容信息改变")
local data = buffer:DataByte()
local msg = Family_pb.FamilyDefendInfo()
msg:ParseFromString(data)
GuildFightManager.UpdateDefendStageData(msg)
end
-- 公会战匹配成功
function this.GuildFightMatchingSuccess(buffer)
-- 不在公会主界面不接收,打开界面时会刷新
if not UIManager.IsOpen(UIName.GuildMainCityPanel) then
return
end
Log("服务器推送:公会战匹配成功")
local data = buffer:DataByte()
local msg = Family_pb.EnemyFamily()
msg:ParseFromString(data)
GuildFightManager.SetEnemyBaseData(msg)
end
-- 公会战匹配成功
function this.GuildFightBeKilled(buffer)
Log("服务器推送:公会战有人被打败")
-- 不在公会主界面不接收,打开界面时会刷新
local data = buffer:DataByte()
local msg = Family_pb.DefeatResponse()
msg:ParseFromString(data)
Log("服务器推送:公会战有人被打败, uid = " .. msg.uid)
GuildFightManager.KillSomeBody(msg)
end
-- 公会祭祀进度
function this.GuildFeteRewardProcess(buffer)
local data = buffer:DataByte()
local msg = Family_pb.FamilyFeteRewardProcessIndication()
msg:ParseFromString(data)
Log("服务器推送:公会祭祀进度更新,score= "..msg.score)
MyGuildManager.SetMyFeteInfo_ByScore(msg)
2020-05-11 09:38:52 +08:00
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.OnRefreshFeteProcess)
end
--公会十绝阵阶段刷新
function this.GuildRefreshDeathPosStatus(buffer)
local data = buffer:DataByte()
local msg = Family_pb.DeathPathStatusChangeIndication()
msg:ParseFromString(data)
Log("服务器推送:公会十绝阵阶段刷新,status= "..msg.status)
DeathPosManager.status=msg.status
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshDeathPosStatus)
end
--公会十绝阵 其他玩家领取奖励推送
function this.GuildDoRewardIndication(buffer)
local data = buffer:DataByte()
local msg = Family_pb.DoRewardIndication()
msg:ParseFromString(data)
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshDeathPosReward)
2020-05-09 13:31:21 +08:00
end
function this.ActivityUpdateProgressIndication(buffer)
local data = buffer:DataByte()
local message = PlayerInfoProto_pb.ActivityUpateProgressIndication()
message:ParseFromString(data)
ActivityGiftManager.RefreshActivityProgressData(message)
end
function this.UpdateUserExp(buffer)
local data = buffer:DataByte()
local message = PlayerInfoProto_pb.UpdateUserExpIndicaiton()
message:ParseFromString(data)
PlayerManager.BcakUpdateUserExp(message)
end
function this.UpdateSecretSeasonData(buffer)
local data = buffer:DataByte()
local message = PlayerInfoProto_pb.UpdateSecretBoxSeasonIndication()
message:ParseFromString(data)
SecretBoxManager.RefreshSeasonTime(message)
end
-- 滚出图
function this.TimeToFuckOutMap(buffer)
if UIManager.IsOpen(UIName.BattleFailPopup) then
UIManager.ClosePanel(UIName.BattleFailPopup)
end
if UIManager.IsOpen(UIName.BattleWinPopup) then
UIManager.ClosePanel(UIName.BattleWinPopup)
end
if UIManager.IsOpen(UIName.BattlePanel) then
BattleLogic.IsEnd = true
UIManager.ClosePanel(UIName.BattlePanel)
end
if UIManager.IsOpen(UIName.FormationPanel) then
UIManager.ClosePanel(UIName.FormationPanel)
end
Game.GlobalEvent:DispatchEvent(GameEvent.Map.OnForceGetOutMap)
end
-- 刷新地图事件点的显示时间
function this.FreshPointShowTime(buffer)
local data = buffer:DataByte()
local msg = MapInfoProto_pb.EndlessTimeIndication()
msg:ParseFromString(data)
EndLessMapManager.InitRefreshPoint(msg.infos)
EndLessMapManager.isAddPoint = true
MapManager.PanelCloseCallBack(UIName.MapOptionPanel, function()
Game.GlobalEvent:DispatchEvent(GameEvent.Map.OnAddCountTimePoint)
end)
end
-- 强制改名
function this.PlayerBackCInfo(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.PlayerBackCInfoIndication()
msg:ParseFromString(data)
Log("服务器推送:强制改名为:" .. msg.nickName)
NameManager.SetRoleName(msg.nickName)
PlayerManager.nickName = msg.nickName
Game.GlobalEvent:DispatchEvent(GameEvent.Player.OnChangeName)
end
--支付成功
function this.PaySuccess(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.NotifyPaySuccessfulIndicaiton()
msg:ParseFromString(data)
Log("支付成功!道具名称:" .. msg.goodsId)
--if LoginManager.pt_pId == 2 then --TODO:九游渠道不允许客户端接受回调处理,通过监听服务器推送处理
local tip = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, msg.goodsId).Tip
PopupTipPanel.ShowTip(tip)
--FirstRechargeManager.RefreshAccumRechargeValue(msg.goodsId)
Game.GlobalEvent:DispatchEvent(GameEvent.MoneyPay.OnPayResultSuccess, msg.goodsId)
--end
end
--调查问卷
function this.RefreshQuestionnaire(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.QuestionIndication()
msg:ParseFromString(data)
if msg.state == 1 then
QuestionnaireManager.SetQuestionState(0)
QuestionnaireManager.RefreshQuestionData()
else
QuestionnaireManager.ResetArgs()
QuestionnaireManager.SetQuestionState(-1)
end
Game.GlobalEvent:DispatchEvent(GameEvent.Questionnaire.OnQuestionnaireChange, msg.state)
end
-- 空地生成小怪
function this.MapNewAMonster(buffer)
local data = buffer:DataByte()
local msg = MapInfoProto_pb.RefreshMonsterResponse()
msg:ParseFromString(data)
for i = 1, #msg.cell do
local pos = msg.cell[i].cellId
local mapPointId = msg.cell[i].pointId
MapManager.pointAtkPower[msg.cell[i].cellId] = msg.cell[i].monsterForce
Log("无尽副本服务器推送数据,在空地上生成小怪!")
MapManager.PanelCloseCallBack(UIName.BattleEndPanel, function()
CallBackOnPanelOpen(UIName.MapPanel, function ()
Game.GlobalEvent:DispatchEvent(GameEvent.Map.PointAdd, pos, mapPointId)
end)
--local u, v = Map_Pos2UV(pos)
--Log(string.format("生成一只小怪,位置是(%s, %s)", u, v))
end)
end
end
-- 空地生成小怪
function this.BloodyScoreChanged(buffer)
local data = buffer:DataByte()
local msg = RoomProto_pb.BloodyScoreChangeIndication()
msg:ParseFromString(data)
MatchDataManager.SetRewardScore(msg.myscore)
end
-- 无尽副本换编队刷新最大血量值
function this.EndLessTeamChange(buffer)
local data = buffer:DataByte()
local msg = MapInfoProto_pb.EndlessSetTeamIndication()
msg:ParseFromString(data)
EndLessMapManager.UpDateTeamMaxHp(msg.info)
end
function this.DirectBuyGoods(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.DirectBuyIndication()
msg:ParseFromString(data)
Log("异妖直购 购买成功 " .. msg.goodsId)
PatFaceManager.ShowBuyLaterDrop(msg)
end
function this.RefreshMapData(buffer)
local data = buffer:DataByte()
local msg = MapInfoProto_pb.EndlessMapChange()
msg:ParseFromString(data)
Log("推送的世界ID " .. msg.mapId)
Log("推送的无尽世界等级 " .. msg.worldLevel)
EndLessMapManager.openMapId = msg.mapId
EndLessMapManager.worldLevel = msg.worldLevel
end
function this.RestTreasureTaskData(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.TreasureRefreshIndication()
msg:ParseFromString(data)
TaskManager.ResetTreasureTaskInfo(msg.tasks)
end
function this.RefreshTreasureLevel(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.TreasureLevelUpIndication()
msg:ParseFromString(data)
TreasureOfSomebodyManagerV2.SetCurrentLevel(msg.level)
CheckRedPointStatus(RedPointType.TreasureOfSl)
end
--幸运转盘
function this.ReceiveLuckyTurnData(buffer)
local data=buffer:DataByte()
local msg=PlayerInfoProto_pb.LuckWheelIndication()
msg:ParseFromString(data)
--Log("==YSP== 服务器推送 幸运转盘数据 "..tostring(msg.posInfos))
LuckyTurnTableManager.ReceiveServerData(msg.posInfos,msg.posInfosAdvance)
end
-- 更新关卡ID
function this.FreshFightId(buffer)
Log("后端推送关卡状态!")
local data=buffer:DataByte()
local msg=FightInfoProto_pb.MainLevelFightUpdateIndication()
msg:ParseFromString(data)
FightPointPassManager.RefreshFightId(msg)
end
-- 后端推送累充金额
function this.RefreshAccuMoneyNum(buffer)
Log("推送充值金额")
local data=buffer:DataByte()
local msg=PlayerInfoProto_pb.RefreshRechargeIndication()
msg:ParseFromString(data)
VipManager.RefreshChargeMoney(msg.amount, false)
OperatingManager.RefreshMonthCardChargeMoney(msg)
end
-- 巅峰战阶段更新
function this.TopMatchStageUpdate(buffer)
Log("巅峰战阶段切换")
local data = buffer:DataByte()
local msg = ArenaInfoProto_pb.ChampionProgressUpdateIndication()
msg:ParseFromString(data)
ArenaTopMatchManager.UpdateTopMatchStage(msg)
end
-- 巅峰战竞猜成功
function this.TopMatchGuessSuccess(buffer)
Log("巅峰战竞猜奖励发放")
local data = buffer:DataByte()
local msg = ArenaInfoProto_pb.ChampionGuessSuccessIndication()
msg:ParseFromString(data)
ArenaTopMatchManager.OnGuessSuccess(msg)
end
-- 巅峰战竞猜成功
function this.OnPrivilegeUpdate(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.PrivilegeIndication()
msg:ParseFromString(data)
Log("特权解锁")
PrivilegeManager.OnPrivilegeUpdate(msg.infos)
end
function this.RefreshExpeditionHalidom(buffer)
local data = buffer:DataByte()
local msg = Expedition_pb.ExpeditionEquipIndication()
msg:ParseFromString(data)
ExpeditionManager.UpdateHalidomValue(msg)
end
function this.RefreshExpeditionNodeAndHeros(buffer)
local data = buffer:DataByte()
local msg = Expedition_pb.ExpeditionNodeInfoIndication()
msg:ParseFromString(data)
--if msg.nodeInfo then
-- Log(" ******* 推送更新远征 msg.nodeInfo "..#msg.nodeInfo)
--else
-- Log(" ******* 推送更新远征 msg.nodeInfo nil")
--end
--if msg.heroInfo then
-- Log(" ******* 推送更新远征 msg.heroInfo "..#msg.heroInfo)
--else
-- Log(" ******* 推送更新远征 msg.heroInfo nil")
--end
ExpeditionManager.UpdateHeroHpValue(msg.heroInfo)
ExpeditionManager.UpdateNodeValue(msg.nodeInfo)
end
function this.RefreshMonthCardData(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.MonthCardIndication()
msg:ParseFromString(data)
OperatingManager.UpdateMonthCardData(msg)
end
function this.RefreshGuildCarDelayProgressData(buffer)
local data = buffer:DataByte()
local msg = Family_pb.CarDelayProgressIndication()
msg:ParseFromString(data)
GuildCarDelayManager.SetProgressData(msg)
end
return this