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:
@@ -18,353 +18,8 @@ public class MyPageCharaMenu : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Vector3 RIGHT_BASE_NO_CUSTOM_BG_POSITION = new Vector3(505f, 0f, -50f);
|
||||
|
||||
[SerializeField]
|
||||
private UIButton sinkaButton;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel labelSinkaButton;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture originalTex;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject texBase;
|
||||
|
||||
private UITexture[] caharaTex;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _rightBase;
|
||||
|
||||
private Vector3 _rightBaseDefaultPosition;
|
||||
|
||||
private bool _isFirstCallOnEnable = true;
|
||||
|
||||
[SerializeField]
|
||||
private MyPageCenterCard cardManager;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject CardMainObj;
|
||||
|
||||
[SerializeField]
|
||||
private UIScrollView scroll;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject scrollColliderObj;
|
||||
|
||||
[SerializeField]
|
||||
private UICenterOnChild scrollCenterOnChild;
|
||||
|
||||
private const float SCROLL_X_SIZE = 100f;
|
||||
|
||||
private float _beforeCircleAngle;
|
||||
|
||||
[SerializeField]
|
||||
private float InitialSpeed = 22f;
|
||||
|
||||
[SerializeField]
|
||||
private float DecelerationBase = 3.5f;
|
||||
|
||||
[SerializeField]
|
||||
private float DecelerationAdd = 10f;
|
||||
|
||||
[SerializeField]
|
||||
private float DragSpeed = 2.1f;
|
||||
|
||||
[SerializeField]
|
||||
private float DragSpeed2 = 0.1f;
|
||||
|
||||
private bool _isClockwise;
|
||||
|
||||
private float _currentSpeed;
|
||||
|
||||
private float _currentDeceleration;
|
||||
|
||||
private bool _isOnEnable;
|
||||
|
||||
private IList<DragInfo> _dragInfoList;
|
||||
|
||||
private int _currentIndex;
|
||||
|
||||
private int _oldIndex = -1;
|
||||
|
||||
private float _soundTimer;
|
||||
|
||||
private bool _isFirstUpdate = true;
|
||||
|
||||
private const string LABEL_BUTTON_EVO_TEXT = "Card_0030";
|
||||
|
||||
private const string LABEL_BUTTON_RETURN_TEXT = "Card_0067";
|
||||
|
||||
public bool IsForceActive { get; set; }
|
||||
|
||||
public UIButton EvolutionButton => sinkaButton;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
caharaTex = new UITexture[40];
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
caharaTex[i] = UnityEngine.Object.Instantiate(originalTex);
|
||||
caharaTex[i].transform.parent = texBase.transform;
|
||||
caharaTex[i].transform.localScale = new Vector3(0.35f, 0.35f, 1f);
|
||||
caharaTex[i].transform.transform.localPosition = new Vector3((float)i * 100f, 0f, 0f);
|
||||
caharaTex[i].gameObject.name = i.ToString();
|
||||
}
|
||||
originalTex.gameObject.SetActive(value: false);
|
||||
LoadCenterCardIndex();
|
||||
sinkaButton.onClick.Clear();
|
||||
sinkaButton.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
if (!cardManager.CardDetail.IsCardObjRotateTween)
|
||||
{
|
||||
cardManager.ChangeEvoDisplay(_currentIndex);
|
||||
cardManager.PlayCardRotationAnime(_currentIndex, cardManager.IsAfterEvolution(_currentIndex));
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_MYPAGE_EVOLVE);
|
||||
GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MYPAGE_EVO_1);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_MYPAGE_EVO_1, new Vector3(0f, 0.3f, 0f));
|
||||
ChangeStateSinkaButton(_currentIndex);
|
||||
}
|
||||
}));
|
||||
ChangeStateSinkaButton(_currentIndex);
|
||||
if (_dragInfoList == null)
|
||||
{
|
||||
_dragInfoList = new List<DragInfo>();
|
||||
}
|
||||
UIEventListener uIEventListener = UIEventListener.Get(scrollColliderObj);
|
||||
uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate
|
||||
{
|
||||
_currentSpeed = 0f;
|
||||
});
|
||||
UIEventListener uIEventListener2 = UIEventListener.Get(scrollColliderObj);
|
||||
uIEventListener2.onDragStart = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener2.onDragStart, (UIEventListener.VoidDelegate)delegate
|
||||
{
|
||||
_dragInfoList.Clear();
|
||||
_dragInfoList.Add(new DragInfo(Time.time, GetLastTouchPos().x));
|
||||
});
|
||||
UIEventListener uIEventListener3 = UIEventListener.Get(scrollColliderObj);
|
||||
uIEventListener3.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener3.onDrag, (UIEventListener.VectorDelegate)delegate(GameObject g, Vector2 delta)
|
||||
{
|
||||
if (_isClockwise == delta.x < 0f)
|
||||
{
|
||||
_dragInfoList.Add(new DragInfo(Time.time, GetLastTouchPos().x));
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentSpeed = 0f;
|
||||
_isClockwise = !_isClockwise;
|
||||
_dragInfoList.Clear();
|
||||
_dragInfoList.Add(new DragInfo(Time.time, GetLastTouchPos().x));
|
||||
}
|
||||
});
|
||||
UIEventListener uIEventListener4 = UIEventListener.Get(scrollColliderObj);
|
||||
uIEventListener4.onDragEnd = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener4.onDragEnd, (UIEventListener.VoidDelegate)delegate
|
||||
{
|
||||
_dragInfoList.Add(new DragInfo(Time.time, GetLastTouchPos().x));
|
||||
int num = _dragInfoList.Count - 1;
|
||||
_currentSpeed = 0f;
|
||||
float num2 = Mathf.Abs(_dragInfoList[num].time - _dragInfoList[0].time);
|
||||
if (!(num2 <= float.Epsilon))
|
||||
{
|
||||
float num3 = Mathf.Abs(_dragInfoList[num].posX - _dragInfoList[0].posX);
|
||||
if (!(num3 <= float.Epsilon))
|
||||
{
|
||||
float num4 = num3 / num2;
|
||||
if (!(num4 < DragSpeed))
|
||||
{
|
||||
int num5 = 2;
|
||||
if (num >= num5)
|
||||
{
|
||||
num2 = Mathf.Abs(_dragInfoList[num].time - _dragInfoList[num - num5].time);
|
||||
if (num2 <= float.Epsilon)
|
||||
{
|
||||
return;
|
||||
}
|
||||
num3 = Mathf.Abs(_dragInfoList[num].posX - _dragInfoList[num - num5].posX);
|
||||
if (num3 <= float.Epsilon)
|
||||
{
|
||||
return;
|
||||
}
|
||||
num4 = num3 / num2;
|
||||
if (num4 < DragSpeed2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
_currentSpeed = InitialSpeed * num4 * 0.1f;
|
||||
_currentDeceleration = DecelerationBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private bool IsAbleUpdate()
|
||||
{
|
||||
if (!UIManager.GetInstance().getUIBase_CardManager().getCreateEndFlag())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!MyPageMenu.Instance.IsCardLoadFinish)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!cardManager.canMyPageCardMove())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!IsAbleUpdate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_isFirstUpdate)
|
||||
{
|
||||
_isFirstUpdate = false;
|
||||
ScrollCenterOn(_currentIndex, 100f);
|
||||
return;
|
||||
}
|
||||
if (_soundTimer > 0f)
|
||||
{
|
||||
_soundTimer -= Time.deltaTime;
|
||||
}
|
||||
if (_isOnEnable)
|
||||
{
|
||||
_isOnEnable = false;
|
||||
ChangeStateSinkaButton(_currentIndex);
|
||||
}
|
||||
Vector3 localPosition = scroll.gameObject.transform.localPosition;
|
||||
float num = -4000f;
|
||||
float num2 = num / 360f;
|
||||
float num3 = localPosition.x / num2;
|
||||
float num4;
|
||||
for (num4 = localPosition.x - 50f; num4 >= 0f; num4 += num)
|
||||
{
|
||||
}
|
||||
while (num4 < num)
|
||||
{
|
||||
num4 -= num;
|
||||
}
|
||||
int num5 = (int)Mathf.Abs(num4 / 100f);
|
||||
if (_oldIndex != num5)
|
||||
{
|
||||
if (!UIManager.GetInstance().isFading() && _soundTimer <= 0f)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_SCROLL);
|
||||
_soundTimer = 0.1f;
|
||||
}
|
||||
_currentIndex = num5;
|
||||
_oldIndex = _currentIndex;
|
||||
cardManager.UpdateSelectCard();
|
||||
ChangeStateSinkaButton(_currentIndex);
|
||||
GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MYPAGE_EVO_1);
|
||||
}
|
||||
if (_beforeCircleAngle != num3)
|
||||
{
|
||||
_beforeCircleAngle = num3;
|
||||
CardMainObj.transform.eulerAngles = new Vector3(0f, num3, 0f);
|
||||
cardManager.SetCardTransform();
|
||||
}
|
||||
if (_currentSpeed > 0f)
|
||||
{
|
||||
float deltaTime = Time.deltaTime;
|
||||
_currentDeceleration += DecelerationAdd * deltaTime;
|
||||
_currentSpeed -= _currentDeceleration * deltaTime;
|
||||
if (_currentSpeed > 0f)
|
||||
{
|
||||
float num6 = _currentSpeed * deltaTime * (_isClockwise ? 1f : (-1f));
|
||||
num6 /= 10f;
|
||||
scroll.Scroll(num6);
|
||||
}
|
||||
else
|
||||
{
|
||||
ScrollCenterOn(num5, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeStateSinkaButton(int index)
|
||||
{
|
||||
if (!cardManager.isEvo(index))
|
||||
{
|
||||
sinkaButton.gameObject.SetActive(value: false);
|
||||
return;
|
||||
}
|
||||
sinkaButton.gameObject.SetActive(value: true);
|
||||
if (cardManager.IsAfterEvolution(index))
|
||||
{
|
||||
labelSinkaButton.text = Data.SystemText.Get("Card_0067");
|
||||
}
|
||||
else
|
||||
{
|
||||
labelSinkaButton.text = Data.SystemText.Get("Card_0030");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (_isFirstCallOnEnable)
|
||||
{
|
||||
_isFirstCallOnEnable = false;
|
||||
_rightBaseDefaultPosition = _rightBase.transform.localPosition;
|
||||
}
|
||||
if (Data.Load.data.AcquiredMyPageBGList.Count == 0)
|
||||
{
|
||||
_rightBase.transform.localPosition = RIGHT_BASE_NO_CUSTOM_BG_POSITION;
|
||||
}
|
||||
else
|
||||
{
|
||||
_rightBase.transform.localPosition = _rightBaseDefaultPosition;
|
||||
}
|
||||
_currentSpeed = 0f;
|
||||
_isOnEnable = true;
|
||||
cardManager.CardDetail.ResetAngleCardObj();
|
||||
scrollColliderObj.SetActive(!IsForceActive);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (!(cardManager.CardDetail.CardDetailWindow == null))
|
||||
{
|
||||
cardManager.CardDetail.CardDetailWindow.HideDetail();
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadCenterCardIndex()
|
||||
{
|
||||
_currentIndex = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.HOME_CENTER_CARD_INDEX);
|
||||
}
|
||||
|
||||
public void SaveCenterCardIndex()
|
||||
{
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.HOME_CENTER_CARD_INDEX, _currentIndex);
|
||||
}
|
||||
|
||||
public int getNowSelIndex()
|
||||
{
|
||||
return _currentIndex;
|
||||
}
|
||||
|
||||
private Vector2 GetLastTouchPos()
|
||||
{
|
||||
return UICamera.currentCamera.ScreenToWorldPoint(UICamera.lastEventPosition);
|
||||
}
|
||||
|
||||
private void ScrollCenterOn(int index)
|
||||
{
|
||||
scrollCenterOnChild.CenterOn(caharaTex[index].transform);
|
||||
}
|
||||
|
||||
private void ScrollCenterOn(int index, float springStrength)
|
||||
{
|
||||
float springStrength2 = scrollCenterOnChild.springStrength;
|
||||
scrollCenterOnChild.springStrength = springStrength;
|
||||
scrollCenterOnChild.CenterOn(caharaTex[index].transform);
|
||||
scrollCenterOnChild.springStrength = springStrength2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user