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:
@@ -41,16 +41,6 @@ public abstract class ReceivePlayActionsReflectionBase
|
||||
|
||||
protected OperateMgr _operateMgr;
|
||||
|
||||
private const float WAIT_TIME_AFTER_START_SHOW_SELECT = 0.3f;
|
||||
|
||||
private const float WAIT_TIME_BETWEEN_CONSECUTIVE_SELECTIONS = 0.2f;
|
||||
|
||||
private const float WAIT_TIME_AFTER_START_SHOW_CHOICE = 0.5f;
|
||||
|
||||
private const float WAIT_TIME_AFTER_EVOLVE_CHOICE_SELECT = 0.15f;
|
||||
|
||||
private const float WAIT_TIME_BETWEEN_CONSECUTIVE_CHOICE_SELECTIONS = 0.5f;
|
||||
|
||||
protected BattleCardBase _actingCard;
|
||||
|
||||
protected List<BattleCardBase> _selectedCards = new List<BattleCardBase>();
|
||||
@@ -94,16 +84,6 @@ public abstract class ReceivePlayActionsReflectionBase
|
||||
return actingCard.GetSelectSkillsNoDuplication(actingCard.GetSelectTypeSkill(isEvolve).ToList());
|
||||
}
|
||||
|
||||
private VfxBase CreatePlayNonTransformChoiceCardVfx(BattleCardBase playedCard, List<BattleCardBase> choiceCards, Transform transformToPlayFrom, BattlePlayerBase battlePlayer, List<int> selectedChoiceCardIds, VfxBase battleCardSelectVfx)
|
||||
{
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(battleCardSelectVfx, CreateHideChoiceCardsVfx(playedCard, choiceCards), InstantVfx.Create(delegate
|
||||
{
|
||||
playedCard.BattleCardView.Transform.position = transformToPlayFrom.position;
|
||||
playedCard.BattleCardView.GameObject.SetActive(value: true);
|
||||
}), _operateMgr.InitSetCard(playedCard, battlePlayer.IsPlayer, isSelect: false, isRecovery: false, isChoiceSelect: true, isAccelerateSelect: false, registerDirectlyToVfxManager: false));
|
||||
return SequentialVfxPlayer.Create(parallelVfxPlayer, _operateMgr.PlayCard(playedCard, battlePlayer.IsPlayer, null, isRecovery: false, selectedChoiceCardIds));
|
||||
}
|
||||
|
||||
public static VfxBase CreateHideChoiceCardsVfx(BattleCardBase actingCard, List<BattleCardBase> choiceCardsToHide, bool dontUnloadResources = false)
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
@@ -238,7 +218,7 @@ public abstract class ReceivePlayActionsReflectionBase
|
||||
{
|
||||
ChoiceUtility.SetupChoiceCardForSkillTargetSelect(selectedChoiceCard);
|
||||
}));
|
||||
sequentialVfxPlayer2.Register(new DelaySetupVfx(() => _operateMgr.InitSetCard(selectedChoiceCard, isPlayer, isSelect: true)));
|
||||
sequentialVfxPlayer2.Register(NullVfx.GetInstance());
|
||||
sequentialVfxPlayer2.Register(CreateStartSelectVfx(selectedChoiceCard, isEvolve: false, isChoice: true));
|
||||
parallelVfxPlayer.Register(sequentialVfxPlayer2);
|
||||
parallelVfxPlayer.Register(CreateHideChoiceCardsVfx(_actingChoiceCard, _choiceCards.FindAll((BattleCardBase card) => card != selectedChoiceCard), dontUnloadResources: true));
|
||||
@@ -255,7 +235,7 @@ public abstract class ReceivePlayActionsReflectionBase
|
||||
}));
|
||||
}
|
||||
parallelVfxPlayer.Register(CreateHideChoiceCardsVfx(_actingChoiceCard, _choiceCards));
|
||||
CompleteChoiceDataIns.SetChoiceCardVfx(new DelaySetupVfx(() => _operateMgr.PlayCard(_actingChoiceCard, isPlayer, null, isRecovery: false, selectedChoiceCardIdList, isChoiceBrave)));
|
||||
CompleteChoiceDataIns.SetChoiceCardVfx(NullVfx.GetInstance());
|
||||
}
|
||||
}
|
||||
else if (isEvolve)
|
||||
@@ -266,7 +246,7 @@ public abstract class ReceivePlayActionsReflectionBase
|
||||
}
|
||||
else
|
||||
{
|
||||
CompleteChoiceDataIns.SetChoiceCardVfx(new DelaySetupVfx(() => CreatePlayNonTransformChoiceCardVfx(_actingChoiceCard, _choiceCards, selectedChoiceCard.BattleCardView.Transform.parent, battlePlayer, selectedChoiceCardIdList, battleCardSelectVfx)));
|
||||
CompleteChoiceDataIns.SetChoiceCardVfx(NullVfx.GetInstance());
|
||||
}
|
||||
sequentialVfxPlayer.Register(parallelVfxPlayer);
|
||||
_battleMgr.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer);
|
||||
@@ -318,7 +298,7 @@ public abstract class ReceivePlayActionsReflectionBase
|
||||
if (selectableCards.Count > 0)
|
||||
{
|
||||
sequentialVfxPlayer.Register(GetSelectAlertvfx(battlePlayer));
|
||||
sequentialVfxPlayer.Register(battlePlayer.BattleView.StartShowSelect(GameMgr.GetIns().IsReplayBattle ? battleCardBase : _actingCard, _currentSkill, selectableCards, isEvolve));
|
||||
sequentialVfxPlayer.Register(battlePlayer.BattleView.StartShowSelect(_battleMgr.GameMgr.IsReplayBattle ? battleCardBase : _actingCard, _currentSkill, selectableCards, isEvolve));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -366,46 +346,6 @@ public abstract class ReceivePlayActionsReflectionBase
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
protected VfxBase CreateStartFusionSelectVfx(BattleCardBase fusionCard)
|
||||
{
|
||||
_actingCard = fusionCard;
|
||||
_selectSkills = fusionCard.Skills.Where((SkillBase s) => s is Skill_fusion).ToList();
|
||||
_fusionMetamorphoseSkill = fusionCard.Skills.FirstOrDefault((SkillBase s) => s is Skill_fusion_metamorphose) as Skill_fusion_metamorphose;
|
||||
_currentSkill = _selectSkills.FirstOrDefault();
|
||||
_selectedChoiceCards.Clear();
|
||||
_isBurialRiteSelect = false;
|
||||
_selectedCards.Clear();
|
||||
_selectableCards = GetSelectableCards(fusionCard.IsPlayer);
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
BattlePlayerBase battlePlayerBase = _battleMgr.GetBattlePlayer(fusionCard.IsPlayer);
|
||||
if (!fusionCard.HasNoSelectFusionSkill)
|
||||
{
|
||||
sequentialVfxPlayer.Register(GetSelectAlertvfx(battlePlayerBase));
|
||||
}
|
||||
if (fusionCard.IsPlayer)
|
||||
{
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
fusionCard.BattleCardView.HideHandCardInfo();
|
||||
fusionCard.BattleCardView.GameObject.transform.localEulerAngles = FusionTargetSelectTouchProcessor.INIT_LOCAL_EULAR_ANGLE;
|
||||
battlePlayerBase.BattleView.PlayQueueView.AddCardToViewVfx(fusionCard.BattleCardView, forceCardIntoPlayQueue: true, isSelectTarget: true, isChoice: false);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
fusionCard.BattleCardView.HideHandCardInfo();
|
||||
fusionCard.BattleCardView.GameObject.transform.localEulerAngles = FusionTargetSelectTouchProcessor.INIT_LOCAL_EULAR_ANGLE;
|
||||
sequentialVfxPlayer.Register(battlePlayerBase.BattleView.PlayQueueView.AddCardToViewVfx(fusionCard.BattleCardView, forceCardIntoPlayQueue: true, isSelectTarget: true, isChoice: false));
|
||||
}
|
||||
sequentialVfxPlayer.Register(battlePlayerBase.BattleView.StartShowSelect(fusionCard, _currentSkill, _selectableCards, isEvol: false));
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
battlePlayerBase.BattleView.StartShowFusionUI(_actingCard, _selectableCards, 8, null);
|
||||
battlePlayerBase.ClassInformationUIController.SetIsSelect(isSelect: true);
|
||||
}));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public virtual void SelectFusionIngredientCard(int cardIndex, bool isPlayer = true)
|
||||
{
|
||||
BattlePlayerBase battlePlayer = _battleMgr.GetBattlePlayer(isPlayer);
|
||||
@@ -442,7 +382,7 @@ public abstract class ReceivePlayActionsReflectionBase
|
||||
{
|
||||
InstantVfx selectCardVfx = InstantVfx.Create(delegate
|
||||
{
|
||||
BattleManagerBase.GetIns().GetBattlePlayer(isPlayer).ClassInformationUIController.SetIsSelect(isSelect: false);
|
||||
_battleMgr.GetBattlePlayer(isPlayer).ClassInformationUIController.SetIsSelect(isSelect: false);
|
||||
});
|
||||
_actingCard.SelfBattlePlayer.BattleView.StopFusionUI();
|
||||
CompleteSelectDataIns = new CompleteSelectData(selectCardVfx);
|
||||
@@ -471,7 +411,7 @@ public abstract class ReceivePlayActionsReflectionBase
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
string text = "";
|
||||
if (GameMgr.GetIns().IsWatchBattle)
|
||||
if (_battleMgr.GameMgr.IsWatchBattle)
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
text = (battlePlayer.IsPlayer ? systemText.Get("Battle_0501") : systemText.Get("Battle_0502"));
|
||||
@@ -483,23 +423,6 @@ public abstract class ReceivePlayActionsReflectionBase
|
||||
});
|
||||
}
|
||||
|
||||
protected VfxBase CreateStartChoiceSelectVfx(BattleCardBase actingCard, SkillBase choiceSkill, bool isEvolve, BattleCardBase accelerateCard)
|
||||
{
|
||||
BattlePlayerBase battlePlayer = _battleMgr.GetBattlePlayer(actingCard.IsPlayer);
|
||||
_actingChoiceCard = actingCard;
|
||||
_choiceCards = ChoiceUtility.CreateChoiceTokenCards(actingCard, battlePlayer.BattleView, choiceSkill, _battleMgr);
|
||||
_selectedChoiceCards.Clear();
|
||||
_choiceSkill = choiceSkill;
|
||||
_numberOfChoiceCardsToSelect = ChoiceUtility.GetNumberOfCardsToSelect(choiceSkill);
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
if (isEvolve)
|
||||
{
|
||||
parallelVfxPlayer.Register(new StopEvolutionTargetFocasVfx(actingCard.BattleCardView.GameObject));
|
||||
}
|
||||
parallelVfxPlayer.Register(battlePlayer.BattleView.StartShowChoice(_actingChoiceCard, choiceSkill, _choiceCards, isEvolve, accelerateCard, isChoiceBrave: false));
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
|
||||
private BattleCardBase GetSelectedChoiceCard(int selectedChoiceCardId, List<BattleCardBase> choiceCards)
|
||||
{
|
||||
return choiceCards.Find((BattleCardBase card) => card.CardId == selectedChoiceCardId);
|
||||
|
||||
Reference in New Issue
Block a user