--战斗表现轮询管理器 local ExpUpdateManager = {} local LuaUpdater = require("Main/LuaUpdater") local ExpBatchSystem = require("Battle.Expression.ExpBatchSystem") local MonsterShowRangeSqr local dist_Level local dist_Town = 45*45 local LuaConst=LuaConst local FP=FP local ForceAllEffectNeedCulling = false -- 设置为true来让所有特效参与剔除 local FeatureTypeEffectAsPlayerSelf = { [622023] = true, [622024] = true, [622025] = true, [622026] = true, [622027] = true, [622028] = true, [622001] = true, [104120102] = true, -- 马超试炼关的隐形怪 [627102] = true, -- 肉鸽玩法的boss [627104] = true, -- 肉鸽玩法的特殊怪物 } function ExpUpdateManager.Init() local dist = DataSheetManager.ConstData:GetDataByID("MonsterShowRange").IntValue dist_Level = dist*dist MonsterShowRangeSqr = dist_Level LuaUpdater.StartUpdate(ExpUpdateManager.OnExpUpdate) LuaUpdater.StartRealTimeUpdate(ExpUpdateManager.OnExpRealTimeUpdate) end function ExpUpdateManager.EnterLevel() if LevelManager.IsNoBattleLevel() then --主城NPC显隐距离 MonsterShowRangeSqr = dist_Town else --战斗怪物显隐距离 MonsterShowRangeSqr = dist_Level end end function ExpUpdateManager.OnExpUpdate(deltaTime, timeSinceUpdate) if not LogicUpdateManager.FightBegin or LevelManager.IsLevelPause() then return end if not LogicUpdateManager.IsInReconnectFastPlay() then --实体的更新 ExpSystemManager.OnUpdate(deltaTime) --子弹的更新 ExpSystemManager.OnExpMissileUpdate(deltaTime) end end function ExpUpdateManager.OnExpRealTimeUpdate(deltaTime, timeSinceUpdate) --数据打点 BIManager.OnUpdate(deltaTime) if not LogicUpdateManager.FightBegin or LevelManager.IsLevelPause() then return end if not LogicUpdateManager.IsInReconnectFastPlay() then --同步玩法的网络检测 if LevelManager.IsSyncLevel() and not LevelManager.IsInLevelWatchBattle() and not LevelManager.IsReplayBattle()then KCPTransport.OnExpUpdate(deltaTime) end end end function ExpUpdateManager.OnPostLogicUpdate() ExpBatchSystem.BatchEntities(LogicUpdateManager._entityDic) ExpBatchSystem.BatchApplyData() end --当前控制的 function ExpUpdateManager.IsEffectAsPlayerSelf(entity) if ForceAllEffectNeedCulling then return false end --TODO 临时给长安炮塔、冲车开个后门,以后转化成数据表配置参数 if entity.isMonster and FeatureTypeEffectAsPlayerSelf[entity._logicInitData._characterData.MonsterType] then return true end local curPlayerID = LevelPlayerManager.MyPlayerIDInRoom local isMainPlayerSelf = (entity:GetPlayerID() == curPlayerID) and entity:IsMainEntityOfPlayer() if GameAppInfo.IsVersionGreaterThan113000() then if isMainPlayerSelf then return true end else return isMainPlayerSelf end local masterEntity = entity:GetMasterEntity() if masterEntity then if entity.components.base.CurMonsterFeature.AsCalledNotCullingPs then -- 作为召唤物,不剔除特效 local isMasterPlayerSelf = (masterEntity:GetPlayerID() == curPlayerID) and masterEntity:IsMainEntityOfPlayer() if isMasterPlayerSelf then return true end end end local driveComp = entity.components.drive local driverEntity = driveComp and driveComp.BeDrivedByEntity if driverEntity then local isDriverPlayerSelf = (driverEntity:GetPlayerID() == curPlayerID) and driverEntity:IsMainEntityOfPlayer() if isDriverPlayerSelf then return true end end return false end return ExpUpdateManager