Decompiled source of Savestates and cam utils v1.2.1

savestates.dll

Decompiled a year ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Reptile;
using SaveState.Patches;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MyUnityGameMod1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyUnityGameMod1")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e59b1fb1-39dd-4018-81da-ce9714f55f21")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public static class StringToQuaternion
{
	public static Quaternion Convert(string quaternionString)
	{
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			string[] array = quaternionString.Trim('(', ')').Split(new char[1] { ',' });
			if (array.Length == 4)
			{
				float num = float.Parse(array[0], CultureInfo.InvariantCulture);
				float num2 = float.Parse(array[1], CultureInfo.InvariantCulture);
				float num3 = float.Parse(array[2], CultureInfo.InvariantCulture);
				float num4 = float.Parse(array[3], CultureInfo.InvariantCulture);
				return new Quaternion(num, num2, num3, num4);
			}
			throw new FormatException("Invalid quaternion string format. Must contain 4 components.");
		}
		catch (Exception ex)
		{
			throw new FormatException("Error converting string to Quaternion: " + ex.Message);
		}
	}
}
namespace SaveState
{
	[BepInPlugin("com.Dragsun.Savestate", "Savestate", "1.2.1")]
	public class SaveStatePlugin : BaseUnityPlugin
	{
		public static class StringToVector3Converter
		{
			public static Vector3 Convert(string vectorString)
			{
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				string text = Regex.Replace(vectorString, "[\\(\\)\\s]", "");
				string[] array = text.Split(new char[1] { ',' });
				if (array.Length == 3 && float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) && float.TryParse(array[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3))
				{
					return new Vector3(result, result2, result3);
				}
				Debug.LogError((object)("Failed to convert string to Vector3: " + vectorString));
				return Vector3.zero;
			}
		}

		private const string MyGUID = "com.Dragsun.Savestate";

		private const string PluginName = "Savestate";

		private const string VersionString = "1.2.1";

		public static string KeyboardSet1Key = "Save the position";

		public static string KeyboardGet1Key = "Load the position";

		public static string ResetCameraKey = "Reset the camera";

		public static string ReloadSettingsKey = "Reload the camera settings";

		public static string NumpadPlusKey = "Change the slot for the save/load +";

		public static string NumpadMinKey = "Change the slot for the save/load -";

		public static string FovIntKey = "Fov for the camera";

		public static string MDragIntKey = "maximum drag for the camera";

		public static string DDragIntKey = "Default drag for the camera";

		public static ConfigEntry<float> FovInt;

		public static ConfigEntry<float> MDragInt;

		public static ConfigEntry<float> DDragInt;

		public static ConfigEntry<KeyboardShortcut> ReloadSettings;

		public static ConfigEntry<KeyboardShortcut> KeyboardGet1;

		public static ConfigEntry<KeyboardShortcut> KeyboardSet1;

		public static ConfigEntry<KeyboardShortcut> ResetCamera;

		public static ConfigEntry<KeyboardShortcut> NumpadPlus;

		public static ConfigEntry<KeyboardShortcut> NumpadMin;

		public static GameplayUI ui;

		private static readonly Harmony Harmony = new Harmony("com.Dragsun.Savestate");

		public static ManualLogSource Log = new ManualLogSource("Savestate");

		public static ConfigEntry<string> MyDictionaryConfig;

		public static Dictionary<int, string> MyDictionary = new Dictionary<int, string>();

		public static Dictionary<int, Vector3> playerpos = new Dictionary<int, Vector3>();

		public static Dictionary<int, Quaternion> playerRotation = new Dictionary<int, Quaternion>();

		public static Dictionary<int, float> playerboost = new Dictionary<int, float>();

		public static Vector3 value;

		public static Quaternion test2;

		public static Vector3 test1;

		public static int slot = 0;

		public static string postionKey = "1";

		public static string rotationKey = "2";

		public static string boostKey = "3";

		public static int stageKey;

		public static int postionInt;

		public static int rotationInt;

		public static int boostInt;

		public static Player player { get; set; }

		public static GameplayCamera gameplayCamera { get; set; }

		public static GameInput gameInput { get; set; }

		public static CameraMode cameraMode { get; set; }

		public static Overlay overlay { get; set; }

		public static WorldHandler worldHandler { get; set; }

