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>
165 lines
4.0 KiB
C#
165 lines
4.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
public class DrumrollScrollManager : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField]
|
|
private UIScrollView _scrollView;
|
|
|
|
[SerializeField]
|
|
private UIGrid _itemListParent;
|
|
|
|
[SerializeField]
|
|
private UICenterOnChild _gridCenter;
|
|
|
|
[SerializeField]
|
|
private UIButton _ButtonScrollPrev;
|
|
|
|
[SerializeField]
|
|
private UIButton _ButtonScrollNext;
|
|
|
|
private List<GameObject> _itemList = new List<GameObject>();
|
|
|
|
private bool _isDrag;
|
|
|
|
private int _CurrentIndex;
|
|
|
|
private Action<int> _SelectCallBack;
|
|
|
|
public IEnumerator CreateDrumrollScroll_Coroutine(List<GameObject> itemObjList, int defaultIndex, Action<int> selectCallback, Action onCreateCallBack = null)
|
|
{
|
|
InitItemList(itemObjList);
|
|
_CurrentIndex = defaultIndex;
|
|
_SelectCallBack = selectCallback;
|
|
yield return null;
|
|
_gridCenter.onCenter = null;
|
|
float springStrength = _gridCenter.springStrength;
|
|
_gridCenter.springStrength = 5000f;
|
|
_gridCenter.onFinished = delegate
|
|
{
|
|
_gridCenter.onFinished = null;
|
|
TweenAlpha.Begin(base.gameObject, 0f, 1f);
|
|
};
|
|
_gridCenter.CenterOn(_itemList[defaultIndex].transform);
|
|
_gridCenter.springStrength = springStrength;
|
|
_gridCenter.onCenter = null;
|
|
_gridCenter.onCenter = delegate(GameObject g)
|
|
{
|
|
_isDrag = true;
|
|
OnChangeScroll(g);
|
|
};
|
|
_ButtonScrollPrev.onClick.Clear();
|
|
_ButtonScrollPrev.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnPushBtnPrev();
|
|
}));
|
|
_ButtonScrollNext.onClick.Clear();
|
|
_ButtonScrollNext.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnPushBtnNext();
|
|
}));
|
|
SetDrumrollButton();
|
|
if (_itemList.Count <= 1)
|
|
{
|
|
_scrollView.enabled = false;
|
|
}
|
|
onCreateCallBack.Call();
|
|
}
|
|
|
|
private void InitItemList(List<GameObject> itemObjList)
|
|
{
|
|
_scrollView.currentMomentum = Vector3.zero;
|
|
_scrollView.DisableSpring();
|
|
_scrollView.momentumAmount = 70f;
|
|
_itemList = itemObjList;
|
|
for (int i = 0; i < _itemList.Count; i++)
|
|
{
|
|
GameObject obj = _itemList[i];
|
|
obj.transform.parent = _itemListParent.transform;
|
|
obj.transform.localScale = Vector3.one;
|
|
obj.transform.localPosition = Vector3.down * i * _itemListParent.cellHeight;
|
|
obj.name = i.ToString();
|
|
obj.gameObject.SetActive(value: true);
|
|
UIEventListener uIEventListener = UIEventListener.Get(obj);
|
|
uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate(GameObject g)
|
|
{
|
|
OnChangeScroll(g);
|
|
});
|
|
}
|
|
_itemListParent.repositionNow = true;
|
|
_scrollView.ResetPosition();
|
|
}
|
|
|
|
private void OnChangeScroll(GameObject g)
|
|
{
|
|
int num = int.Parse(g.name);
|
|
if (_CurrentIndex != num)
|
|
{
|
|
_CurrentIndex = num;
|
|
|
|
if (!_isDrag)
|
|
{
|
|
_gridCenter.CenterOn(g.transform);
|
|
}
|
|
else
|
|
{
|
|
_isDrag = false;
|
|
}
|
|
SetDrumrollButton();
|
|
_SelectCallBack.Call(_CurrentIndex);
|
|
}
|
|
}
|
|
|
|
private void SetDrumrollButton()
|
|
{
|
|
if (_itemList.Count <= 1)
|
|
{
|
|
_ButtonScrollNext.gameObject.SetActive(value: false);
|
|
_ButtonScrollPrev.gameObject.SetActive(value: false);
|
|
}
|
|
else if (_CurrentIndex == _itemList.Count - 1)
|
|
{
|
|
_ButtonScrollNext.gameObject.SetActive(value: false);
|
|
_ButtonScrollPrev.gameObject.SetActive(value: true);
|
|
}
|
|
else if (_CurrentIndex == 0)
|
|
{
|
|
_ButtonScrollNext.gameObject.SetActive(value: true);
|
|
_ButtonScrollPrev.gameObject.SetActive(value: false);
|
|
}
|
|
else
|
|
{
|
|
_ButtonScrollNext.gameObject.SetActive(value: true);
|
|
_ButtonScrollPrev.gameObject.SetActive(value: true);
|
|
}
|
|
}
|
|
|
|
private void OnPushBtnNext()
|
|
{
|
|
int currentIndex = _CurrentIndex;
|
|
if (_CurrentIndex < _itemList.Count - 1)
|
|
{
|
|
currentIndex++;
|
|
_isDrag = false;
|
|
OnChangeScroll(_itemList[currentIndex].gameObject);
|
|
}
|
|
}
|
|
|
|
private void OnPushBtnPrev()
|
|
{
|
|
int currentIndex = _CurrentIndex;
|
|
if (_CurrentIndex > 0)
|
|
{
|
|
currentIndex--;
|
|
_isDrag = false;
|
|
OnChangeScroll(_itemList[currentIndex].gameObject);
|
|
}
|
|
}
|
|
}
|