Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of TimeNeverStops Mono v1.3.0
TimeNeverStops_Mono.dll
Decompiled 4 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using FishNet; using HarmonyLib; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using ScheduleOne.DevUtilities; using ScheduleOne.GameTime; using ScheduleOne.PlayerScripts; using ScheduleOne.UI; using Time_Never_Stops; using UnityEngine; using UnityEngine.EventSystems; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "Time Never Stops", "1.3.0", "DropDaDeuce", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("TimeNeverStops_Mono")] [assembly: AssemblyConfiguration("MONO")] [assembly: AssemblyFileVersion("1.3.0.0")] [assembly: AssemblyInformationalVersion("1.3.0+8c929b51717e3ec8e52ac762fc8a2a1ff6130e2c")] [assembly: AssemblyProduct("TimeNeverStops_Mono")] [assembly: AssemblyTitle("TimeNeverStops_Mono")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Time_Never_Stops { public class Core : MelonMod { [CompilerGenerated] private sealed class <SetDaySpeedLoop>d__18 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Core <>4__this; private WaitForSeconds <tick>5__1; private TimeManager <tm>5__2; private float <last>5__3; private int <i>5__4; private float <desired>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetDaySpeedLoop>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <tick>5__1 = null; <tm>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown bool flag; switch (<>1__state) { default: return false; case 0: <>1__state = -1; <tick>5__1 = new WaitForSeconds(1f); goto IL_0172; case 1: <>1__state = -1; goto IL_005d; case 2: { <>1__state = -1; goto IL_0151; } IL_0172: flag = true; goto IL_005d; IL_005d: if ((Object)(object)NetworkSingleton<TimeManager>.Instance == (Object)null) { <>2__current = null; <>1__state = 1; return true; } <tm>5__2 = NetworkSingleton<TimeManager>.Instance; <last>5__3 = <>4__this.<SetDaySpeedLoop>g__ReadPrefAndNormalize|18_0(); ApplyDaySpeed(<last>5__3); <i>5__4 = 0; goto IL_0151; IL_0151: if ((Object)(object)NetworkSingleton<TimeManager>.Instance == (Object)(object)<tm>5__2) { if ((<i>5__4++ & 1) == 0) { <>4__this.cfgCategory.LoadFromFile(false); } <desired>5__5 = <>4__this.<SetDaySpeedLoop>g__ReadPrefAndNormalize|18_0(); if (<SetDaySpeedLoop>g__Differs|18_1(<desired>5__5, <last>5__3) || <SetDaySpeedLoop>g__Differs|18_1(<desired>5__5, <tm>5__2.TimeProgressionMultiplier)) { <last>5__3 = <desired>5__5; ApplyDaySpeed(<last>5__3); } <>2__current = <tick>5__1; <>1__state = 2; return true; } <tm>5__2 = null; goto IL_0172; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SleepStateWatcher>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Core <>4__this; private bool <last>5__1; private TimeManager <lastTm>5__2; private TimeManager <tm>5__3; private bool <cur>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SleepStateWatcher>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <lastTm>5__2 = null; <tm>5__3 = null; <>1__state = -2; } private bool MoveNext() { bool flag; switch (<>1__state) { default: return false; case 0: <>1__state = -1; <last>5__1 = false; <lastTm>5__2 = null; goto IL_013d; case 1: <>1__state = -1; break; case 2: { <>1__state = -1; <tm>5__3 = null; goto IL_013d; } IL_013d: flag = true; break; } if ((Object)(object)NetworkSingleton<TimeManager>.Instance == (Object)null) { <lastTm>5__2 = null; <last>5__1 = false; <>2__current = null; <>1__state = 1; return true; } <tm>5__3 = NetworkSingleton<TimeManager>.Instance; if ((Object)(object)<tm>5__3 != (Object)(object)<lastTm>5__2) { <lastTm>5__2 = <tm>5__3; <last>5__1 = <tm>5__3.SleepInProgress; } <cur>5__4 = <tm>5__3.SleepInProgress; if (<cur>5__4 && !<last>5__1) { <>4__this.OnSleepStart(); } else if (!<cur>5__4 & <last>5__1) { <>4__this.OnSleepEnd(); } <last>5__1 = <cur>5__4; <>2__current = null; <>1__state = 2; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WatchSummaryToggle>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Core <>4__this; private WaitForSeconds <tick>5__1; private bool <cur>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WatchSummaryToggle>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <tick>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <tick>5__1 = new WaitForSeconds(1f); break; case 1: <>1__state = -1; break; } <cur>5__2 = cfgEnableSummaryAwake.Value; if (<cur>5__2 != <>4__this._lastEnableSummaryAwake) { <>4__this._lastEnableSummaryAwake = <cur>5__2; <>4__this.cfgCategory.SaveToFile(false); MelonLogger.Msg("EnableDailySummaryAwake: " + (<cur>5__2 ? "ON" : "OFF")); } <>2__current = <tick>5__1; <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private MelonPreferences_Category cfgCategory; private MelonPreferences_Entry<string> cfgDaySpeedStr; public static MelonPreferences_Entry<bool> cfgEnableSummaryAwake; private MelonPreferences_Entry<float> cfgLegacyDaySpeed; public static MelonPreferences_Entry<bool> cfgMultiplierOnly; private bool _updatingPref; private bool _lastEnableSummaryAwake; private const float DefaultSpeed = 1f; private const float MinSpeed = 0.1f; private const float MaxSpeed = 100f; public override void OnInitializeMelon() { MelonPreferences_Category val = MelonPreferences.CreateCategory("TimeNeverStops"); cfgLegacyDaySpeed = val.GetEntry<float>("DaySpeedMultiplier") ?? val.CreateEntry<float>("DaySpeedMultiplier", 1f, "Day Speed Multiplier", "Sets the in-game time speed multiplier. 1.0 = normal speed, 0.5 = half speed, 2.0 = double speed.Minimum 0.1, Maximum 3.0. Default = 1.0 (Vanilla Game Speed)", false, false, (ValueValidator)null, (string)null); val.DeleteEntry("DaySpeedMultiplier"); if (cfgLegacyDaySpeed.Value != 1f) { MelonLogger.Warning($"Legacy DaySpeedMultiplier found with value {cfgLegacyDaySpeed.Value}. Migrating to new config system."); } string text = Math.Clamp(cfgLegacyDaySpeed.Value, 0.1f, 100f).ToString("R", CultureInfo.InvariantCulture); string text2 = Path.Combine(MelonEnvironment.UserDataDirectory, "DropDaDeuce-TimeNeverStops"); string text3 = Path.Combine(text2, "TimeNeverStops.cfg"); Directory.CreateDirectory(text2); cfgCategory = val; val = null; cfgCategory.SetFilePath(text3, File.Exists(text3), true); cfgMultiplierOnly = cfgCategory.GetEntry<bool>("TimeMultiplierOnlyMode") ?? cfgCategory.CreateEntry<bool>("TimeMultiplierOnlyMode", false, "Multiplier Only Mode", "If true the mod ONLY changes the day speed multiplier.\nDisables:\n- 4AM freeze bypass\n- Daily summary while awake\n- Sleep prompt hiding.\nChange at runtime is applied but a restart is safest.", false, false, (ValueValidator)null, (string)null); cfgDaySpeedStr = cfgCategory.GetEntry<string>("DaySpeedMultiplier") ?? cfgCategory.CreateEntry<string>("DaySpeedMultiplier", text, "Day Speed Multiplier", "String parsed to float by the mod.\n1.0 = normal, 0.5 = half, 2.0 = double.\nMin 0.1, Max 100.0, Default 1.0.", false, false, (ValueValidator)null, (string)null); cfgEnableSummaryAwake = cfgCategory.GetEntry<bool>("EnableDailySummaryAwake") ?? cfgCategory.CreateEntry<bool>("EnableDailySummaryAwake", true, "Enable Daily Summary While Awake", "If enabled, the daily summary will be shown while awake (unless Multiplier Only Mode is ON).", false, false, (ValueValidator)null, (string)null); if (!cfgMultiplierOnly.Value) { _lastEnableSummaryAwake = cfgEnableSummaryAwake.Value; MelonCoroutines.Start(WatchSummaryToggle()); MelonCoroutines.Start(SleepStateWatcher()); } else { MelonLogger.Msg("TimeMultiplierOnlyMode enabled: all non-multiplier features disabled."); } float num = Sanitize(ParseFloatOrDefault(cfgDaySpeedStr.Value, 1f)); if (!IsStringValidAndInRange(cfgDaySpeedStr.Value)) { cfgDaySpeedStr.Value = num.ToString(CultureInfo.InvariantCulture); } _updatingPref = true; cfgCategory.SaveToFile(true); _updatingPref = false; ((MelonEventBase<LemonAction<string, string>>)(object)cfgDaySpeedStr.OnEntryValueChanged).Subscribe((LemonAction<string, string>)delegate(string _, string newV) { if (!_updatingPref) { float v = ParseFloatOrDefault(newV, 1f); float newSpeed = Sanitize(v); if (!IsStringValidAndInRange(newV)) { _updatingPref = true; cfgDaySpeedStr.Value = newSpeed.ToString(CultureInfo.InvariantCulture); cfgCategory.SaveToFile(false); _updatingPref = false; } ApplyDaySpeed(newSpeed); } }, 0, false); MelonCoroutines.Start(SetDaySpeedLoop()); } [IteratorStateMachine(typeof(<SleepStateWatcher>d__11))] private IEnumerator SleepStateWatcher() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SleepStateWatcher>d__11(0) { <>4__this = this }; } private void OnSleepStart() { Patch_Tick_XPMenu.SuppressDuringSleep(on: true); } private void OnSleepEnd() { Patch_Tick_XPMenu.SuppressDuringSleep(on: false); Patch_Tick_XPMenu.MarkHandledForToday(); } private static bool TryParseFloatInvariant(string s, out float value) { return float.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out value); } private static float ParseFloatOrDefault(string s, float fallback) { float value; return (TryParseFloatInvariant(s, out value) && float.IsFinite(value)) ? value : fallback; } private static float Sanitize(float v) { return Math.Clamp(float.IsFinite(v) ? v : 1f, 0.1f, 100f); } private static bool IsStringValidAndInRange(string s) { float value; return TryParseFloatInvariant(s, out value) && float.IsFinite(value) && value >= 0.1f && value <= 100f; } [IteratorStateMachine(typeof(<SetDaySpeedLoop>d__18))] private IEnumerator SetDaySpeedLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetDaySpeedLoop>d__18(0) { <>4__this = this }; } private static void ApplyDaySpeed(float newSpeed) { TimeManager instance = NetworkSingleton<TimeManager>.Instance; if (!((Object)(object)instance == (Object)null)) { float num = Sanitize(newSpeed); if (Mathf.Abs(instance.TimeProgressionMultiplier - num) > 0.0001f) { instance.TimeProgressionMultiplier = num; MelonLogger.Msg($"Day speed set to {num:0.########}x"); } } } [IteratorStateMachine(typeof(<WatchSummaryToggle>d__20))] private IEnumerator WatchSummaryToggle() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WatchSummaryToggle>d__20(0) { <>4__this = this }; } [CompilerGenerated] private float <SetDaySpeedLoop>g__ReadPrefAndNormalize|18_0() { float num = ParseFloatOrDefault(cfgDaySpeedStr.Value, 1f); float result = Sanitize(float.IsFinite(num) ? num : 1f); string text = result.ToString(CultureInfo.InvariantCulture); if (cfgDaySpeedStr.Value != text) { cfgDaySpeedStr.Value = text; cfgCategory.SaveToFile(false); } return result; } [CompilerGenerated] internal static bool <SetDaySpeedLoop>g__Differs|18_1(float a, float b, float eps = 0.0001f) { return Mathf.Abs(a - b) > eps; } } public static class PatchLogger { public static void LogPatchLoad(string patchName) { MelonLogger.Msg("[Harmony] " + patchName + " loaded."); } } [HarmonyPatch(typeof(TimeManager), "Tick")] [HarmonyPriority(600)] public static class Patch_Tick_XPMenu { [CompilerGenerated] private sealed class <ShowDailySummaryRoutine>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TimeManager tm; private DailySummary <ds>5__1; private HUD <hud>5__2; private EventSystem <es>5__3; private RankUpCanvas <rankCanvas>5__4; private GameObject <go>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ShowDailySummaryRoutine>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <ds>5__1 = null; <hud>5__2 = null; <es>5__3 = null; <rankCanvas>5__4 = null; <go>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; busy = true; tm.ResetHostSleepDone(); <ds>5__1 = NetworkSingleton<DailySummary>.Instance; <hud>5__2 = Singleton<HUD>.Instance; if ((Object)(object)<ds>5__1 == (Object)null || <ds>5__1.IsOpen) { busy = false; return false; } if ((Object)(object)<hud>5__2 != (Object)null) { ((Behaviour)<hud>5__2.canvas).enabled = false; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; Time.timeScale = 1f; <es>5__3 = EventSystem.current; if ((Object)(object)<es>5__3 == (Object)null) { <go>5__5 = new GameObject("EventSystem"); <go>5__5.AddComponent<EventSystem>(); <go>5__5.AddComponent<StandaloneInputModule>(); <go>5__5 = null; } <ds>5__1.Open(); goto IL_012e; case 1: <>1__state = -1; goto IL_012e; case 2: { <>1__state = -1; goto IL_01c0; } IL_012e: if (<ds>5__1.IsOpen) { <>2__current = null; <>1__state = 1; return true; } <rankCanvas>5__4 = Object.FindObjectOfType<RankUpCanvas>(true); if (!((Object)(object)<rankCanvas>5__4 != (Object)null)) { break; } <rankCanvas>5__4.StartEvent(); if ((Object)(object)<hud>5__2 != (Object)null) { ((Behaviour)<hud>5__2.canvas).enabled = false; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; Time.timeScale = 1f; goto IL_01c0; IL_01c0: if (<rankCanvas>5__4.IsRunning) { <>2__current = null; <>1__state = 2; return true; } break; } tm.MarkHostSleepDone(); Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; if ((Object)(object)<hud>5__2 != (Object)null) { ((Behaviour)<hud>5__2.canvas).enabled = true; } else { <hud>5__2 = Singleton<HUD>.Instance; if ((Object)(object)<hud>5__2 != (Object)null) { ((Behaviour)<hud>5__2.canvas).enabled = true; } else { MelonLogger.Warning("HUD not found. Cannot restore HUD canvas."); } } busy = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool firedToday; private static bool busy; private static int lastHHmm; private static bool suppressForSleep; public static bool startupSkip; static Patch_Tick_XPMenu() { startupSkip = true; PatchLogger.LogPatchLoad("Patch_Tick_XPMenu"); startupSkip = true; } public static void SuppressDuringSleep(bool on) { suppressForSleep = on; } public static void MarkHandledForToday() { firedToday = true; lastHHmm = 700; } [HarmonyPrefix] public static bool Prefix(TimeManager __instance) { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Invalid comparison between Unknown and I4 MelonPreferences_Entry<bool> cfgMultiplierOnly = Core.cfgMultiplierOnly; if (cfgMultiplierOnly != null && cfgMultiplierOnly.Value) { return true; } if (__instance.CurrentTime != 400 && (!__instance.IsCurrentTimeWithinRange(400, 600) || GameManager.IS_TUTORIAL)) { return true; } if ((Object)(object)Player.Local == (Object)null) { MelonLogger.Warning("Local player does not exist. Waiting for player spawn."); return false; } TMAccess.SetTimeOnCurrentMinute(__instance, 0f); TMAccess.TryStartStaggeredMinPass(__instance, 1f / (__instance.TimeProgressionMultiplier * Time.timeScale)); if (__instance.CurrentTime == 2359) { TMAccess.SetElapsedDays(__instance, __instance.ElapsedDays + 1); TMAccess.SetCurrentTime(__instance, 0); TMAccess.SetDailyMinTotal(__instance, 0); __instance.onDayPass?.Invoke(); __instance.onHourPass?.Invoke(); if ((int)__instance.CurrentDay == 0) { __instance.onWeekPass?.Invoke(); } } else if (__instance.CurrentTime % 100 >= 59) { TMAccess.SetCurrentTime(__instance, __instance.CurrentTime + 41); __instance.onHourPass?.Invoke(); } else { TMAccess.SetCurrentTime(__instance, __instance.CurrentTime + 1); } TMAccess.SetDailyMinTotal(__instance, TimeManager.GetMinSumFrom24HourTime(__instance.CurrentTime)); __instance.HasChanged = true; if (__instance.ElapsedDays == 0 && __instance.CurrentTime == 2000 && __instance.onFirstNight != null) { __instance.onFirstNight.Invoke(); } return false; } [HarmonyPostfix] public static void Postfix(TimeManager __instance) { MelonPreferences_Entry<bool> cfgMultiplierOnly = Core.cfgMultiplierOnly; if (cfgMultiplierOnly != null && cfgMultiplierOnly.Value) { return; } bool flag = Core.cfgEnableSummaryAwake?.Value ?? true; if (!InstanceFinder.IsHost || GameManager.IS_TUTORIAL || !flag || __instance.SleepInProgress || suppressForSleep) { return; } DailySummary instance = NetworkSingleton<DailySummary>.Instance; if ((Object)(object)instance != (Object)null && instance.IsOpen) { return; } if (startupSkip) { startupSkip = false; lastHHmm = __instance.CurrentTime; firedToday = true; return; } int currentTime = __instance.CurrentTime; if (lastHHmm > currentTime) { firedToday = false; } if (!firedToday && !busy && currentTime >= 700 && __instance.ElapsedDays >= 1) { MelonCoroutines.Start(ShowDailySummaryRoutine(__instance)); firedToday = true; } lastHHmm = currentTime; } [IteratorStateMachine(typeof(<ShowDailySummaryRoutine>d__10))] private static IEnumerator ShowDailySummaryRoutine(TimeManager tm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ShowDailySummaryRoutine>d__10(0) { tm = tm }; } } [HarmonyPatch(typeof(HUD), "Update")] [HarmonyPriority(200)] public static class Patch_HUD_HideSleepPrompt { private static void Postfix(HUD __instance) { MelonPreferences_Entry<bool> cfgMultiplierOnly = Core.cfgMultiplierOnly; if ((cfgMultiplierOnly == null || !cfgMultiplierOnly.Value) && (Object)(object)__instance?.SleepPrompt != (Object)null) { ((Component)__instance.SleepPrompt).gameObject.SetActive(false); } } } internal static class TMAccess { private static readonly Action<TimeManager, int> _setCurrentTime; private static readonly Action<TimeManager, int> _setElapsedDays; private static readonly Action<TimeManager, int> _setDailyMinTotal; private static readonly Action<TimeManager, float> _setTimeOnCurrentMinute; private static readonly MethodInfo _staggeredMinPass; static TMAccess() { _setCurrentTime = BuildSetter<int>("CurrentTime"); _setElapsedDays = BuildSetter<int>("ElapsedDays"); _setDailyMinTotal = BuildSetter<int>("DailyMinTotal"); _setTimeOnCurrentMinute = BuildSetter<float>("TimeOnCurrentMinute"); _staggeredMinPass = AccessTools.Method(typeof(TimeManager), "StaggeredMinPass", (Type[])null, (Type[])null); } private static Action<TimeManager, T> BuildSetter<T>(string propName) { MethodInfo methodInfo = AccessTools.PropertySetter(typeof(TimeManager), propName); if (methodInfo == null) { return delegate { }; } return (Action<TimeManager, T>)Delegate.CreateDelegate(typeof(Action<TimeManager, T>), null, methodInfo); } public static void SetCurrentTime(TimeManager tm, int v) { _setCurrentTime(tm, v); } public static void SetElapsedDays(TimeManager tm, int v) { _setElapsedDays(tm, v); } public static void SetDailyMinTotal(TimeManager tm, int v) { _setDailyMinTotal(tm, v); } public static void SetTimeOnCurrentMinute(TimeManager tm, float v) { _setTimeOnCurrentMinute(tm, v); } public static void TryStartStaggeredMinPass(TimeManager tm, float arg) { if (_staggeredMinPass == null) { return; } try { if (_staggeredMinPass.Invoke(tm, new object[1] { arg }) is IEnumerator enumerator) { ((MonoBehaviour)tm).StartCoroutine(enumerator); } } catch (Exception ex) { MelonLogger.Warning("Could not invoke StaggeredMinPass (Mono): " + ex.Message); } } } internal static class BuildVersion { internal const string Value = "1.3.0"; } } namespace Time_Never_Stops.TemplateUtils { public static class AssetBundleUtils { private static Core mod = MelonAssembly.FindMelonInstance<Core>(); private static MelonAssembly melonAssembly = ((MelonBase)mod).MelonAssembly; public static AssetBundle LoadAssetBundle(string bundleFileName) { try { string text = typeof(Core).Namespace + ".Assets." + bundleFileName; Stream manifestResourceStream = melonAssembly.Assembly.GetManifestResourceStream(text ?? ""); if (manifestResourceStream == null) { ((MelonBase)mod).Unregister("AssetBundle: '" + text + "' not found. \nOpen .csproj file and search for '" + bundleFileName + "'.\nIf it doesn't exist,\nCopy your asset to Assets/ folder then look for 'your.assetbundle' in .csproj file.", false); return null; } return AssetBundle.LoadFromStream(manifestResourceStream); } catch (Exception arg) { ((MelonBase)mod).Unregister($"Failed to load AssetBundle. Please report to dev: {arg}", false); return null; } } public static AssetBundle GetLoadedAssetBundle(string asset_name_flag) { AssetBundle[] array = AssetBundle.GetAllLoadedAssetBundles().ToArray(); try { AssetBundle[] array2 = array; foreach (AssetBundle val in array2) { if (val.Contains(asset_name_flag)) { return val; } } string text = ""; AssetBundle[] array3 = array; foreach (AssetBundle val2 in array3) { string[] allAssetNames = val2.GetAllAssetNames(); string text2 = string.Join("\n\r -", allAssetNames); text = text + ((Object)val2).name + $"({allAssetNames.Length} assets):" + text2; } throw new Exception($"Asset '{asset_name_flag}' not found in {array.Length} bundle(s).\n{text}"); } catch (Exception arg) { ((MelonBase)mod).Unregister($"Failed to get loaded AssetBundle. Please report to dev: \n{arg}", false); return null; } } public static GameObject LoadAssetFromBundle(string asset_name) { AssetBundle loadedAssetBundle = GetLoadedAssetBundle(asset_name); return loadedAssetBundle.LoadAsset<GameObject>(asset_name); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { internal IgnoresAccessChecksToAttribute(string assemblyName) { } } }