refactor: Cleaned up score view interface

This commit is contained in:
Gerard Gascón 2024-04-19 11:28:39 +02:00
parent 779af276d3
commit 858e49e1d9
13 changed files with 36 additions and 123 deletions

View file

@ -4,14 +4,14 @@ namespace Presenter.SaveSystem {
public class LoadGame {
private readonly IGameRepository _repository;
private readonly Score _score;
private readonly IExpressionInput _expressionInput;
private readonly IScoreView _scoreView;
private readonly IRoseSpawner _spawner;
private readonly IRoseGrow _growAnimation;
public LoadGame(IGameRepository repository, Score score, IExpressionInput expressionInput, IRoseSpawner spawner, IRoseGrow growAnimation) {
public LoadGame(IGameRepository repository, Score score, IScoreView scoreView, IRoseSpawner spawner, IRoseGrow growAnimation) {
_repository = repository;
_score = score;
_expressionInput = expressionInput;
_scoreView = scoreView;
_spawner = spawner;
_growAnimation = growAnimation;
}
@ -19,7 +19,7 @@ namespace Presenter.SaveSystem {
public void Run() {
Score newScore = _repository.LoadScore();
_score.SetFromOtherScore(newScore);
_expressionInput.UpdateView(_score.Value, _score.GrowPercentage);
_scoreView.UpdateView(_score.Value);
_growAnimation.GrowStep();
int roses = _score.Value / (_score.SpawnRate * _score.GrowIterations);