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:
@@ -1,4 +1,3 @@
|
||||
using CriWare;
|
||||
using UnityEngine;
|
||||
|
||||
public class Effect : MonoBehaviour
|
||||
@@ -13,18 +12,8 @@ public class Effect : MonoBehaviour
|
||||
|
||||
private bool m_Use;
|
||||
|
||||
private GameObject m_ChaseObjIns;
|
||||
|
||||
private GameObject m_LookAtObject;
|
||||
|
||||
private bool _buff;
|
||||
|
||||
private CriAtomSource m_EffectSeSource;
|
||||
|
||||
private Camera _lookAtCamera;
|
||||
|
||||
private bool _isFollowScale;
|
||||
|
||||
public Effect()
|
||||
{
|
||||
m_Type = EffectMgr.EffectType.NONE;
|
||||
@@ -34,272 +23,13 @@ public class Effect : MonoBehaviour
|
||||
_buff = false;
|
||||
}
|
||||
|
||||
public void Init(EffectMgr.EffectType type, bool isCommon = false, string SePath = "", bool isFollowScale = false)
|
||||
{
|
||||
m_Type = type;
|
||||
if (!string.IsNullOrEmpty(SePath))
|
||||
{
|
||||
m_EffectSeSource = base.gameObject.GetComponent<CriAtomSource>();
|
||||
m_EffectSeSource.use3dPositioning = true;
|
||||
m_EffectSeSource.playOnStart = false;
|
||||
}
|
||||
m_GameObjIns = base.gameObject;
|
||||
m_ParticleSystem = m_GameObjIns.GetComponent<ParticleSystem>();
|
||||
m_ParticleSystem.GetComponent<Renderer>().sortingOrder = 4;
|
||||
if (isCommon)
|
||||
{
|
||||
m_ParticleSystem.Stop();
|
||||
}
|
||||
_isFollowScale = isFollowScale;
|
||||
}
|
||||
|
||||
public void Play(Vector3 Pos, Quaternion Rot)
|
||||
{
|
||||
m_Pos = Pos;
|
||||
m_GameObjIns.transform.position = m_Pos;
|
||||
m_GameObjIns.transform.rotation = Rot;
|
||||
On();
|
||||
m_GameObjIns.SetActive(value: true);
|
||||
m_ParticleSystem.Play();
|
||||
if (m_EffectSeSource != null)
|
||||
{
|
||||
m_EffectSeSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public void Play(Vector3 Pos)
|
||||
{
|
||||
m_Pos = Pos;
|
||||
m_GameObjIns.transform.position = m_Pos;
|
||||
On();
|
||||
m_GameObjIns.SetActive(value: true);
|
||||
m_ParticleSystem.Play();
|
||||
if (m_EffectSeSource != null)
|
||||
{
|
||||
m_EffectSeSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public void Play(Vector3 Pos, GameObject obj)
|
||||
{
|
||||
m_ChaseObjIns = obj;
|
||||
if (obj != null)
|
||||
{
|
||||
_buff = true;
|
||||
}
|
||||
m_Pos = Pos;
|
||||
m_GameObjIns.transform.position = m_Pos;
|
||||
On();
|
||||
m_GameObjIns.SetActive(value: true);
|
||||
m_ParticleSystem.Play();
|
||||
if (m_EffectSeSource != null)
|
||||
{
|
||||
m_EffectSeSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public void Play(float PosX, float PosY, float PosZ)
|
||||
{
|
||||
m_Pos.x = PosX;
|
||||
m_Pos.y = PosY;
|
||||
m_Pos.z = PosZ;
|
||||
m_GameObjIns.transform.position = m_Pos;
|
||||
On();
|
||||
m_GameObjIns.SetActive(value: true);
|
||||
m_ParticleSystem.Play();
|
||||
if (m_EffectSeSource != null)
|
||||
{
|
||||
m_EffectSeSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public void Play(float PosX, float PosY)
|
||||
{
|
||||
m_Pos.x = PosX;
|
||||
m_Pos.y = PosY;
|
||||
m_GameObjIns.transform.position = m_Pos;
|
||||
On();
|
||||
m_GameObjIns.SetActive(value: true);
|
||||
m_ParticleSystem.Play();
|
||||
if (m_EffectSeSource != null)
|
||||
{
|
||||
m_EffectSeSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
On();
|
||||
m_GameObjIns.SetActive(value: true);
|
||||
m_ParticleSystem.Play();
|
||||
}
|
||||
|
||||
public void FadeOut()
|
||||
{
|
||||
m_ParticleSystem.Stop();
|
||||
}
|
||||
|
||||
public void FadeIn()
|
||||
{
|
||||
On();
|
||||
m_ParticleSystem.Play();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
Off();
|
||||
m_GameObjIns.SetActive(value: false);
|
||||
m_ParticleSystem.Stop();
|
||||
}
|
||||
|
||||
public void PlayBuff(GameObject obj)
|
||||
{
|
||||
m_Pos = obj.transform.position;
|
||||
m_GameObjIns.transform.position = m_Pos;
|
||||
m_ChaseObjIns = obj;
|
||||
_buff = true;
|
||||
On();
|
||||
UpdatePositionAndRotation();
|
||||
m_GameObjIns.SetActive(value: true);
|
||||
m_ParticleSystem.Play();
|
||||
}
|
||||
|
||||
public void StopBuff()
|
||||
{
|
||||
m_ChaseObjIns = null;
|
||||
_buff = false;
|
||||
Off();
|
||||
m_GameObjIns.SetActive(value: false);
|
||||
m_ParticleSystem.Stop();
|
||||
}
|
||||
|
||||
public void StartLookAtEffect(GameObject fromObject, GameObject toObject)
|
||||
{
|
||||
m_ChaseObjIns = fromObject;
|
||||
m_LookAtObject = toObject;
|
||||
_buff = true;
|
||||
On();
|
||||
UpdatePositionAndRotation();
|
||||
m_GameObjIns.SetActive(value: true);
|
||||
m_ParticleSystem.Play();
|
||||
}
|
||||
|
||||
public void StartLookAtCameraEffect(GameObject fromObject, Camera toCamera)
|
||||
{
|
||||
m_ChaseObjIns = fromObject;
|
||||
_lookAtCamera = toCamera;
|
||||
_buff = true;
|
||||
On();
|
||||
UpdatePositionAndRotation();
|
||||
m_GameObjIns.SetActive(value: true);
|
||||
m_ParticleSystem.Play();
|
||||
}
|
||||
|
||||
public void StopLookAtEffect()
|
||||
{
|
||||
m_ChaseObjIns = null;
|
||||
m_LookAtObject = null;
|
||||
_buff = false;
|
||||
Off();
|
||||
m_GameObjIns.SetActive(value: false);
|
||||
m_ParticleSystem.Stop();
|
||||
}
|
||||
|
||||
private void UpdatePositionAndRotation()
|
||||
{
|
||||
m_GameObjIns.transform.position = m_ChaseObjIns.transform.position;
|
||||
m_GameObjIns.transform.rotation = CalculateRotation();
|
||||
}
|
||||
|
||||
private void UpdateScale()
|
||||
{
|
||||
m_GameObjIns.transform.localScale = m_ChaseObjIns.transform.localScale;
|
||||
}
|
||||
|
||||
private Quaternion CalculateRotation()
|
||||
{
|
||||
if (m_LookAtObject != null)
|
||||
{
|
||||
Vector3 position = m_ChaseObjIns.transform.position;
|
||||
Vector3 position2 = m_LookAtObject.transform.position;
|
||||
float z = Mathf.Atan2(position2.y - position.y, position2.x - position.x) * 57.29578f - 90f;
|
||||
return Quaternion.Euler(0f, 0f, z);
|
||||
}
|
||||
if (_lookAtCamera != null)
|
||||
{
|
||||
Vector3 position3 = m_ChaseObjIns.transform.position;
|
||||
Vector3 position4 = _lookAtCamera.transform.position;
|
||||
return Quaternion.FromToRotation(Vector3.forward, position3 - position4);
|
||||
}
|
||||
return m_ChaseObjIns.transform.rotation;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!_buff)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_ChaseObjIns != null)
|
||||
{
|
||||
if (_isFollowScale)
|
||||
{
|
||||
UpdateScale();
|
||||
}
|
||||
UpdatePositionAndRotation();
|
||||
}
|
||||
else
|
||||
{
|
||||
StopBuff();
|
||||
}
|
||||
}
|
||||
|
||||
public void On()
|
||||
{
|
||||
m_Use = true;
|
||||
}
|
||||
|
||||
public void Off()
|
||||
{
|
||||
m_Use = false;
|
||||
}
|
||||
|
||||
public void Change()
|
||||
{
|
||||
m_Use = !m_Use;
|
||||
}
|
||||
|
||||
public void ChangeParticleColor(Color color)
|
||||
{
|
||||
MotionUtils.ChangeParticleSystemColor(m_ParticleSystem.gameObject, color);
|
||||
}
|
||||
|
||||
public EffectMgr.EffectType GetEffectType()
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
|
||||
public GameObject GetGameObjIns()
|
||||
{
|
||||
return m_GameObjIns;
|
||||
}
|
||||
|
||||
public bool IsOn()
|
||||
{
|
||||
return m_Use;
|
||||
}
|
||||
|
||||
public bool IsPlay()
|
||||
{
|
||||
if (m_ParticleSystem.isPlaying || m_ParticleSystem.isPaused || m_ParticleSystem.IsAlive())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public GameObject GetChaseObjIns()
|
||||
{
|
||||
return m_ChaseObjIns;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user