[Refactor] Final fix GameManager & GameController
This commit is contained in:
@@ -6,16 +6,16 @@ namespace YachtDice.UI.Presentation
|
||||
public sealed class DicePanelPresenter : IDisposable
|
||||
{
|
||||
private readonly DicePanelView _view;
|
||||
private readonly GameManager _gameManager;
|
||||
private readonly GameLoopController _gameLoopController;
|
||||
private readonly DiceManager _diceManager;
|
||||
|
||||
public event Action RollClicked;
|
||||
public event Action<int> DiceToggled;
|
||||
|
||||
public DicePanelPresenter(DicePanelView view, GameManager gameManager, DiceManager diceManager)
|
||||
public DicePanelPresenter(DicePanelView view, GameLoopController gameLoopController, DiceManager diceManager)
|
||||
{
|
||||
_view = view;
|
||||
_gameManager = gameManager;
|
||||
_gameLoopController = gameLoopController;
|
||||
_diceManager = diceManager;
|
||||
}
|
||||
|
||||
@@ -36,32 +36,32 @@ namespace YachtDice.UI.Presentation
|
||||
public void ResetForNewTurn()
|
||||
{
|
||||
_view.ResetForNewTurn();
|
||||
_view.SetRollButtonState(true, 0, _gameManager.MaxRollsPerTurn);
|
||||
_view.SetRollButtonState(true, 0, _gameLoopController.MaxRollsPerTurn);
|
||||
}
|
||||
|
||||
public void PrepareForRoll()
|
||||
{
|
||||
_view.SetRollButtonState(false, _gameManager.CurrentRoll, _gameManager.MaxRollsPerTurn);
|
||||
_view.SetRollButtonState(false, _gameLoopController.CurrentRoll, _gameLoopController.MaxRollsPerTurn);
|
||||
_view.SetDiceInteractable(false);
|
||||
}
|
||||
|
||||
public void HandleRollComplete(int rollNumber)
|
||||
{
|
||||
var canRollAgain = _gameManager.CanRoll;
|
||||
_view.SetRollButtonState(canRollAgain, rollNumber, _gameManager.MaxRollsPerTurn);
|
||||
var canRollAgain = _gameLoopController.CanRoll;
|
||||
_view.SetRollButtonState(canRollAgain, rollNumber, _gameLoopController.MaxRollsPerTurn);
|
||||
_view.SetDiceInteractable(true);
|
||||
_view.SetAllDiceValues(_diceManager.GetCurrentValues());
|
||||
}
|
||||
|
||||
public void HandleGameOver()
|
||||
{
|
||||
_view.SetRollButtonState(false, _gameManager.MaxRollsPerTurn, _gameManager.MaxRollsPerTurn);
|
||||
_view.SetRollButtonState(false, _gameLoopController.MaxRollsPerTurn, _gameLoopController.MaxRollsPerTurn);
|
||||
_view.SetDiceInteractable(false);
|
||||
}
|
||||
|
||||
public void ResetForNewGame()
|
||||
{
|
||||
_view.ResetForNewGame(_gameManager.MaxRollsPerTurn);
|
||||
_view.ResetForNewGame(_gameLoopController.MaxRollsPerTurn);
|
||||
}
|
||||
|
||||
public void SetDiceLocked(int index, bool isLocked)
|
||||
|
||||
Reference in New Issue
Block a user