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:
@@ -4,6 +4,9 @@ using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
// TODO(engine-cleanup-pass2): 47 of 50 methods unrun in baseline
|
||||
// Type: Wizard.Battle.Mulligan.MulliganInfoControl
|
||||
// See data_dumps/reports/engine-cleanup/live-methods.baseline.txt
|
||||
|
||||
namespace Wizard.Battle.Mulligan;
|
||||
|
||||
@@ -48,16 +51,6 @@ public class MulliganInfoControl : UIBase
|
||||
|
||||
private static readonly Vector3 SUBMIT_BUTTON_SCALE = new Vector3(1.4f, 1.4f, 1f);
|
||||
|
||||
private const float ZONE_VERTICAL_OFFSET_INNER = 50f;
|
||||
|
||||
private const float ZONE_VERTICAL_OFFSET_OUTSIDE = 80f;
|
||||
|
||||
private const float TITLEBAR_VERTICAL_OFFSET = 40f;
|
||||
|
||||
private const float TITLEBAR_HORIZONTAL_OFFSET_BASE = 180f;
|
||||
|
||||
private const float WATCH_BATTLE_TITLEBAR_HORIZONTAL_OFFSET_BASE = 0f;
|
||||
|
||||
private static readonly float[] ABANDON_TEXT_OFFSET_BOTTOM = new float[2] { -5f, -50f };
|
||||
|
||||
private static readonly float[] ABANDON_TEXT_OFFSET_TOP = new float[2] { 55f, 10f };
|
||||
@@ -66,20 +59,8 @@ public class MulliganInfoControl : UIBase
|
||||
|
||||
private static readonly float[] KEEP_TEXT_OFFSET_TOP = new float[2] { 55f, 10f };
|
||||
|
||||
private const float FADEIN_SEC = 0.5f;
|
||||
|
||||
private const float FADEIN_ALPHA = 1f;
|
||||
|
||||
private const float FADEOUT_SEC = 0.5f;
|
||||
|
||||
private const float FADEOUT_ALPHA = 0f;
|
||||
|
||||
private const float CARD_POS_Z = -10f;
|
||||
|
||||
private static readonly int[] CARD_POS_Y = new int[2] { -25, 25 };
|
||||
|
||||
private const float CHANGEMARK_POS_Z = -12f;
|
||||
|
||||
private static readonly float[][] CHANGEMARK_POS_Y = new float[2][]
|
||||
{
|
||||
new float[2] { -25f, 0f },
|
||||
@@ -104,8 +85,6 @@ public class MulliganInfoControl : UIBase
|
||||
|
||||
private static readonly int[] ZONE_POS_X = new int[2] { 0, 416 };
|
||||
|
||||
private const float HIDE_TOP_PANEL_DURATION = 0.3f;
|
||||
|
||||
private static readonly Vector3 ENEMY_CLASS_ICON_POSITION = new Vector3(-274.2f, -33f, 0f);
|
||||
|
||||
private static readonly Vector3[] ENEMY_CLASS_ICON_POSITION_2 = new Vector3[2]
|
||||
@@ -136,10 +115,6 @@ public class MulliganInfoControl : UIBase
|
||||
|
||||
private static readonly Vector3 MY_ROTATION_INFO_POSITION = new Vector3(-246f, -21.9f, 0f);
|
||||
|
||||
private const int MY_ROTATION_PACK_RABEL_WIDTH_SHORT = 50;
|
||||
|
||||
private const int MY_ROTATION_PACK_RABEL_WIDTH_LONG = 80;
|
||||
|
||||
private static readonly string[] USE_SHORT_WIDTH_LANGUAGE = new string[2] { "Jpn", "Kor" };
|
||||
|
||||
[SerializeField]
|
||||
@@ -187,9 +162,6 @@ public class MulliganInfoControl : UIBase
|
||||
[SerializeField]
|
||||
private GameObject TimerObj;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel TimerLabel;
|
||||
|
||||
[SerializeField]
|
||||
public UIButton SubmitBtn;
|
||||
|
||||
@@ -217,30 +189,12 @@ public class MulliganInfoControl : UIBase
|
||||
|
||||
private BattleManagerBase m_BtlMgrIns;
|
||||
|
||||
private long startTicks;
|
||||
|
||||
private int passageStartSecond;
|
||||
|
||||
private float maxSecond;
|
||||
|
||||
private bool isTimerOn;
|
||||
|
||||
private int StateCnt;
|
||||
|
||||
public const float ENEMY_INFO_HIDE_POS = 340f;
|
||||
|
||||
private float extendTime;
|
||||
|
||||
private Color TIMER_COLOR_RED = new Color(0.85490197f, 0.2901961f, 0.2509804f);
|
||||
|
||||
private Color TIMER_COLOR_YELLOW = new Color(1f, 41f / 51f, 23f / 85f);
|
||||
|
||||
private Color TIMER_COLOR_WHITE = new Color(1f, 0.99215686f, 47f / 51f);
|
||||
|
||||
public bool IsEnd { get; private set; }
|
||||
|
||||
public bool IsShowingMulliganSelect { get; private set; }
|
||||
|
||||
private int SCREEN_HEIGHT => m_3DCamera.pixelHeight;
|
||||
|
||||
public event Action OnStartMulligan;
|
||||
@@ -249,53 +203,10 @@ public class MulliganInfoControl : UIBase
|
||||
|
||||
public event Func<VfxBase> OnTimeUp;
|
||||
|
||||
public void SetExtendTime(float leftTime)
|
||||
{
|
||||
extendTime = leftTime;
|
||||
}
|
||||
|
||||
public void InitMulliganInfo()
|
||||
{
|
||||
m_BtlMgrIns = BattleManagerBase.GetIns();
|
||||
base.gameObject.SetActive(value: false);
|
||||
m_3DCamera = m_BtlMgrIns.Battle3DContainer.transform.Find("Camera").GetComponent<Camera>();
|
||||
List<GameObject> list = new List<GameObject>();
|
||||
for (int i = 0; i < _partsPlayer._exchangeMark.Length; i++)
|
||||
{
|
||||
list.Add(_partsPlayer._exchangeMark[i].gameObject);
|
||||
}
|
||||
for (int j = 0; j < _partsOpponent._exchangeMark.Length; j++)
|
||||
{
|
||||
list.Add(_partsOpponent._exchangeMark[j].gameObject);
|
||||
}
|
||||
UIManager.GetInstance().AttachAtlas(list);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (GameMgr.GetIns().IsAINetwork && m_BtlMgrIns.IsRecovery)
|
||||
{
|
||||
return;
|
||||
}
|
||||
long ticks = TimeUtil.GetAbsoluteTime().Ticks - startTicks;
|
||||
TimeSpan timeSpan = new TimeSpan(ticks);
|
||||
if (!isTimerOn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
float num = maxSecond - (float)timeSpan.TotalMilliseconds / 1000f + extendTime;
|
||||
SetTimerLabel(num);
|
||||
if (num <= 0f)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
VfxBase[] allFuncCallResults = this.OnTimeUp.GetAllFuncCallResults();
|
||||
foreach (VfxBase vfx in allFuncCallResults)
|
||||
{
|
||||
sequentialVfxPlayer.Register(vfx);
|
||||
}
|
||||
sequentialVfxPlayer.Register(m_BtlMgrIns.MulliganMgr.Submit(m_BtlMgrIns));
|
||||
m_BtlMgrIns.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer);
|
||||
}
|
||||
// Pre-Phase-5b: MulliganInfoControl is UI-only headless; camera lookup + AttachAtlas dropped
|
||||
m_BtlMgrIns = null;
|
||||
}
|
||||
|
||||
public override void assetBundleEnd()
|
||||
@@ -329,7 +240,7 @@ public class MulliganInfoControl : UIBase
|
||||
StateCnt = 0;
|
||||
base.gameObject.SetActive(value: true);
|
||||
SetSubmitLabel();
|
||||
if (GameMgr.GetIns().IsWatchBattle)
|
||||
if (false /* Pre-Phase-5b: IsWatchBattle const-false */)
|
||||
{
|
||||
_SetTitleLabel(TitleType.Watch);
|
||||
}
|
||||
@@ -347,7 +258,7 @@ public class MulliganInfoControl : UIBase
|
||||
isTimerOn = false;
|
||||
TimerObj.SetActive(value: false);
|
||||
EnableButton(on: false);
|
||||
if (GameMgr.GetIns().IsNetworkBattle && StateCnt < 2 && !GameMgr.GetIns().IsWatchBattle)
|
||||
if (StateCnt < 2 /* Pre-Phase-5b: IsNetworkBattle assumed true; IsWatchBattle const-false */)
|
||||
{
|
||||
_SetTitleLabel(TitleType.WaitOpponent);
|
||||
}
|
||||
@@ -369,23 +280,11 @@ public class MulliganInfoControl : UIBase
|
||||
TweenAlpha.Begin(_partsPlayer._abandonBG.gameObject, 0.5f, 0f);
|
||||
}
|
||||
|
||||
public void HideMulliganCenterUI()
|
||||
{
|
||||
TweenAlpha.Begin(_partsPlayer._keepBG.gameObject, 0.5f, 0f);
|
||||
TweenAlpha.Begin(_partsPlayer._abandonBG.gameObject, 0.5f, 0f);
|
||||
}
|
||||
|
||||
public void HideMulliganOpponentChangeUI()
|
||||
{
|
||||
TweenAlpha.Begin(_partsOpponent._abandonBG.gameObject, 0.5f, 0f);
|
||||
}
|
||||
|
||||
public void HideMulliganOpponentCenterUI()
|
||||
{
|
||||
TweenAlpha.Begin(_partsOpponent._keepBG.gameObject, 0.5f, 0f);
|
||||
TweenAlpha.Begin(_partsOpponent._abandonBG.gameObject, 0.5f, 0f);
|
||||
}
|
||||
|
||||
public void InitiallizeView()
|
||||
{
|
||||
AnchorTL.uiCamera = m_3DCamera;
|
||||
@@ -458,66 +357,11 @@ public class MulliganInfoControl : UIBase
|
||||
TitleBar.bottomAnchor.Set(0.5f, -40f);
|
||||
TitleBar.leftAnchor.target = target;
|
||||
TitleBar.rightAnchor.target = target;
|
||||
float num3 = ((GameMgr.GetIns().IsWatchBattle && !GameMgr.GetIns().IsReplayBattle) ? 0f : 180f);
|
||||
float num3 = 180f; // Pre-Phase-5b: IsWatchBattle / IsReplayBattle const-false
|
||||
TitleBar.leftAnchor.Set(0f, num3 * m_3DCamera.aspect);
|
||||
TitleBar.rightAnchor.Set(1f, (0f - num3) * m_3DCamera.aspect);
|
||||
}
|
||||
|
||||
public void ShowMulliganUI()
|
||||
{
|
||||
if (GameMgr.GetIns().IsNetworkBattle && !GameMgr.GetIns().IsReplayBattle)
|
||||
{
|
||||
isTimerOn = true;
|
||||
startTicks = TimeUtil.GetAbsoluteTime().Ticks;
|
||||
if (ToolboxGame.RealTimeNetworkAgent != null)
|
||||
{
|
||||
passageStartSecond = ToolboxGame.RealTimeNetworkAgent.GetPreparedStartTimer();
|
||||
}
|
||||
if ((float)passageStartSecond <= 25f)
|
||||
{
|
||||
maxSecond = 60f;
|
||||
}
|
||||
else
|
||||
{
|
||||
maxSecond = 60f - ((float)passageStartSecond - 25f);
|
||||
if (maxSecond <= 0f)
|
||||
{
|
||||
maxSecond = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool active = true;
|
||||
bool active2 = true;
|
||||
bool flag = true;
|
||||
if (ViewType.Watch == _viewType)
|
||||
{
|
||||
active = false;
|
||||
active2 = false;
|
||||
flag = false;
|
||||
}
|
||||
TurnImg.gameObject.SetActive(active);
|
||||
EnemyInfo.gameObject.SetActive(active2);
|
||||
EnableButton(flag);
|
||||
TweenAlpha.Begin(TitleBar.gameObject, 0.5f, 1f);
|
||||
TweenAlpha.Begin(_partsPlayer._keepBG.gameObject, 0.5f, 1f);
|
||||
TweenAlpha.Begin(_partsPlayer._abandonBG.gameObject, 0.5f, 1f);
|
||||
if (ViewType.Watch == _viewType)
|
||||
{
|
||||
TweenAlpha.Begin(_partsOpponent._keepBG.gameObject, 0.5f, 1f);
|
||||
TweenAlpha.Begin(_partsOpponent._abandonBG.gameObject, 0.5f, 1f);
|
||||
}
|
||||
TweenAlpha.Begin(TurnImg.gameObject, 0.5f, 1f);
|
||||
TweenAlpha.Begin(EnemyInfo.gameObject, 0.5f, 1f);
|
||||
SetEnemyReady(-1);
|
||||
SetTimerLabel(maxSecond);
|
||||
IsShowingMulliganSelect = true;
|
||||
}
|
||||
|
||||
public void ShowTimerUI()
|
||||
{
|
||||
TimerObj.SetActive(ViewType.Watch != _viewType && isTimerOn);
|
||||
}
|
||||
|
||||
private void EnableButton(bool on)
|
||||
{
|
||||
SubmitBtn.gameObject.SetActive(on);
|
||||
@@ -536,11 +380,6 @@ public class MulliganInfoControl : UIBase
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public void SetMulliganEnd()
|
||||
{
|
||||
IsEnd = true;
|
||||
}
|
||||
|
||||
public void SetEnemyReady(int num)
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
@@ -562,7 +401,7 @@ public class MulliganInfoControl : UIBase
|
||||
|
||||
private void SetEnemyClassInfo()
|
||||
{
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
DataMgr dataMgr = null; // Pre-Phase-5b: headless has no DataMgr
|
||||
MyRotationInfo myRotationInfo;
|
||||
if (dataMgr.GetEnemySubClassId() != 10)
|
||||
{
|
||||
@@ -615,58 +454,12 @@ public class MulliganInfoControl : UIBase
|
||||
EnemyInfo.spriteName = MARIGAN_PANEL_CLASS + dataMgr.GetEnemyClassId().ToString("00");
|
||||
}
|
||||
|
||||
private void SetTimerLabel(float milliseconds)
|
||||
{
|
||||
if (GameMgr.GetIns().IsNetworkBattle)
|
||||
{
|
||||
float num = Mathf.Max(0f, Mathf.Ceil(milliseconds));
|
||||
if (num <= 10f)
|
||||
{
|
||||
TimerLabel.color = TIMER_COLOR_RED;
|
||||
}
|
||||
else if (num <= 30f)
|
||||
{
|
||||
TimerLabel.color = TIMER_COLOR_YELLOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
TimerLabel.color = TIMER_COLOR_WHITE;
|
||||
}
|
||||
TimerLabel.text = num.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
TimerLabel.text = "";
|
||||
TimerObj.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSubmitLabel()
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
SubmitBtnLabel.text = systemText.Get("Battle_0102");
|
||||
}
|
||||
|
||||
public VfxBase OnMulliganSubmit()
|
||||
{
|
||||
HideButtons();
|
||||
for (int i = 0; i < _partsPlayer._exchangeMark.Length; i++)
|
||||
{
|
||||
_partsPlayer._exchangeMark[i].gameObject.SetActive(value: false);
|
||||
}
|
||||
for (int j = 0; j < _partsOpponent._exchangeMark.Length; j++)
|
||||
{
|
||||
_partsOpponent._exchangeMark[j].gameObject.SetActive(value: false);
|
||||
}
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
if (!BattleManagerBase.GetIns().IsRecovery)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.MULLIGAN_DECIDE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void _SetTitleLabel(TitleType type)
|
||||
{
|
||||
TitleLabel.text = string.Empty;
|
||||
@@ -681,7 +474,7 @@ public class MulliganInfoControl : UIBase
|
||||
TitleLabel.text = Data.SystemText.Get("Battle_0104");
|
||||
break;
|
||||
case TitleType.Watch:
|
||||
if (GameMgr.GetIns().IsReplayBattle)
|
||||
if (false /* Pre-Phase-5b: IsReplayBattle const-false */)
|
||||
{
|
||||
TitleLabel.text = Data.SystemText.Get("Battle_0467");
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user