[Add] GameLoop base
This commit is contained in:
@@ -9,6 +9,7 @@ namespace YachtDice.UI.Presentation
|
||||
public sealed class ScoreCardPresenter : IDisposable
|
||||
{
|
||||
private readonly ScoreCardView _view;
|
||||
private readonly GameLoopController _gameLoopController;
|
||||
private readonly CategoryCatalog _categoryCatalog;
|
||||
private readonly ScoringSystem _scoringSystem;
|
||||
private readonly DiceManager _diceManager;
|
||||
@@ -17,11 +18,13 @@ namespace YachtDice.UI.Presentation
|
||||
|
||||
public ScoreCardPresenter(
|
||||
ScoreCardView view,
|
||||
GameLoopController gameLoopController,
|
||||
CategoryCatalog categoryCatalog,
|
||||
ScoringSystem scoringSystem,
|
||||
DiceManager diceManager)
|
||||
{
|
||||
_view = view;
|
||||
_gameLoopController = gameLoopController;
|
||||
_categoryCatalog = categoryCatalog;
|
||||
_scoringSystem = scoringSystem;
|
||||
_diceManager = diceManager;
|
||||
@@ -55,11 +58,12 @@ namespace YachtDice.UI.Presentation
|
||||
if (_scoringSystem.IsCategoryUsed(category))
|
||||
continue;
|
||||
|
||||
var result = _scoringSystem.PreviewScore(dice, category);
|
||||
var result = _gameLoopController.PreviewCategory(category);
|
||||
previews[category] = result.FinalScore;
|
||||
}
|
||||
|
||||
_view.UpdatePreviews(previews);
|
||||
SetAvailableCategoriesInteractable();
|
||||
}
|
||||
|
||||
public void SetCategoryScored(CategoryDefinition category, int finalScore)
|
||||
@@ -72,6 +76,19 @@ namespace YachtDice.UI.Presentation
|
||||
_view.SetAllInteractable(interactable);
|
||||
}
|
||||
|
||||
public void SetAvailableCategoriesInteractable()
|
||||
{
|
||||
var allCategories = _categoryCatalog.All;
|
||||
for (var i = 0; i < allCategories.Count; i++)
|
||||
{
|
||||
var category = allCategories[i];
|
||||
if (_scoringSystem.IsCategoryUsed(category))
|
||||
continue;
|
||||
|
||||
_view.SetCategoryInteractable(category, _gameLoopController.CanScoreCategory(category));
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTotalDisplay(ScoreSummary summary)
|
||||
{
|
||||
_view.UpdateTotalDisplay(summary.DisplayTotal);
|
||||
|
||||
Reference in New Issue
Block a user