Decompiled source of TimePause v1.0.1

TimePause.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Microsoft.CodeAnalysis;
using SSSGame;
using SSSGame.Weather;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TimePause")]
[assembly: AssemblyTitle("TimePause")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 TimePause
{
	[BepInPlugin("blacks7ar.TimePause", "TimePause", "1.0.1")]
	public class Plugin : BasePlugin
	{
		private class ToggleUpdater : MonoBehaviour
		{
			private static bool _paused;

			private static WeatherSystem weatherSystem;

			private void Update()
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)weatherSystem == (Object)null)
				{
					weatherSystem = Object.FindObjectOfType<WeatherSystem>();
					if ((Object)(object)weatherSystem == (Object)null)
					{
						return;
					}
				}
				if (Input.GetKeyDown(_pauseKey.Value))
				{
					_paused = !_paused;
					weatherSystem.Rpc_ToggleTimePassing();
					string text = (_paused ? "Time Paused!" : "Time Unpaused!");
					string text2 = "";
					float num = 5f;
					NotificationMenu.DisplayLarge(ref text2, ref text, (Sprite)null, ref num);
				}
			}
		}

		private const string modGUID = "blacks7ar.TimePause";

		public const string modName = "TimePause";

		public const string modAuthor = "blacks7ar";

		public const string modVersion = "1.0.1";

		private static ManualLogSource TLogger;

		private static ConfigEntry<KeyCode> _pauseKey;

		public override void Load()
		{
			TLogger = ((BasePlugin)this).Log;
			TLogger.LogInfo((object)"Mod loaded!");
			_pauseKey = ((BasePlugin)this).Config.Bind<KeyCode>("General", "Pause Key", (KeyCode)285, "Pressed hot key to pause, press it again to unpaused.");
			((BasePlugin)this).AddComponent<ToggleUpdater>();
		}
	}
}