refactor: Cleaned up score view interface
This commit is contained in:
parent
779af276d3
commit
858e49e1d9
13 changed files with 36 additions and 123 deletions
31
Assets/Scripts/View/UI/ScoreView.cs
Normal file
31
Assets/Scripts/View/UI/ScoreView.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using Domain;
|
||||
using Presenter;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace View.UI {
|
||||
public class ScoreView : MonoBehaviour, IScoreView {
|
||||
[SerializeField] private TMP_Text text;
|
||||
|
||||
private ExpressionClick _click;
|
||||
private CustomInput _customInput;
|
||||
|
||||
private void Start() {
|
||||
_click = FindObjectOfType<Dependencies>().ExpressionClick;
|
||||
_customInput = FindObjectOfType<Dependencies>().CustomInput;
|
||||
}
|
||||
|
||||
private void Update() =>
|
||||
CheckInput();
|
||||
|
||||
public void UpdateView(int score) =>
|
||||
text.text = score.ToString();
|
||||
|
||||
private void CheckInput() {
|
||||
_customInput.UpdateInput();
|
||||
|
||||
if (_customInput.AnyKeyDown())
|
||||
_click.Execute();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue