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:
@@ -3,6 +3,10 @@ using System.Collections.Generic;
|
||||
using Cute;
|
||||
using LitJson;
|
||||
using UnityEngine;
|
||||
// TODO(engine-cleanup-pass2): 74 of 75 methods unrun in baseline
|
||||
// Type: Wizard.PlayerStaticData
|
||||
// See data_dumps/reports/engine-cleanup/live-methods.baseline.txt
|
||||
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
@@ -193,7 +197,7 @@ public class PlayerStaticData : MonoBehaviour
|
||||
return m_type switch
|
||||
{
|
||||
Type.Emblem => UserEmblemID.ToString(),
|
||||
Type.RankIcon => (GameMgr.GetIns().GetDataMgr().IsDipslayHighRankFormat() ? UserRankHighAllFormat() : UserRank(Format)).ToString("00"),
|
||||
Type.RankIcon => UserRank(Format).ToString("00"), // Pre-Phase-5b: headless has no display-high-rank flag
|
||||
Type.Country => UserCountryCode,
|
||||
_ => "",
|
||||
};
|
||||
@@ -202,24 +206,16 @@ public class PlayerStaticData : MonoBehaviour
|
||||
|
||||
public enum EmblemTexSize
|
||||
{
|
||||
S,
|
||||
M,
|
||||
MAX
|
||||
}
|
||||
S}
|
||||
|
||||
public enum RankTexSize
|
||||
{
|
||||
S,
|
||||
L,
|
||||
MAX
|
||||
}
|
||||
L }
|
||||
|
||||
public enum CountryTexSize
|
||||
{
|
||||
S,
|
||||
M,
|
||||
MAX
|
||||
}
|
||||
S}
|
||||
|
||||
public enum AgreementState
|
||||
{
|
||||
@@ -235,9 +231,7 @@ public class PlayerStaticData : MonoBehaviour
|
||||
SEALED,
|
||||
COLOSSEUM,
|
||||
COMPETITION,
|
||||
SPECIAL_CRYSTAL,
|
||||
MAX
|
||||
}
|
||||
SPECIAL_CRYSTAL }
|
||||
|
||||
public static AgreementState _tosAgreementState = AgreementState.NotAgree;
|
||||
|
||||
@@ -251,30 +245,10 @@ public class PlayerStaticData : MonoBehaviour
|
||||
|
||||
public static TimeData UserTime = new TimeData();
|
||||
|
||||
public static int UserViewerID => Certification.ViewerId;
|
||||
|
||||
public static string UserName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Data.Load.data == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return Data.Load.data._userInfo.name;
|
||||
}
|
||||
set
|
||||
{
|
||||
Data.Load.data._userInfo.name = value;
|
||||
}
|
||||
}
|
||||
public static int UserViewerID => 0; // Pre-Phase-5 chunk 39: aliased Certification.ViewerId — client-only UI accessor, dead headless
|
||||
|
||||
public static string UserRegionCode => PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.CURRENT_REGION_CODE);
|
||||
|
||||
public static bool IsOfficialUser { get; set; }
|
||||
|
||||
public static bool IsOfficialUserDisplay { get; set; }
|
||||
|
||||
public static AgreementState KorAuthorityAgreementState { get; set; } = AgreementState.NotAgree;
|
||||
|
||||
public static int UserCrystalCount
|
||||
@@ -353,30 +327,6 @@ public class PlayerStaticData : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public static int UserChallengeTicketNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetItemNum(1);
|
||||
}
|
||||
set
|
||||
{
|
||||
UpdateItemNum(1, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static int UserColosseumTicketNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetItemNum(2);
|
||||
}
|
||||
set
|
||||
{
|
||||
UpdateItemNum(2, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static long UserEmblemID
|
||||
{
|
||||
get
|
||||
@@ -395,18 +345,6 @@ public class PlayerStaticData : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public static int UserDegreeID
|
||||
{
|
||||
get
|
||||
{
|
||||
return Data.Load.data._userInfo.selected_degree_id;
|
||||
}
|
||||
set
|
||||
{
|
||||
Data.Load.data._userInfo.selected_degree_id = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static string UserCountryCode
|
||||
{
|
||||
get
|
||||
@@ -425,83 +363,11 @@ public class PlayerStaticData : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public static bool UserPromotionFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.is_promotion;
|
||||
}
|
||||
set
|
||||
{
|
||||
Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.is_promotion = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static int UserPromotionMatchCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.match_count;
|
||||
}
|
||||
set
|
||||
{
|
||||
Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.match_count = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static int UserPromotionWinCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.win;
|
||||
}
|
||||
set
|
||||
{
|
||||
Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.win = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static int UserPromotionLoseCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.lose;
|
||||
}
|
||||
set
|
||||
{
|
||||
Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.lose = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static string UserBirthDay
|
||||
{
|
||||
get
|
||||
{
|
||||
return Data.Load.data._userInfo.birth_day;
|
||||
}
|
||||
set
|
||||
{
|
||||
Data.Load.data._userInfo.birth_day = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsLootBoxRegulation(LootBoxType type)
|
||||
{
|
||||
return Data.Load.data.LootBoxReguration[(int)type];
|
||||
}
|
||||
|
||||
public static bool IsPurchaseNotificationOfLootBox()
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (IsLootBoxRegulation((LootBoxType)i))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int GetItemNum(int itemId)
|
||||
{
|
||||
if (Data.Load.data._userItemDict == null)
|
||||
@@ -515,11 +381,6 @@ public class PlayerStaticData : MonoBehaviour
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void InitializeItemNum(int itemId, int num)
|
||||
{
|
||||
UpdateItemNum(itemId, num);
|
||||
}
|
||||
|
||||
public static void UpdateItemNum(int itemId, int num)
|
||||
{
|
||||
if (Data.Load.data._userItemDict == null)
|
||||
@@ -543,107 +404,6 @@ public class PlayerStaticData : MonoBehaviour
|
||||
UserRankTexture = new UserTex(UserTex.Type.RankIcon);
|
||||
}
|
||||
|
||||
public static void LoadUserEmblemTexture()
|
||||
{
|
||||
UserEmblemTexture.LoadTexture();
|
||||
}
|
||||
|
||||
public static void AttachUserEmblemTexture(UITexture uiTexture, EmblemTexSize size)
|
||||
{
|
||||
UserEmblemTexture.AttachTexture(uiTexture, (int)size);
|
||||
}
|
||||
|
||||
public static void LoadUserCountryTexture()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(UserCountryCode))
|
||||
{
|
||||
UserCountryTexture.LoadTexture();
|
||||
}
|
||||
}
|
||||
|
||||
public static void AttachUserCountryTexture(UITexture uiTexture, CountryTexSize size)
|
||||
{
|
||||
UserCountryTexture.AttachTexture(uiTexture, (int)size);
|
||||
}
|
||||
|
||||
public static int UserBattlePointCurrentFormat()
|
||||
{
|
||||
return UserBattlePoint(Data.CurrentFormat);
|
||||
}
|
||||
|
||||
public static int UserBattlePoint(Format inFormat)
|
||||
{
|
||||
return Data.Load.data._userRank[(int)inFormat].battle_point;
|
||||
}
|
||||
|
||||
public static int UserBattlePointHighFormat()
|
||||
{
|
||||
int val = UserBattlePoint(Format.Rotation);
|
||||
int val2 = UserBattlePoint(Format.Unlimited);
|
||||
return Math.Max(val, val2);
|
||||
}
|
||||
|
||||
public static int UserMasterPointCurrentFormat()
|
||||
{
|
||||
return UserMasterPoint(Data.CurrentFormat);
|
||||
}
|
||||
|
||||
public static int UserMasterPoint(Format inFormat)
|
||||
{
|
||||
return Data.Load.data._userRank[(int)inFormat].master_point;
|
||||
}
|
||||
|
||||
public static int UserMasterPointHighAllFormat()
|
||||
{
|
||||
return UserMasterPoint(HighRankFormat());
|
||||
}
|
||||
|
||||
public static Format HighRankFormat()
|
||||
{
|
||||
int num = UserRank(Format.Rotation);
|
||||
int num2 = UserRank(Format.Unlimited);
|
||||
if (num == num2)
|
||||
{
|
||||
int num3 = UserBattlePoint(Format.Rotation);
|
||||
int num4 = UserBattlePoint(Format.Unlimited);
|
||||
if (IsMasterRank(Format.Rotation))
|
||||
{
|
||||
num3 = UserMasterPoint(Format.Rotation);
|
||||
num4 = UserMasterPoint(Format.Unlimited);
|
||||
}
|
||||
if (num3 <= num4)
|
||||
{
|
||||
return Format.Unlimited;
|
||||
}
|
||||
return Format.Rotation;
|
||||
}
|
||||
if (num <= num2)
|
||||
{
|
||||
return Format.Unlimited;
|
||||
}
|
||||
return Format.Rotation;
|
||||
}
|
||||
|
||||
public static int UserBattlePointEachRankCurrentFormat()
|
||||
{
|
||||
return UserBattlePointEachRank(Data.CurrentFormat);
|
||||
}
|
||||
|
||||
public static int UserBattlePointEachRank(Format inFormat)
|
||||
{
|
||||
if (IsMasterRank(inFormat))
|
||||
{
|
||||
return Data.Load.data._userRank[(int)inFormat].grandMasterData.currentMasterPoint;
|
||||
}
|
||||
int num = ((!Data.Load.data.IsStartRank(inFormat, UserRank(inFormat))) ? Data.Load.data.GetRankInfo(inFormat, UserRank(inFormat) - 1).accumulate_point : 0);
|
||||
return UserBattlePoint(inFormat) - num;
|
||||
}
|
||||
|
||||
public static int UserRankCurrentFormat()
|
||||
{
|
||||
return UserRank(Data.CurrentFormat);
|
||||
}
|
||||
|
||||
public static int UserRank(Format inFormat)
|
||||
{
|
||||
if (inFormat == Format.PreRotation)
|
||||
@@ -670,12 +430,6 @@ public class PlayerStaticData : MonoBehaviour
|
||||
UserRankTexture.LoadTexture();
|
||||
}
|
||||
|
||||
public static void ReLoadUserRankTexture(string inOldId, string inNewId, Format inFormat)
|
||||
{
|
||||
UserRankTexture.Format = inFormat;
|
||||
UserRankTexture.ReLoadTexture(inOldId, inNewId);
|
||||
}
|
||||
|
||||
public static void AttachUserRankTexture(UITexture uiTexture, RankTexSize size)
|
||||
{
|
||||
UserRankTexture.AttachTexture(uiTexture, (int)size);
|
||||
@@ -691,36 +445,6 @@ public class PlayerStaticData : MonoBehaviour
|
||||
return Data.Load.data._userRank[(int)inFormat].is_master_rank;
|
||||
}
|
||||
|
||||
public static bool IsGrandMasterRankCurrentFormat()
|
||||
{
|
||||
return IsGrandMasterRank(Data.CurrentFormat);
|
||||
}
|
||||
|
||||
public static bool IsGrandMasterRank(Format inFormat)
|
||||
{
|
||||
return Data.Load.data._userRank[(int)inFormat].is_grand_master_rank;
|
||||
}
|
||||
|
||||
public static bool IsMaxRank(Format inFormat)
|
||||
{
|
||||
List<RankInfo> rankInfoRawList = Data.Load.data.GetRankInfoRawList(inFormat);
|
||||
return UserRank(inFormat) >= rankInfoRawList[rankInfoRawList.Count - 1].RankId;
|
||||
}
|
||||
|
||||
public static int UserNextRankExp(Format inFormat)
|
||||
{
|
||||
if (IsMasterRank(inFormat))
|
||||
{
|
||||
return Data.Load.data._userRank[(int)inFormat].grandMasterData.targetMasterPoint;
|
||||
}
|
||||
return Mathf.Max(0, Data.Load.data.GetRankInfo(inFormat, UserRank(inFormat)).necessary_point - UserBattlePointEachRank(inFormat));
|
||||
}
|
||||
|
||||
public static bool UserPromotionIsWin(int matchNum)
|
||||
{
|
||||
return (Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.battle_result >> matchNum) % 2 != 0;
|
||||
}
|
||||
|
||||
public static void UpdateHaveUserGoodsNumByJsonData(JsonData userGoodsList)
|
||||
{
|
||||
for (int i = 0; i < userGoodsList.Count; i++)
|
||||
@@ -753,14 +477,14 @@ public class PlayerStaticData : MonoBehaviour
|
||||
case UserGoods.Type.Card:
|
||||
{
|
||||
int cardId = (int)userGoodsId;
|
||||
GameMgr.GetIns().GetDataMgr().UpdateUserOwnCardData(cardId, num);
|
||||
/* Pre-Phase-5b: headless has no user card data */
|
||||
break;
|
||||
}
|
||||
case UserGoods.Type.SpotCard:
|
||||
case UserGoods.Type.SpotCardOnlyLatestCardPack:
|
||||
{
|
||||
int cardId = (int)userGoodsId;
|
||||
GameMgr.GetIns().GetDataMgr().SpotCardData.SetSpotCardNum(cardId, num);
|
||||
/* Pre-Phase-5b: headless has no spot card data */
|
||||
break;
|
||||
}
|
||||
case UserGoods.Type.Rupy:
|
||||
@@ -771,7 +495,7 @@ public class PlayerStaticData : MonoBehaviour
|
||||
}
|
||||
break;
|
||||
case UserGoods.Type.Skin:
|
||||
GameMgr.GetIns().GetDataMgr().GetCharaPrmBySkinId((int)userGoodsId)?.Acquired();
|
||||
/* Pre-Phase-5b: headless has no chara master */
|
||||
break;
|
||||
case UserGoods.Type.Sleeve:
|
||||
Data.Master.SleeveMgr.Acquired(userGoodsId);
|
||||
|
||||
Reference in New Issue
Block a user