		private void Awake()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			FovInt = ((BaseUnityPlugin)this).Config.Bind<float>("FovSettup", FovIntKey, 64f, new ConfigDescription("Fov number.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 360f), Array.Empty<object>()));
			DDragInt = ((BaseUnityPlugin)this).Config.Bind<float>("mindrag", DDragIntKey, 2.9f, new ConfigDescription("mindrag.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>()));
			MDragInt = ((BaseUnityPlugin)this).Config.Bind<float>("maxdrag", MDragIntKey, 3.55f, new ConfigDescription("Maxdrag.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>()));
			ReloadSettings = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Reload1", ReloadSettingsKey, new KeyboardShortcut((KeyCode)286, Array.Empty<KeyCode>()), (ConfigDescription)null);
			KeyboardSet1 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General1", KeyboardSet1Key, new KeyboardShortcut((KeyCode)108, Array.Empty<KeyCode>()), (ConfigDescription)null);
			KeyboardGet1 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General2", KeyboardGet1Key, new KeyboardShortcut((KeyCode)107, Array.Empty<KeyCode>()), (ConfigDescription)null);
			ResetCamera = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("ResetCamera", KeyboardGet1Key, new KeyboardShortcut((KeyCode)114, Array.Empty<KeyCode>()), (ConfigDescription)null);
			NumpadPlus = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Savestate1", NumpadPlusKey, new KeyboardShortcut((KeyCode)270, Array.Empty<KeyCode>()), (ConfigDescription)null);
			NumpadMin = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Savestate2", NumpadMinKey, new KeyboardShortcut((KeyCode)45, Array.Empty<KeyCode>()), (ConfigDescription)null);
			ReloadSettings.SettingChanged += ConfigSettingChanged;
			KeyboardSet1.SettingChanged += ConfigSettingChanged;
			KeyboardGet1.SettingChanged += ConfigSettingChanged;
			ResetCamera.SettingChanged += ConfigSettingChanged;
			NumpadPlus.SettingChanged += ConfigSettingChanged;
			NumpadMin.SettingChanged += ConfigSettingChanged;
			FovInt.SettingChanged += ConfigSettingChanged;
			MDragInt.SettingChanged += ConfigSettingChanged;
			DDragInt.SettingChanged += ConfigSettingChanged;
			MyDictionaryConfig = ((BaseUnityPlugin)this).Config.Bind<string>("MyDictionary", "Data", SerializeDictionary(MyDictionary), "Serialized dictionary data");
			DeserializeDictionary(MyDictionaryConfig.Value, MyDictionary);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: Savestate, VersionString: 1.2.1 is loading...");
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: Savestate, VersionString: 1.2.1 is loaded.");
			Log = ((BaseUnityPlugin)this).Logger;
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			KeyboardShortcut val = KeyboardGet1.Value;
			Stage currentStage;
			if (((KeyboardShortcut)(ref val)).IsDown() && (Object)(object)player != (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"saving position -------------------------------");
				currentStage = Utility.GetCurrentStage();
				stageKey = returnCustomId(((object)(Stage)(ref currentStage)).ToString());
				postionInt = int.Parse(stageKey + postionKey + slot, CultureInfo.InvariantCulture);
				rotationInt = int.Parse(stageKey + rotationKey + slot, CultureInfo.InvariantCulture);
				boostInt = int.Parse(stageKey + boostKey + slot, CultureInfo.InvariantCulture);
				Dictionary<int, string> myDictionary = MyDictionary;
				int key = postionInt;
				Vector3 localPosition = ((Component)player).transform.localPosition;
				myDictionary[key] = ((Vector3)(ref localPosition)).ToString("G");
				Dictionary<int, string> myDictionary2 = MyDictionary;
				int key2 = rotationInt;
				Quaternion localRotation = ((Component)player).transform.localRotation;
				myDictionary2[key2] = ((Quaternion)(ref localRotation)).ToString("G");
				MyDictionary[boostInt] = player.boostCharge.ToString();
				MyDictionaryConfig.Value = SerializeDictionary(MyDictionary);
				test1 = ((Component)player).transform.localPosition;
				test2 = ((Component)player).transform.localRotation;
				((BaseUnityPlugin)this).Logger.LogInfo((object)((Component)player).transform.localPosition);
				((BaseUnityPlugin)this).Logger.LogInfo((object)((Component)player).transform.localRotation);
				((BaseUnityPlugin)this).Logger.LogInfo((object)player.boostCharge);
				((BaseUnityPlugin)this).Logger.LogInfo((object)("saving position to " + slot));
				UI.Instance.ShowNotification("saving position to " + slot);
			}
			val = ResetCamera.Value;
			if ((((KeyboardShortcut)(ref val)).IsDown() || Input.GetKeyDown((KeyCode)339)) && (Object)(object)gameplayCamera != (Object)null)
			{
				gameplayCamera.ResetCameraPositionRotation();
			}
			val = KeyboardSet1.Value;
			if (((KeyboardShortcut)(ref val)).IsDown() && (Object)(object)player != (Object)null)
			{
				currentStage = Utility.GetCurrentStage();
				stageKey = returnCustomId(((object)(Stage)(ref currentStage)).ToString());
				postionInt = int.Parse(stageKey + postionKey + slot, CultureInfo.InvariantCulture);
				rotationInt = int.Parse(stageKey + rotationKey + slot, CultureInfo.InvariantCulture);
				boostInt = int.Parse(stageKey + boostKey + slot, CultureInfo.InvariantCulture);
				if (MyDictionary.ContainsKey(postionInt))
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)"loading position -------------------------------");
					((BaseUnityPlugin)this).Logger.LogInfo((object)MyDictionary[postionInt]);
					((BaseUnityPlugin)this).Logger.LogInfo((object)MyDictionary[rotationInt]);
					((BaseUnityPlugin)this).Logger.LogInfo((object)MyDictionary[boostInt]);
					worldHandler.PlaceCurrentPlayerAt(StringToVector3Converter.Convert(MyDictionary[postionInt]), StringToQuaternion.Convert(MyDictionary[rotationInt]), true);
					player.boostCharge = float.Parse(MyDictionary[boostInt], CultureInfo.InvariantCulture);
					((BaseUnityPlugin)this).Logger.LogInfo((object)"rotated nerd");
					((BaseUnityPlugin)this).Logger.LogInfo((object)("teleporting to slot :" + slot));
					UI.Instance.ShowNotification("teleporting to slot " + slot);
				}
				else
				{
					UI instance = UI.Instance;
					string text = slot.ToString();
					currentStage = Utility.GetCurrentStage();
					instance.ShowNotification("No saved states for slot " + text + " in " + ((object)(Stage)(ref currentStage)).ToString());
				}
			}
			val = ReloadSettings.Value;
			if (((KeyboardShortcut)(ref val)).IsDown() && (Object)(object)player != (Object)null)
			{
				gameplayCamera.cam.fieldOfView = FovInt.Value;
				gameplayCamera.dragDistanceDefault = DDragInt.Value;
				gameplayCamera.dragDistanceMax = MDragInt.Value;
			}
			val = NumpadPlus.Value;
			if (((KeyboardShortcut)(ref val)).IsDown())
			{
				if (slot < 200)
				{
					slot++;
				}
				UI.Instance.ShowNotification("slot : " + slot);
				((BaseUnityPlugin)this).Logger.LogInfo((object)slot);
			}
			val = NumpadMin.Value;
			if (((KeyboardShortcut)(ref val)).IsDown())
			{
				if (slot > 0)
				{
					slot--;
				}
				UI.Instance.ShowNotification("slot : " + slot);
				((BaseUnityPlugin)this).Logger.LogInfo((object)slot);
			}
		}

		private void ConfigSettingChanged(object sender, EventArgs e)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null);
			if (val != null)
			{
				if (val.ChangedSetting.Definition.Key == KeyboardGet1Key)
				{
					KeyboardShortcut val2 = (KeyboardShortcut)val.ChangedSetting.BoxedValue;
				}
				if (val.ChangedSetting.Definition.Key == KeyboardSet1Key)
				{
					KeyboardShortcut val3 = (KeyboardShortcut)val.ChangedSetting.BoxedValue;
				}
				if (val.ChangedSetting.Definition.Key == NumpadMinKey)
				{
					KeyboardShortcut val4 = (KeyboardShortcut)val.ChangedSetting.BoxedValue;
				}
				if (val.ChangedSetting.Definition.Key == NumpadPlusKey)
				{
					KeyboardShortcut val5 = (KeyboardShortcut)val.ChangedSetting.BoxedValue;
				}
			}
		}

