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>
208 lines
5.1 KiB
C#
208 lines
5.1 KiB
C#
using System;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
public class ChapterSelectButton : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField]
|
|
private UISprite _notSelectMask;
|
|
|
|
[SerializeField]
|
|
private UISprite _clearMask;
|
|
|
|
[SerializeField]
|
|
private UILabel _clearLabel;
|
|
|
|
[SerializeField]
|
|
private UILabel _chapterNo;
|
|
|
|
[SerializeField]
|
|
private UILabel _chapterName;
|
|
|
|
[SerializeField]
|
|
private UIMarquee _chapterNameMarquee;
|
|
|
|
[SerializeField]
|
|
private UITexture _bg;
|
|
|
|
[SerializeField]
|
|
private GameObject _tapEffectLocator;
|
|
|
|
[SerializeField]
|
|
private UIDragScrollView _dragScrollView;
|
|
|
|
private StoryChapterData _chapterData;
|
|
|
|
public Action OnClick { get; set; }
|
|
|
|
public GameObject TapEffectLocator => _tapEffectLocator;
|
|
|
|
public Transform ClearLabelTransform => _clearLabel.transform;
|
|
|
|
public void SetScrollEnable(bool enable)
|
|
{
|
|
_dragScrollView.enabled = enable;
|
|
}
|
|
|
|
public void SetClearVisible(bool visible)
|
|
{
|
|
_clearLabel.gameObject.SetActive(visible);
|
|
}
|
|
|
|
public static string GetHeaderPath(StoryChapterData chapterData, bool isFetch)
|
|
{
|
|
return Toolbox.ResourcesManager.GetAssetTypePath("story_chapter_header_" + chapterData.ChapterButtonBgId.ToString("00"), ResourcesManager.AssetLoadPathType.StoryChapterHeader, isFetch);
|
|
}
|
|
|
|
public void OnStartClearEffect()
|
|
{
|
|
_clearLabel.gameObject.SetActive(value: true);
|
|
_clearLabel.enabled = false;
|
|
}
|
|
|
|
public void OnFinishClearEffect()
|
|
{
|
|
_clearLabel.enabled = true;
|
|
}
|
|
|
|
public void UpdateClearState(StoryChapterData.ChapterClearStatus clearState)
|
|
{
|
|
AreaSelectUtility.SetClearLabelColor(_clearLabel, clearState);
|
|
}
|
|
|
|
public void SetChapterData(StoryChapterData chapterData, AreaSelectUI parent, UIScrollView scrollView)
|
|
{
|
|
_chapterData = chapterData;
|
|
_dragScrollView.scrollView = scrollView;
|
|
_bg.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(GetHeaderPath(chapterData, isFetch: true));
|
|
_bg.gameObject.SetActive(value: true);
|
|
_notSelectMask.gameObject.SetActive(value: false);
|
|
UpdateClearState(chapterData.ClearStatus);
|
|
_clearLabel.gameObject.SetActive(chapterData.IsPlayedChapter);
|
|
if (chapterData.IsMaintenanceChapter)
|
|
{
|
|
Color color = _chapterName.color;
|
|
UIManager.SetObjectToGrey(base.gameObject, b: true);
|
|
_chapterName.color = color;
|
|
_chapterName.text = Data.SystemText.Get("System_0022");
|
|
_chapterNo.text = string.Empty;
|
|
}
|
|
else
|
|
{
|
|
string chapterTitleStory = parent.GetChapterTitleStory(chapterData.ChapterId);
|
|
int num = chapterTitleStory.IndexOf(' ');
|
|
_chapterNo.text = chapterTitleStory.Substring(0, num + 1);
|
|
_chapterName.text = chapterTitleStory.Substring(num + 1);
|
|
_chapterNameMarquee.SetWidthOfNeedsToScroll(324f - (float)_chapterNo.width);
|
|
_chapterNameMarquee.Reset();
|
|
}
|
|
}
|
|
|
|
public void UpdateSelectStatus(int SelectChapterIndex, int selfIndex, AreaSelectUI parent, bool isinterpscale, UIScrollView scrollView)
|
|
{
|
|
bool flag = selfIndex == SelectChapterIndex;
|
|
int num = 0;
|
|
float num2 = 0f;
|
|
if (flag)
|
|
{
|
|
num = 4;
|
|
num2 = 1f;
|
|
}
|
|
else
|
|
{
|
|
num = 3;
|
|
num2 = 0.85f;
|
|
}
|
|
bool flag2 = parent.IsUseChapterListClearedMask && _chapterData.IsCleared;
|
|
if (!_chapterData.IsMaintenanceChapter)
|
|
{
|
|
Color color = new Color(1f, 1f, 1f, 1f);
|
|
color.a = num2;
|
|
_bg.color = color;
|
|
_notSelectMask.color = color;
|
|
_chapterNo.color = color;
|
|
_chapterName.color = color;
|
|
_clearLabel.color = color;
|
|
}
|
|
if (_bg.gameObject.activeSelf != flag)
|
|
{
|
|
_bg.gameObject.SetActive(flag);
|
|
SetMarqueeEnable(flag);
|
|
}
|
|
if (_notSelectMask.gameObject.activeSelf == flag)
|
|
{
|
|
_notSelectMask.gameObject.SetActive(!flag);
|
|
}
|
|
if (_clearMask.gameObject.activeSelf != flag2)
|
|
{
|
|
_clearMask.gameObject.SetActive(flag2);
|
|
}
|
|
UpdateInterpsScale(isinterpscale, flag);
|
|
Vector3 localPosition = base.transform.localPosition;
|
|
float num3 = Mathf.Abs(localPosition.y + scrollView.transform.localPosition.y);
|
|
float num4 = 200f;
|
|
if (num3 < num4)
|
|
{
|
|
float num5 = num4 - Mathf.Sqrt(num4 * num4 - num3 * num3);
|
|
num5 *= 2.5f;
|
|
localPosition.x = 190f + num5;
|
|
}
|
|
else
|
|
{
|
|
localPosition.x = 530f + num4;
|
|
}
|
|
base.transform.localPosition = localPosition;
|
|
_bg.depth = num;
|
|
_notSelectMask.depth = num;
|
|
}
|
|
|
|
public void SetMarqueeEnable(bool enable)
|
|
{
|
|
if (enable)
|
|
{
|
|
_chapterNameMarquee.StartMarquee();
|
|
}
|
|
else
|
|
{
|
|
_chapterNameMarquee.Reset();
|
|
}
|
|
}
|
|
|
|
private void UpdateInterpsScale(bool isinterpscale, bool isSelected)
|
|
{
|
|
float num = (isSelected ? 1f : 0.75f);
|
|
if (isinterpscale)
|
|
{
|
|
Vector3 localScale = base.transform.localScale;
|
|
if (localScale.x < num)
|
|
{
|
|
localScale.x += Time.deltaTime;
|
|
if (localScale.x >= num)
|
|
{
|
|
localScale.x = num;
|
|
}
|
|
}
|
|
else if (localScale.x > num)
|
|
{
|
|
localScale.x -= Time.deltaTime;
|
|
if (localScale.x <= num)
|
|
{
|
|
localScale.x = num;
|
|
}
|
|
}
|
|
localScale.y = localScale.x;
|
|
base.transform.localScale = localScale;
|
|
}
|
|
else
|
|
{
|
|
Vector3 localScale2 = base.transform.localScale;
|
|
localScale2.x = num;
|
|
localScale2.y = num;
|
|
base.transform.localScale = localScale2;
|
|
}
|
|
}
|
|
}
|