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:
@@ -14,11 +14,7 @@ public class QuestSelectionPage : UIBase
|
||||
{
|
||||
NONE,
|
||||
PUZZLE,
|
||||
BOSS_RUSH,
|
||||
SECRET_BOSS
|
||||
}
|
||||
|
||||
private const int BEGINNER_CHARACTER_ID = 4403;
|
||||
BOSS_RUSH }
|
||||
|
||||
[SerializeField]
|
||||
private UISpriteAtlasOverwriter _spriteAtlasOverwriter;
|
||||
@@ -80,27 +76,9 @@ public class QuestSelectionPage : UIBase
|
||||
[SerializeField]
|
||||
private GameObject _winBonusRoot;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _winBonusBeforeRoot;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _winBonusAfterRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _winBonusCountLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _winBonusCountSprite;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _bossRushTurnDisplayRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _bossRushShortestClearLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _bossRushShortestClearClassIcon;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _tweetBannerButton;
|
||||
|
||||
@@ -137,16 +115,6 @@ public class QuestSelectionPage : UIBase
|
||||
|
||||
private List<QuestSelectionButtonData> _buttonData;
|
||||
|
||||
private const string BG_TEXTURE_NAME = "bg_quest";
|
||||
|
||||
private const int REWARD_DISPLAY_MAX_COUNT = 99;
|
||||
|
||||
private const int QUEST_POINT_CONFIRM_DIALOG_DEPTH = 1;
|
||||
|
||||
private const string POINT_UP_SPRITE_PREFIX = "point_up_";
|
||||
|
||||
private const int WIN_COUNT_MAX = 3;
|
||||
|
||||
public override bool IsUseCommonBackground()
|
||||
{
|
||||
return false;
|
||||
@@ -422,7 +390,7 @@ public class QuestSelectionPage : UIBase
|
||||
|
||||
private QuestSelectionButtonData GetDefaultSelectData()
|
||||
{
|
||||
QuestBattleData questBattleData = GameMgr.GetIns().GetDataMgr().QuestBattleData;
|
||||
QuestBattleData questBattleData = null; // Pre-Phase-5b: headless has no QuestBattleData
|
||||
if (questBattleData != null)
|
||||
{
|
||||
QuestSelectionButtonData questSelectionButtonData = null;
|
||||
@@ -452,9 +420,9 @@ public class QuestSelectionPage : UIBase
|
||||
return questSelectionButtonData;
|
||||
}
|
||||
}
|
||||
if (GameMgr.GetIns().GetDataMgr().QuestFirstSelectType == FirstSelectType.PUZZLE)
|
||||
if (false /* Pre-Phase-5b: headless has no QuestFirstSelectType */)
|
||||
{
|
||||
GameMgr.GetIns().GetDataMgr().QuestFirstSelectType = FirstSelectType.NONE;
|
||||
// Pre-Phase-5b: headless has no QuestFirstSelectType write
|
||||
if (_puzzleQuestInfo.Status == PuzzleQuestStatus.InProgress)
|
||||
{
|
||||
foreach (QuestSelectionButtonData buttonDatum2 in _buttonData)
|
||||
@@ -467,7 +435,7 @@ public class QuestSelectionPage : UIBase
|
||||
}
|
||||
}
|
||||
bool flag = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.BOSS_RUSH);
|
||||
if (GameMgr.GetIns().GetDataMgr().QuestFirstSelectType == FirstSelectType.BOSS_RUSH && !flag)
|
||||
if (false && !flag /* Pre-Phase-5b: headless has no QuestFirstSelectType */)
|
||||
{
|
||||
foreach (QuestSelectionButtonData buttonDatum3 in _buttonData)
|
||||
{
|
||||
@@ -524,7 +492,7 @@ public class QuestSelectionPage : UIBase
|
||||
|
||||
private void OnClickClassButton(int index)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON);
|
||||
|
||||
if (_currentIndex != index)
|
||||
{
|
||||
_currentIndex = index;
|
||||
@@ -532,30 +500,6 @@ public class QuestSelectionPage : UIBase
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectCharaQuestButton(QuestOpponentData buttonData)
|
||||
{
|
||||
UpdateTweetButtonVisible(buttonData.BattleData.CharaId == 4403);
|
||||
ChangeChara(buttonData.BattleData.CharaId);
|
||||
if (buttonData.WinCountForWinBonusPoint == 0)
|
||||
{
|
||||
_winBonusRoot.SetActive(value: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_winBonusRoot.SetActive(value: true);
|
||||
_winBonusBeforeRoot.SetActive(value: true);
|
||||
_winBonusAfterRoot.SetActive(buttonData.IsEnableWinBonusPoint);
|
||||
_winBonusCountLabel.text = string.Format(Data.SystemText.Get("Quest_0036"), buttonData.WinCount, buttonData.WinCountForWinBonusPoint);
|
||||
int num = Math.Min(buttonData.WinCount, 3);
|
||||
_winBonusCountSprite.spriteName = "point_up_" + (num + 1).ToString("D2");
|
||||
}
|
||||
bool flag = _isOpenExtra || !buttonData.BattleData.IsExtra;
|
||||
UIManager.SetObjectToGrey(_decideButton.gameObject, !flag, ColorCode.Get(eColorCodeId.QuestSelectButtonTextColor));
|
||||
_decisionButtonEffect.SetActive(flag);
|
||||
_decideButtonTextLabel.text = Data.SystemText.Get("Quest_0022");
|
||||
_bossRushTurnDisplayRoot.SetActive(value: false);
|
||||
}
|
||||
|
||||
public void SelectCharaPuzzleButton(PuzzleQuestInfo buttonData)
|
||||
{
|
||||
UpdateTweetButtonVisible(isSelectBeginner: false);
|
||||
@@ -567,54 +511,6 @@ public class QuestSelectionPage : UIBase
|
||||
_bossRushTurnDisplayRoot.SetActive(value: false);
|
||||
}
|
||||
|
||||
public void SelectEventStoryButton(EventStoryQuestInfo buttonData)
|
||||
{
|
||||
UpdateTweetButtonVisible(isSelectBeginner: false);
|
||||
ChangeEventStoryTexture();
|
||||
_winBonusRoot.SetActive(value: false);
|
||||
_decisionButtonEffect.SetActive(value: true);
|
||||
_decideButtonTextLabel.text = Data.SystemText.Get("Quest_0052");
|
||||
_bossRushTurnDisplayRoot.SetActive(value: false);
|
||||
}
|
||||
|
||||
public void SelectBossRushButton(BossRushInfo buttonData)
|
||||
{
|
||||
UpdateTweetButtonVisible(isSelectBeginner: false);
|
||||
ChangeBossRushTexture();
|
||||
_winBonusRoot.SetActive(value: false);
|
||||
_decisionButtonEffect.SetActive(value: true);
|
||||
if (buttonData.IsDeckRegistered)
|
||||
{
|
||||
_decideButtonTextLabel.text = Data.SystemText.Get("BossRush_0008");
|
||||
}
|
||||
else
|
||||
{
|
||||
_decideButtonTextLabel.text = Data.SystemText.Get("BossRush_0009");
|
||||
}
|
||||
_bossRushTurnDisplayRoot.SetActive(value: true);
|
||||
if (buttonData.ShortestClearTurn.HasValue && buttonData.ShortestClearTurn.Value > 0)
|
||||
{
|
||||
_bossRushShortestClearLabel.text = buttonData.ShortestClearTurn.Value.ToString();
|
||||
_bossRushShortestClearClassIcon.gameObject.SetActive(value: true);
|
||||
_bossRushShortestClearClassIcon.spriteName = ClassCharaPrm.GetLargeIconSpriteName((CardBasePrm.ClanType)buttonData.ShortestClearClass.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_bossRushShortestClearLabel.text = Data.SystemText.Get("BossRush_0040");
|
||||
_bossRushShortestClearClassIcon.gameObject.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectSecretBossButton(SecretBossInfo bossInfo)
|
||||
{
|
||||
UpdateTweetButtonVisible(isSelectBeginner: false);
|
||||
ChangeChara(bossInfo.CharaId);
|
||||
_winBonusRoot.SetActive(value: false);
|
||||
_decisionButtonEffect.SetActive(value: true);
|
||||
_decideButtonTextLabel.text = Data.SystemText.Get("Quest_0022");
|
||||
_bossRushTurnDisplayRoot.SetActive(value: false);
|
||||
}
|
||||
|
||||
private void ChangeChara(int charaId, bool isPlayChangeAnimation = true)
|
||||
{
|
||||
if (!(_currentTextureId == charaId.ToString()))
|
||||
@@ -629,28 +525,6 @@ public class QuestSelectionPage : UIBase
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeEventStoryTexture()
|
||||
{
|
||||
if (!(_currentTextureId == "event_story"))
|
||||
{
|
||||
_currentTextureId = "event_story";
|
||||
ResourcesManager resourcesManager = Toolbox.ResourcesManager;
|
||||
_selectCharaTexture.mainTexture = resourcesManager.LoadObject<Texture>(resourcesManager.GetAssetTypePath("event_story", ResourcesManager.AssetLoadPathType.ClassCharaBase, isfetch: true));
|
||||
PlayCharaChangeAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeBossRushTexture()
|
||||
{
|
||||
if (!(_currentTextureId == "boss_rush"))
|
||||
{
|
||||
_currentTextureId = "boss_rush";
|
||||
ResourcesManager resourcesManager = Toolbox.ResourcesManager;
|
||||
_selectCharaTexture.mainTexture = resourcesManager.LoadObject<Texture>(resourcesManager.GetAssetTypePath("boss_rush", ResourcesManager.AssetLoadPathType.ClassCharaBase, isfetch: true));
|
||||
PlayCharaChangeAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayCharaChangeAnimation()
|
||||
{
|
||||
GameObject obj = _selectCharaTexture.gameObject;
|
||||
@@ -664,74 +538,16 @@ public class QuestSelectionPage : UIBase
|
||||
_selectionButtonList[_currentIndex].OnDecideButtonClick();
|
||||
}
|
||||
|
||||
public void OnClassDecideButtonClick(QuestOpponentData buttonData)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
dataMgr.m_BattleType = DataMgr.BattleType.Quest;
|
||||
dataMgr.SetQuestBattleData(buttonData.BattleData);
|
||||
CreateDeckSelectForQuest();
|
||||
}
|
||||
|
||||
public void OnPuzzleDecideButtonClick()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
|
||||
CreatePuzzleQuestSelectDialog();
|
||||
GameMgr.GetIns().GetDataMgr().SetQuestBattleData(null);
|
||||
}
|
||||
|
||||
public static void CreateDeckSelectForQuest()
|
||||
{
|
||||
QuestDeckListTask task = new QuestDeckListTask();
|
||||
task.SetParameter(GameMgr.GetIns().GetDataMgr().QuestBattleData.QuestStageId);
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
CreateQuestDeckDialog(task.DeckGroupListData, task.BonusFormatList, task.BonusClassList, isBattleAgain: false);
|
||||
}));
|
||||
}
|
||||
|
||||
public static void CreateQuestDeckDialog(DeckGroupListData deckGroupListData, List<Format> bonusFormatList, List<CardBasePrm.ClanType> bonusClassList, bool isBattleAgain)
|
||||
{
|
||||
int questStageId = GameMgr.GetIns().GetDataMgr().QuestBattleData.QuestStageId;
|
||||
QuestLastUsedDeckSaveDataManager.ExtractedDeckData deck = new QuestLastUsedDeckSaveDataManager().GetDeck(questStageId);
|
||||
Format defaultFormat = ((deck != null) ? deck.Format : ((Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT)));
|
||||
Action<DeckUI> onUpdateDeckUICustomize = delegate(DeckUI deckUI)
|
||||
{
|
||||
SetDeckPointUpText(deckUI, bonusFormatList, bonusClassList);
|
||||
if (isBattleAgain)
|
||||
{
|
||||
if (deckUI.Deck.Format == GameMgr.GetIns().GetDataMgr().GetSelectDeckFormat() && deckUI.Deck.GetDeckID() == GameMgr.GetIns().GetDataMgr().GetSelectDeckId())
|
||||
{
|
||||
deckUI.SetTextAppealLabelLeft(Data.SystemText.Get("Card_0235"));
|
||||
}
|
||||
deckUI.SetSelectable(deckUI.Deck.IsUsable());
|
||||
}
|
||||
};
|
||||
DeckSelectUIDialog.Create(Data.SystemText.Get("Quest_0017"), deckGroupListData, defaultFormat, DeckSelectUIDialog.eFormatChangeUIType.UseOtherCategory, !isBattleAgain, delegate(DialogBase dialog, DeckData deck2)
|
||||
{
|
||||
QuestDeckSelectConfirmDialog.Create(dialog, deck2, isBattleAgain);
|
||||
}, new DeckSelectUI.InitOptions
|
||||
{
|
||||
OnUpdateDeckUICustomize = onUpdateDeckUICustomize,
|
||||
FirstDisplayPageIndexGetter = new QuestFirstDisplayPageIndexGetter()
|
||||
});
|
||||
}
|
||||
|
||||
private static void SetDeckPointUpText(DeckUI deckUI, List<Format> bonusFormatList, List<CardBasePrm.ClanType> bonusClassList)
|
||||
{
|
||||
if (!GameMgr.GetIns().GetDataMgr().QuestBattleData.IsMockBattle)
|
||||
{
|
||||
DeckData deck = deckUI.Deck;
|
||||
if (bonusFormatList.Contains(deck.Format) && bonusClassList.Contains((CardBasePrm.ClanType)deck.GetDeckClassID()))
|
||||
{
|
||||
deckUI.SetTextAppealLabelRight(Data.SystemText.Get("Quest_0029"));
|
||||
}
|
||||
}
|
||||
// Pre-Phase-5b: headless has no QuestBattleData
|
||||
}
|
||||
|
||||
private void OnQuestConfirmButtonClick(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Quest_0005"));
|
||||
@@ -743,7 +559,7 @@ public class QuestSelectionPage : UIBase
|
||||
|
||||
private void OnPointConfirmButtonClick(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Quest_0006"));
|
||||
@@ -761,7 +577,7 @@ public class QuestSelectionPage : UIBase
|
||||
|
||||
private void OnClickBonusDetailButton(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
|
||||
if (string.IsNullOrEmpty(_announceId))
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
@@ -817,7 +633,7 @@ public class QuestSelectionPage : UIBase
|
||||
|
||||
private void OnDecidePuzzleQuest(PuzzleQuestData data, int difficulty)
|
||||
{
|
||||
GameMgr.GetIns().GetDataMgr().QuestFirstSelectType = FirstSelectType.PUZZLE;
|
||||
// Pre-Phase-5b: headless has no QuestFirstSelectType write
|
||||
PuzzleUtil.SetPuzzleQuestData(data, difficulty, DataMgr.BattleType.Quest);
|
||||
PuzzleUtil.ChangeSceneToPuzzleQuest(data);
|
||||
}
|
||||
@@ -858,7 +674,7 @@ public class QuestSelectionPage : UIBase
|
||||
|
||||
private void OnClickTweetBanner()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
|
||||
QuestCampaignDialog.Create(null, OnTweet);
|
||||
}
|
||||
|
||||
@@ -867,9 +683,4 @@ public class QuestSelectionPage : UIBase
|
||||
_isTweetFinish = true;
|
||||
UpdateTweetButtonVisible(isSelectBeginner: false);
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
AllLabelColorChanger.ChangeAllLabel(base.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user