local Base = require("Battle/Expression/ExpLevel/ExpLevelFunction/ExpSyncLevelFunction") local ExpSyncFourCountryChaosLevelFunction = class("ExpSyncFourCountryChaosLevelFunction",Base) local EventSystem = require('Event/EventSystem') local CountdownFrame = 100 local StopCountdownFrame = DataSheetManager.ConstData:GetDataByID("SyncFourCountryBlockDisappearTime").IntValue * LuaConst.LogicFrameRate local ShowCountdownFrame = StopCountdownFrame - CountdownFrame local EntityHeadUIModule = require("View/Battle/BattleEntityUI/EntityUIModule/EntityHeadUIModule") function ExpSyncFourCountryChaosLevelFunction:OnInitLevel() self.doCloseCountDownTimers = 0 end function ExpSyncFourCountryChaosLevelFunction:Update() Base.Update(self) if LogicUpdateManager._clientHandleFrame >= ShowCountdownFrame and LogicUpdateManager._clientHandleFrame < StopCountdownFrame then if not LogicUpdateManager.IsInReconnectFastPlay() then if LogicUpdateManager._clientHandleFrame == ShowCountdownFrame then EventSystem.Dispatch(EventID.UI_SyncSolo_OpenCountDownPanel) end local waitTimeEla = LogicUpdateManager._clientHandleFrame - ShowCountdownFrame if waitTimeEla % 20 == 0 then local second = (CountdownFrame - waitTimeEla) / 20 EventSystem.Dispatch(EventID.UI_UIBattleCountDownPanel_SetNumber , second) if second <= 0 then EventSystem.Dispatch(EventID.PlayGameSound,"UI_begin") end end end elseif LogicUpdateManager._clientHandleFrame >= StopCountdownFrame then if self.doCloseCountDownTimers < 10 then -- 优化代码(之前次数太多了) EventSystem.Dispatch(EventID.Level_CloseUIView, Const_UI_Lua.UIEnum.UIBattleCountDownFormalPanel) self.doCloseCountDownTimers = self.doCloseCountDownTimers + 1 end end end function ExpSyncFourCountryChaosLevelFunction:OnScoreChanged(entity, scoreDelta, playerScore, countryScore, reason, oldscoreNo1CampID, newScoreNo1CampID) if reason ~= LuaConst.EFourCountryScoreChangeReason.INIT then if oldscoreNo1CampID then local oldEntityList = CampManager.GetEntityListOfCampId(oldscoreNo1CampID) if oldEntityList then for i,entity in ipairs(oldEntityList) do if entity.isHero or entity.isIllusion then entity.ExpEntity:StopEffectByType(LuaConst.EffectType.FourCountryNo1) entity.ExpEntity:SetModelFourCountryCrownVisible(false) end end end end if newScoreNo1CampID then local newEntityList = CampManager.GetEntityListOfCampId(newScoreNo1CampID) for i,entity in ipairs(newEntityList) do if entity.isHero or entity.isIllusion then entity.ExpEntity:PlayEffectByType(LuaConst.EffectType.FourCountryNo1) entity.ExpEntity:SetModelFourCountryCrownVisible(true) end end self.scoreNo1CampID = newScoreNo1CampID end end EventSystem.Dispatch(EventID.UI_FourCountryWar_ScoreChange, entity, scoreDelta, playerScore, countryScore, reason) EventSystem.Dispatch(EventID.UIBattle_Element_SetHeadUI, entity.ExpEntity.RenderEntity, EntityHeadUIModule.HeadUIType.FourCountryScore, playerScore) end function ExpSyncFourCountryChaosLevelFunction:OnHandleHeroDead(killer, deadEntity, involveKillPlayerIDList, assistHeroEntityIDList, kStatistic, relaxAssistPlayerIDList) Base.OnHandleHeroDead(self, killer, deadEntity, involveKillPlayerIDList, assistHeroEntityIDList, kStatistic, relaxAssistPlayerIDList) if killer:IsHero() then if deadEntity:IsPlayerSelf() then if not killer:IsPlayerSelf() then local killerName = killer._logicInitData.Name killerName = UTL.Color.GetColorModelNameByCampRelationType(killerName, killer:GetCampID() == LogicUpdateManager._curEntity:GetCampID() and 1 or 2) local msg = string.FormatByIdsKey("IDS_SyncFourCountry_BattleFieldBroadcast_4", UTL.String.GetColorCountryName(killer:GetCampID()), killerName) --CTL.Tips.AddTipsMsg(msg) --old EventSystem.Dispatch(EventID.UI_FourCountryWar_PlayerBattleMsg, msg) --new end else --如果死亡的是其他玩家 local killerName = killer._logicInitData.Name killerName = UTL.Color.GetColorModelNameByCampRelationType(killerName, killer:GetCampID() == LogicUpdateManager._curEntity:GetCampID() and 1 or 2, killer:IsPlayerSelf()) local deadName = deadEntity._logicInitData.Name deadName = UTL.Color.GetColorModelNameByCampRelationType(deadName, deadEntity:GetCampID() == LogicUpdateManager._curEntity:GetCampID() and 1 or 2) local msg = string.FormatByIdsKey( "IDS_SyncFourCountry_BattleFieldBroadcast_5", UTL.String.GetColorCountryName(killer:GetCampID()), killerName, UTL.String.GetColorCountryName(deadEntity:GetCampID()), deadName) --CTL.Tips.AddTipsMsg(msg) --old EventSystem.Dispatch(EventID.UI_FourCountryWar_PlayerBattleMsg, msg) --new end else if deadEntity:IsPlayerSelf() then --CTL.Tips.AddTipsMsg(Const_IDS.IDS_SyncFourCountry_BattleFieldBroadcast_6) --old EventSystem.Dispatch(EventID.UI_FourCountryWar_PlayerBattleMsg, UIUtils.GetLocalizedTxt(Const_IDS.IDS_SyncFourCountry_BattleFieldBroadcast_6)) --new else local deadName = deadEntity._logicInitData.Name deadName = UTL.Color.GetColorModelNameByCampRelationType(deadName, deadEntity:GetCampID() == LogicUpdateManager._curEntity:GetCampID() and 1 or 2) --CTL.Tips.AddTipsMsg(string.FormatByIdsKey("IDS_SyncFourCountry_BattleFieldBroadcast_7", UTL.String.GetColorCountryName(deadEntity:GetCampID()), deadName)) --old EventSystem.Dispatch(EventID.UI_FourCountryWar_PlayerBattleMsg, string.FormatByIdsKey("IDS_SyncFourCountry_BattleFieldBroadcast_7", UTL.String.GetColorCountryName(deadEntity:GetCampID()), deadName)) --new end end end --主视角事件,仅自身视角 function ExpSyncFourCountryChaosLevelFunction:OnCanSeeChanged(myVisualFieldComp, targetEntity, canSee) Base.OnCanSeeChanged(self, myVisualFieldComp, targetEntity, canSee) if canSee then if targetEntity.isHero and self.scoreNo1CampID == targetEntity.CampID then targetEntity.ExpEntity:PlayEffectByType(LuaConst.EffectType.FourCountryNo1) targetEntity.ExpEntity:SetModelFourCountryCrownVisible(true) end else if targetEntity.isHero and self.scoreNo1CampID == targetEntity.CampID then targetEntity.ExpEntity:StopEffectByType(LuaConst.EffectType.FourCountryNo1) targetEntity.ExpEntity:SetModelFourCountryCrownVisible(false) end end end -- 最后结算时,需要看下是否需要弹出消极作战的提示 function ExpSyncFourCountryChaosLevelFunction:OnLevelOver() Base.OnLevelOver(self) local curPlayerHangUpState = self.levelFunction.playerHangUpStateDic[LevelPlayerManager.MyPlayerIDInRoom] if curPlayerHangUpState == LuaConst.PlayerHangUpState.PunishManualFight or curPlayerHangUpState == LuaConst.PlayerHangUpState.Punish then return end local score = self.levelFunction:GetPlayerScore(LevelPlayerManager.MyPlayerIDInRoom) local punishForAFKPoints = DataSheetManager.ConstData:GetDataByID("PunishForAFKPoints").IntValue -- 华夏争鼎里低于多少积分判定为消极 if score < punishForAFKPoints then --弹出二次提示框 UTL.MessageBox.ShowOnlyOkNoCloseBox(Const_IDS.IDS_WARNING, Const_IDS.IDS_PunishForAFK_NoticeTips2) end end return ExpSyncFourCountryChaosLevelFunction