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:
@@ -9,20 +9,10 @@ public class MyPageItemHome : MyPageItem
|
||||
{
|
||||
private enum Notification
|
||||
{
|
||||
Info,
|
||||
Max
|
||||
}
|
||||
|
||||
private const string TEXTURE_ROOM_CAMPAIGN = "campaign_banner_mypage";
|
||||
Info }
|
||||
|
||||
public static readonly Vector3 TUTORIAL_OFFSET_FOOTER = new Vector3(0f, 19f, 0f);
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _bannerPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _subBannerPrefab;
|
||||
|
||||
private GameObject _bannerObject;
|
||||
|
||||
private GameObject _subBannerObject;
|
||||
@@ -54,9 +44,6 @@ public class MyPageItemHome : MyPageItem
|
||||
[SerializeField]
|
||||
private UILabel _guildNotificationLabel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _cardDetailObj;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _contentsRoot;
|
||||
|
||||
@@ -86,24 +73,12 @@ public class MyPageItemHome : MyPageItem
|
||||
|
||||
private MyPageHomeStatic _homeStatic;
|
||||
|
||||
private const int GIFT_MAX_COUNT = 99;
|
||||
|
||||
public const int MISSION_MAX_COUNT = 99;
|
||||
|
||||
private bool _isFinishInitialize;
|
||||
|
||||
private int _notificationMask;
|
||||
|
||||
public GameObject ContentsRoot => _contentsRoot;
|
||||
|
||||
public bool IsCustomMyPage => Data.MyPage.data.BGInfo.BGType != MyPageDetail.BGType.Deck;
|
||||
|
||||
public void SetHomeStatic(MyPageHomeStatic homeDeck)
|
||||
{
|
||||
_homeStatic = homeDeck;
|
||||
CreateBanner();
|
||||
}
|
||||
|
||||
public override void Initialize(MyPageMenu parent)
|
||||
{
|
||||
base.Initialize(parent);
|
||||
@@ -280,12 +255,6 @@ public class MyPageItemHome : MyPageItem
|
||||
}
|
||||
}
|
||||
|
||||
public void OnReadGift()
|
||||
{
|
||||
_giftCount--;
|
||||
SetUnreadGiftCount(_giftCount);
|
||||
}
|
||||
|
||||
private void CheckNotify(Action onFinish)
|
||||
{
|
||||
if (!_contentsRoot.activeSelf || Data.Load.data._userTutorial.TutorialStep != 100)
|
||||
@@ -293,9 +262,11 @@ public class MyPageItemHome : MyPageItem
|
||||
return;
|
||||
}
|
||||
DateTime last_announce_time = Data.MyPage.data.last_announce_time;
|
||||
if (last_announce_time > GameMgr.GetIns().AnnounceTime)
|
||||
// Pre-Phase-5b: gated on ambient GameMgr.AnnounceTime cursor to avoid
|
||||
// re-showing the same announcement. Headless has no announcement UI to display;
|
||||
// always fall through to the else branch below.
|
||||
if (false)
|
||||
{
|
||||
GameMgr.GetIns().AnnounceTime = last_announce_time;
|
||||
_notificationMask |= 1;
|
||||
if (_notificationMask != 0)
|
||||
{
|
||||
@@ -350,31 +321,11 @@ public class MyPageItemHome : MyPageItem
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMyPageFadeOpen(bool isHomeActive)
|
||||
{
|
||||
OnUpdateCustomMyPageEnable(isHomeActive);
|
||||
_restoreUIButton.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!_isFinishInitialize && _homeStatic.CardLoadFinish)
|
||||
{
|
||||
_isFinishInitialize = true;
|
||||
GameObject obj = _giftButton.gameObject.transform.parent.gameObject;
|
||||
bool activeSelf = obj.activeSelf;
|
||||
obj.SetActive(value: false);
|
||||
obj.SetActive(value: true);
|
||||
obj.SetActive(activeSelf);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPushGiftButton()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
MailTopTask mailTopTask = GameMgr.GetIns().GetMailTopTask();
|
||||
mailTopTask.SetParameter(Data.Load.data._userTutorial.TutorialStep != 100);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(mailTopTask, OnRequestGift));
|
||||
// Pre-Phase-5b: fired MailTopTask via NetworkManager. Headless has no wire tasks;
|
||||
// short-circuit to the success callback so the UI scene-change still fires.
|
||||
OnRequestGift(default(NetworkTask.ResultCode));
|
||||
}
|
||||
|
||||
private void OnRequestGift(NetworkTask.ResultCode error)
|
||||
@@ -384,10 +335,8 @@ public class MyPageItemHome : MyPageItem
|
||||
|
||||
private void OnPushMissionButton()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
MissionInfoTask missionInfoTask = GameMgr.GetIns().GetMissionInfoTask();
|
||||
missionInfoTask.SetParameter();
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(missionInfoTask, OpenMission));
|
||||
// Pre-Phase-5b: fired MissionInfoTask via NetworkManager. See OnPushGiftButton.
|
||||
OpenMission(default(NetworkTask.ResultCode));
|
||||
}
|
||||
|
||||
private void OpenMission(NetworkTask.ResultCode error)
|
||||
@@ -415,19 +364,19 @@ public class MyPageItemHome : MyPageItem
|
||||
|
||||
private void OnPushBattlePassButton()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
|
||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.BattlePass);
|
||||
}
|
||||
|
||||
private void OnPushBGCustomButton()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
|
||||
MyPageBGCustomDialog.Create(OnDecideMyPageBG);
|
||||
}
|
||||
|
||||
private void OnPushHideUIButton()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
|
||||
ToggleUIVisible(visible: false);
|
||||
}
|
||||
|
||||
@@ -466,35 +415,9 @@ public class MyPageItemHome : MyPageItem
|
||||
return randomIdList[random.Next(0, randomIdList.Count)];
|
||||
}
|
||||
|
||||
public void ShowBanner()
|
||||
{
|
||||
if (Data.Load.data._userTutorial.TutorialStep == 100)
|
||||
{
|
||||
_banner.Show();
|
||||
_subBanner.Show();
|
||||
}
|
||||
}
|
||||
|
||||
public void HideBanner()
|
||||
{
|
||||
_banner.Hide();
|
||||
_subBanner.Hide();
|
||||
}
|
||||
|
||||
private void CreateBanner()
|
||||
{
|
||||
_bannerObject = NGUITools.AddChild(_contentsRoot, _bannerPrefab);
|
||||
_banner = _bannerObject.GetComponent<MyPageBanner>();
|
||||
_homeStatic.Initialize();
|
||||
_subBannerObject = NGUITools.AddChild(_contentsRoot, _subBannerPrefab);
|
||||
_subBanner = _subBannerObject.GetComponent<MyPageSubBanner>();
|
||||
_banner._isFirstTips = false;
|
||||
_subBanner._isFirstTips = false;
|
||||
}
|
||||
|
||||
private void OnPushGuildButton()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
|
||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Guild);
|
||||
}
|
||||
|
||||
@@ -525,38 +448,6 @@ public class MyPageItemHome : MyPageItem
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SetFirstTips()
|
||||
{
|
||||
_banner._isFirstTips = true;
|
||||
_banner.SetActive(inActive: false);
|
||||
_subBanner._isFirstTips = true;
|
||||
_subBanner.SetActive(inActive: false);
|
||||
_homeStatic.SetTutorialMode();
|
||||
}
|
||||
|
||||
public void SetGuideEffectToGiftButton()
|
||||
{
|
||||
base.Parent.SetGuideEffect(_giftButton.transform, new Vector3(-14f, 0f, 0f), -90f);
|
||||
}
|
||||
|
||||
public void SetGiftReceiveTutorialMode()
|
||||
{
|
||||
UIManager.SetObjectToGrey(_missionButton.gameObject, b: true);
|
||||
UIManager.SetObjectToGrey(_guildButton.gameObject, b: true);
|
||||
UIManager.SetObjectToGrey(_battlePassButton.gameObject, b: true);
|
||||
UIManager.SetObjectToGrey(_bgCustomButton.gameObject, b: true);
|
||||
}
|
||||
|
||||
public void FinishFirstTips()
|
||||
{
|
||||
UIManager.SetObjectToGrey(_giftButton.gameObject, b: false);
|
||||
UIManager.SetObjectToGrey(_missionButton.gameObject, b: false);
|
||||
UIManager.SetObjectToGrey(_guildButton.gameObject, b: false);
|
||||
UIManager.SetObjectToGrey(_battlePassButton.gameObject, b: false);
|
||||
UIManager.SetObjectToGrey(_bgCustomButton.gameObject, b: false);
|
||||
_homeStatic.FinishFirstTips();
|
||||
}
|
||||
|
||||
public void SetUnreadGiftCount(int count)
|
||||
{
|
||||
if (!(_giftNumberRoot.gameObject == null))
|
||||
|
||||
Reference in New Issue
Block a user