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:
@@ -11,20 +11,11 @@ public static class Global
|
||||
{
|
||||
public enum CHAR_TYPE
|
||||
{
|
||||
PLAYER,
|
||||
ENEMY,
|
||||
NONE,
|
||||
MAX
|
||||
}
|
||||
NONE }
|
||||
|
||||
public enum CardRarity
|
||||
{
|
||||
MIN = 1,
|
||||
BRONZE = 1,
|
||||
SILVER = 2,
|
||||
GOLD = 3,
|
||||
LEGEND = 4,
|
||||
MAX = 5
|
||||
}
|
||||
|
||||
public enum LANG_TYPE
|
||||
@@ -37,9 +28,7 @@ public static class Global
|
||||
Fre,
|
||||
Ita,
|
||||
Ger,
|
||||
Spa,
|
||||
Max
|
||||
}
|
||||
Spa }
|
||||
|
||||
public struct LanguageProps
|
||||
{
|
||||
@@ -62,82 +51,6 @@ public static class Global
|
||||
|
||||
public const int NONE = -1;
|
||||
|
||||
public const string NONE_TEXT = "NONE";
|
||||
|
||||
public const int GOBLIN_CARD_ID = 100011010;
|
||||
|
||||
public const int FIGHTER_CARD_ID = 100011020;
|
||||
|
||||
public const int EVOLVE_TO_OTHER_CARD_INITIAL_ID = 910;
|
||||
|
||||
public const int CHOICE_BRAVE_CARD_INITIAL_ID = 930;
|
||||
|
||||
public const int RITE_OF_THE_IGNORANT_ID = 900344060;
|
||||
|
||||
public const int GHIOS_SPARKLING_PRISM_ID = 120341020;
|
||||
|
||||
public const int ARAMIS_ID = 900241110;
|
||||
|
||||
public const int WIELDER_OF_THE_COSMOS_ID = 123841020;
|
||||
|
||||
public const int SLAUGHTERING_SAMURAI_ID = 130241030;
|
||||
|
||||
public const int GOBLIN_MAGE_ID = 125021010;
|
||||
|
||||
public const int ARCHANGEL_OF_EVOCATION_ID = 117031020;
|
||||
|
||||
public const int PEERLESS_WARRIOR_ID = 129241020;
|
||||
|
||||
public const int ELEANOR_TECHNIQUE_ID = 930344070;
|
||||
|
||||
public const int VAIDI_SECRET_ART_ID = 930444050;
|
||||
|
||||
public const int BRIARMAIDEN_ID = 132141010;
|
||||
|
||||
public const int THUNDER_GOD_OF_THE_TEMPEST_ID = 123031020;
|
||||
|
||||
public const int REAPER_CARD_IDX = -99;
|
||||
|
||||
public const long ONE_SECOND = 10000000L;
|
||||
|
||||
public const float BASE_SCREEN_WIDTH_SIZE = 1280f;
|
||||
|
||||
public const float BASE_SCREEN_HEIGHT_SIZE = 640f;
|
||||
|
||||
public const int STANDARD_DECK_CARD_NUM_MAX = 40;
|
||||
|
||||
public const int TWO_PICK_DECK_MAX_NUM = 30;
|
||||
|
||||
public const int WIND_FALL_DECK_MAX_NUM = 35;
|
||||
|
||||
public const int STANDARD_DECK_SAVABLE_CARD_NUM_MAX = 50;
|
||||
|
||||
public const int SAME_KIND_NUM_MAX_BASE = 3;
|
||||
|
||||
public const int CARD_RARITY_MIN = 1;
|
||||
|
||||
public const int CARD_RARITY_BRONZE = 1;
|
||||
|
||||
public const int CARD_RARITY_SILVER = 2;
|
||||
|
||||
public const int CARD_RARITY_GOLD = 3;
|
||||
|
||||
public const int CARD_RARITY_LEGEND = 4;
|
||||
|
||||
public const int CARD_RARITY_MAX = 5;
|
||||
|
||||
public const int DAMAGE_EFFECT_MAX_NUM = 12;
|
||||
|
||||
public const float MULLIGAN_TIME_LIMIT = 60f;
|
||||
|
||||
public const float TURN_TIME_LIMIT = 90f;
|
||||
|
||||
public const float TURN_TIME_EXTEND_ONPLAY = 3f;
|
||||
|
||||
public const float TURN_TIME_EXTEND_MAX = 15f;
|
||||
|
||||
public const float DRAG_DISTANCE = 40f;
|
||||
|
||||
public static Color CARD_SELECT_COLOR;
|
||||
|
||||
public static Color CARD_PASSIVE_COLOR;
|
||||
@@ -234,22 +147,6 @@ public static class Global
|
||||
|
||||
public static readonly Vector3 CLASS_BATTLE_POSITION_ENEMY;
|
||||
|
||||
public const int BATTLE_LAYER = 10;
|
||||
|
||||
public const int SUB_PARTICLES_LAYER = 12;
|
||||
|
||||
public const int HIGH_RANK_EVOLVE_LAYER = 13;
|
||||
|
||||
public const int BATTLE_UNDER_LAYER = 15;
|
||||
|
||||
public const int FRONT_UI_LAYER = 24;
|
||||
|
||||
public const int SYSTEM_UI_LAYER = 22;
|
||||
|
||||
public const int CUT_IN_LAYER = 31;
|
||||
|
||||
public const int EMPTY_DECK_ID = -1;
|
||||
|
||||
public static readonly Vector3 EP_PANEL_POSITION_PLAYER;
|
||||
|
||||
public static readonly Vector3 PLAYER_CHOICE_BRAVE_BUTTON_POSITION;
|
||||
@@ -258,10 +155,6 @@ public static class Global
|
||||
|
||||
public static readonly Vector3 PLAYER_CHOICE_BRAVE_BUTTON_POSITION_ZOOM;
|
||||
|
||||
public const int DEFAULT_EMBLEM_ID = 100000000;
|
||||
|
||||
public const int DEFAULT_DEGREE_ID = 300003;
|
||||
|
||||
public static Vector2 WEBVIEW_NORMAL_SIZE;
|
||||
|
||||
public static Vector3 POSITION_COST_ICON;
|
||||
@@ -286,14 +179,6 @@ public static class Global
|
||||
|
||||
public static int WideFieldOfView;
|
||||
|
||||
public const float WideFieldOfViewAspectRatioThreshold = 1.5f;
|
||||
|
||||
public const float ASPECT_RATIO_OVER_16_9 = 1.8f;
|
||||
|
||||
public const string BASE_GAME_FONT_NAME = "A-OTF-KaiminTuStd-Bold";
|
||||
|
||||
public const string BASE_BITMAP_FONT_NAME = "FOT-TsukuAOldMinPr6-E";
|
||||
|
||||
public static string GAME_FONT_NAME;
|
||||
|
||||
public static string[] fontFileNames;
|
||||
@@ -302,36 +187,12 @@ public static class Global
|
||||
|
||||
public static List<int> SeSysSummonLandingDuplicateCheckId;
|
||||
|
||||
public const int ROTATION_SEASON_CHANGE_ERROR_FOR_BUY = 110;
|
||||
|
||||
public const int ROTATION_SEASON_CHANGE_ERROR = 109;
|
||||
|
||||
private const int CHINESE_TAIWAN_ID = 1028;
|
||||
|
||||
private const int CHINESE_HONGKONG_ID = 3076;
|
||||
|
||||
private const int CHINESE_MAKAO_ID = 5124;
|
||||
|
||||
private const int CHINESE_SINGAPORE_ID = 4100;
|
||||
|
||||
private const int CHINESE_CHINA_ID = 2052;
|
||||
|
||||
public const int LANG_MAX = 9;
|
||||
|
||||
public static string jpn_font;
|
||||
|
||||
public const string CHS_FONT = "DFGBWB7-900";
|
||||
|
||||
public static LanguageProps[] LanguagePropList;
|
||||
|
||||
public static UnityEngine.Font GAME_FONT;
|
||||
|
||||
public const string CLONE_SUFFIX = "(Clone)";
|
||||
|
||||
private const string BBCodePattern = "(\\[[a-z0-9\\/\\-]*\\])";
|
||||
|
||||
public const string BBCodePatternName = "(\\[[a-z0-9\\/\\-]*(rub\\<[^\\>]*\\>)*\\])";
|
||||
|
||||
private static Vector2 CARD_NAME_POS_SHORT;
|
||||
|
||||
private static Vector2 CARD_NAME_POS_NORMAL;
|
||||
@@ -346,12 +207,6 @@ public static class Global
|
||||
|
||||
private static int CARD_NAME_SIZE_ALPHABET_LANGUAGE;
|
||||
|
||||
public const int CARD_NAME_LIMIT_LENGTH_ENG = 11;
|
||||
|
||||
public const int CARD_NAME_LIMIT_LENGTH_JPN = 5;
|
||||
|
||||
private const char ZERO_WIDTH_MARKER = '\u200b';
|
||||
|
||||
private static readonly LANG_TYPE[] WordBreakLanguages;
|
||||
|
||||
private static readonly LANG_TYPE[] AlphabetLanguages;
|
||||
@@ -360,18 +215,6 @@ public static class Global
|
||||
|
||||
private static readonly string[] AlphabetLanguageNames;
|
||||
|
||||
public static bool IsSnCollabSkin(int skinId)
|
||||
{
|
||||
if (4300 <= skinId)
|
||||
{
|
||||
return skinId <= 4399;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern int GetUserDefaultLangID();
|
||||
|
||||
static Global()
|
||||
{
|
||||
CARD_SELECT_COLOR = Color.cyan;
|
||||
@@ -661,38 +504,6 @@ public static class Global
|
||||
}
|
||||
}
|
||||
|
||||
public static List<string> GetParentList(Transform t, bool isOwnContains)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
if (isOwnContains)
|
||||
{
|
||||
list.Add(t.name);
|
||||
}
|
||||
Transform transform = null;
|
||||
Transform transform2 = t;
|
||||
while ((transform = transform2.parent) != null)
|
||||
{
|
||||
list.Insert(0, transform.name);
|
||||
transform2 = transform;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static string GetParentListToString(Transform t, bool isOwnContains)
|
||||
{
|
||||
List<string> parentList = GetParentList(t, isOwnContains);
|
||||
string text = string.Empty;
|
||||
for (int i = 0; i < parentList.Count; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
text += ":";
|
||||
}
|
||||
text += parentList[i];
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public static bool IsAlphabetLanguage()
|
||||
{
|
||||
string textLanguage = CustomPreference.GetTextLanguage();
|
||||
@@ -705,66 +516,6 @@ public static class Global
|
||||
return WordBreakLanguageNames.Contains(textLanguage);
|
||||
}
|
||||
|
||||
public static LANG_TYPE CastToLangType(string type)
|
||||
{
|
||||
foreach (LANG_TYPE item in Enum.GetValues(typeof(LANG_TYPE)).Cast<LANG_TYPE>())
|
||||
{
|
||||
if (type == item.ToString())
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return LANG_TYPE.Max;
|
||||
}
|
||||
|
||||
public static bool IsSupportedLanguageType(string langType)
|
||||
{
|
||||
for (int i = 0; i < LanguagePropList.Count(); i++)
|
||||
{
|
||||
if (LanguagePropList[i].LangType == langType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsSupportedSystemLanguage(string sysLang)
|
||||
{
|
||||
for (int i = 0; i < LanguagePropList.Count(); i++)
|
||||
{
|
||||
if (LanguagePropList[i].Name == sysLang)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static string GetDisplayLanguage(string type)
|
||||
{
|
||||
for (int i = 0; i < LanguagePropList.Count(); i++)
|
||||
{
|
||||
if (LanguagePropList[i].LangType == type)
|
||||
{
|
||||
return LanguagePropList[i].DisplayName;
|
||||
}
|
||||
}
|
||||
return LanguagePropList[0].DisplayName;
|
||||
}
|
||||
|
||||
public static string GetLanguageType(string sysLang)
|
||||
{
|
||||
for (int i = 0; i < LanguagePropList.Count(); i++)
|
||||
{
|
||||
if (LanguagePropList[i].Name == sysLang)
|
||||
{
|
||||
return LanguagePropList[i].LangType;
|
||||
}
|
||||
}
|
||||
return LanguagePropList[0].LangType;
|
||||
}
|
||||
|
||||
public static string GetFontLangType(string type)
|
||||
{
|
||||
for (int i = 0; i < LanguagePropList.Count(); i++)
|
||||
@@ -776,22 +527,4 @@ public static class Global
|
||||
}
|
||||
return LanguagePropList[0].Font;
|
||||
}
|
||||
|
||||
public static string GetSystemLanguage()
|
||||
{
|
||||
if (Application.systemLanguage == SystemLanguage.Chinese)
|
||||
{
|
||||
switch (GetUserDefaultLangID())
|
||||
{
|
||||
case 2052:
|
||||
case 4100:
|
||||
return SystemLanguage.ChineseSimplified.ToString();
|
||||
case 1028:
|
||||
case 3076:
|
||||
case 5124:
|
||||
return SystemLanguage.ChineseTraditional.ToString();
|
||||
}
|
||||
}
|
||||
return Application.systemLanguage.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user