Decompiled source of Cubs ReGUI v0.0.3

ReGUI.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Il2Cpp;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppKeepsake;
using Il2CppKeepsake.HyperSpace.NewInputSystem;
using Il2CppKeepsake.Modal;
using Il2CppSystem;
using Il2CppUniRx;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using ReGUI;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.UI;

[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), "ReGUI", "0.0.3", "GraciousCub5622", null)]
[assembly: MelonGame("Keepsake Games", "Jump Space")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ReGUI")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f65d12a7e134dd8ab1db2aee713dfb899f1462ab")]
[assembly: AssemblyProduct("ReGUI")]
[assembly: AssemblyTitle("ReGUI")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 ReGUI
{
	public class Core : MelonMod
	{
		[CompilerGenerated]
		private sealed class <LongDelayedActivate>d__36 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Core <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LongDelayedActivate>d__36(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					changeUI();
					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();
			}
		}

		[CompilerGenerated]
		private sealed class <ShortDelayedActivate>d__37 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Core <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ShortDelayedActivate>d__37(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.3f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					changeUI();
					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();
			}
		}

		public static bool captions;

		public static bool Controls;

		public static GameObject gui;

		public static GameObject lobbyHud;

		private static MelonPreferences_Category Prefs;

		private static MelonPreferences_Entry<string> IncreaseKey;

		private static MelonPreferences_Entry<string> DecreaseKey;

		private static MelonPreferences_Entry<float> EquipmentScale;

		private static MelonPreferences_Entry<string> ToggleCaptionsKey;

		private static MelonPreferences_Entry<string> ToggleControlsKey;

		private static MelonPreferences_Entry<string> ToggleCrosshairKey;

		private static MelonPreferences_Entry<string> ToggleHudKey;

		private static MelonPreferences_Entry<string> RefreshUIKey1;

		private static MelonPreferences_Entry<string> RefreshUIKey2;

		private static MelonPreferences_Entry<string> RefreshUIKey3;

		private static MelonPreferences_Entry<string> ZoomKey;

		private static MelonPreferences_Entry<float> ZoomFOV;

		private static MelonPreferences_Entry<float> ZoomSpeed;

		private float originalFOV = -1f;

		private static MelonPreferences_Entry<string> OpenConfigKey;

		private static MelonPreferences_Entry<string> OpenZoomConfigKey;

		private bool waitingForKeybind;

		private MelonPreferences_Entry<string> keybindBeingSet;

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg("[ReGUI] Mod Initialized.");
			Prefs = MelonPreferences.CreateCategory("CompactUI");
			IncreaseKey = Prefs.CreateEntry<string>("IncreaseScaleKey", "F4", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			DecreaseKey = Prefs.CreateEntry<string>("DecreaseScaleKey", "F3", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			EquipmentScale = Prefs.CreateEntry<float>("EquipmentBarScale", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			ToggleCaptionsKey = Prefs.CreateEntry<string>("ToggleCaptionsKey", "F9", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			ToggleControlsKey = Prefs.CreateEntry<string>("ToggleControlsKey", "F10", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			ToggleCrosshairKey = Prefs.CreateEntry<string>("ToggleCrosshairKey", "F11", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			ToggleHudKey = Prefs.CreateEntry<string>("ToggleHudKey", "F8", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			RefreshUIKey1 = Prefs.CreateEntry<string>("RefreshUIKey1", "F", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			RefreshUIKey2 = Prefs.CreateEntry<string>("RefreshUIKey2", "Esc", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			RefreshUIKey3 = Prefs.CreateEntry<string>("RefreshUIKey3", "B", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			ZoomKey = Prefs.CreateEntry<string>("ZoomKey", "Z", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			ZoomFOV = Prefs.CreateEntry<float>("ZoomFOV", 35f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			ZoomSpeed = Prefs.CreateEntry<float>("ZoomSpeed", 10f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			OpenConfigKey = Prefs.CreateEntry<string>("OpenConfigMenuKey", "[", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			OpenZoomConfigKey = Prefs.CreateEntry<string>("OpenZoomConfigMenuKey", "]", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		}

		public override void OnSceneWasInitialized(int buildIndex, string sceneName)
		{
			if (sceneName == "Global")
			{
				gui = GameObject.Find("PF_GUI/FullScreenGUI");
			}
			MelonCoroutines.Start(LongDelayedActivate());
			if (sceneName == "Dest_Lobby_Start")
			{
				lobbyHud = GameObject.Find("Gameplay/PF_Destination DestData_Lobby_Start/PF_LobbyHud");
			}
			originalFOV = -1f;
		}

		public override void OnApplicationQuit()
		{
			MelonPreferences.Save();
		}

		public override void OnLateUpdate()
		{
			Keyboard current = Keyboard.current;
			if (current == null)
			{
				return;
			}
			try
			{
				if (IsKeyPressed(OpenConfigKey.Value, current) && ((ReactiveProperty<bool>)(object)Global.m_GameSessionState.m_LocalPlayerIsPlaying).Value)
				{
					ShowConfigMenu();
				}
			}
			catch
			{
			}
			try
			{
				if (IsKeyPressed(OpenZoomConfigKey.Value, current) && ((ReactiveProperty<bool>)(object)Global.m_GameSessionState.m_LocalPlayerIsPlaying).Value)
				{
					ShowZoomMenu();
				}
			}
			catch
			{
			}
			if (waitingForKeybind)
			{
				Enumerator<KeyControl> enumerator = Keyboard.current.allKeys.GetEnumerator();
				while (enumerator.MoveNext())
				{
					KeyControl current2 = enumerator.Current;
					if (IsKeyPressed(((InputControl)current2).displayName, current))
					{
						keybindBeingSet.Value = ((InputControl)current2).displayName;
						waitingForKeybind = false;
						keybindBeingSet = null;
						MelonPreferences.Save();
						ModalManager.CancelAllModals();
						MelonLogger.Msg("[ReGUI] Bound to " + ((InputControl)current2).displayName);
					}
				}
			}
			if (IsKeyPressed(ToggleCaptionsKey.Value, current))
			{
				captions = !captions;
				MelonCoroutines.Start(ShortDelayedActivate());
			}
			if (IsKeyPressed(ToggleControlsKey.Value, current))
			{
				Controls = !Controls;
				MelonCoroutines.Start(ShortDelayedActivate());
			}
			if (IsKeyPressed(ToggleCrosshairKey.Value, current))
			{
				GameObject val = GameObject.Find("PF_GUI/FullScreenGUI/PF_FirstPersonHUD/Crosshairs");
				if ((Object)(object)val != (Object)null)
				{
					val.SetActive(!val.activeSelf);
				}
			}
			if (IsKeyPressed(ToggleHudKey.Value, current))
			{
				if ((Object)(object)gui == (Object)null)
				{
					gui = GameObject.Find("PF_GUI/FullScreenGUI");
				}
				if ((Object)(object)lobbyHud == (Object)null)
				{
					lobbyHud = GameObject.Find("Gameplay/PF_Destination DestData_Lobby_Start/PF_LobbyHud");
				}
				if ((Object)(object)gui != (Object)null)
				{
					gui.SetActive(!gui.activeSelf);
				}
				if ((Object)(object)lobbyHud != (Object)null)
				{
					lobbyHud.SetActive(!lobbyHud.activeSelf);
				}
				MelonCoroutines.Start(ShortDelayedActivate());
			}
			if (IsKeyPressed(RefreshUIKey1.Value, current) || IsKeyPressed(RefreshUIKey2.Value, current) || IsKeyPressed(RefreshUIKey3.Value, current))
			{
				MelonCoroutines.Start(ShortDelayedActivate());
			}
			HandleScaleHotkeys();
			try
			{
				HandleCameraZoom(current);
			}
			catch
			{
			}
		}

		private void HandleCameraZoom(Keyboard kb)
		{
			if (Global.GameSettings.m_FovOnFoot_Setter == null || Global.GameSettings.m_FovOnFoot == null)
			{
				return;
			}
			try
			{
				if (originalFOV < 0f)
				{
					originalFOV = ((ReactiveProperty<float>)(object)Global.GameSettings.m_FovOnFoot_Setter).Value;
				}
				KeyControl key;
				bool flag = TryGetKey(ZoomKey.Value, kb, out key) && ((ButtonControl)key).isPressed;
				float num = ((flag && !Cursor.visible) ? ZoomFOV.Value : originalFOV);
				if (!flag && Global.GameSettings.m_FovOnFoot.Value != originalFOV && Cursor.visible)
				{
					originalFOV = Global.GameSettings.m_FovOnFoot.Value;
				}
				((ReactiveProperty<float>)(object)Global.GameSettings.m_FovOnFoot_Setter).SetValue(Mathf.Lerp(((ReactiveProperty<float>)(object)Global.GameSettings.m_FovOnFoot_Setter).Value, num, Time.deltaTime * ZoomSpeed.Value), false);
			}
			catch
			{
			}
		}

		private void ZoomFovModal()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			ModalButton val = new ModalButton("Close", (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				ModalManager.CancelAllModals();
			}), true);
			ModalButton val2 = new ModalButton("Increase Zoom FOV", (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				ZoomFOV.Value = Mathf.Clamp(ZoomFOV.Value + 5f, 5f, 110f);
				MelonPreferences.Save();
				ModalManager.CancelAllModals();
				ZoomFovModal();
			}), false);
			ModalButton val3 = new ModalButton("Decrease Zoom FOV", (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				ZoomFOV.Value = Mathf.Clamp(ZoomFOV.Value - 5f, 5f, 110f);
				MelonPreferences.Save();
				ModalManager.CancelAllModals();
				ZoomFovModal();
			}), false);
			ModalManager.ShowModal("Zoom FOV Adjustment", "Adjust the zoom field of view. Current : " + ZoomFOV.Value, (InstigatorPriority)3, Action<ModalRequest>.op_Implicit((Action<ModalRequest>)delegate
			{
				ModalManager.CancelModal(ModalManager.CurrentModal);
			}), (ModalButton[])(object)new ModalButton[3] { val2, val3, val });
		}

		private void ZoomSpeedModal()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			ModalButton val = new ModalButton("Close", (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				ModalManager.CancelAllModals();
			}), true);
			ModalButton val2 = new ModalButton("Increase Zoom Speed", (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				ZoomSpeed.Value = Mathf.Clamp(ZoomSpeed.Value + 1f, 1f, 20f);
				MelonPreferences.Save();
				ModalManager.CancelAllModals();
				ZoomSpeedModal();
			}), false);
			ModalButton val3 = new ModalButton("Decrease Zoom Speed", (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				ZoomSpeed.Value = Mathf.Clamp(ZoomSpeed.Value - 1f, 1f, 20f);
				MelonPreferences.Save();
				ModalManager.CancelAllModals();
				ZoomSpeedModal();
			}), false);
			ModalManager.ShowModal("Zoom Speed Adjustment", "Adjust the zoom speed. Current : " + ZoomSpeed.Value, (InstigatorPriority)3, Action<ModalRequest>.op_Implicit((Action<ModalRequest>)delegate
			{
				ModalManager.CancelModal(ModalManager.CurrentModal);
			}), (ModalButton[])(object)new ModalButton[3] { val2, val3, val });
		}

		private void ShowZoomMenu()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			ModalButton val = new ModalButton("Close", (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				ModalManager.CancelAllModals();
			}), true);
			ModalButton val2 = new ModalButton("Zoom Key: " + ZoomKey.Value, (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				BeginKeyRebind(ZoomKey);
			}), true);
			ModalButton val3 = new ModalButton($"Zoom Speed: {ZoomSpeed.Value}", (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				ZoomSpeedModal();
			}), true);
			ModalButton val4 = new ModalButton($"Zoom FOV: {ZoomFOV.Value}", (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				ZoomFovModal();
			}), true);
			ModalManager.ShowModal("Zoom Configuration", "Adjust zoom settings here.", (InstigatorPriority)3, Action<ModalRequest>.op_Implicit((Action<ModalRequest>)delegate
			{
				ModalManager.CancelModal(ModalManager.CurrentModal);
			}), (ModalButton[])(object)new ModalButton[4] { val2, val3, val4, val });
		}

		private void ShowConfigMenu()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			ModalButton val = new ModalButton("Close", (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				ModalManager.CancelAllModals();
			}), true);
			ModalButton val2 = new ModalButton("Increase Scale: " + IncreaseKey.Value, (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				BeginKeyRebind(IncreaseKey);
			}), true);
			ModalButton val3 = new ModalButton("Decrease Scale: " + DecreaseKey.Value, (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				BeginKeyRebind(DecreaseKey);
			}), true);
			ModalButton val4 = new ModalButton("Toggle Captions: " + ToggleCaptionsKey.Value, (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				BeginKeyRebind(ToggleCaptionsKey);
			}), true);
			ModalButton val5 = new ModalButton("Toggle Controls: " + ToggleControlsKey.Value, (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				BeginKeyRebind(ToggleControlsKey);
			}), true);
			ModalButton val6 = new ModalButton("Toggle Crosshair: " + ToggleCrosshairKey.Value, (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				BeginKeyRebind(ToggleCrosshairKey);
			}), true);
			ModalButton val7 = new ModalButton("Toggle HUD: " + ToggleHudKey.Value, (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				BeginKeyRebind(ToggleHudKey);
			}), true);
			ModalButton val8 = new ModalButton("Zoom Key: " + ZoomKey.Value, (InputKeys)15, Action<ModalButton>.op_Implicit((Action<ModalButton>)delegate
			{
				BeginKeyRebind(ZoomKey);
			}), true);
			ModalManager.ShowModal("ReGUI Configuration", "Rebind keys or adjust values.\nClick a bind, then press a key.", (InstigatorPriority)3, Action<ModalRequest>.op_Implicit((Action<ModalRequest>)delegate
			{
				ModalManager.CancelModal(ModalManager.CurrentModal);
			}), (ModalButton[])(object)new ModalButton[7] { val2, val3, val4, val5, val6, val7, val });
		}

		private void BeginKeyRebind(MelonPreferences_Entry<string> entry)
		{
			waitingForKeybind = true;
			keybindBeingSet = entry;
			ModalManager.ShowModal("Rebind Key", "Press any key to bind:\n" + ((MelonPreferences_Entry)entry).Identifier, (InstigatorPriority)3, Action<ModalRequest>.op_Implicit((Action<ModalRequest>)delegate
			{
				waitingForKeybind = false;
				keybindBeingSet = null;
			}), (Il2CppReferenceArray<ModalButton>)null);
		}

		private void HandleScaleHotkeys()
		{
			Keyboard current = Keyboard.current;
			if (current != null)
			{
				if (TryGetKey(IncreaseKey.Value, current, out var key) && ((ButtonControl)key).wasPressedThisFrame)
				{
					EquipmentScale.Value = Mathf.Clamp(EquipmentScale.Value + 0.05f, 0.2f, 2f);
					ApplyEquipmentScale();
					((MelonBase)this).LoggerInstance.Msg($"[CompactUI] Equipment bar scale: {EquipmentScale.Value:F2}");
					MelonPreferences.Save();
				}
				if (TryGetKey(DecreaseKey.Value, current, out var key2) && ((ButtonControl)key2).wasPressedThisFrame)
				{
					EquipmentScale.Value = Mathf.Clamp(EquipmentScale.Value - 0.05f, 0.2f, 2f);
					ApplyEquipmentScale();
					((MelonBase)this).LoggerInstance.Msg($"[CompactUI] Equipment bar scale: {EquipmentScale.Value:F2}");
					MelonPreferences.Save();
				}
			}
		}

		private static bool IsKeyPressed(string keyName, Keyboard kb)
		{
			KeyControl key;
			return TryGetKey(keyName, kb, out key) && ((ButtonControl)key).wasPressedThisFrame;
		}

		private static bool TryGetKey(string keyName, Keyboard kb, out KeyControl key)
		{
			key = kb.FindKeyOnCurrentKeyboardLayout(keyName);
			return key != null;
		}

		[IteratorStateMachine(typeof(<LongDelayedActivate>d__36))]
		private IEnumerator LongDelayedActivate()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LongDelayedActivate>d__36(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<ShortDelayedActivate>d__37))]
		private IEnumerator ShortDelayedActivate()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ShortDelayedActivate>d__37(0)
			{
				<>4__this = this
			};
		}

		public static void changeUI()
		{
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			MelonPreferences.Load();
			try
			{
				ApplyEquipmentScale();
			}
			catch
			{
			}
			try
			{
				((Behaviour)GameObject.Find("PF_GUI/FullScreenGUI/PF_FirstPersonHUD/PlayerStatusBar/PlayerBar").GetComponent<Image>()).enabled = false;
			}
			catch
			{
			}
			try
			{
				GameObject.Find("PF_GUI/FullScreenGUI/PF_FirstPersonHUD/PlayerStatusBar/PlayerBar/LocationLabel").SetActive(false);
			}
			catch
			{
			}
			try
			{
				GameObject.Find("PF_GUI/FullScreenGUI/PF_FirstPersonHUD/PlayerStatusBar/PlayerBar/PlayernameLabel").SetActive(false);
			}
			catch
			{
			}
			try
			{
				GameObject.Find("PF_GUI/FullScreenGUI/PF_Hints").SetActive(captions);
			}
			catch
			{
			}
			try
			{
				GameObject.Find("Gameplay/PF_Destination DestData_Lobby_Start/PF_LobbyHud/PF_PlayerStatusBar_Lobby/PlayerBar/PlayernameLabel").SetActive(false);
			}
			catch
			{
			}
			try
			{
				GameObject.Find("Gameplay/PF_Destination DestData_Lobby_Start/PF_LobbyHud/PF_PlayerGroupBar_Lobby/InviteFriendBox").SetActive(false);
			}
			catch
			{
			}
			try
			{
				GameObject.Find("Gameplay/PF_Destination DestData_Lobby_Start/PF_LobbyHud/PF_PlayerStatusBar_Lobby/PF_Wallet/CreditsBox").transform.localPosition = new Vector3(165f, -55f, 0f);
			}
			catch
			{
			}
			try
			{
				GameObject.Find("Gameplay/PF_Destination DestData_Lobby_Start/PF_LobbyHud/PF_PlayerStatusBar_Lobby/PF_Wallet/IngotsBox").transform.localPosition = new Vector3(320f, -55f, 0f);
			}
			catch
			{
			}
			try
			{
				List<GameObject> list = FindGameObjectsContaining("PF_IngameFullscreen");
				foreach (GameObject item in list)
				{
					item.SetActive(!Controls);
				}
			}
			catch
			{
			}
		}

		private static void ApplyEquipmentScale()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("PF_GUI/FullScreenGUI/PF_FirstPersonHUD/PF_EquipmentBar");
			if ((Object)(object)val != (Object)null)
			{
				float value = EquipmentScale.Value;
				val.transform.localScale = new Vector3(value, value, value);
			}
		}

		public static List<GameObject> FindGameObjectsContaining(string substring)
		{
			List<GameObject> list = new List<GameObject>();
			foreach (GameObject item in Object.FindObjectsOfType<GameObject>())
			{
				if (item != null && (((Object)item).name?.Contains(substring)).GetValueOrDefault())
				{
					list.Add(item);
				}
			}
			return list;
		}
	}
}