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>
168 lines
5.3 KiB
C#
168 lines
5.3 KiB
C#
using System.Collections.Generic;
|
|
using Cute;
|
|
using UnityEngine;
|
|
using Wizard.RoomMatch;
|
|
|
|
namespace Wizard;
|
|
|
|
public class TreasureBoxCpDialog : MonoBehaviour
|
|
{
|
|
private UIAtlas _arenaAtlas;
|
|
|
|
private List<string> _loadFileList = new List<string>();
|
|
|
|
[SerializeField]
|
|
private UISprite _currentBoxSprite;
|
|
|
|
[SerializeField]
|
|
private UISprite _nextBoxSprite;
|
|
|
|
[SerializeField]
|
|
private UISprite _openedBoxSprite;
|
|
|
|
[SerializeField]
|
|
private UISprite[] _gradeStepSprites;
|
|
|
|
[SerializeField]
|
|
private UIGauge _gradeGauge;
|
|
|
|
[SerializeField]
|
|
private UILabel _nextGradeLabel;
|
|
|
|
[SerializeField]
|
|
private UILabel _nextGradeNumLabel;
|
|
|
|
[SerializeField]
|
|
private GameObject _openedBoxParts;
|
|
|
|
[SerializeField]
|
|
private GameObject _notOpenedBoxParts;
|
|
|
|
[SerializeField]
|
|
private UISprite _gaugeBackground;
|
|
|
|
[SerializeField]
|
|
private UIButton _treasureBoxGradeUpMethodButton;
|
|
|
|
[SerializeField]
|
|
private UISprite _arrowSprite;
|
|
|
|
private readonly float[][] _memory_value = new float[5][]
|
|
{
|
|
new float[0],
|
|
new float[2] { 0f, 1f },
|
|
new float[7] { 0f, 0.156f, 0.33f, 0.503f, 0.676f, 0.848f, 1f },
|
|
new float[9] { 0f, 0.114f, 0.244f, 0.373f, 0.502f, 0.631f, 0.761f, 0.892f, 1f },
|
|
new float[11]
|
|
{
|
|
0f, 0.087f, 0.192f, 0.294f, 0.397f, 0.5f, 0.605f, 0.709f, 0.812f, 0.917f,
|
|
1f
|
|
}
|
|
};
|
|
|
|
public static DialogBase CreateDialog()
|
|
{
|
|
SystemText systemText = Data.SystemText;
|
|
DialogBase dialog = UIManager.GetInstance().CreateDialogClose();
|
|
dialog.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn);
|
|
dialog.SetSize(DialogBase.Size.M);
|
|
dialog.SetButtonText(systemText.Get("TreasureBoxCp_0023"));
|
|
dialog.SetTitleLabel(systemText.Get("TreasureBoxCp_0001"));
|
|
GameObject gameObject = Object.Instantiate(LoadPrefab("UI/layoutParts/TreasureBoxCpDialog"));
|
|
TreasureBoxCpDialog treasureBoxCpDialog = gameObject.GetComponent<TreasureBoxCpDialog>();
|
|
treasureBoxCpDialog._treasureBoxGradeUpMethodButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
dialog.SetDisp(inDisp: false);
|
|
|
|
treasureBoxCpDialog.CreateDetailDialog(dialog);
|
|
}));
|
|
treasureBoxCpDialog.SetData();
|
|
dialog.SetObj(gameObject);
|
|
return dialog;
|
|
}
|
|
|
|
private void CreateDetailDialog(DialogBase parentDialog)
|
|
{
|
|
SystemText systemText = Data.SystemText;
|
|
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
|
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
|
dialogBase.SetSize(DialogBase.Size.M);
|
|
GameObject obj = Object.Instantiate(LoadPrefab("UI/layoutParts/TreasureBoxCpDetail"));
|
|
dialogBase.SetTitleLabel(systemText.Get("TreasureBoxCp_0007"));
|
|
dialogBase.SetObj(obj);
|
|
dialogBase.OnClose = delegate
|
|
{
|
|
if (parentDialog != null)
|
|
{
|
|
parentDialog.SetDisp(inDisp: true);
|
|
}
|
|
};
|
|
if (RoomBase.GetInstance() != null)
|
|
{
|
|
RoomBase.GetInstance().TreasureCpGradeUpConditionDialog = dialogBase;
|
|
}
|
|
}
|
|
|
|
private static GameObject LoadPrefab(string path)
|
|
{
|
|
PrefabMgr prefabMgr = null; // Pre-Phase-5b: no PrefabMgr headless
|
|
prefabMgr.Load(path);
|
|
return prefabMgr.Get(path);
|
|
}
|
|
|
|
public void SetData()
|
|
{
|
|
_openedBoxParts.SetActive(value: false);
|
|
_notOpenedBoxParts.SetActive(value: false);
|
|
TreasureBoxCp data = Data.TreasureBoxCp;
|
|
_gradeGauge.Value = ((data.NextGrade == 0) ? 1f : _memory_value[data.NextGrade][data.CurrentMemory]);
|
|
_nextGradeLabel.text = Data.SystemText.Get("TreasureBoxCp_0005");
|
|
int num = data.MaxMemory - data.CurrentMemory;
|
|
_nextGradeNumLabel.text = Data.SystemText.Get("TreasureBoxCp_0027", num.ToString());
|
|
SetGaugeBackground(data.NextGrade, data.MaxGrade);
|
|
string atlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Arena, null);
|
|
_loadFileList.Add(atlasName);
|
|
StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(atlasName, delegate
|
|
{
|
|
atlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Arena, null, isload: true);
|
|
_arenaAtlas = Toolbox.ResourcesManager.LoadObject<GameObject>(atlasName).GetComponent<UIAtlas>();
|
|
_currentBoxSprite.atlas = _arenaAtlas;
|
|
_nextBoxSprite.atlas = _arenaAtlas;
|
|
_openedBoxSprite.atlas = _arenaAtlas;
|
|
_gaugeBackground.atlas = _arenaAtlas;
|
|
_arrowSprite.atlas = _arenaAtlas;
|
|
if (data.IsTreasureBoxOpened)
|
|
{
|
|
_openedBoxSprite.spriteName = $"box_2pick_0{TreasureBoxCp.GRADE_TO_TREASURE_BOX_ID[data.CurrentGrade]}_open";
|
|
UIManager.SetObjectToGrey(_openedBoxSprite.gameObject, b: true);
|
|
_openedBoxParts.SetActive(value: true);
|
|
}
|
|
else
|
|
{
|
|
_currentBoxSprite.spriteName = $"box_2pick_0{TreasureBoxCp.GRADE_TO_TREASURE_BOX_ID[data.CurrentGrade]}_close";
|
|
_nextBoxSprite.spriteName = $"box_2pick_0{TreasureBoxCp.GRADE_TO_TREASURE_BOX_ID[data.NextGrade]}_close";
|
|
_arrowSprite.spriteName = "arrow";
|
|
_notOpenedBoxParts.SetActive(value: true);
|
|
}
|
|
for (int i = 0; i < _gradeStepSprites.Length; i++)
|
|
{
|
|
_gradeStepSprites[i].atlas = _arenaAtlas;
|
|
if (i < data.CurrentGrade)
|
|
{
|
|
_gradeStepSprites[i].spriteName = "icon_diamond_mark_on";
|
|
}
|
|
else
|
|
{
|
|
_gradeStepSprites[i].spriteName = "icon_diamond_mark_off";
|
|
}
|
|
}
|
|
}));
|
|
}
|
|
|
|
private void SetGaugeBackground(int nextGrade, int maxGrade)
|
|
{
|
|
int num = ((nextGrade == 0) ? maxGrade : nextGrade);
|
|
_gaugeBackground.spriteName = $"gauge_bg_scale_{num}";
|
|
}
|
|
}
|