public static void Update() { if (thresholdsNew != null) { return; } thresholdsBackup = Resources.Instance.PlayerProfile.CanSleepTime; if (Map.Instance.Player == null || thresholdsBackup == null || thresholdsBackup.Length <= 0) { return; } thresholdsNew = new EnvironmentSimulator.DateTimeThreshold[thresholdsBackup.Length]; EnvironmentSimulator.DateTimeSerialization midnight = new EnvironmentSimulator.DateTimeSerialization( new Traverse(Map.Instance.Player).Field("_midnightTime").GetValue <DateTime>() ); EnvironmentSimulator.DateTimeThreshold threshold = new EnvironmentSimulator.DateTimeThreshold() { min = midnight, max = midnight }; for (int i = 0; i < thresholdsNew.Length; i++) { thresholdsNew[i] = threshold; } }
public static void SetWakeTime(DateTime time) { if (wakeTimeSet) { return; } wakeTimeSet = true; EnvironmentSimulator.DateTimeSerialization DTSerial = new EnvironmentSimulator.DateTimeSerialization { Time = time }; new Traverse(Resources.Instance.PlayerProfile) .Field("_wakeTime") .SetValue(DTSerial); }