time should be calculated in the correct handler

This commit is contained in:
Sebastian Bularca
2026-05-26 00:22:27 +02:00
parent dd049642b0
commit fb3cec2e04
2 changed files with 12 additions and 12 deletions

View File

@@ -26,9 +26,9 @@ namespace Nox.Game {
public int suppliesAvailable = -1;
public float currentTime = -1f;
public DayPhase currentDayPhase = DayPhase.Morning;
public List<string> completedEncounterIds = new ();
public List<string> abandonedEncounterIds = new ();
public List<QuestLogEntry> questLogEntries = new ();
public List<string> completedEncounterIds = new();
public List<string> abandonedEncounterIds = new();
public List<QuestLogEntry> questLogEntries = new();
}
public class AdventurePlayMode : IPlayMode {
@@ -137,13 +137,9 @@ namespace Nox.Game {
partyInventoryHandler ??= new PartyInventoryHandler(adventureData, adventureSettings);
partyInventoryHandler.Initialize();
var calendarSettings = Addressables.LoadAssetAsync<CalendarSettings>("CalendarSettings").WaitForCompletion();
var calendarSettings = Addressables.LoadAssetAsync<CalendarSettings>("CalendarSettings").WaitForCompletion();
var worldClock = new WorldClock(calendarSettings);
var totalMinutes = adventureData.currentDay * calendarSettings.MinutesPerDay
+ (int)(adventureData.currentTime * calendarSettings.MinutesPerDay);
worldClock.AdvanceMinutes(totalMinutes);
worldClock.Tick(adventureData.currentTime);
timeHandler ??= new TimeHandler(adventureSettings, adventureData, worldClock);
timeHandler ??= new TimeHandler(adventureSettings, adventureData, worldClock, calendarSettings);
zoneSystem ??= new ZoneSystem(mapRef.zonesObjectHolder);
encounterHandler = new EncounterHandler(zoneSystem, encounterRegistry, encounterPrefabs, adventureData, questProgress);
@@ -169,7 +165,7 @@ namespace Nox.Game {
var popupViewPrefab = Addressables.LoadAssetAsync<GameObject>("PopupReferencePrefab").WaitForCompletion().GetComponent<PopupReference>();
var guiCanvas = guiReferences.GetComponentInParent<Canvas>().transform;
popupSystem = new PopupSystem(popupSettings, popupViewPrefab, guiCanvas);
popupSystem.RegisterCategory(PopupCategory.Character, priority: 10);
popupSystem.RegisterCategory(PopupCategory.Character, 10);
}
partyGuiView = new PartyGuiView(guiReferences.portraitsContainer, guiReferences.partyMemberSlotPrefab, portraitsHolder, popupSystem);
@@ -207,7 +203,7 @@ namespace Nox.Game {
activePlayMode = PlayMode.Adventure,
activeParty = partyDefinition,
partyPosition = partyRef ? SerializableVector3.FromVector3(partyRef.transform.position) : SerializableVector3.Zero,
adventureData = this.adventureData,
adventureData = adventureData,
questLogEntries = questLog?.CreateSnapshot() ?? new List<QuestLogEntry>()
};
}