-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e731c84
commit 764e7f3
Showing
2 changed files
with
119 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,35 @@ | ||
using Events; | ||
using System.Collections.Generic; | ||
using Events; | ||
using TMPro; | ||
using UniRx; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
namespace UserInterface | ||
namespace UserInterface.Overlay | ||
{ | ||
public class TacticView : MonoBehaviour | ||
{ | ||
[SerializeField] private ScriptableInt tacticSystem; | ||
[SerializeField] private TextMeshProUGUI tacticName; | ||
|
||
private void Start() | ||
{ | ||
UpdateView(); | ||
MessageBroker.Default | ||
.Receive<TacticChanged>() | ||
.TakeUntilDestroy(this) | ||
.Subscribe(_ => UpdateView()); | ||
} | ||
public class TacticView : MonoBehaviour | ||
{ | ||
[SerializeField] private ScriptableInt tacticSystem; | ||
[SerializeField] private TextMeshProUGUI tacticName; | ||
[SerializeField] private Image tacticIcon; | ||
[SerializeField] private Sprite[] tacticIcons; | ||
|
||
private void UpdateView() | ||
{ | ||
tacticName.text = ((Tactic) tacticSystem.value).ToString(); | ||
} | ||
} | ||
} | ||
private void Start() | ||
{ | ||
UpdateView(); | ||
MessageBroker.Default | ||
.Receive<TacticChanged>() | ||
.TakeUntilDestroy(this) | ||
.Subscribe(_ => UpdateView()); | ||
} | ||
|
||
private void UpdateView() | ||
{ | ||
tacticName.text = ((Tactic) tacticSystem.value).ToString(); | ||
if (tacticSystem.value >= 0 && tacticSystem.value < tacticIcons.Length) | ||
{ | ||
tacticIcon.sprite = tacticIcons[tacticSystem.value]; | ||
} | ||
} | ||
} | ||
} |