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:
@@ -1,5 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
// TODO(engine-cleanup-pass2): 14 of 15 methods unrun in baseline
|
||||
// Type: Wizard.PlayerPrefsWrapper
|
||||
// See data_dumps/reports/engine-cleanup/live-methods.baseline.txt
|
||||
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
@@ -9,12 +13,6 @@ public static class PlayerPrefsWrapper
|
||||
|
||||
public static readonly int FALSE = 0;
|
||||
|
||||
public static readonly KeyValuePair<string, float> BGM_VOLUME = new KeyValuePair<string, float>("BGMVOLUME", 1f);
|
||||
|
||||
public static readonly KeyValuePair<string, float> SE_VOLUME = new KeyValuePair<string, float>("SEVOLUME", 1f);
|
||||
|
||||
public static readonly KeyValuePair<string, float> VOICE_VOLUME = new KeyValuePair<string, float>("VOICEVOLUME", 1f);
|
||||
|
||||
public static readonly KeyValuePair<string, int> SOUND_MUTE = new KeyValuePair<string, int>("SOUND_MUTE", FALSE);
|
||||
|
||||
public static readonly KeyValuePair<string, int> MOVIE_SUBTITLES = new KeyValuePair<string, int>("MOVIE_SUBTITLES", FALSE);
|
||||
@@ -51,16 +49,10 @@ public static class PlayerPrefsWrapper
|
||||
|
||||
public static readonly KeyValuePair<string, bool> CARDPACK_CARD_AUTO_OPEN = new KeyValuePair<string, bool>("SKIPCARDPACK", value: false);
|
||||
|
||||
public static readonly KeyValuePair<string, int> HOME_CENTER_CARD_INDEX = new KeyValuePair<string, int>("HOME_CARD_INDEX", 0);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_DECK_ID = new KeyValuePair<string, int>("LAST_BATTLE_DECK_ID", -1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_DECK_FORMAT_FOR_MYPAGE = new KeyValuePair<string, int>("LAST_BATTLE_DECK_FORMAT", 2);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_DECK_ID_FOR_MYPAGE = new KeyValuePair<string, int>("LAST_BATTLE_DECK_ID_FOR_MYPAGE", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_IS_DEFAULT_DECK_FOR_MYPAGE = new KeyValuePair<string, int>("LAST_BATTLE_IS_DEFDECK", TRUE);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_DECK_FORMAT_FOR_SINGLE_RECOVER = new KeyValuePair<string, int>("LAST_BATTLE_DECK_FORMAT_FOR_SINGLE_RECOVER", 2);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_LEADER_ID = new KeyValuePair<string, int>("LAST_BATTLE_LEADER_ID", 0);
|
||||
@@ -75,22 +67,6 @@ public static class PlayerPrefsWrapper
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_DECK_SLEEVE_ID = new KeyValuePair<string, string>("LAST_BATTLE_DECK_SLEEVE_ID", "");
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_DECK_ID_MULTI_DECK_ROOM1 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_DECK_ID1", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_DECK_ID_MULTI_DECK_ROOM2 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_DECK_ID2", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_DECK_ID_MULTI_DECK_ROOM3 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_DECK_ID3", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_DECK_ID_MULTI_DECK_ROOM4 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_DECK_ID4", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_DECK_ID_MULTI_DECK_ROOM1 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_DECK_ID1", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_DECK_ID_MULTI_DECK_ROOM2 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_DECK_ID2", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_DECK_ID_MULTI_DECK_ROOM3 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_DECK_ID3", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_DECK_ID_MULTI_DECK_ROOM4 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_DECK_ID4", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_ENEMY_CARD_ID_ROOM1 = new KeyValuePair<string, string>("LAST_BATTLE_ENEMY_CARD_ID_ROOM1", string.Empty);
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_ENEMY_CARD_ID_ROOM2 = new KeyValuePair<string, string>("LAST_BATTLE_ENEMY_CARD_ID_ROOM2", string.Empty);
|
||||
@@ -107,52 +83,10 @@ public static class PlayerPrefsWrapper
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_CARD_ID_FORMAT4 = new KeyValuePair<string, int>("LAST_BATTLE_ENEMY_CARD_ID_FORMAT4", 2);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_CLASS_ID_MULTI_DECK_ROOM1 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_CLASS1", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_CLASS_ID_MULTI_DECK_ROOM2 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_CLASS2", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_CLASS_ID_MULTI_DECK_ROOM3 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_CLASS3", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_CLASS_ID_MULTI_DECK_ROOM4 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_CLASS4", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_SUB_CLASS_ID_MULTI_DECK_ROOM1 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_SUB_CLASS1", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_SUB_CLASS_ID_MULTI_DECK_ROOM2 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_SUB_CLASS2", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_SUB_CLASS_ID_MULTI_DECK_ROOM3 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_SUB_CLASS3", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_SUB_CLASS_ID_MULTI_DECK_ROOM4 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_SUB_CLASS4", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_ENEMY_MY_ROTATION_ID_MULTI_DECK_ROOM1 = new KeyValuePair<string, string>("LAST_ROOM_BATTLE_ENEMY_MY_ROTATION1", string.Empty);
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_ENEMY_MY_ROTATION_ID_MULTI_DECK_ROOM2 = new KeyValuePair<string, string>("LAST_ROOM_BATTLE_ENEMY_MY_ROTATION2", string.Empty);
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_ENEMY_MY_ROTATION_ID_MULTI_DECK_ROOM3 = new KeyValuePair<string, string>("LAST_ROOM_BATTLE_ENEMY_MY_ROTATION3", string.Empty);
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_ENEMY_MY_ROTATION_ID_MULTI_DECK_ROOM4 = new KeyValuePair<string, string>("LAST_ROOM_BATTLE_ENEMY_MY_ROTATION4", string.Empty);
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_ENEMY_SLEEVE_ID_MULTI_DECK_ROOM1 = new KeyValuePair<string, string>("LAST_ROOM_BATTLE_ENEMY_SLEEVE1", "1");
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_ENEMY_SLEEVE_ID_MULTI_DECK_ROOM2 = new KeyValuePair<string, string>("LAST_ROOM_BATTLE_ENEMY_SLEEVE2", "1");
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_ENEMY_SLEEVE_ID_MULTI_DECK_ROOM3 = new KeyValuePair<string, string>("LAST_ROOM_BATTLE_ENEMY_SLEEVE3", "1");
|
||||
|
||||
public static readonly KeyValuePair<string, string> LAST_BATTLE_ENEMY_SLEEVE_ID_MULTI_DECK_ROOM4 = new KeyValuePair<string, string>("LAST_ROOM_BATTLE_ENEMY_SLEEVE4", "1");
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_SKIN_ID_MULTI_DECK_ROOM1 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_SKIN1", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_SKIN_ID_MULTI_DECK_ROOM2 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_SKIN2", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_SKIN_ID_MULTI_DECK_ROOM3 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_SKIN3", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_SKIN_ID_MULTI_DECK_ROOM4 = new KeyValuePair<string, int>("LAST_ROOM_BATTLE_ENEMY_SKIN4", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_PLAYER_BAN_DECK_ID = new KeyValuePair<string, int>("LAST_BATTLE_PLAYER_BAN_DECK_ID", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, int> LAST_BATTLE_ENEMY_BAN_DECK_ID = new KeyValuePair<string, int>("LAST_BATTLE_ENEMY_BAN_DECK_ID", 1);
|
||||
|
||||
public static readonly KeyValuePair<string, string> ROOM_MATCH_2PICK_DRAFT_MY_SELECT_DECK = new KeyValuePair<string, string>("ROOM_MATCHI_2PICK_DRAFT_MY_SELECT_DECK", "");
|
||||
|
||||
public static readonly KeyValuePair<string, string> QUEST_LAST_USED_DECK_INFO = new KeyValuePair<string, string>("QUEST_LAST_USED_DECK_INFO", string.Empty);
|
||||
|
||||
public static readonly KeyValuePair<string, string> FIRST_TIPS = new KeyValuePair<string, string>("FIRST_TIPS", "0");
|
||||
@@ -319,8 +253,6 @@ public static class PlayerPrefsWrapper
|
||||
|
||||
public static readonly KeyValuePair<string, int> AUTO_CACHE_CLEAR_FLAG = new KeyValuePair<string, int>("AUTO_CACHE_CLEAR_FLAG", FALSE);
|
||||
|
||||
public static readonly KeyValuePair<string, int> ASSET_FILE_ERROR_LATE = new KeyValuePair<string, int>("ASSET_FILE_ERROR_IN_BATTLE", FALSE);
|
||||
|
||||
public static readonly KeyValuePair<string, int> PURCHASE_ALERT = new KeyValuePair<string, int>("PURCHASE_ALERT", TRUE);
|
||||
|
||||
public static readonly KeyValuePair<string, int> JOINING_GUILD_ID = new KeyValuePair<string, int>("JOINING_GUILD_ID", -1);
|
||||
@@ -394,11 +326,6 @@ public static class PlayerPrefsWrapper
|
||||
return PlayerPrefs.GetInt(id.Key, id.Value);
|
||||
}
|
||||
|
||||
public static float GetValue(KeyValuePair<string, float> id)
|
||||
{
|
||||
return PlayerPrefs.GetFloat(id.Key, id.Value);
|
||||
}
|
||||
|
||||
public static string GetValue(KeyValuePair<string, string> id)
|
||||
{
|
||||
return PlayerPrefs.GetString(id.Key, id.Value);
|
||||
@@ -419,51 +346,11 @@ public static class PlayerPrefsWrapper
|
||||
PlayerPrefs.SetInt(id.Key, value);
|
||||
}
|
||||
|
||||
public static void SetValue(KeyValuePair<string, float> id, float value)
|
||||
{
|
||||
PlayerPrefs.SetFloat(id.Key, value);
|
||||
}
|
||||
|
||||
public static void SetValue(KeyValuePair<string, string> id, string value)
|
||||
{
|
||||
PlayerPrefs.SetString(id.Key, value);
|
||||
}
|
||||
|
||||
public static void ConvertOldStageIdListToNewStageIdList()
|
||||
{
|
||||
int value = GetValue(OFF_STAGE);
|
||||
if (value == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool[] array = new bool[Data.Load.data.OpenBattleFieldIdList.Count];
|
||||
string[] array2 = new string[12]
|
||||
{
|
||||
"1", "2", "3", "4", "5", "6", "7", "10", "18", "30",
|
||||
"31", "1005"
|
||||
};
|
||||
new List<int>();
|
||||
int num = value;
|
||||
int num2 = 1;
|
||||
for (int i = 0; i < array2.Length; i++)
|
||||
{
|
||||
if ((num & num2) != 0)
|
||||
{
|
||||
for (int j = 0; j < Data.Load.data.OpenBattleFieldIdList.Count; j++)
|
||||
{
|
||||
if (array2[i] == Data.Load.data.OpenBattleFieldIdList[j].ToString())
|
||||
{
|
||||
array[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
num2 *= 2;
|
||||
}
|
||||
SetValue(OFF_STAGE, 0);
|
||||
SetValue(OFF_STAGE_ID, ConvertStageIdListToSaveData(array));
|
||||
}
|
||||
|
||||
public static void TurnOnFirsStageIfStageIdListAllOff()
|
||||
{
|
||||
List<int> list = CreateStageOffList();
|
||||
|
||||
Reference in New Issue
Block a user