		private string SerializeDictionary(Dictionary<int, string> dictionary)
		{
			return string.Join("|", dictionary.Select((KeyValuePair<int, string> kv) => $"{kv.Key}:{kv.Value}"));
		}

		private void DeserializeDictionary(string serializedData, Dictionary<int, string> dictionary)
		{
			dictionary.Clear();
			string[] array = serializedData.Split(new char[1] { '|' });
			string[] array2 = array;
			foreach (string text in array2)
			{
				string[] array3 = text.Split(new char[1] { ':' });
				if (array3.Length == 2 && int.TryParse(array3[0], out var result))
				{
					dictionary[result] = array3[1];
				}
			}
		}

		public static int returnCustomId(string text)
		{
			if (text.ToUpper() == "downhill".ToUpper())
			{
				return 1;
			}
			if (text.ToUpper() == "hideout".ToUpper())
			{
				return 2;
			}
			if (text.ToUpper() == "square".ToUpper())
			{
				return 3;
			}
			if (text.ToUpper() == "tower".ToUpper())
			{
				return 4;
			}
			if (text.ToUpper() == "Mall".ToUpper())
			{
				return 5;
			}
			if (text.ToUpper() == "osaka".ToUpper())
			{
				return 6;
			}
			if (text.ToUpper() == "pyramid".ToUpper())
			{
				return 7;
			}
			return 0;
		}
	}
}
namespace SaveState.Patches
{
	[HarmonyPatch(typeof(CameraMode))]
	internal class CameraModePatches
	{
		[HarmonyPatch("Activate")]
		[HarmonyPostfix]
		public static void Activate_Postfix(CameraMode __instance)
		{
			if (SaveStatePlugin.cameraMode == null)
			{
				SaveStatePlugin.cameraMode = __instance;
			}
		}
	}
	[HarmonyPatch(typeof(GameplayCamera))]
	internal class GameplayCameraPatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		public static bool Awake_Prefix(GameplayCamera __instance)
		{
			if ((Object)(object)SaveStatePlugin.gameplayCamera == (Object)null)
			{
				SaveStatePlugin.gameplayCamera = __instance;
			}
			SaveStatePlugin.Log.LogInfo((object)"In Player Awake method Prefix.");
			return true;
		}

