forked from Shardstone/trail-into-darkness
Added a custom calendar system
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Jovian.Calendar;
|
||||
using Nox.Core;
|
||||
|
||||
namespace Nox.Game.UI {
|
||||
@@ -7,20 +8,22 @@ namespace Nox.Game.UI {
|
||||
private readonly InputSystem_Actions inputActions;
|
||||
private readonly AdventureData adventureData;
|
||||
private readonly AdventureSettings adventureSettings;
|
||||
private DayPhase dayPhase = DayPhase.Midnight;
|
||||
private readonly WorldClock worldClock;
|
||||
private int currentDay;
|
||||
private int previousTime;
|
||||
|
||||
public AdventureView(
|
||||
GameDataState gameDataState,
|
||||
public AdventureView(GameDataState gameDataState,
|
||||
GuiReferences guiReferences,
|
||||
InputSystem_Actions inputActions,
|
||||
AdventureData adventureData,
|
||||
AdventureSettings adventureSettings) {
|
||||
AdventureSettings adventureSettings,
|
||||
WorldClock worldClock) {
|
||||
this.gameDataState = gameDataState;
|
||||
this.guiReferences = guiReferences;
|
||||
this.inputActions = inputActions;
|
||||
this.adventureData = adventureData;
|
||||
this.adventureSettings = adventureSettings;
|
||||
this.worldClock = worldClock;
|
||||
}
|
||||
private void InvokePauseMenu() {
|
||||
gameDataState.ChangePlayMode(PlayMode.PauseMenu);
|
||||
@@ -28,7 +31,8 @@ namespace Nox.Game.UI {
|
||||
|
||||
public void Initialize() {
|
||||
guiReferences.pauseMenuButton.onClick.AddListener(InvokePauseMenu);
|
||||
guiReferences.dayText.text = $"Day {adventureData.currentDay}, {adventureData.currentDayPhase.ToString()}";
|
||||
guiReferences.dayText.text = $"{worldClock.FullStringNamed()}";
|
||||
previousTime = -1;
|
||||
guiReferences.suppliesBar.fillAmount = (float)adventureData.suppliesAvailable / adventureSettings.maxSupplies;
|
||||
guiReferences.suppliesText.text = $"{adventureData.suppliesAvailable}/{adventureSettings.maxSupplies}";
|
||||
}
|
||||
@@ -40,14 +44,14 @@ namespace Nox.Game.UI {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
public void Tick() {
|
||||
if(dayPhase != adventureData.currentDayPhase) {
|
||||
dayPhase = adventureData.currentDayPhase;
|
||||
guiReferences.dayText.text = $"Day {adventureData.currentDay}, {adventureData.currentDayPhase.ToString()}";
|
||||
var time = worldClock.Now.minute;
|
||||
if (time != previousTime) {
|
||||
previousTime = time;
|
||||
}
|
||||
guiReferences.dayText.text = $"{worldClock.FullStringNamed()}";
|
||||
|
||||
if(currentDay != adventureData.currentDay) {
|
||||
currentDay = adventureData.currentDay;
|
||||
guiReferences.dayText.text = $"Day {adventureData.currentDay}, {adventureData.currentDayPhase.ToString()}";
|
||||
guiReferences.suppliesBar.fillAmount = (float)adventureData.suppliesAvailable / adventureSettings.maxSupplies;
|
||||
guiReferences.suppliesText.text = $"{adventureData.suppliesAvailable}/{adventureSettings.maxSupplies}";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user