engine cleanup passes 4-7 + multi-instancing ambient rip
Squashes 146 commits from battle-engine-extraction. Net: 2,045 files changed, +11,896 / -158,687 lines. Ships engine passes 4-7 (dead-code cull, view-layer stub, receive-path shrink) plus the Phase-5 AsyncLocal ambient deletion that turns concurrent battles into a type-system property rather than a scope contract. ## What landed **Passes 4-7 (chunks 1-34):** Extended the Phase-4 const-false collapse into a cascading cull across the skill graph, view layer, and receive-path periphery. Six mode flags (IsWatchBattle/IsReplayBattle/IsAdmin/IsAdminWatch/IsPuzzleQuest/ IsAINetwork) became `const false`, every guarded block deleted. Field*.cs subclass ctors + BackGroundBase + ObjectChecker culled to no-ops. Mulligan family reworked to take a mgr param through IMulliganMgr.InitMulligan. Emotion/Recovery/Resource clusters null-stubbed. Prediction/OperationSimulator/ skill filters converted from static ambient reads to per-mgr reads via SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr / ins.BattleMgr / this.BattleMgr. **Phase-5 ambient rip (chunks 35-47):** Deleted BattleAmbient / BattleAmbient- Context / TestBattleScope in full. Every per-battle mutable slot now lives on the mgr instance itself: mgr.InstanceIsForecast / InstanceIsRandomDraw / InstanceRecoveryInfo / InstanceViewerId / InstanceNetworkAgent / GameMgr BattleManagerBase.GetIns() returns null unconditionally; the residual static flags + 3 façades (Certification.ViewerId, Data.BattleRecoveryInfo, ToolboxGame.RealTimeNetworkAgent) are null-tolerant defaults kept for the handful of engine-internal readers that still reference their types. Zero BattleAmbient references anywhere in engine + node + tests. Added pre-seeded GameMgr ctor overload threaded through the mgr chain (BattleManagerBase → SingleBattleMgr / NetworkBattleManagerBase → NetworkStandard- BattleMgr → HeadlessBattleMgr / HeadlessNetworkBattleMgr). Fixtures build a GameMgr, seed it via HeadlessEngineEnv.SeedCharaIds/SeedNetUser, and pass it to the mgr's ctor — no ambient reach. Node side (SVSim.BattleNode/SessionBattleEngine): _ctx replaced with a plain GameMgr field; 34 `using var _ambient = BattleAmbient.Enter(_ctx)` scope wraps ripped from every accessor and mutator; EngineGlobalInit.WirePerSessionGameMgr takes GameMgr as a param and runs from SessionBattleEngine.SetupInternal BEFORE mgr construction. Test side: TestBattleScope deleted; 18 fixture [SetUp]s migrated to `HeadlessEngineEnv.EnsureProcessGlobals()`; MultiInstanceEngineTests rewritten around per-mgr construction (GetIns() → null is the pinned invariant). ## Regression fixes - **chunk-48** (MulliganCtrl): chunk-35's `= null` stubs on card lookups broke the live receive-driven Deal path (BattlePlayerBase.DrawCard NRE'd downstream of NetworkPlayerMulliganCtrl.StartMulliganVfx). Restored the three lookups via `_battlePlayer.BattleMgr.GetBattleCardIdx`. Engine tests were satisfied by the WireMulliganPhase seam; unit tests exposed the live-path gap. ## Ship state - SVSim.BattleEngine.Tests: 56/56 pass, 2 skip - SVSim.UnitTests: 1554/1554 pass (was 1523/31-fail before chunk 48) - Solution build: 0 source warnings (40 pre-existing NU1902 MessagePack CVEs in SVSim.EmulatedEntrypoint, unrelated) - Sequential PVP smoke: verified live (two back-to-back battles, no regression on cleanup/spinup) - Concurrent PVP smoke: verified live Adds tools/engine-port/ClosureAnalyzer/ — the Roslyn transitive-type-closure analyzer needed to make future cascade cleanup safe (per feedback memory "Engine cleanup needs closure tool" from the 2026-06-28 pass-3 failure). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -7,331 +7,48 @@ public class QualityManager : MonoBehaviour, IManager
|
||||
{
|
||||
public enum GPUQualityLevel
|
||||
{
|
||||
Level_1,
|
||||
Level_2,
|
||||
Level_3,
|
||||
Level_4
|
||||
}
|
||||
|
||||
public enum AssetQualityLevel
|
||||
{
|
||||
None,
|
||||
Level_1,
|
||||
Level_2,
|
||||
Max
|
||||
}
|
||||
None}
|
||||
|
||||
public enum SoundQualityLevel
|
||||
{
|
||||
None,
|
||||
Level_1,
|
||||
Level_2,
|
||||
Max
|
||||
}
|
||||
None}
|
||||
|
||||
public enum MovieQualityLevel
|
||||
{
|
||||
None,
|
||||
Level_1,
|
||||
Level_2,
|
||||
Max
|
||||
}
|
||||
None}
|
||||
|
||||
public enum MemoryQualityLevel
|
||||
{
|
||||
Level_1,
|
||||
Level_2
|
||||
}
|
||||
|
||||
public enum GameQualityLevel
|
||||
{
|
||||
Level_1,
|
||||
Level_2,
|
||||
Level_3,
|
||||
Level_4
|
||||
}
|
||||
|
||||
public enum OutLineLevel
|
||||
{
|
||||
OutLine_On,
|
||||
OutLine_Off
|
||||
}
|
||||
|
||||
private GPUQualityLevel _gpuQualityLevel;
|
||||
|
||||
private AssetQualityLevel _assetQualityLevel;
|
||||
|
||||
private SoundQualityLevel _soundQualityLevel;
|
||||
|
||||
private MovieQualityLevel _movieQualityLevel;
|
||||
|
||||
private MemoryQualityLevel _memoryQualityLevel;
|
||||
|
||||
private Vector2 _deviceResolution = Vector2.zero;
|
||||
|
||||
private Vector2 _gameResolution = Vector2.zero;
|
||||
|
||||
private int _defaultFrameRate = 60;
|
||||
|
||||
private bool _isDeviceResolutionSetting;
|
||||
|
||||
public bool isFullScreen;
|
||||
|
||||
private GameQualityLevel _gameQualityLevel;
|
||||
|
||||
private OutLineLevel _outlineLevel;
|
||||
|
||||
public Vector2 deviceResolution => _deviceResolution;
|
||||
|
||||
public Vector2 gameResolution => _gameResolution;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
UpdateFromUnity();
|
||||
}
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
while (Toolbox.SavedataManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
Initialize();
|
||||
Toolbox.QualityManager = this;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
CheckGPUQuality();
|
||||
CheckMemoryQuality();
|
||||
CheckAssetQuality();
|
||||
CheckSoundQuality();
|
||||
CheckMovieQuality();
|
||||
InitializeGameQuality();
|
||||
}
|
||||
|
||||
private void CheckGPUQuality()
|
||||
{
|
||||
_gpuQualityLevel = GPUQualityLevel.Level_4;
|
||||
}
|
||||
|
||||
private void CheckMemoryQuality()
|
||||
{
|
||||
_memoryQualityLevel = MemoryQualityLevel.Level_2;
|
||||
}
|
||||
|
||||
private void CheckAssetQuality()
|
||||
{
|
||||
_assetQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? AssetQualityLevel.Level_1 : AssetQualityLevel.Level_2);
|
||||
SetAssetQualityLevel(_assetQualityLevel);
|
||||
}
|
||||
|
||||
private void CheckSoundQuality()
|
||||
{
|
||||
int num = Toolbox.SavedataManager.GetInt("SOUNDQUALIY");
|
||||
if (num != 0)
|
||||
{
|
||||
_soundQualityLevel = (SoundQualityLevel)num;
|
||||
}
|
||||
else
|
||||
{
|
||||
_soundQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? SoundQualityLevel.Level_1 : SoundQualityLevel.Level_2);
|
||||
}
|
||||
SetSoundQualityLevel(_soundQualityLevel);
|
||||
}
|
||||
|
||||
private void CheckMovieQuality()
|
||||
{
|
||||
_movieQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? MovieQualityLevel.Level_1 : MovieQualityLevel.Level_2);
|
||||
}
|
||||
|
||||
public static GPUQualityLevel GetGPUQualityLevel()
|
||||
{
|
||||
if (Toolbox.QualityManager == null)
|
||||
{
|
||||
return GPUQualityLevel.Level_1;
|
||||
}
|
||||
return Toolbox.QualityManager._gpuQualityLevel;
|
||||
}
|
||||
|
||||
public static MemoryQualityLevel GetMemoryQualityLevel()
|
||||
{
|
||||
if (Toolbox.QualityManager == null)
|
||||
{
|
||||
return MemoryQualityLevel.Level_1;
|
||||
}
|
||||
return Toolbox.QualityManager._memoryQualityLevel;
|
||||
}
|
||||
|
||||
public static void SetAssetQualityLevel(AssetQualityLevel _AssetQualityLevel)
|
||||
{
|
||||
if (Toolbox.QualityManager != null)
|
||||
{
|
||||
Toolbox.QualityManager._assetQualityLevel = _AssetQualityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public static AssetQualityLevel GetAssetQualityLevel()
|
||||
{
|
||||
if (Toolbox.QualityManager == null)
|
||||
{
|
||||
return AssetQualityLevel.Level_1;
|
||||
}
|
||||
return Toolbox.QualityManager._assetQualityLevel;
|
||||
}
|
||||
|
||||
public static void SetSoundQualityLevel(SoundQualityLevel _SoundQualityLevel)
|
||||
{
|
||||
if (Toolbox.QualityManager != null)
|
||||
{
|
||||
Toolbox.QualityManager._soundQualityLevel = _SoundQualityLevel;
|
||||
Toolbox.SavedataManager.SetInt("SOUNDQUALIY", (int)Toolbox.QualityManager._soundQualityLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public static SoundQualityLevel GetSoundQualityLevel()
|
||||
{
|
||||
if (Toolbox.QualityManager == null)
|
||||
{
|
||||
return SoundQualityLevel.Level_1;
|
||||
}
|
||||
return Toolbox.QualityManager._soundQualityLevel;
|
||||
}
|
||||
|
||||
public static void SetMovieQualityLevel(MovieQualityLevel _MovieQualityLevel)
|
||||
{
|
||||
if (Toolbox.QualityManager != null)
|
||||
{
|
||||
Toolbox.QualityManager._movieQualityLevel = _MovieQualityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public static MovieQualityLevel GetMovieQualityLevel()
|
||||
{
|
||||
if (Toolbox.QualityManager == null)
|
||||
{
|
||||
return MovieQualityLevel.Level_1;
|
||||
}
|
||||
return Toolbox.QualityManager._movieQualityLevel;
|
||||
}
|
||||
|
||||
public void LimitResolution()
|
||||
{
|
||||
_gameResolution = _deviceResolution;
|
||||
if (_deviceResolution.x > 1280f || _deviceResolution.y > 1280f)
|
||||
{
|
||||
float num = 1280f / _deviceResolution.x;
|
||||
_gameResolution = new Vector2(_deviceResolution.x * num, _deviceResolution.y * num);
|
||||
Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen);
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeResolution(float rate, bool saveratio = true)
|
||||
{
|
||||
LimitResolution();
|
||||
float num = _gameResolution.x * rate / _gameResolution.x;
|
||||
_gameResolution = new Vector2(_gameResolution.x * num, _gameResolution.y * num);
|
||||
Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen);
|
||||
}
|
||||
|
||||
public void ChangeResolutionToDeviceSetting()
|
||||
{
|
||||
_gameResolution = _deviceResolution;
|
||||
Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen);
|
||||
}
|
||||
|
||||
public void ChangeResolution(float width, float height, bool fullscreen)
|
||||
{
|
||||
if (width == 0f || height == 0f)
|
||||
{
|
||||
width = Screen.width;
|
||||
height = Screen.height;
|
||||
}
|
||||
isFullScreen = fullscreen;
|
||||
_deviceResolution = new Vector2(width, height);
|
||||
Screen.SetResolution((int)width, (int)height, fullscreen);
|
||||
}
|
||||
|
||||
private void InitializeGameQuality()
|
||||
{
|
||||
if (_gpuQualityLevel == GPUQualityLevel.Level_4)
|
||||
{
|
||||
_gameQualityLevel = GameQualityLevel.Level_4;
|
||||
}
|
||||
else if (_gpuQualityLevel == GPUQualityLevel.Level_3)
|
||||
{
|
||||
_gameQualityLevel = GameQualityLevel.Level_3;
|
||||
}
|
||||
else if (_gpuQualityLevel == GPUQualityLevel.Level_2)
|
||||
{
|
||||
_gameQualityLevel = GameQualityLevel.Level_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
_gameQualityLevel = GameQualityLevel.Level_1;
|
||||
}
|
||||
if (_memoryQualityLevel == MemoryQualityLevel.Level_1)
|
||||
{
|
||||
_gameQualityLevel = GameQualityLevel.Level_1;
|
||||
}
|
||||
if (!_isDeviceResolutionSetting)
|
||||
{
|
||||
_deviceResolution = new Vector2(Screen.width, Screen.height);
|
||||
_isDeviceResolutionSetting = true;
|
||||
}
|
||||
if (_gpuQualityLevel <= GPUQualityLevel.Level_2 && Toolbox.SavedataManager.GetInt("SOUNDQUALIY") == 0)
|
||||
{
|
||||
SetSoundQualityLevel(SoundQualityLevel.Level_1);
|
||||
}
|
||||
DecideDeviceSetting();
|
||||
}
|
||||
|
||||
private void DecideDeviceSetting()
|
||||
{
|
||||
string graphicsDeviceName = SystemInfo.graphicsDeviceName;
|
||||
if (graphicsDeviceName.Contains("PowerVR") && graphicsDeviceName.Contains("SGX 540"))
|
||||
{
|
||||
_outlineLevel = OutLineLevel.OutLine_Off;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGameQualityLevel(GPUQualityLevel level)
|
||||
{
|
||||
_gpuQualityLevel = level;
|
||||
}
|
||||
|
||||
public GameQualityLevel GetGameQualityLevel()
|
||||
{
|
||||
return _gameQualityLevel;
|
||||
}
|
||||
|
||||
public void SetFrameRate(int frameRate)
|
||||
{
|
||||
_defaultFrameRate = frameRate;
|
||||
}
|
||||
|
||||
public int GetFrameRate()
|
||||
{
|
||||
return _defaultFrameRate;
|
||||
}
|
||||
|
||||
public void ChangeResolutionFixedHalf()
|
||||
{
|
||||
}
|
||||
|
||||
public void ChangeResolutionFixedBack()
|
||||
{
|
||||
}
|
||||
|
||||
public OutLineLevel GetOutLineLevel()
|
||||
{
|
||||
return _outlineLevel;
|
||||
}
|
||||
|
||||
public void UpdateFromUnity()
|
||||
{
|
||||
isFullScreen = Screen.fullScreen;
|
||||
|
||||
Reference in New Issue
Block a user