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:
@@ -11,264 +11,23 @@ public class FirstTips : MonoBehaviour
|
||||
public enum TipsType
|
||||
{
|
||||
Deck = 0,
|
||||
CardCreate = 1,
|
||||
ChallengeTwoPick = 2,
|
||||
SoroPlay = 3,
|
||||
Battle = 4,
|
||||
Card = 5,
|
||||
VideoSharing = 6,
|
||||
VideoRecordingIosJpn = 7,
|
||||
VideoRecordingIosEng = 8,
|
||||
VideoRecordingAndroidEng = 9,
|
||||
ShopCardPack = 10,
|
||||
CardDestruct = 11,
|
||||
Convention = 12,
|
||||
BattleBeforeFormatUser = 13,
|
||||
DeckBeforeFormatUser = 14,
|
||||
DeckAfterFormatUser = 15,
|
||||
Colosseum = 16,
|
||||
ColosseumInfo = 17,
|
||||
Challenge = 18,
|
||||
Sealed = 19,
|
||||
GuildNotJoining = 20,
|
||||
GuildJoining = 21,
|
||||
SoroPlayOnlydAssist = 22,
|
||||
SpotCardExchange = 23,
|
||||
GachaPointExchange = 24,
|
||||
Quest = 25,
|
||||
AdditionalPuzzle = 26,
|
||||
Competition = 27,
|
||||
Crossover = 28,
|
||||
Bingo = 29,
|
||||
NeutralPopularityVote = 30,
|
||||
LeaderPopularityVote = 31,
|
||||
CompetitionVer2 = 32,
|
||||
MyRotationDeck = 33,
|
||||
BossRush = 34,
|
||||
CompetitionTwoPick = 35,
|
||||
RedEtherCampaign = 36,
|
||||
SoroPlay2 = 37,
|
||||
ResurgentCard = 38,
|
||||
ColosseumWindFall = 39,
|
||||
HeroesFreeMatch = 40,
|
||||
HeroesGrandPrix = 41,
|
||||
TimeslipResurgentCard = 42,
|
||||
Colosseum2PickChaos = 43,
|
||||
ChallengeTwoPickCube = 44,
|
||||
ChallengeTwoPickChaos = 45,
|
||||
Max = 46,
|
||||
MyPage = 1001,
|
||||
BattlePathSeason = 1002
|
||||
}
|
||||
MyPage = 1001 }
|
||||
|
||||
protected enum Csv
|
||||
{
|
||||
TipsType,
|
||||
TextId,
|
||||
Mask,
|
||||
PrefabName,
|
||||
ImageName
|
||||
}
|
||||
|
||||
public const float TWEEN_ALPHA_TIME = 0.5f;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture m_ImageTex;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel m_WindowLabel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject m_NextTextMarkObject;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject m_MaskObject;
|
||||
|
||||
[SerializeField]
|
||||
private TweenAlpha m_TweenAlpha;
|
||||
|
||||
[SerializeField]
|
||||
private UIPanel _panel;
|
||||
|
||||
private ArrayList m_Csv;
|
||||
|
||||
private List<string[]> m_TipsData;
|
||||
|
||||
private IEnumerable<TipsType> _tipsTypes;
|
||||
|
||||
private int m_PageNo;
|
||||
|
||||
private int m_PageMaxNo;
|
||||
|
||||
private GameObject m_TipsPrefab;
|
||||
|
||||
private bool m_DestoryFlg;
|
||||
|
||||
private bool _isResourceLoadFinish;
|
||||
|
||||
private int _startPage;
|
||||
|
||||
private List<string> m_AssetFileList = new List<string>();
|
||||
|
||||
private ResourcesManager.AssetLoadPathType m_AssetType = ResourcesManager.AssetLoadPathType.FirstTips;
|
||||
|
||||
private bool _isEnableBackKeyChange = true;
|
||||
|
||||
private Action _onFinish;
|
||||
|
||||
private int _seasonId;
|
||||
|
||||
private const string TIPS_CSV_NAME = "firsttips";
|
||||
|
||||
public bool IsEnableBackKeyChange
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isEnableBackKeyChange;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isEnableBackKeyChange = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateTips(TipsType in_TipsType, Action onFinish)
|
||||
{
|
||||
CreateTips(new TipsType[1] { in_TipsType }, onFinish);
|
||||
}
|
||||
|
||||
public void CreateTips(IEnumerable<TipsType> tipsTypes, Action onFinish, int startPage = 0, int seasonId = 0)
|
||||
{
|
||||
_startPage = startPage;
|
||||
_onFinish = onFinish;
|
||||
_panel.alpha = 0f;
|
||||
GameMgr.GetIns().GetInputMgr().isBackKeyEnable = false;
|
||||
m_TweenAlpha.enabled = false;
|
||||
m_AssetFileList.Clear();
|
||||
_tipsTypes = tipsTypes;
|
||||
_seasonId = seasonId;
|
||||
List<string> list = new List<string>();
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("firsttips", ResourcesManager.AssetLoadPathType.Master);
|
||||
list.Add(assetTypePath);
|
||||
m_AssetFileList.Add(assetTypePath);
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(list, _CsvLoadEnd));
|
||||
}
|
||||
|
||||
protected void _CsvLoadEnd()
|
||||
{
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("etc/firsttips", ResourcesManager.AssetLoadPathType.Master, isfetch: true);
|
||||
TextAsset textAsset = Toolbox.ResourcesManager.LoadObject<TextAsset>(assetTypePath);
|
||||
m_Csv = Utility.ConvertCSV(textAsset.text);
|
||||
m_TipsData = new List<string[]>();
|
||||
foreach (TipsType tipsType in _tipsTypes)
|
||||
{
|
||||
foreach (ArrayList item in m_Csv)
|
||||
{
|
||||
string[] array = (string[])item.ToArray(typeof(string));
|
||||
if (int.Parse(array[0]) == (int)tipsType)
|
||||
{
|
||||
m_TipsData.Add(array);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_PageMaxNo = m_TipsData.Count;
|
||||
List<string> list = new List<string>();
|
||||
foreach (string[] tipsDatum in m_TipsData)
|
||||
{
|
||||
if (tipsDatum[4] != "")
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(tipsDatum[4], m_AssetType);
|
||||
assetTypePath2 = ConvertSeasonImageFileName((TipsType)int.Parse(tipsDatum[0]), assetTypePath2);
|
||||
if (!list.Contains(assetTypePath2))
|
||||
{
|
||||
list.Add(assetTypePath2);
|
||||
m_AssetFileList.Add(assetTypePath2);
|
||||
}
|
||||
}
|
||||
if (tipsDatum[3] != "")
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(tipsDatum[3], m_AssetType);
|
||||
if (!list.Contains(assetTypePath2))
|
||||
{
|
||||
list.Add(assetTypePath2);
|
||||
m_AssetFileList.Add(assetTypePath2);
|
||||
}
|
||||
}
|
||||
}
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(list, _ResourceLoadEnd));
|
||||
}
|
||||
|
||||
protected void _ResourceLoadEnd()
|
||||
{
|
||||
_isResourceLoadFinish = true;
|
||||
m_TweenAlpha.enabled = true;
|
||||
_PageSet(_startPage);
|
||||
}
|
||||
|
||||
public void TipsClickCallBack()
|
||||
{
|
||||
if (_isResourceLoadFinish && !m_DestoryFlg)
|
||||
{
|
||||
m_PageNo++;
|
||||
if (m_PageMaxNo > m_PageNo)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_FEED_TEXT);
|
||||
_PageSet(m_PageNo);
|
||||
}
|
||||
else if (m_PageNo == m_PageMaxNo)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL);
|
||||
m_TweenAlpha.PlayReverse();
|
||||
m_DestoryFlg = true;
|
||||
StartCoroutine(Destroy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void _PageSet(int in_PageNo)
|
||||
{
|
||||
m_PageNo = in_PageNo;
|
||||
SystemText systemText = Data.SystemText;
|
||||
m_WindowLabel.SetWrapText(systemText.Get(m_TipsData[m_PageNo][1]));
|
||||
if (m_PageMaxNo != 1)
|
||||
{
|
||||
m_NextTextMarkObject.SetActive(value: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NextTextMarkObject.SetActive(value: false);
|
||||
}
|
||||
if ("1" == m_TipsData[m_PageNo][2])
|
||||
{
|
||||
m_MaskObject.SetActive(value: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MaskObject.SetActive(value: false);
|
||||
}
|
||||
string text = m_TipsData[m_PageNo][4];
|
||||
if (text != "")
|
||||
{
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(text, m_AssetType, isfetch: true);
|
||||
assetTypePath = ConvertSeasonImageFileName((TipsType)int.Parse(m_TipsData[m_PageNo][0]), assetTypePath);
|
||||
Texture mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath);
|
||||
m_ImageTex.mainTexture = mainTexture;
|
||||
}
|
||||
string path = m_TipsData[m_PageNo][3];
|
||||
if (m_TipsData[m_PageNo][3] != "")
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(path, m_AssetType, isfetch: true);
|
||||
m_TipsPrefab = Toolbox.ResourcesManager.LoadObject<GameObject>(assetTypePath2);
|
||||
m_TipsPrefab = UnityEngine.Object.Instantiate(m_TipsPrefab);
|
||||
m_TipsPrefab.transform.parent = m_ImageTex.gameObject.transform;
|
||||
m_TipsPrefab.transform.localPosition = Vector3.zero;
|
||||
m_TipsPrefab.transform.localScale = Vector3.one;
|
||||
}
|
||||
else if (m_TipsPrefab != null)
|
||||
{
|
||||
UnityEngine.Object.Destroy(m_TipsPrefab);
|
||||
m_TipsPrefab = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsAllwaysDispaly(TipsType in_TipsType)
|
||||
@@ -280,15 +39,6 @@ public class FirstTips : MonoBehaviour
|
||||
return false;
|
||||
}
|
||||
|
||||
private string ConvertSeasonImageFileName(TipsType tipsType, string imagePath)
|
||||
{
|
||||
if (tipsType == TipsType.BattlePathSeason || tipsType == TipsType.Colosseum2PickChaos || tipsType == TipsType.ChallengeTwoPickChaos)
|
||||
{
|
||||
return string.Format(imagePath, _seasonId);
|
||||
}
|
||||
return imagePath;
|
||||
}
|
||||
|
||||
public static bool IsFirstTipsOpen(TipsType in_TipsType)
|
||||
{
|
||||
if (IsAllwaysDispaly(in_TipsType))
|
||||
@@ -306,27 +56,6 @@ public class FirstTips : MonoBehaviour
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerator Destroy()
|
||||
{
|
||||
float time = 0f;
|
||||
while (time < 0.5f)
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
foreach (TipsType tipsType in _tipsTypes)
|
||||
{
|
||||
SaveFinishFirstTips(tipsType);
|
||||
}
|
||||
_onFinish.Call();
|
||||
UnityEngine.Object.Destroy(base.gameObject);
|
||||
}
|
||||
|
||||
public static void ClearTipsFlag()
|
||||
{
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.FIRST_TIPS, 0.ToString());
|
||||
}
|
||||
|
||||
public static void SaveFinishFirstTips(TipsType tips)
|
||||
{
|
||||
if (!IsAllwaysDispaly(tips))
|
||||
@@ -337,18 +66,6 @@ public class FirstTips : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnDestroy()
|
||||
{
|
||||
if (m_AssetFileList.Count != 0)
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(m_AssetFileList);
|
||||
}
|
||||
if (IsEnableBackKeyChange)
|
||||
{
|
||||
GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static long Fix(long value)
|
||||
{
|
||||
if (value < 0)
|
||||
|
||||
Reference in New Issue
Block a user