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:
@@ -1,4 +1,8 @@
|
||||
using Wizard.Battle.View.Vfx;
|
||||
// TODO(engine-cleanup-pass2): 2 of 4 methods unrun in baseline
|
||||
// Type: Wizard.Battle.Phase.LoadingPhase
|
||||
// See data_dumps/reports/engine-cleanup/live-methods.baseline.txt
|
||||
|
||||
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
@@ -23,7 +27,7 @@ public class LoadingPhase : IPhase
|
||||
|
||||
public virtual VfxBase Teardown()
|
||||
{
|
||||
return new BattleLoadingEndVfx(_battleMgr);
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public virtual void Pause()
|
||||
|
||||
@@ -1,169 +1,172 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.Resource;
|
||||
using Wizard.Battle.Touch;
|
||||
using Wizard.Battle.UI;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
public class MainPhase : IPhase
|
||||
{
|
||||
protected readonly BattleManagerBase _battleManager;
|
||||
|
||||
protected readonly BattlePlayer _battlePlayer;
|
||||
|
||||
protected readonly BattleEnemy _battleEnemy;
|
||||
|
||||
private readonly TouchControl _touchControl;
|
||||
|
||||
protected readonly GameObject _menuButton;
|
||||
|
||||
private readonly IBattleResourceMgr _battleResourceMgr;
|
||||
|
||||
private readonly BattleLogManager _battleLogManager;
|
||||
|
||||
private readonly GameObject _battery;
|
||||
|
||||
protected bool _enableTouch;
|
||||
|
||||
private CanNotTouchCardVfx _canNotTouchCardVfx;
|
||||
|
||||
private readonly Func<OperateMgr> _getOperateMgr;
|
||||
|
||||
private OperateMgr OperateMgr => _getOperateMgr();
|
||||
|
||||
public MainPhase(BattleManagerBase battleManager, BattleLogManager logManager)
|
||||
{
|
||||
_battleManager = battleManager;
|
||||
_battlePlayer = battleManager.BattlePlayer;
|
||||
_battleEnemy = battleManager.BattleEnemy;
|
||||
_touchControl = battleManager.TouchControl;
|
||||
_menuButton = battleManager.MenuButtonObject;
|
||||
_getOperateMgr = () => battleManager.OperateMgr;
|
||||
_battleResourceMgr = battleManager.BattleResourceMgr;
|
||||
_battleLogManager = logManager;
|
||||
_battery = battleManager.BattleUIContainer.Battery;
|
||||
}
|
||||
|
||||
public virtual VfxBase Setup()
|
||||
{
|
||||
ParallelVfxPlayer parallelVfxPlayer = CreateUpdateBattlePlayersVfx();
|
||||
parallelVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
if (!_battleManager.IsBattleEnd)
|
||||
{
|
||||
if (_menuButton != null)
|
||||
{
|
||||
_menuButton.SetActive(value: true);
|
||||
}
|
||||
_battleLogManager.SetActiveShowButton(isActive: true);
|
||||
}
|
||||
}));
|
||||
return SequentialVfxPlayer.Create(parallelVfxPlayer, InstantVfx.Create(delegate
|
||||
{
|
||||
_enableTouch = true;
|
||||
}));
|
||||
}
|
||||
|
||||
public VfxWith<IPhase> Update(float dt)
|
||||
{
|
||||
if (_enableTouch)
|
||||
{
|
||||
return new VfxWith<IPhase>(_touchControl.Update(dt), null);
|
||||
}
|
||||
return new VfxWith<IPhase>(NullVfx.GetInstance(), null);
|
||||
}
|
||||
|
||||
public virtual VfxBase Teardown()
|
||||
{
|
||||
_battleManager.VfxMgr.RegisterImmediateVfx(new CanNotTouchCardVfx());
|
||||
_menuButton.SetActive(value: false);
|
||||
_battlePlayer.PlayerBattleView.HideTurnEndButton();
|
||||
_battleLogManager.HideLog();
|
||||
_battleLogManager.SetActiveShowButton(isActive: false);
|
||||
OperateMgr.AllClearBattleView();
|
||||
_enableTouch = false;
|
||||
_battlePlayer.ClassInformationUIController.HideInfomation();
|
||||
_battleEnemy.ClassInformationUIController.HideInfomation();
|
||||
_battery.SetActive(value: false);
|
||||
_battlePlayer.StatusPanelControl.HideStatusPanelAlways();
|
||||
_battleEnemy.StatusPanelControl.HideStatusPanelAlways();
|
||||
if (_battleManager is NewReplayBattleMgr)
|
||||
{
|
||||
(_battleManager as NewReplayBattleMgr).SetActiveMoveTurnButton(isActive: false);
|
||||
}
|
||||
_battleManager.FinishBattle();
|
||||
return ParallelVfxPlayer.Create(new ThinkIconHideVfx(_battleResourceMgr), new EmotionHideMessageVfx(_battleResourceMgr), (_touchControl._touchProcessor == null) ? NullVfx.GetInstance() : _touchControl._touchProcessor.End().Vfx, InstantVfx.Create(delegate
|
||||
{
|
||||
if (UIManager.GetInstance().NowOpenDialog != null)
|
||||
{
|
||||
UIManager.GetInstance().NowOpenDialog.Close();
|
||||
}
|
||||
}), InstantVfx.Create(_battlePlayer.PlayerEmotion.CancelShowButtons), _battlePlayer.PlayerEmotion.HideButtons());
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
bool isSelecting = _battlePlayer.PlayerBattleView.IsSelecting;
|
||||
if (isSelecting)
|
||||
{
|
||||
_battlePlayer.BattleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate
|
||||
{
|
||||
SetTouchable(enable: false);
|
||||
}));
|
||||
}
|
||||
_battlePlayer.PlayerBattleView.DragArrowStop(BattleManagerBase.GetIns());
|
||||
_battlePlayer.PlayerBattleView.ReleaseLockOnTarget();
|
||||
BattleCardBase hitCard = _touchControl._hitCard;
|
||||
if (hitCard != null && hitCard.IsOnMove)
|
||||
{
|
||||
_touchControl.StopMovingHandCard(hitCard);
|
||||
}
|
||||
ResetInput();
|
||||
if (isSelecting)
|
||||
{
|
||||
_battlePlayer.BattleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate
|
||||
{
|
||||
SetTouchable(enable: true);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ResetInput()
|
||||
{
|
||||
_touchControl.Exit();
|
||||
_battlePlayer.BattleMgr.VfxMgr.RegisterSequentialVfx(_touchControl.ForceEndTouchProcessor());
|
||||
if (_battlePlayer.IsSelfTurn && !_battlePlayer.PlayerBattleView.IsEvolutionVfx)
|
||||
{
|
||||
_battlePlayer.PlayerBattleView.TurnEndButtonUI.ShowBtn(_battlePlayer.PlayerBattleView.CanPlayerEndTurnImmediately);
|
||||
}
|
||||
}
|
||||
|
||||
protected ParallelVfxPlayer CreateUpdateBattlePlayersVfx()
|
||||
{
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
parallelVfxPlayer.Register(ParallelVfxPlayer.Create(_battlePlayer.CreateUpdateDeckCountLabelVfx(), _battleEnemy.CreateUpdateDeckCountLabelVfx()));
|
||||
parallelVfxPlayer.Register(_battlePlayer.StartBattleMainView());
|
||||
parallelVfxPlayer.Register(_battleEnemy.StartBattleMainView());
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
|
||||
protected virtual void SetTouchable(bool enable)
|
||||
{
|
||||
if (enable && _canNotTouchCardVfx == null)
|
||||
{
|
||||
bool isUpdateHandCardsPlayability = true;
|
||||
if (GameMgr.GetIns().IsWatchBattle)
|
||||
{
|
||||
isUpdateHandCardsPlayability = !(BattleManagerBase.GetIns() as NetworkBattleManagerBase).IsSkillSelectTiming;
|
||||
}
|
||||
_canNotTouchCardVfx = new CanNotTouchCardVfx(isUpdateHandCardsPlayability);
|
||||
}
|
||||
else if (_canNotTouchCardVfx != null)
|
||||
{
|
||||
_canNotTouchCardVfx.End();
|
||||
_canNotTouchCardVfx = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.Resource;
|
||||
using Wizard.Battle.Touch;
|
||||
using Wizard.Battle.UI;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
// TODO(engine-cleanup-pass2): 9 of 12 methods unrun in baseline
|
||||
// Type: Wizard.Battle.Phase.MainPhase
|
||||
// See data_dumps/reports/engine-cleanup/live-methods.baseline.txt
|
||||
|
||||
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
public class MainPhase : IPhase
|
||||
{
|
||||
protected readonly BattleManagerBase _battleManager;
|
||||
|
||||
protected readonly BattlePlayer _battlePlayer;
|
||||
|
||||
protected readonly BattleEnemy _battleEnemy;
|
||||
|
||||
private readonly TouchControl _touchControl;
|
||||
|
||||
protected readonly GameObject _menuButton;
|
||||
|
||||
private readonly IBattleResourceMgr _battleResourceMgr;
|
||||
|
||||
private readonly BattleLogManager _battleLogManager;
|
||||
|
||||
private readonly GameObject _battery;
|
||||
|
||||
protected bool _enableTouch;
|
||||
|
||||
private VfxBase _canNotTouchCardVfx;
|
||||
|
||||
private readonly Func<OperateMgr> _getOperateMgr;
|
||||
|
||||
private OperateMgr OperateMgr => _getOperateMgr();
|
||||
|
||||
public MainPhase(BattleManagerBase battleManager, BattleLogManager logManager)
|
||||
{
|
||||
_battleManager = battleManager;
|
||||
_battlePlayer = battleManager.BattlePlayer;
|
||||
_battleEnemy = battleManager.BattleEnemy;
|
||||
_touchControl = battleManager.TouchControl;
|
||||
_menuButton = battleManager.MenuButtonObject;
|
||||
_getOperateMgr = () => battleManager.OperateMgr;
|
||||
_battleResourceMgr = battleManager.BattleResourceMgr;
|
||||
_battleLogManager = logManager;
|
||||
_battery = battleManager.BattleUIContainer.Battery;
|
||||
}
|
||||
|
||||
public virtual VfxBase Setup()
|
||||
{
|
||||
ParallelVfxPlayer parallelVfxPlayer = CreateUpdateBattlePlayersVfx();
|
||||
parallelVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
if (!_battleManager.IsBattleEnd)
|
||||
{
|
||||
if (_menuButton != null)
|
||||
{
|
||||
_menuButton.SetActive(value: true);
|
||||
}
|
||||
_battleLogManager.SetActiveShowButton(isActive: true);
|
||||
}
|
||||
}));
|
||||
return SequentialVfxPlayer.Create(parallelVfxPlayer, InstantVfx.Create(delegate
|
||||
{
|
||||
_enableTouch = true;
|
||||
}));
|
||||
}
|
||||
|
||||
public VfxWith<IPhase> Update(float dt)
|
||||
{
|
||||
if (_enableTouch)
|
||||
{
|
||||
return new VfxWith<IPhase>(_touchControl.Update(dt), null);
|
||||
}
|
||||
return new VfxWith<IPhase>(NullVfx.GetInstance(), null);
|
||||
}
|
||||
|
||||
public virtual VfxBase Teardown()
|
||||
{
|
||||
_battleManager.VfxMgr.RegisterImmediateVfx(NullVfx.GetInstance());
|
||||
_menuButton.SetActive(value: false);
|
||||
_battlePlayer.PlayerBattleView.HideTurnEndButton();
|
||||
_battleLogManager.HideLog();
|
||||
_battleLogManager.SetActiveShowButton(isActive: false);
|
||||
OperateMgr.AllClearBattleView();
|
||||
_enableTouch = false;
|
||||
_battlePlayer.ClassInformationUIController.HideInfomation();
|
||||
_battleEnemy.ClassInformationUIController.HideInfomation();
|
||||
_battery.SetActive(value: false);
|
||||
_battlePlayer.StatusPanelControl.HideStatusPanelAlways();
|
||||
_battleEnemy.StatusPanelControl.HideStatusPanelAlways();
|
||||
if (_battleManager is NewReplayBattleMgr)
|
||||
{
|
||||
(_battleManager as NewReplayBattleMgr).SetActiveMoveTurnButton(isActive: false);
|
||||
}
|
||||
_battleManager.FinishBattle();
|
||||
return ParallelVfxPlayer.Create(NullVfx.GetInstance(), NullVfx.GetInstance(), (_touchControl._touchProcessor == null) ? NullVfx.GetInstance() : _touchControl._touchProcessor.End().Vfx, InstantVfx.Create(delegate
|
||||
{
|
||||
if (UIManager.GetInstance().NowOpenDialog != null)
|
||||
{
|
||||
UIManager.GetInstance().NowOpenDialog.Close();
|
||||
}
|
||||
}), InstantVfx.Create(_battlePlayer.PlayerEmotion.CancelShowButtons), _battlePlayer.PlayerEmotion.HideButtons());
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
bool isSelecting = _battlePlayer.PlayerBattleView.IsSelecting;
|
||||
if (isSelecting)
|
||||
{
|
||||
_battlePlayer.BattleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate
|
||||
{
|
||||
SetTouchable(enable: false);
|
||||
}));
|
||||
}
|
||||
_battlePlayer.PlayerBattleView.DragArrowStop(_battleManager);
|
||||
_battlePlayer.PlayerBattleView.ReleaseLockOnTarget();
|
||||
BattleCardBase hitCard = _touchControl._hitCard;
|
||||
if (hitCard != null && hitCard.IsOnMove)
|
||||
{
|
||||
_touchControl.StopMovingHandCard(hitCard);
|
||||
}
|
||||
ResetInput();
|
||||
if (isSelecting)
|
||||
{
|
||||
_battlePlayer.BattleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate
|
||||
{
|
||||
SetTouchable(enable: true);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ResetInput()
|
||||
{
|
||||
_touchControl.Exit();
|
||||
_battlePlayer.BattleMgr.VfxMgr.RegisterSequentialVfx(_touchControl.ForceEndTouchProcessor());
|
||||
if (_battlePlayer.IsSelfTurn && !_battlePlayer.PlayerBattleView.IsEvolutionVfx)
|
||||
{
|
||||
_battlePlayer.PlayerBattleView.TurnEndButtonUI.ShowBtn(_battlePlayer.PlayerBattleView.CanPlayerEndTurnImmediately);
|
||||
}
|
||||
}
|
||||
|
||||
protected ParallelVfxPlayer CreateUpdateBattlePlayersVfx()
|
||||
{
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
parallelVfxPlayer.Register(ParallelVfxPlayer.Create(_battlePlayer.CreateUpdateDeckCountLabelVfx(), _battleEnemy.CreateUpdateDeckCountLabelVfx()));
|
||||
parallelVfxPlayer.Register(_battlePlayer.StartBattleMainView());
|
||||
parallelVfxPlayer.Register(_battleEnemy.StartBattleMainView());
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
|
||||
protected virtual void SetTouchable(bool enable)
|
||||
{
|
||||
if (enable && _canNotTouchCardVfx == null)
|
||||
{
|
||||
bool isUpdateHandCardsPlayability = true;
|
||||
if (_battleManager.GameMgr.IsWatchBattle)
|
||||
{
|
||||
isUpdateHandCardsPlayability = !(_battleManager as NetworkBattleManagerBase).IsSkillSelectTiming;
|
||||
}
|
||||
_canNotTouchCardVfx = NullVfx.GetInstance();
|
||||
}
|
||||
else if (_canNotTouchCardVfx != null)
|
||||
{
|
||||
_canNotTouchCardVfx = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Wizard.Battle.Mulligan;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
// TODO(engine-cleanup-pass2): 9 of 12 methods unrun in baseline
|
||||
// Type: Wizard.Battle.Phase.MulliganPhaseBase
|
||||
// See data_dumps/reports/engine-cleanup/live-methods.baseline.txt
|
||||
|
||||
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
@@ -15,8 +19,6 @@ public class MulliganPhaseBase : IPhase
|
||||
|
||||
private bool _enableTouch;
|
||||
|
||||
private const float MULLIGAN_LOG_WAIT_TIME = 20f;
|
||||
|
||||
protected MulliganPhaseBase(BattleManagerBase battleMgr)
|
||||
{
|
||||
_battleMgr = battleMgr;
|
||||
@@ -26,8 +28,8 @@ public class MulliganPhaseBase : IPhase
|
||||
{
|
||||
_mulliganMgr = mulliganMgr;
|
||||
_battleMgr.MulliganMgr = _mulliganMgr;
|
||||
MulliganInfoControl component = NGUITools.AddChild(_battleMgr.Battle3DContainer, GameMgr.GetIns().GetPrefabMgr().Get("Prefab/UI/MulliganInfo")).GetComponent<MulliganInfoControl>();
|
||||
_mulliganMgr.InitMulligan(component, _battleMgr.BattlePlayer.PlayerBattleView);
|
||||
MulliganInfoControl component = NGUITools.AddChild(_battleMgr.Battle3DContainer, _battleMgr.GameMgr.GetPrefabMgr().Get("Prefab/UI/MulliganInfo")).GetComponent<MulliganInfoControl>();
|
||||
_mulliganMgr.InitMulligan(_battleMgr, component, _battleMgr.BattlePlayer.PlayerBattleView);
|
||||
_mulliganOperateCtrl = CreateMulliganOperateControl();
|
||||
}
|
||||
|
||||
@@ -79,10 +81,10 @@ public class MulliganPhaseBase : IPhase
|
||||
_battleMgr.OnSubmitMulligan -= SubmitMulligan;
|
||||
MulliganInfoControl mulliganInfo = _mulliganMgr.GetMulliganInfo();
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(new MulliganEndVfx(mulliganInfo, _battleMgr.BattlePlayer, _battleMgr.BattleEnemy));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
sequentialVfxPlayer.Register(mulliganInfo.SetPlayerReady());
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(mulliganInfo.HideTopPanels));
|
||||
sequentialVfxPlayer.Register(new PlayerAndEnemyReadyVfx(_battleMgr.BattlePlayer, _battleMgr.BattleEnemy));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
sequentialVfxPlayer.Register(mulliganInfo.DestroyMulliganUIVfx());
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
public class NetworkBattlePhaseCreator : PhaseCreatorBase
|
||||
{
|
||||
protected readonly NetworkBattleManagerBase _networkBattleManager;
|
||||
|
||||
public NetworkBattlePhaseCreator(NetworkBattleManagerBase battleMgr)
|
||||
: base(battleMgr)
|
||||
{
|
||||
_networkBattleManager = battleMgr;
|
||||
}
|
||||
|
||||
public override IPhase CreateMulliganPhase()
|
||||
{
|
||||
return new NetworkMulliganPhase(_networkBattleManager, _networkBattleManager.NetworkSender);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,10 @@ using System.Collections.Generic;
|
||||
using Cute;
|
||||
using Wizard.Battle.Mulligan;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
// TODO(engine-cleanup-pass2): 6 of 11 methods unrun in baseline
|
||||
// Type: Wizard.Battle.Phase.NetworkMulliganPhase
|
||||
// See data_dumps/reports/engine-cleanup/live-methods.baseline.txt
|
||||
|
||||
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
@@ -22,7 +26,7 @@ public class NetworkMulliganPhase : MulliganPhaseBase
|
||||
: base(battleMgr)
|
||||
{
|
||||
_networkBattleMgr = battleMgr;
|
||||
if (GameMgr.GetIns().IsAINetwork)
|
||||
if (_networkBattleMgr.GameMgr.IsAINetwork)
|
||||
{
|
||||
_singleMulliganMgr = new SingleMulliganMgr();
|
||||
}
|
||||
@@ -31,7 +35,7 @@ public class NetworkMulliganPhase : MulliganPhaseBase
|
||||
_networkMulliganMgr = new NetworkMulliganMgr(sender);
|
||||
}
|
||||
IMulliganMgr mulliganMgr;
|
||||
if (!GameMgr.GetIns().IsAINetwork)
|
||||
if (!_networkBattleMgr.GameMgr.IsAINetwork)
|
||||
{
|
||||
IMulliganMgr networkMulliganMgr = _networkMulliganMgr;
|
||||
mulliganMgr = networkMulliganMgr;
|
||||
@@ -60,12 +64,12 @@ public class NetworkMulliganPhase : MulliganPhaseBase
|
||||
IMulliganMgr mulliganMgr = _mulliganMgr;
|
||||
mulliganMgr.OnSubmit = (Action)Delegate.Combine(mulliganMgr.OnSubmit, (Action)delegate
|
||||
{
|
||||
if (GameMgr.GetIns().IsAINetwork)
|
||||
if (_networkBattleMgr.GameMgr.IsAINetwork)
|
||||
{
|
||||
SingleMulliganMgr singleMulligan = _mulliganMgr as SingleMulliganMgr;
|
||||
OnNetworkAlive = (Action)Delegate.Combine(OnNetworkAlive, (Action)delegate
|
||||
{
|
||||
singleMulligan.AIMulliganEndAction();
|
||||
singleMulligan.AIMulliganEndAction(_networkBattleMgr);
|
||||
OnNetworkAlive = null;
|
||||
});
|
||||
}
|
||||
@@ -74,7 +78,7 @@ public class NetworkMulliganPhase : MulliganPhaseBase
|
||||
|
||||
public override VfxWith<IPhase> Update(float dt)
|
||||
{
|
||||
if (GameMgr.GetIns().IsAINetwork && ToolboxGame.RealTimeNetworkAgent != null && ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive)
|
||||
if (_networkBattleMgr.GameMgr.IsAINetwork && _networkBattleMgr.InstanceNetworkAgent != null && _networkBattleMgr.InstanceNetworkAgent.PlayerNetworkStatus.IsAlive)
|
||||
{
|
||||
OnNetworkAlive.Call();
|
||||
}
|
||||
@@ -83,7 +87,7 @@ public class NetworkMulliganPhase : MulliganPhaseBase
|
||||
|
||||
public void MulliganEventSetting()
|
||||
{
|
||||
if (!GameMgr.GetIns().IsAINetwork)
|
||||
if (!_networkBattleMgr.GameMgr.IsAINetwork)
|
||||
{
|
||||
OperateReceive operateReceive = _networkBattleMgr.OperateReceive;
|
||||
operateReceive.OnEndMulligan = (Func<VfxBase>)Delegate.Combine(operateReceive.OnEndMulligan, new Func<VfxBase>(EndMulligan));
|
||||
@@ -99,7 +103,7 @@ public class NetworkMulliganPhase : MulliganPhaseBase
|
||||
public override VfxBase Teardown()
|
||||
{
|
||||
VfxBase result = base.Teardown();
|
||||
if (GameMgr.GetIns().IsAINetwork)
|
||||
if (_networkBattleMgr.GameMgr.IsAINetwork)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@@ -119,13 +123,13 @@ public class NetworkMulliganPhase : MulliganPhaseBase
|
||||
LocalLog.AccumulateLastTraceLog("EndMulligan");
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(this.OnEndMulligan.GetAllFuncVfxResults());
|
||||
sequentialVfxPlayer.Register(GameMgr.GetIns().IsAINetwork ? _singleMulliganMgr.CompleteMulligan(_networkBattleMgr) : _networkMulliganMgr.CompleteMulligan(_networkBattleMgr));
|
||||
sequentialVfxPlayer.Register(_networkBattleMgr.GameMgr.IsAINetwork ? _singleMulliganMgr.CompleteMulligan(_networkBattleMgr) : _networkMulliganMgr.CompleteMulligan(_networkBattleMgr));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
protected virtual VfxBase ReceivePlayerMulligan(List<int> mulliganAfterCardIndexes)
|
||||
{
|
||||
if (GameMgr.GetIns().IsAINetwork)
|
||||
if (_networkBattleMgr.GameMgr.IsAINetwork)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
@@ -136,7 +140,7 @@ public class NetworkMulliganPhase : MulliganPhaseBase
|
||||
protected VfxBase ReceiveOpponentMulligan(List<int> mulliganAfterCardIndexes)
|
||||
{
|
||||
LocalLog.AccumulateLastTraceLog("ReceiveOpponentMulligan");
|
||||
if (GameMgr.GetIns().IsAINetwork)
|
||||
if (_networkBattleMgr.GameMgr.IsAINetwork)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class OpeningPhase : IPhase
|
||||
|
||||
public virtual VfxBase Setup()
|
||||
{
|
||||
return new DefaultOpeningVfx(_battleMgr.BackGround);
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public virtual VfxWith<IPhase> Update(float dt)
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using Wizard.Battle.UI;
|
||||
// TODO(engine-cleanup-pass2): 4 of 6 methods unrun in baseline
|
||||
// Type: Wizard.Battle.Phase.PhaseCreatorBase
|
||||
// See data_dumps/reports/engine-cleanup/live-methods.baseline.txt
|
||||
|
||||
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Wizard.Battle.Recovery;
|
||||
using Wizard.Battle.UI;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
public class RecoveryAfterMulliganPhase : IPhase
|
||||
{
|
||||
private readonly IRecoveryManager _recoveryManager;
|
||||
|
||||
private readonly BattleManagerBase _battleMgr;
|
||||
|
||||
private readonly Func<IPhase> _createMainPhase;
|
||||
|
||||
private readonly BattlePlayer _battlePlayer;
|
||||
|
||||
private readonly BattleEnemy _battleEnemy;
|
||||
|
||||
private readonly TouchControl _touchControl;
|
||||
|
||||
private bool _isEndRecovery;
|
||||
|
||||
public RecoveryAfterMulliganPhase(IRecoveryManager recoveryManager, BattleManagerBase battleMgr, Func<IPhase> createMainPhase)
|
||||
{
|
||||
_recoveryManager = recoveryManager;
|
||||
_battleMgr = battleMgr;
|
||||
_createMainPhase = createMainPhase;
|
||||
_battlePlayer = battleMgr.BattlePlayer;
|
||||
_battleEnemy = battleMgr.BattleEnemy;
|
||||
_touchControl = battleMgr.TouchControl;
|
||||
}
|
||||
|
||||
public VfxBase Setup()
|
||||
{
|
||||
_recoveryManager.OnEndRecovery += delegate
|
||||
{
|
||||
_isEndRecovery = true;
|
||||
};
|
||||
return _recoveryManager.Recovery(_battleMgr.BattlePlayer, _battleMgr.BattleEnemy, BattleCoroutine.GetInstance().StartCoroutine);
|
||||
}
|
||||
|
||||
public VfxWith<IPhase> Update(float dt)
|
||||
{
|
||||
_battleMgr.VfxMgr.Update(dt);
|
||||
VfxBase vfx = _recoveryManager.UpdateRecovery();
|
||||
if (_isEndRecovery)
|
||||
{
|
||||
return new VfxWith<IPhase>(vfx, _createMainPhase());
|
||||
}
|
||||
return new VfxWith<IPhase>(vfx, null);
|
||||
}
|
||||
|
||||
public VfxBase Teardown()
|
||||
{
|
||||
if (_recoveryManager is SingleBattleRecoveryManager)
|
||||
{
|
||||
((SingleBattleRecoveryManager)_recoveryManager).CreateRecoveryFileFromTempFile();
|
||||
((SingleBattleRecoveryRecordManager)((SingleBattleMgr)BattleManagerBase.GetIns()).ContentsCreator.RecoveryRecordManager).ClearRecoderTempFilePath();
|
||||
}
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
_battleMgr.BattlePlayer.PlayerBattleView.PlayQueueView.ForceClearPlayQueue();
|
||||
_battleMgr.BattleEnemy.BattleEnemyView.PlayQueueView.ForceClearPlayQueue();
|
||||
if (_battleMgr.IsBattleEnd)
|
||||
{
|
||||
BattleLogManager.GetInstance().SetActiveShowButton(isActive: false);
|
||||
}
|
||||
if (_battleMgr.BattlePlayer.Class.IsDead && _battleMgr.BattleEnemy.Class.IsDead)
|
||||
{
|
||||
VfxBase vfx = (_battleMgr.BattlePlayer.IsSelfTurn ? _battleMgr.DeadClass(PlayerDead: true, BattleManagerBase.FINISH_TYPE.NORMAL) : _battleMgr.DeadClass(PlayerDead: false, BattleManagerBase.FINISH_TYPE.NORMAL));
|
||||
sequentialVfxPlayer.Register(vfx);
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
_battleMgr.InitiateGameEndSequence(!_battleMgr.BattlePlayer.IsSelfTurn);
|
||||
}));
|
||||
}
|
||||
else if (_battleMgr.BattlePlayer.Class.IsDead)
|
||||
{
|
||||
sequentialVfxPlayer.Register(_battleMgr.DeadClass(PlayerDead: true, BattleManagerBase.FINISH_TYPE.NORMAL));
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
_battleMgr.InitiateGameEndSequence(hasWon: false);
|
||||
}));
|
||||
}
|
||||
else if (_battleMgr.BattleEnemy.Class.IsDead)
|
||||
{
|
||||
sequentialVfxPlayer.Register(_battleMgr.DeadClass(PlayerDead: false, BattleManagerBase.FINISH_TYPE.NORMAL));
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
_battleMgr.InitiateGameEndSequence(hasWon: true);
|
||||
}));
|
||||
}
|
||||
if (_battlePlayer.PlayerBattleView.IsSelecting)
|
||||
{
|
||||
_touchControl.SelectCancelActCard();
|
||||
}
|
||||
_touchControl.Exit();
|
||||
if (_battlePlayer.IsSelfTurn)
|
||||
{
|
||||
for (int num = 0; num < _battlePlayer.HandCardList.Count; num++)
|
||||
{
|
||||
_battlePlayer.HandCardList[num].BattleCardView.UpdateMovability();
|
||||
}
|
||||
}
|
||||
VfxBase vfxBase = (_battleEnemy.IsSelfTurn ? _battleEnemy.CreateThinkingVfx(_battleMgr) : NullVfx.GetInstance());
|
||||
VfxBase vfxBase2 = RestoreUI(_battleMgr);
|
||||
return SequentialVfxPlayer.Create(InstantVfx.Create(delegate
|
||||
{
|
||||
_battleMgr.BackGround.PlayBgm();
|
||||
}), vfxBase2, InstantVfx.Create(delegate
|
||||
{
|
||||
_battleMgr.BattlePlayer.ClassInformationUIController.Recovery();
|
||||
_battleMgr.BattleEnemy.ClassInformationUIController.Recovery();
|
||||
_battleMgr.BattlePlayer.PlayerBattleView.TurnEndButtonUI.Recovery();
|
||||
_battleMgr.BattleResultControl.Recovery();
|
||||
if (!_battleMgr.IsBattleEnd)
|
||||
{
|
||||
IPlayerView playerBattleView = _battleMgr.BattlePlayer.PlayerBattleView;
|
||||
playerBattleView.TurnEndButtonUI._isButtonForcedOff = false;
|
||||
_battleMgr.BattlePlayer.TurnStartEffectEnd();
|
||||
playerBattleView.HideTurnEndPulseEffect();
|
||||
playerBattleView.ShowTurnEndButton();
|
||||
}
|
||||
}), new BattleLoadingEndVfx(_battleMgr), vfxBase, sequentialVfxPlayer);
|
||||
}
|
||||
|
||||
public static VfxBase RestoreUI(BattleManagerBase battleMgr)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register((!battleMgr.BattlePlayer.NowTurnEvol) ? ((VfxBase)InstantVfx.Create(delegate
|
||||
{
|
||||
battleMgr.BattlePlayer.BattleView.EpIcon.GetComponent<UISprite>().spriteName = "battle_icon_evo_off";
|
||||
})) : ((VfxBase)NullVfx.GetInstance()));
|
||||
sequentialVfxPlayer.Register((!battleMgr.BattleEnemy.NowTurnEvol) ? ((VfxBase)InstantVfx.Create(delegate
|
||||
{
|
||||
battleMgr.BattleEnemy.BattleView.EpIcon.GetComponent<UISprite>().spriteName = "battle_icon_evo_off";
|
||||
})) : ((VfxBase)NullVfx.GetInstance()));
|
||||
sequentialVfxPlayer.Register(new DummyDeckChangeCardVfx(isPlayer: true, battleMgr.BattlePlayer.DeckCardList.Count));
|
||||
sequentialVfxPlayer.Register(new DummyDeckChangeCardVfx(isPlayer: false, battleMgr.BattleEnemy.DeckCardList.Count));
|
||||
sequentialVfxPlayer.Register(ParallelVfxPlayer.Create(battleMgr.BattlePlayer.Class.SkillApplyInformation.AllSkillEffectRestart(), battleMgr.BattleEnemy.Class.SkillApplyInformation.AllSkillEffectRestart()));
|
||||
foreach (BattleCardBase handCard in battleMgr.BattlePlayer.HandCardList)
|
||||
{
|
||||
sequentialVfxPlayer.Register(handCard.BattleCardView.ShowHandCardInfo(isRecovery: true));
|
||||
}
|
||||
List<BattleCardBase> list = battleMgr.BattlePlayer.InPlayCards.ToList();
|
||||
list.AddRange(battleMgr.BattleEnemy.InPlayCards.ToList());
|
||||
for (int num = 0; num < list.Count; num++)
|
||||
{
|
||||
sequentialVfxPlayer.Register(list[num].BattleCardView.InitializeBattleCardIcon(list[num], list[num].Skills));
|
||||
sequentialVfxPlayer.Register(list[num].BattleCardView.ShowBattleCardIcon());
|
||||
}
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
public class RecoveryNetworkAfterSubmitMulliganPhase : RecoveryNetworkBeforeSubmitMulliganPhase
|
||||
{
|
||||
public RecoveryNetworkAfterSubmitMulliganPhase(NetworkBattleManagerBase networkBattleMgr, NetworkBattleSender networkBattleSender)
|
||||
: base(networkBattleMgr, networkBattleSender)
|
||||
{
|
||||
}
|
||||
|
||||
public override VfxBase Setup()
|
||||
{
|
||||
base.Setup();
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase Teardown()
|
||||
{
|
||||
base.Teardown();
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
public class RecoveryNetworkBattleMainPhaseCreator : NetworkBattlePhaseCreator
|
||||
{
|
||||
public RecoveryNetworkBattleMainPhaseCreator(NetworkBattleManagerBase battleMgr)
|
||||
: base(battleMgr)
|
||||
{
|
||||
}
|
||||
|
||||
public override IPhase CreateMulliganPhase()
|
||||
{
|
||||
return new RecoveryNetworkAfterSubmitMulliganPhase(_networkBattleManager, _networkBattleManager.NetworkSender);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
public class RecoveryNetworkBattleMulliganPhaseCreator : NetworkBattlePhaseCreator
|
||||
{
|
||||
public RecoveryNetworkBattleMulliganPhaseCreator(NetworkBattleManagerBase battleMgr)
|
||||
: base(battleMgr)
|
||||
{
|
||||
}
|
||||
|
||||
public override IPhase CreateMulliganPhase()
|
||||
{
|
||||
return new RecoveryNetworkBeforeSubmitMulliganPhase(_networkBattleManager, _networkBattleManager.NetworkSender);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace Wizard.Battle.Phase;
|
||||
|
||||
public class RecoveryNetworkBeforeSubmitMulliganPhase : NetworkMulliganPhase
|
||||
{
|
||||
public RecoveryNetworkBeforeSubmitMulliganPhase(NetworkBattleManagerBase networkBattleMgr, NetworkBattleSender networkBattleSender)
|
||||
: base(networkBattleMgr, networkBattleSender)
|
||||
{
|
||||
}
|
||||
|
||||
public void RecoveryEnd()
|
||||
{
|
||||
SetUpSubmitEvent();
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public class ResultPhase : IResultPhase, IPhase
|
||||
{
|
||||
_battleMgr.TurnPanelControl.GameObject.SetActive(value: false);
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
DataMgr dataMgr = _battleMgr.GameMgr.GetDataMgr();
|
||||
if (dataMgr.m_BattleType == DataMgr.BattleType.BossRushQuest && !_battleMgr.BattleResultControl.AlreadyResultRecovery)
|
||||
{
|
||||
_battleMgr.BattleResultControl.AlreadyResultRecovery = true;
|
||||
@@ -36,7 +36,7 @@ public class ResultPhase : IResultPhase, IPhase
|
||||
{
|
||||
effectBattle = eb;
|
||||
});
|
||||
DelaySetupVfx mainVfx = new DelaySetupVfx(() => new SkillEffectBattleVfx(effectBattle, classCard.BattleCardView, classCard.ResourceMgr, () => classCard.BattleCardView.GameObject.transform.position, () => classCard.BattleCardView.CardWrapObject.transform.position, 0f, 0f, EffectMgr.MoveType.DIRECT, EffectMgr.TargetType.SINGLE, isPlayer: true));
|
||||
VfxBase mainVfx = NullVfx.GetInstance();
|
||||
VfxWithLoading vfxWithLoading = VfxWithLoading.Create(loadingVfx, mainVfx);
|
||||
BattleCardBase.HealParam healParam = new BattleCardBase.HealParam(dataMgr.BossRushBattleData.RecoveryPointWhenFinish, classCard, classCard);
|
||||
BattleCardBase.HealResult healResult = classCard.ApplyHealing(healParam, null);
|
||||
@@ -63,7 +63,7 @@ public class ResultPhase : IResultPhase, IPhase
|
||||
_battleMgr.BattlePlayer.PlayerBattleView.TurnEndButtonUI.HideAnimation();
|
||||
_battleMgr.BattlePlayer.PlayerBattleView.HideChoiceBraveButton();
|
||||
_battleMgr.BattleEnemy.BattleEnemyView.HideChoiceBraveButton();
|
||||
GameMgr.GetIns().GetSoundMgr().StopBGM(null, 1f);
|
||||
|
||||
this.OnSetupEnd.Call();
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user