Files
gregCore/src/GameLayer/Patches/Lifecycle/TimePatch.cs
T
Marvin 07bc596c77
gregCore CI / build (push) Has been cancelled
Refactor and enhance gregCore framework
- Disabled IMGUI drawing in Core.cs for Unity 6 stability.
- Consolidated GregCoreMod and DataCenterModLoaderMod into a single GregCoreMod class for better organization and clarity.
- Updated GregBootstrapper to use a boolean flag for hook integration.
- Simplified HookIntegration class by removing unnecessary fields and methods, focusing on essential functionality.
- Updated PlayerPatch and ShopPatch to emit hooks using string representation for better compatibility.
- Introduced ModMenu and GregHardwareID classes for centralized mod configuration and unique object identification.
- Enhanced GregDevConsole for improved logging and UI management.
- Added legacy shims for backward compatibility with older mods.
- Improved UI management with CanvasGroup for better input handling.
- Updated QoL settings to allow for a range in slider values.
2026-04-24 15:45:10 +02:00

35 lines
1.1 KiB
C#

using gregCore.GameLayer.Hooks;
namespace gregCore.GameLayer.Patches.Lifecycle;
internal static class TimePatch
{
private static int _lastDay = -1;
internal static void OnUpdate(global::Il2Cpp.TimeController __instance)
{
try
{
int currentDay = __instance.day;
if (_lastDay >= 0 && currentDay != _lastDay)
{
var payload = EventPayloadBuilder.ForGeneric("greg.lifecycle.DayEnded", new Dictionary<string, object>
{
{ "Day", currentDay },
{ "PreviousDay", _lastDay }
});
// Emit for both canonical and legacy
HookIntegration.Emit(HookName.Create("lifecycle", "DayEnded").ToString(), payload);
HookIntegration.Emit(HookName.Create("system", "GameDayAdvanced").ToString(), payload);
}
_lastDay = currentDay;
}
catch (Exception ex)
{
HookIntegration.LogPatchError(nameof(OnUpdate), ex);
}
}
}