		[HarmonyPatch("UpdateCamera")]
		[HarmonyPostfix]
		public static void UpdateCamera_Postfix(GameplayCamera __instance)
		{
			__instance.cam.fieldOfView = SaveStatePlugin.FovInt.Value;
			__instance.dragDistanceDefault = SaveStatePlugin.DDragInt.Value;
			__instance.dragDistanceMax = SaveStatePlugin.MDragInt.Value;
		}
	}
	[HarmonyPatch(typeof(CameraRegisterer))]
	internal class CameraRegistererPatches
	{
		[HarmonyPatch("UpdateCameraFov")]
		[HarmonyPrefix]
		public static void UpdateCameraFov_Prefix(CameraRegisterer __instance)
		{
			__instance.storyCamera.fieldOfView = SaveStatePlugin.FovInt.Value;
			SaveStatePlugin.gameplayCamera.cam.fieldOfView = SaveStatePlugin.FovInt.Value;
			SaveStatePlugin.gameplayCamera.dragDistanceDefault = SaveStatePlugin.DDragInt.Value;
			SaveStatePlugin.gameplayCamera.dragDistanceMax = SaveStatePlugin.MDragInt.Value;
		}
	}
	[HarmonyPatch(typeof(GameplayUI))]
	public class GameplayUIPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Init")]
		public static void Init(GameplayUI __instance)
		{
			SaveStatePlugin.ui = __instance;
			((Component)__instance.gameplayScreen).gameObject.AddComponent<UI>();
		}
	}
	[HarmonyPatch(typeof(Player))]
	internal class PlayerPatches
	{
		[HarmonyPatch("Init")]
		[HarmonyPrefix]
		public static bool Awake_Prefix(Player __instance)
		{
			if ((Object)(object)SaveStatePlugin.player == (Object)null)
			{
				SaveStatePlugin.player = __instance;
			}
			SaveStatePlugin.Log.LogInfo((object)"In Player Awake method Prefix.");
			return true;
		}

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void Awake_Postfix(Player __instance)
		{
			if ((Object)(object)SaveStatePlugin.gameplayCamera != (Object)null)
			{
				SaveStatePlugin.gameplayCamera.cam.fieldOfView = SaveStatePlugin.FovInt.Value;
				SaveStatePlugin.gameplayCamera.dragDistanceDefault = SaveStatePlugin.DDragInt.Value;
				SaveStatePlugin.gameplayCamera.dragDistanceMax = SaveStatePlugin.MDragInt.Value;
			}
			SaveStatePlugin.Log.LogInfo((object)"In Player Awake method Postfix.");
		}
	}
	public class UI : MonoBehaviour
	{
		public static UI Instance;

		private TextMeshProUGUI m_label = null;

		private float m_notificationTimer = 5f;

		private bool m_active;

		private void Awake()
		{
			Instance = this;
			SetupLabel();
		}

		private void FixedUpdate()
		{
			UpdateTimer();
		}

		public void ShowNotification(string text)
		{
			((TMP_Text)m_label).text = text;
			m_notificationTimer = 5f;
			if (!m_active)
			{
				m_active = true;
				((Component)m_label).gameObject.SetActive(true);
			}
		}

		private void UpdateTimer()
		{
			if (m_notificationTimer < 0f && m_active)
			{
				m_notificationTimer = 5f;
				m_active = false;
				((Component)m_label).gameObject.SetActive(false);
				((TMP_Text)m_label).text = "";
			}
			if (m_active)
			{
				m_notificationTimer -= Time.fixedDeltaTime;
			}
		}

		private void SetupLabel()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			m_label = new GameObject("FlyMode_Notification").AddComponent<TextMeshProUGUI>();
			UIManager uIManager = Core.Instance.UIManager;
			GameplayUI value = Traverse.Create((object)uIManager).Field<GameplayUI>("gameplay").Value;
			TextMeshProUGUI graffitiNewLabel = value.graffitiNewLabel;
			((TMP_Text)m_label).font = ((TMP_Text)graffitiNewLabel).font;
			((TMP_Text)m_label).fontSize = 35f;
			((TMP_Text)m_label).fontMaterial = ((TMP_Text)graffitiNewLabel).fontMaterial;
			((TMP_Text)m_label).alignment = (TextAlignmentOptions)257;
			RectTransform rectTransform = ((TMP_Text)m_label).rectTransform;
			rectTransform.anchorMin = new Vector2(0.1f, 0.5f);
			rectTransform.anchorMax = new Vector2(0.6f, 0.1f);
			rectTransform.pivot = new Vector2(0f, 1f);
			rectTransform.anchoredPosition = new Vector2(0.2f, 0.2f);
			((Transform)((TMP_Text)m_label).rectTransform).SetParent((Transform)(object)((Component)value.gameplayScreen).GetComponent<RectTransform>(), false);
		}
	}
	[HarmonyPatch(typeof(UserInputHandler))]
	internal class UserInputHandlerPatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void Awake_Postfix(UserInputHandler __instance)
		{
			if (SaveStatePlugin.gameInput == null)
			{
				SaveStatePlugin.gameInput = __instance.gameInput;
			}
		}
	}
	[HarmonyPatch(typeof(WorldHandler))]
	internal class WorldHandlerPatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void Awake_Postfix(WorldHandler __instance)
		{
			if ((Object)(object)SaveStatePlugin.worldHandler == (Object)null)
			{
				SaveStatePlugin.worldHandler = __instance;
			}
			if ((Object)(object)SaveStatePlugin.gameplayCamera != (Object)null)
			{
				SaveStatePlugin.gameplayCamera.cam.fieldOfView = SaveStatePlugin.FovInt.Value;
				SaveStatePlugin.gameplayCamera.dragDistanceDefault = SaveStatePlugin.DDragInt.Value;
				SaveStatePlugin.gameplayCamera.dragDistanceMax = SaveStatePlugin.MDragInt.Value;
			}
		}
	}
}
namespace MyUnityGameMod1.Utils
{
	internal static class ModUtils
	{
	}
}
namespace MyUnityGameMod1.MonoBehaviours
{
	internal class MyUnityGameMod1Component : MonoBehaviour
	{
		public void Awake()
		{
		}

		public void Start()
		{
		}

		public void Update()
		{
		}

		public void LateUpdate()
		{
		}
	}
}