feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
This commit is contained in:
205
SVSim.BattleEngine/Engine/NetworkReplayBattleMgr.cs
Normal file
205
SVSim.BattleEngine/Engine/NetworkReplayBattleMgr.cs
Normal file
@@ -0,0 +1,205 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.BattleMgr;
|
||||
using Wizard.Replay;
|
||||
|
||||
public class NetworkReplayBattleMgr : NetworkWatchBattleMgr
|
||||
{
|
||||
public UIButton StopReplayBtn;
|
||||
|
||||
public UIButton ReplayForwardBtn;
|
||||
|
||||
public UIButton ReplaySkipBtn;
|
||||
|
||||
private UISprite ReplaySkipBtnSprite;
|
||||
|
||||
private const int NORMAL_SPEED = 1;
|
||||
|
||||
private const int SKIP_SPEED = 5;
|
||||
|
||||
protected const string PLAY_BUTTON_NAME = "btn_replay_play";
|
||||
|
||||
protected const string PAUSE_BUTTON_NAME = "btn_replay_pause";
|
||||
|
||||
private const string SKIP_BUTTON_NAME = "btn_replay_turn_end";
|
||||
|
||||
private const string NEW_SKIP_BUTTON_NAME = "btn_replay_new";
|
||||
|
||||
private const int REPLAY_SKIP_BUTTON_ICON_WIDTH = 32;
|
||||
|
||||
private const int NEW_REPLAY_SKIP_BUTTON_ICON_WIDTH = 46;
|
||||
|
||||
public ReplayController ReplayController;
|
||||
|
||||
public bool isStopReplay { get; protected set; }
|
||||
|
||||
public bool isForwardReplay { get; set; }
|
||||
|
||||
public bool isSkipReplay { get; private set; }
|
||||
|
||||
public NetworkReplayBattleMgr(IBattleMgrContentsCreator contentsCreator)
|
||||
: base(contentsCreator)
|
||||
{
|
||||
networkReceiver = new NetworkReplayBattleReceiver(this);
|
||||
_networkBattleSetupCardEventBase = new NetworkReplayBattleSetupCardEvent(this, RegisterActionManager, base.networkBattleData);
|
||||
GameMgr.GetIns().GetPrefabMgr().Load("Prefab/UI/Replay/BtnStopReplay");
|
||||
StopReplayBtn = NGUITools.AddChild(UIManager.GetInstance().getCamera().gameObject, GameMgr.GetIns().GetPrefabMgr().Get("Prefab/UI/Replay/BtnStopReplay")).GetComponent<UIButton>();
|
||||
UISprite StopReplayBtnSprite = StopReplayBtn.transform.GetChild(0).GetComponent<UISprite>();
|
||||
StopReplayBtn.GetComponent<UIAnchor>().uiCamera = GameMgr.GetIns().GetGameObjMgr().GetUIContainerCam();
|
||||
StopReplayBtn.gameObject.SetActive(value: false);
|
||||
StopReplayBtn.onClick.Clear();
|
||||
StopReplayBtn.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
isStopReplay = !isStopReplay;
|
||||
if (isStopReplay)
|
||||
{
|
||||
StopReplayBtnSprite.spriteName = "btn_replay_play";
|
||||
UIManager.SetObjectToGrey(ReplayForwardBtn.gameObject, b: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
StopReplayBtnSprite.spriteName = "btn_replay_pause";
|
||||
UIManager.SetObjectToGrey(ReplayForwardBtn.gameObject, b: true);
|
||||
}
|
||||
}));
|
||||
GameMgr.GetIns().GetPrefabMgr().Load("Prefab/UI/Replay/BtnReplayForward");
|
||||
ReplayForwardBtn = NGUITools.AddChild(UIManager.GetInstance().getCamera().gameObject, GameMgr.GetIns().GetPrefabMgr().Get("Prefab/UI/Replay/BtnReplayForward")).GetComponent<UIButton>();
|
||||
ReplayForwardBtn.GetComponent<UIAnchor>().container = StopReplayBtn.gameObject;
|
||||
ReplayForwardBtn.gameObject.SetActive(value: false);
|
||||
ReplayForwardBtn.onClick.Clear();
|
||||
ReplayForwardBtn.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
isForwardReplay = true;
|
||||
}));
|
||||
UIManager.SetObjectToGrey(ReplayForwardBtn.gameObject, b: true);
|
||||
UIManager.GetInstance().StartCoroutine(WaitTillTurnEndUIReady());
|
||||
}
|
||||
|
||||
private IEnumerator WaitTillTurnEndUIReady()
|
||||
{
|
||||
while (!BattlePlayer.PlayerBattleView.TurnEndBtn)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
GameMgr.GetIns().GetPrefabMgr().Load("Prefab/UI/Replay/BtnSkipReplay");
|
||||
ReplaySkipBtn = NGUITools.AddChild(BattlePlayer.PlayerBattleView.TurnEndButtonUI.GetTurnEndButton(), GameMgr.GetIns().GetPrefabMgr().Get("Prefab/UI/Replay/BtnSkipReplay")).GetComponent<UIButton>();
|
||||
ReplaySkipBtnSprite = ReplaySkipBtn.transform.GetChild(0).GetComponent<UISprite>();
|
||||
ReplaySkipBtnSprite.width = (GameMgr.GetIns().IsNewReplayBattle ? 46 : 32);
|
||||
ReplaySkipBtn.gameObject.SetActive(value: false);
|
||||
ReplaySkipBtn.onClick.Clear();
|
||||
ReplaySkipBtn.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
isSkipReplay = !isSkipReplay;
|
||||
if (isSkipReplay)
|
||||
{
|
||||
ReplaySkipBtnSprite.spriteName = "btn_replay_pause";
|
||||
ReplaySkipBtnSprite.width = 32;
|
||||
Time.timeScale = 5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetSkipStatus();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
protected override void SetUpDisconnectCheck()
|
||||
{
|
||||
}
|
||||
|
||||
public void ResetSkipStatus()
|
||||
{
|
||||
isSkipReplay = false;
|
||||
ReplaySkipBtnSprite.spriteName = (GameMgr.GetIns().IsNewReplayBattle ? "btn_replay_new" : "btn_replay_turn_end");
|
||||
ReplaySkipBtnSprite.width = (GameMgr.GetIns().IsNewReplayBattle ? 46 : 32);
|
||||
Time.timeScale = 1f;
|
||||
}
|
||||
|
||||
public void SetActiveReplayButton(bool isActive)
|
||||
{
|
||||
StopReplayBtn.gameObject.SetActive(isActive);
|
||||
ReplayForwardBtn.gameObject.SetActive(isActive);
|
||||
ReplaySkipBtn.gameObject.SetActive(isActive);
|
||||
if (!isActive)
|
||||
{
|
||||
isStopReplay = false;
|
||||
isForwardReplay = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetUpRetireEvent()
|
||||
{
|
||||
BattlePlayer.PlayerBattleView.OnRetire += delegate
|
||||
{
|
||||
if (!(ToolboxGame.RealTimeNetworkAgent == null))
|
||||
{
|
||||
ResetSkipStatus();
|
||||
ReplayController._replayDataHandler.Stop();
|
||||
BattleCoroutine.GetInstance().StopAllCoroutines();
|
||||
ToolboxGame.RealTimeNetworkAgent.DestroyObj(RealTimeNetworkAgent.DESTROY_OBJECT_LOG.Replay);
|
||||
UIManager.GetInstance().StartCoroutine(GameMgr.GetIns().GetBattleCtrl().BattleEnd(delegate
|
||||
{
|
||||
UIManager.ViewScene replayEndBackScene = Data.ReplayBattleInfo.ReplayEndBackScene;
|
||||
UIManager.ChangeViewSceneParam replayEndBackSceneParam = Data.ReplayBattleInfo.ReplayEndBackSceneParam;
|
||||
UIManager.GetInstance().ChangeViewScene(replayEndBackScene, replayEndBackSceneParam);
|
||||
}));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public override void DisposeBattleGameObj()
|
||||
{
|
||||
base.DisposeBattleGameObj();
|
||||
ReplayController = null;
|
||||
Time.timeScale = 1f;
|
||||
Object.Destroy(StopReplayBtn.gameObject);
|
||||
Object.Destroy(ReplayForwardBtn.gameObject);
|
||||
}
|
||||
|
||||
protected override NetworkOperationCollectionBase CreateNetworkOperationCollection(NetworkBattleReceiver.ReceiveData receivedData, bool isPlayer)
|
||||
{
|
||||
return new ReplayOperationCollection(this, OperateMgr, receivedData, base.networkBattleData, isPlayer);
|
||||
}
|
||||
|
||||
public override void ReceiveRetire(bool isWin)
|
||||
{
|
||||
if (isWin == Data.ReplayBattleInfo.is_win)
|
||||
{
|
||||
FinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS.ReplayRetireDiff, Data.ReplayBattleInfo.is_win);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.ReceiveRetire(isWin);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void FinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS log, bool isWin = false, bool isNotRetry = false)
|
||||
{
|
||||
isWin = Data.ReplayBattleInfo.is_win;
|
||||
base.FinishBattleSend(log, isWin, isNotRetry);
|
||||
}
|
||||
|
||||
protected override bool isNetworkOepn()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override OperateReceive CreateOperateReceive()
|
||||
{
|
||||
return new ReplayOperateReceive(this, RegisterActionManager, OperateMgr, base.networkBattleData);
|
||||
}
|
||||
|
||||
protected override BattlePlayer CreateBattlePlayer()
|
||||
{
|
||||
return new BattlePlayer(this, _battleCamera, _backGround, CreatePlayerInnerOptionsBuilder());
|
||||
}
|
||||
|
||||
protected override BattleEnemy CreateBattleEnemy()
|
||||
{
|
||||
return new BattleEnemy(this, _battleCamera, _backGround, CreateEnemyInnerOptionsBuilder());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user