local Level_Model = {} local private = {} local enter_world_pb = require 'Proto/enter_world_pb' local fuben_pb = require 'Proto/fuben_pb' local horse_ride_pb = require('Proto/horse_ride_pb') local battle_event_pb = require"Proto/battle_event_pb" local pvp_broadcast_pb = require 'Proto/pvp_broadcast_pb' local EventSystem = require 'Event/EventSystem' function Level_Model.OnStartup() NetManager.RegisterMsgCB(MessageEnums.MessageConvey, nil) NetManager.RegisterMsgCB(MessageEnums.MessageG2CUnableConveyInfoPush, private.UnableConveyInfoPush) EventSystem.Regist(EventID.Level_SendRoleLeaveFuben, Level_Model.SendRoleLeaveFuben) EventSystem.Regist(EventID.Level_CloseAllBaseUI, private.CloseAllBaseUI) EventSystem.Regist(EventID.Level_CloseUIView, private.CloseUIView) EventSystem.Regist(EventID.Level_OpenUIView, private.OpenUIView) EventSystem.Regist(EventID.Level_HorseState, Level_Model.RideOrOffHorseRequest) EventSystem.Regist(EventID.Level_OpenUIView, private.OpenUIView) EventSystem.Regist(EventID.Level_InitExpLevel, private.OnInitExpLevel) EventSystem.Regist(EventID.UIBattle_LevelFirstPassUpdate, private.UpdateLevelPassData) EventSystem.Regist(EventID.Level_HeroKillHero, private.OnHeroKillHero) EventSystem.Regist(EventID.UI_GuildWarKillInfoNotice, private.OnHeroKillHero_GuildWar) private.levelPassData = {} end function Level_Model.GetLevelPassDataById(levelInfoId) return private.levelPassData[levelInfoId] end function private.UpdateLevelPassData(levelInfoId, isPass) private.levelPassData[levelInfoId] = isPass end function private.OnInitExpLevel() private.isCheatCheckFailed = false end function private.OpenUIView(panel, content) UIManager.OpenView(panel, content) end function private.CloseUIView(panel) UIManager.CloseView(panel) end function private.CloseAllBaseUI() UIManager.CloseAllBase() end --切换主城Req function Level_Model.LevelConveyRequest(type, levelID, itemID, forceConvey) local msg = enter_world_pb.ConveyReq() msg.typ = type msg.mapId = levelID msg.levelItemId = itemID if forceConvey then msg.forceConvey = forceConvey -- 仅仅地图传送时需要 end NetManager.SendMessage(MessageEnums.MessageConvey, msg) end function private.UnableConveyInfoPush(msgResp) private.DealWithUnableConveyReason(msgResp.UnableInfo, msgResp.MapId) end function private.DealWithUnableConveyReason(unableInfo, mapId) for i, v in ipairs(unableInfo) do if v.Reason ~= enter_world_pb.Success then if v.Reason == enter_world_pb.ReasonSceneLv then CTL.Tips.AddTipsMsg(Const_IDS.IDS_ZoneTown_Level, v.Name) elseif v.Reason == enter_world_pb.ReasonSceneOfficeLv then CTL.Tips.AddTipsMsg(Const_IDS.IDS_ZoneTown_OfficeLevel, v.Name) elseif v.Reason == enter_world_pb.ReasonSceneGS then CTL.Tips.AddTipsMsg(Const_IDS.IDS_ZoneTown_Power, v.Name) elseif v.Reason == enter_world_pb.ReasonNearLeader then UTL.MessageBox.ShowOKCancelNoCloseBox(nil, Const_IDS.IDS_ZoneTown_TeamMember, MDL.Team.TeamCallMemberReq) elseif v.Reason == enter_world_pb.ReasonNotSameServer then UTL.MessageBox.ShowOKCancelNoCloseBox(nil, Const_IDS.IDS_ZoneTown_ZoneTeamMember1, function() CTL.CrossServer.KickDifferentServerTeammates(unableInfo) end) elseif v.Reason == enter_world_pb.ReasonNotTeamLeader then if CTL.CrossServer.IsMapCrossServerScene(mapId) then UTL.MessageBox.ShowOKCancelNoCloseBox(nil, Const_IDS.IDS_ZoneTown_TeamLeader, MDL.Team.TeamLeaveReq) else UTL.MessageBox.ShowOKCancelNoCloseBox(nil, Const_IDS.IDS_ZoneTown_ZoneTeamMember2, MDL.Team.TeamLeaveReq) end else logging.error(LTAG.ERROR, "UnableConveyReason没有找到对应枚举:,", v.Reason, ",请程序检查!!!") end return end end end function Level_Model.ReqExitSatelliteTown() CTL.Task.OnStopAutoTask() local msg = enter_world_pb.ConveyReq() msg.typ = 0 msg.mapId = 0 msg.levelItemId = 0 msg.ConveyBack = true NetManager.SendMessage(MessageEnums.MessageConvey, msg) end -- isSyncQuitRoom : 同步关卡还没结束, 就退出 function Level_Model.SendRoleLeaveFuben(isSyncQuitRoom) if BattleDataGetter.IsOnlinePlay() then if not LuaNetManager.IsOnline() then private.ReConnectLeave_isSyncQuitRoom = isSyncQuitRoom NetManager.ManualReConnect(private.SendC2GRoleLeaveFuben); else local inBattle = nil if isSyncQuitRoom then inBattle = 1 end private.SendC2GRoleLeaveFuben(inBattle, isSyncQuitRoom) end end end function Level_Model.SendRoleLeaveFubenFromSetting() if LevelManager.IsFreeToEnterAndLeaveLevel() then --LuaInputManager.SpecialCommand = LuaConst.SpecialCommandType.QuitRoom LuaInputManager.SetSpecialCommand(LuaConst.SpecialCommandType.QuitRoom) else if LevelManager.IsPlanesLevel() then UIManager.CloseView(Const_UI_Lua.UIEnum.UISettingMainPanel) end if CTL.Guide.CheckInGuideLevel() then CTL.Guide.EndGuideLevel() elseif BattleDataGetter.IsOnlinePlay() then if not LuaNetManager.IsOnline() then private.ReConnectLeave_isBattle = 1 NetManager.ManualReConnect(private.SendC2GRoleLeaveFuben) else private.SendC2GRoleLeaveFuben(1) end end end end -- isSyncQuitRoom : 同步关卡还没结束, 就退出 function private.SendC2GRoleLeaveFuben(isBattle , isSyncQuitRoom) if private.ReConnectLeave_isBattle then isBattle = private.ReConnectLeave_isBattle private.ReConnectLeave_isBattle = nil end if private.ReConnectLeave_isSyncQuitRoom then isSyncQuitRoom = private.ReConnectLeave_isSyncQuitRoom private.ReConnectLeave_isSyncQuitRoom = nil if isSyncQuitRoom then isBattle = 1 end end local msg = fuben_pb.C2GRoleLeaveFuben() msg.IsBattle = isBattle or 0 if isSyncQuitRoom then msg.SyncHalfwayLeave = true else msg.SyncHalfwayLeave = false end local myEntity = BattleDataGetter.GetCurEntity() if myEntity then local comp_Move = BattleDataGetter.GetCurEntity().components.move msg.Pos.X, msg.Pos.Y, msg.Pos.Z = comp_Move.LogicPos.x[1], 0, comp_Move.LogicPos.z[1] msg.Dir.X, msg.Dir.Z = comp_Move.LogicRotateDir.x[1], comp_Move.LogicRotateDir.z[1] end logging.log(LTAG.LOG, msg, msg.IsBattle) msg.heroDeadNum = BattleDataGetter.GetPlayerDeadHeroCount(LevelPlayerManager.MyPlayerIDInRoom) local passTime = math.ceil(BattleDataGetter.GetLevelPassTime() + (BattleDataGetter.GetPassTimeOfPrevious() or 0 )) msg.passTime = math.max(passTime, 0) msg.mapId = BattleDataGetter.GetCurLevelID() NetManager.SendMessage(MessageEnums.MessageC2GRoleLeaveFuben, msg) end --主城上下马Req function Level_Model.RideOrOffHorseRequest(entity , ridestate) if entity:IsPlayerSelf() and LevelManager.IsNoBattleLevel() then local msg = horse_ride_pb.C2GHorseRideState() msg.riding = ridestate NetManager.SendMessage(MessageEnums.MessageC2GHorseRideState,msg) end end function Level_Model.LevelPauseSync(battleRoomID) --if BattleDataGetter.IsMainPlayerTeamLeader() then --注掉了,因为IsMainPlayerFirstOnlinePlayer的数据初始化太晚并且太慢,这里访问会出现非法值、过期值。而下面的代码又很重要,不能不调。所以这里不过滤,大家一起发 --联机玩法暂停需要依赖服务器,此处发送TCP给服务器请求暂停,服务器通过停止推帧来实现暂停 local topTimelineRecord = SystemManager.syncTimelineRecordList[#SystemManager.syncTimelineRecordList] if topTimelineRecord then local msg = fuben_pb.C2GTimelineStart() msg.timeLen = topTimelineRecord.duration * 1000 msg.Id = BattleDataGetter.GetSyncTimelineIndex() msg.BRoomId = battleRoomID or BattleDataGetter.GetBattleRoomID() NetManager.SendMessage(MessageEnums.MessageC2GTimelineStart, msg) --else --正常情况,单机模式不会有timelineRecord, 这种情况下也不用给服务器发暂停 --logging.error(LTAG.ERROR, "HYW : 错误!没有timelineRecord!") end --end end function Level_Model.LevelResumeSync(battleRoomID) --联机玩法暂停/恢复需要依赖服务器,此处发送TCP给服务器请求恢复暂停,服务器通过恢复推帧来实现恢复 local msg = fuben_pb.C2GTimelineStop() msg.Id = BattleDataGetter.GetSyncTimelineIndex() msg.BRoomId = battleRoomID or BattleDataGetter.GetBattleRoomID() NetManager.SendMessage(MessageEnums.MessageC2GTimelineStop, msg) end function Level_Model.SetCheatCheckFailedFlag(value) private.isCheatCheckFailed = value end function Level_Model.IsCheatCheckFailed() return private.isCheatCheckFailed end --成就相关↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ function Level_Model.TrySendBattleEvent() local levelType = BattleDataGetter.GetCurLevelType() local msg if LevelManager.IsSyncWorldBossLevel() then msg = battle_event_pb.C2GBattleEvent() Level_Model.TryFillBattleEventByType(battle_event_pb.WorldBossKillNum, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.WorldBossKilledNum, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.WorldBossOnlyKillNum, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.WorldBossRevenge, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.KilledByBlood, msg.event) elseif LevelManager.IsGuildWarLevel() then msg = battle_event_pb.C2GBattleEvent() Level_Model.TryFillBattleEventByType(battle_event_pb.GuildWarKillNum, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.GuildWarKillOrAssistNumOnCar, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.GuildWarCarKilled, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.GuildWarKilledByTower, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.KilledByBlood, msg.event) elseif LevelManager.IsSyncTeamDifficult() then msg = battle_event_pb.C2GBattleEvent() Level_Model.TryFillBattleEventByType(battle_event_pb.MultiPlayerDungeonNoKilledHero, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.MultiPlayerDungeonDestroyPillarWin, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.MultiPlayerDungeonAbsorbBuffWin, msg.event) elseif LevelManager.IsBossChallenge() then msg = battle_event_pb.C2GBattleEvent() Level_Model.TryFillBattleEventByType(battle_event_pb.BossChallengeUseOneHero, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.BossChallengeHeroMaxHp, msg.event) Level_Model.TryFillBattleEventByType(battle_event_pb.BossChallengeNotHurtTime, msg.event) elseif LevelManager.IsWarZoneWorldBossLevel() then msg = battle_event_pb.C2GBattleEvent() Level_Model.TryFillBattleEventByType(battle_event_pb.WarZoneBossKillNum, msg.event) elseif LevelManager.IsSyncSolo() then if LevelManager.LevelType == LuaConst.LevelType.SyncSolo then msg = battle_event_pb.C2GBattleEvent() Level_Model.TryFillBattleEventByType(battle_event_pb.Fair1v1UseHeroResult, msg.event) --else --正常情况,因为有切磋 end end if msg then NetManager.SendMessage(MessageEnums.MessageC2GBattleEvent,msg) end end -- function Level_Model.TryFillBattleEventByType(eventType, eventList) local playerID = BattleDataGetter.GetCurPlayerID() local battleEvent if eventType == battle_event_pb.WorldBossKillNum then local killNum = BattleDataGetter.GetPlayerInvolvedKillNum(playerID) if killNum and killNum > 0 then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, killNum) end elseif eventType == battle_event_pb.WorldBossKilledNum then local deadCount = BattleDataGetter.GetPlayerDeadHeroCount(playerID) if deadCount and deadCount > 0 then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, deadCount) end elseif eventType == battle_event_pb.WorldBossOnlyKillNum then local damge = BattleDataGetter.GetDamageOfPlayer(playerID) if damge == nil or damge <= FP.Const.Zero then local killNum = BattleDataGetter.GetPlayerKillNum(playerID) if killNum > 0 then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, BattleDataGetter.GetPlayerKillNum(playerID)) end end elseif eventType == battle_event_pb.WorldBossRevenge then if BattleDataGetter.GetRevengeCount(playerID) > 0 then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, math.ceil(BattleDataGetter.GetPlayerMinRevengeIntervalFrame(playerID) / 20)) end elseif eventType == battle_event_pb.GuildWarKillNum then local killNum = BattleDataGetter.GetPlayerKillNum(playerID) if killNum and killNum > 0 then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, killNum) end elseif eventType == battle_event_pb.GuildWarKillOrAssistNumOnCar then local num = BattleDataGetter.GetBiggestDrivingComboKillAndAssistNum(playerID) if num > 0 then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, num) end elseif eventType == battle_event_pb.GuildWarCarKilled then local kickedFromVehicleNum = BattleDataGetter.GetKickedFromVehicleNum(playerID) if kickedFromVehicleNum > 0 then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, kickedFromVehicleNum) end elseif eventType == battle_event_pb.GuildWarKilledByTower then local count = BattleDataGetter.GetKilledByTowerCount(playerID) if count > 0 then battleEvent = battle_event_pb.BattleEvent() --被军团战城门的箭塔累计击杀X次(贪功冒进)--1分 table.insert(battleEvent.param, count) end elseif eventType == battle_event_pb.BossChallengeUseOneHero then if BattleDataGetter.GetSwitchHeroCount(playerID) <= 0 then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, MDL.LevelSelect.GetSystemID()) end elseif eventType == battle_event_pb.BossChallengeHeroMaxHp then -- 任意挑战BOSS关卡通关时,每个武将的血量都在Y%以下X次 -- 2022年1月13日补充了需求:血量必须都大于0 -- 这里把所有武将中的最高血量百分比发给服务器,以整数的形式(100%血则发100, 50%血发50) local entities = BattleDataGetter.GetMyHeroEntityTable() if entities then local maxPercent local hasAnyDead = false for i,entity in ipairs(entities) do local percent = FP.tonumberV1(entity.components.attr:HitPointPercents()) if maxPercent == nil or percent > maxPercent then maxPercent = percent end hasAnyDead = not entity:IsAlive() if hasAnyDead then break end end if not hasAnyDead and maxPercent then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, math.ceil(maxPercent * 100)) end end elseif eventType == battle_event_pb.BossChallengeNotHurtTime then --boss挑战连续x秒未收到伤害 param:[x(s)]单场战斗中连续未受伤害最大时间 local entities = BattleDataGetter.GetMyHeroEntityTable() if entities then battleEvent = battle_event_pb.BattleEvent() local longestInterval = 0 for i,entity in ipairs(entities) do if entity.components.record.longestHpLossIntervalFrame > longestInterval then longestInterval = entity.components.record.longestHpLossIntervalFrame end end --logging.error(LTAG.ERROR, "HYW : 11 boss挑战最长风筝时间 : ", longestInterval / 20) table.insert(battleEvent.param, math.floor(longestInterval / 20)) else logging.error(LTAG.ERROR, "HYW : BattleDataGetter.GetMyHeroEntityTable Failed Error! @Level_Model.TryFillBattleEventByType") end elseif eventType == battle_event_pb.MultiPlayerDungeonNoKilledHero then --多人难度副本全员无武将伤亡通关 param:[] local allDeadCount = BattleDataGetter.GetAllPlayerDeadHeroCount() if allDeadCount == 0 then battleEvent = battle_event_pb.BattleEvent() end elseif eventType == battle_event_pb.MultiPlayerDungeonDestroyPillarWin then if BattleDataGetter.GetCurLeveLFunc():GetPillarDeadCount() >= 6 then battleEvent = battle_event_pb.BattleEvent() end elseif eventType == battle_event_pb.MultiPlayerDungeonAbsorbBuffWin then if BattleDataGetter.GetCurLeveLFunc().destroyWeaponFailed and (not BattleDataGetter.GetCurLeveLFunc().isSyncTeamDifficultFailed) then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, BattleDataGetter.GetCurLeveLFunc():GetDifficultyOfTeamDifficultDungeon()) end elseif eventType == battle_event_pb.KilledByBlood then local num = BattleDataGetter.GetPlayerOnePunchKilledCount(playerID) if num and num > 0 then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, num) end elseif eventType == battle_event_pb.WarZoneBossKillNum then local killNum = BattleDataGetter.GetPlayerKillNum(playerID) if killNum and killNum > 0 then battleEvent = battle_event_pb.BattleEvent() table.insert(battleEvent.param, killNum) end elseif eventType == battle_event_pb.Fair1v1UseHeroResult then battleEvent = battle_event_pb.BattleEvent() local myPlayerID = BattleDataGetter.GetCurPlayerID() local army = BattleDataGetter.GetMyPlayerArmy() if army then local heroIDListSortedByArmyPos = {} --按照前中后军排的英雄id列表 for i,heroArmyData in ipairs(army) do heroIDListSortedByArmyPos[LevelPlayerManager.GetHeroArmyPos(myPlayerID, heroArmyData.HeroID) / 2 + 1] = heroArmyData.HeroID end for i,heroID in ipairs(heroIDListSortedByArmyPos) do table.insert(battleEvent.param, heroID) table.insert(battleEvent.param, BattleDataGetter.GetHeroKillNumByPos(myPlayerID, i*2-1)) end else logging.error(LTAG.ERROR, "HYW : army nil Error !") end local myPlayerInfo = BattleDataGetter.GetPlayerInfo(myPlayerID) local levelFunc = BattleDataGetter.GetCurLeveLFunc() local winInfo = levelFunc.winnerCampId == myPlayerInfo.campID and 1 or 0 table.insert(battleEvent.param, winInfo) local enemyPlayerID = myPlayerID == 1 and 2 or 1 if levelFunc.playerID2DeadHeroDic then for i,heroID in ipairs(levelFunc.playerID2DeadHeroDic[enemyPlayerID]) do table.insert(battleEvent.param, heroID) end --else --正常情况,某些时候玩家KCP掉线了,就不会发结果给服务器,此时如果对面发了结果,那么掉线的客户端会在KCP掉线的情况下收到TCP push,此时无法取得levelFunc.playerID2DeadHeroDic,这种情况下就不发给服务器成就数据了 end end if battleEvent then battleEvent.eventTyp = eventType table.insert(eventList, battleEvent) end end --成就相关↑↑↑↑↑↑↑↑↑↑↑↑↑↑ function private.OnHeroKillHero(killer, deadEntity, deadComboKill) if killer ~= deadEntity then if BattleDataGetter.IsInReconnectFastPlay() then return end local levelType = BattleDataGetter.GetCurLevelType() local has, broadcastPVPTypeData = DataSheetManager.BroadcastPVPType:TryGetDataByLevelType(levelType) if has then local killerIsMe = killer == BattleDataGetter.GetCurEntity() local deadEntityPlayerID = deadEntity:GetPlayerID() local deadPlayerInfo = BattleDataGetter.GetPlayerInfo(deadEntityPlayerID) local killerPlayerID = killer:GetPlayerID() local killerPlayerInfo = BattleDataGetter.GetPlayerInfo(killerPlayerID) local beKilledBroadcastData = nil -- 挑选出的最大的播放被终结的配置数据 local deadEntityComboKill = deadComboKill local killerEntityComboKill = BattleDataGetter.GetPlayerComboKillNum(killerPlayerID) for _,broadcastID in ipairs(broadcastPVPTypeData.ID) do local success, broadcastPVPData = DataSheetManager.BroadcastPVP:TryGetDataByID(broadcastID) if success then -- 连杀 if (broadcastPVPData.ComboBroadcastID > 0 or (not string.isNilOrEmpty(broadcastPVPData.ComboIDS))) and killerEntityComboKill == broadcastPVPData.Combo then if broadcastPVPData.ComboBroadcastID > 0 and killerIsMe then -- 全频道跑马灯的只有凶手自己发送请求 local msg = pvp_broadcast_pb.C2GPVPBroadCast() msg.functionId = broadcastID msg.comboKiller.name = killerPlayerInfo.name msg.comboKiller.combo = killerEntityComboKill NetManager.SendMessage(MessageEnums.MessageC2GPVPBroadCast, msg) end if not string.isNilOrEmpty(broadcastPVPData.ComboIDS) then -- 纯客户端显示的跑马灯 local content = string.FormatByIdsKey(broadcastPVPData.ComboIDS, killerPlayerInfo.name, killerEntityComboKill) private.ShowBroadcastMsg(content) end end -- 连杀被终结 if (broadcastPVPData.ComboBeKilledBroadcastID > 0 or (not string.isNilOrEmpty(broadcastPVPData.ComboBeKilledIDS))) and deadEntityComboKill >= broadcastPVPData.Combo then if beKilledBroadcastData == nil or beKilledBroadcastData.Combo < broadcastPVPData.Combo then beKilledBroadcastData = broadcastPVPData end end end end if beKilledBroadcastData then if beKilledBroadcastData.ComboBeKilledBroadcastID > 0 and killerIsMe then -- 全频道跑马灯的只有凶手自己发送请求 local msg = pvp_broadcast_pb.C2GPVPBroadCast() msg.functionId = beKilledBroadcastData.ID msg.beKiller.name = deadPlayerInfo.name msg.beKiller.combo = deadEntityComboKill NetManager.SendMessage(MessageEnums.MessageC2GPVPBroadCast, msg) end if not string.isNilOrEmpty(beKilledBroadcastData.ComboBeKilledIDS) then -- 纯客户端显示的跑马灯 local content = string.FormatByIdsKey(beKilledBroadcastData.ComboBeKilledIDS, killerPlayerInfo.name, deadPlayerInfo.name, deadEntityComboKill) private.ShowBroadcastMsg(content) end end end end end -- 针对 势力战的跨战场需要单独写这跑马灯的功能 function private.OnHeroKillHero_GuildWar(info) local killerName, deadName, killerComboKill,deadComboKill = info.playerNameA, info.playerNameB, info.killNums, info.killNumsB if killerName == deadName then return end if BattleDataGetter.IsInReconnectFastPlay() then return end local levelType = BattleDataGetter.GetCurLevelType() local has, broadcastPVPTypeData = DataSheetManager.BroadcastPVPType:TryGetDataByLevelType(levelType) if has then local killerIsMe = killerName == BattleDataGetter.GetPlayerName() local beKilledBroadcastData = nil -- 挑选出的最大的播放被终结的配置数据 for _,broadcastID in ipairs(broadcastPVPTypeData.ID) do local success, broadcastPVPData = DataSheetManager.BroadcastPVP:TryGetDataByID(broadcastID) if success then -- 连杀 if (broadcastPVPData.ComboBroadcastID > 0 or (not string.isNilOrEmpty(broadcastPVPData.ComboIDS))) and killerComboKill == broadcastPVPData.Combo then if broadcastPVPData.ComboBroadcastID > 0 and killerIsMe then -- 全频道跑马灯的只有凶手自己发送请求 local msg = pvp_broadcast_pb.C2GPVPBroadCast() msg.functionId = broadcastID msg.comboKiller.name = killerName msg.comboKiller.combo = killerComboKill NetManager.SendMessage(MessageEnums.MessageC2GPVPBroadCast, msg) end if not string.isNilOrEmpty(broadcastPVPData.ComboIDS) then -- 纯客户端显示的跑马灯 local content = string.FormatByIdsKey(broadcastPVPData.ComboIDS, killerName, killerComboKill) private.ShowBroadcastMsg(content) end end -- 连杀被终结 if (broadcastPVPData.ComboBeKilledBroadcastID > 0 or (not string.isNilOrEmpty(broadcastPVPData.ComboBeKilledIDS))) and deadComboKill >= broadcastPVPData.Combo then if beKilledBroadcastData == nil or beKilledBroadcastData.Combo < broadcastPVPData.Combo then beKilledBroadcastData = broadcastPVPData end end end end if beKilledBroadcastData then if beKilledBroadcastData.ComboBeKilledBroadcastID > 0 and killerIsMe then -- 全频道跑马灯的只有凶手自己发送请求 local msg = pvp_broadcast_pb.C2GPVPBroadCast() msg.functionId = beKilledBroadcastData.ID msg.beKiller.name = deadName msg.beKiller.combo = deadComboKill NetManager.SendMessage(MessageEnums.MessageC2GPVPBroadCast, msg) end if not string.isNilOrEmpty(beKilledBroadcastData.ComboBeKilledIDS) then -- 纯客户端显示的跑马灯 local content = string.FormatByIdsKey(beKilledBroadcastData.ComboBeKilledIDS, killerName, deadName, deadComboKill) private.ShowBroadcastMsg(content) end end end end function private.ShowBroadcastMsg(content) local msg = { -- 优先级和 ComboBeKilledBroadcastID 一样 Priority = 100, BreakPriority = 10, content = content, mapUIType = MDL.Broadcast.MapUIType.Battle, } MDL.Broadcast.InsertBroadcastMsg(msg) end return Level_Model