Decompiled source of 3D HUD v0.1.5

plugins/com.github.azen.3DGUI.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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 DG.Tweening;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using _3DGUI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.azen.3DGUI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.5.0")]
[assembly: AssemblyInformationalVersion("0.1.5")]
[assembly: AssemblyProduct("com.github.azen.3DGUI")]
[assembly: AssemblyTitle("_3DGUI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.5.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;
		}
	}
}
public class UI3DController : MonoBehaviour
{
	private class TiltElement
	{
		public RectTransform RT;

		public float SpeedMult;

		public Vector3 BaseRotation;

		public float ZDepth;

		public Vector3 InitialScale;

		public Vector2 InitialAnchoredPos;

		public bool AllowStretch;

		public bool IsWheel;

		public float ShakeIntensity;
	}

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

		private object <>2__current;

		public GUIManager gui;

		public UI3DController <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			UI3DController uI3DController = <>4__this;
			switch (num)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if ((Object)(object)Camera.main == (Object)null)
			{
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			Canvas hudCanvas = gui.hudCanvas;
			hudCanvas.renderMode = (RenderMode)1;
			hudCanvas.worldCamera = Camera.main;
			hudCanvas.planeDistance = 0.45f;
			uI3DController._tiltElements.Clear();
			uI3DController._registered.Clear();
			StaminaBar bar = gui.bar;
			uI3DController.Register((bar != null) ? ((Component)bar).gameObject : null, 1.1f, ModConfig.StaminaBaseRot.Value, -5f, ModConfig.StaminaScale.Value, allowStretch: false, isWheel: false);
			uI3DController.SetupInventory3D(gui);
			if ((Object)(object)gui.itemPromptMain != (Object)null)
			{
				RectTransform component = ((Component)((TMP_Text)gui.itemPromptMain).transform.parent).GetComponent<RectTransform>();
				((Object)component).name = "PromptsRoot";
				component.pivot = new Vector2(1f, 0.5f);
				uI3DController.Register(((Component)component).gameObject, 1.05f, ModConfig.PromptBaseRot.Value, -5f, ModConfig.PromptScale.Value, allowStretch: true, isWheel: false);
			}
			if ((Object)(object)gui.temporaryItem != (Object)null)
			{
				((Object)gui.temporaryItem).name = "TemporarySlotRoot";
				uI3DController.Register(((Component)gui.temporaryItem).gameObject, 1f, ModConfig.TempSlotBaseRot.Value, -10f, ModConfig.TempSlotScale.Value, allowStretch: true, isWheel: false);
			}
			if ((Object)(object)gui.mushroomsCanvasGroup != (Object)null)
			{
				((Object)((Component)gui.mushroomsCanvasGroup).gameObject).name = "NumbRoot";
				uI3DController.Register(((Component)gui.mushroomsCanvasGroup).gameObject, 1.1f, ModConfig.StaminaBaseRot.Value, -5f, ModConfig.StaminaScale.Value, allowStretch: false, isWheel: false);
				uI3DController._setupDone = true;
			}
			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 GUIManager _gui;

	private CanvasGroup _hudCG;

	private bool _setupDone;

	private List<TiltElement> _tiltElements = new List<TiltElement>();

	private HashSet<GameObject> _registered = new HashSet<GameObject>();

	private RectTransform _inventory3DRoot;

	private RectTransform _wheelWrapper;

	private GameObject _lastActiveWheel;

	private float _currentAlpha = 1f;

	private Vector2 _smoothLook;

	private Vector3 _physicalRecoil;

	private float _velocityStretch;

	public void Init(GUIManager gui)
	{
		_gui = gui;
		_hudCG = gui.hudCanvasGroup;
		((MonoBehaviour)this).StartCoroutine(SetupRoutine(gui));
	}

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

	private void SetupInventory3D(GUIManager gui)
	{
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_0083: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_inventory3DRoot == (Object)null)
		{
			GameObject val = new GameObject("Inventory3DRoot", new Type[1] { typeof(RectTransform) });
			_inventory3DRoot = val.GetComponent<RectTransform>();
			((Transform)_inventory3DRoot).SetParent(((Component)gui.hudCanvas).transform, false);
			RectTransform inventory3DRoot = _inventory3DRoot;
			RectTransform inventory3DRoot2 = _inventory3DRoot;
			RectTransform inventory3DRoot3 = _inventory3DRoot;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(1f, 0f);
			inventory3DRoot3.pivot = val2;
			Vector2 anchorMin = (inventory3DRoot2.anchorMax = val2);
			inventory3DRoot.anchorMin = anchorMin;
			HorizontalLayoutGroup val4 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val4).spacing = 35f;
			((LayoutGroup)val4).childAlignment = (TextAnchor)8;
			bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = false);
			((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = childControlWidth;
			if ((Object)(object)gui.temporaryItem != (Object)null)
			{
				((Component)gui.temporaryItem).transform.SetParent((Transform)(object)_inventory3DRoot, false);
				((Component)gui.temporaryItem).transform.SetAsFirstSibling();
				Plugin.Log.LogInfo((object)"[3DUI] Temporary slot moved to 3D root.");
			}
			InventoryItemUI[] items = gui.items;
			foreach (InventoryItemUI val5 in items)
			{
				if ((Object)(object)val5 != (Object)null)
				{
					((Component)val5).transform.SetParent((Transform)(object)_inventory3DRoot, false);
				}
			}
			if ((Object)(object)gui.backpack != (Object)null)
			{
				((Component)gui.backpack).transform.SetParent((Transform)(object)_inventory3DRoot, false);
				((Component)gui.backpack).transform.SetAsLastSibling();
			}
		}
		Register(((Component)_inventory3DRoot).gameObject, 1f, ModConfig.InvBaseRot.Value, -12f, ModConfig.InvScale.Value, allowStretch: true, isWheel: false);
	}

	private void LateUpdate()
	{
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_037a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0386: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_0395: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0422: Unknown result type (might be due to invalid IL or missing references)
		//IL_042e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0433: Unknown result type (might be due to invalid IL or missing references)
		//IL_0439: Unknown result type (might be due to invalid IL or missing references)
		//IL_043e: Unknown result type (might be due to invalid IL or missing references)
		//IL_044a: Unknown result type (might be due to invalid IL or missing references)
		//IL_044f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0462: Unknown result type (might be due to invalid IL or missing references)
		//IL_0479: Unknown result type (might be due to invalid IL or missing references)
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
		if (!_setupDone || (Object)(object)Character.localCharacter == (Object)null)
		{
			return;
		}
		if ((Object)(object)_hudCG != (Object)null && !ModConfig.GlobalHUDVisible.Value)
		{
			_hudCG.alpha = 0f;
			return;
		}
		if (!ModConfig.UIEnabled.Value)
		{
			if ((Object)(object)_hudCG != (Object)null)
			{
				_hudCG.alpha = 1f;
			}
			return;
		}
		float deltaTime = Time.deltaTime;
		UpdateWheelWrapper();
		if ((Object)(object)_gui.bar?.extraBar != (Object)null && ((Component)_gui.bar.extraBar).gameObject.activeInHierarchy)
		{
			GameObject gameObject = ((Component)_gui.bar.extraBar).gameObject;
			if (!_registered.Contains(gameObject))
			{
				((Object)gameObject).name = "ExtraStaminaRoot";
				Register(gameObject, 1.1f, ModConfig.ExtraStaminaBaseRot.Value, -5f, ModConfig.ExtraStaminaScale.Value, allowStretch: false, isWheel: false);
			}
		}
		if ((Object)(object)_gui.temporaryItem != (Object)null && ((Component)_gui.temporaryItem).gameObject.activeInHierarchy && (Object)(object)((Component)_gui.temporaryItem).transform.parent != (Object)(object)_inventory3DRoot)
		{
			((Component)_gui.temporaryItem).transform.SetParent((Transform)(object)_inventory3DRoot, false);
			((Component)_gui.temporaryItem).transform.SetAsFirstSibling();
		}
		bool flag = (Object)(object)_lastActiveWheel != (Object)null;
		Vector2 val = (flag ? GetWheelInput() : Character.localCharacter.input.lookInput);
		_smoothLook = Vector2.Lerp(_smoothLook, val, deltaTime * 10f);
		float num = (((Character.localCharacter.data.isClimbing || Character.localCharacter.data.isRopeClimbing) && ModConfig.HideWhileClimbing.Value) ? ModConfig.HiddenAlpha.Value : 1f);
		_currentAlpha = Mathf.Lerp(_currentAlpha, num, deltaTime * 5f);
		if ((Object)(object)_hudCG != (Object)null)
		{
			_hudCG.alpha = _currentAlpha;
		}
		_physicalRecoil = Vector3.Lerp(_physicalRecoil, Vector3.zero, deltaTime * 4f);
		_velocityStretch = Mathf.Lerp(_velocityStretch, Mathf.Clamp01(((Vector3)(ref Character.localCharacter.data.avarageVelocity)).magnitude / 30f), deltaTime * 2f);
		foreach (TiltElement tiltElement in _tiltElements)
		{
			if ((Object)(object)tiltElement.RT == (Object)null)
			{
				continue;
			}
			UpdateItemFromConfig(tiltElement);
			float num2 = 0f;
			float num3 = 0f;
			if (flag)
			{
				if (tiltElement.IsWheel)
				{
					num2 = _smoothLook.y * tiltElement.SpeedMult;
					num3 = (0f - _smoothLook.x) * tiltElement.SpeedMult;
				}
			}
			else if (!tiltElement.IsWheel)
			{
				num2 = _smoothLook.y * 6f * tiltElement.SpeedMult;
				num3 = (0f - _smoothLook.x) * 6f * tiltElement.SpeedMult;
			}
			tiltElement.ShakeIntensity = Mathf.MoveTowards(tiltElement.ShakeIntensity, 0f, deltaTime * 35f);
			Vector3 val2 = Random.insideUnitSphere * tiltElement.ShakeIntensity * 0.15f;
			((Transform)tiltElement.RT).localRotation = Quaternion.Euler(tiltElement.BaseRotation.x + num2 + val2.x, tiltElement.BaseRotation.y + num3 + val2.y, tiltElement.BaseRotation.z);
			float num4 = (tiltElement.AllowStretch ? ((float)((tiltElement.InitialAnchoredPos.x > 0f) ? 1 : (-1)) * _velocityStretch * 35f) : 0f);
			tiltElement.RT.anchoredPosition = tiltElement.InitialAnchoredPos + new Vector2(num4, 0f) + Vector2.op_Implicit(_physicalRecoil) * tiltElement.SpeedMult;
			((Transform)tiltElement.RT).localScale = tiltElement.InitialScale * (1f + _velocityStretch * 0.08f);
			Vector3 localPosition = ((Transform)tiltElement.RT).localPosition;
			localPosition.z = tiltElement.ZDepth;
			((Transform)tiltElement.RT).localPosition = localPosition;
		}
	}

	private void UpdateItemFromConfig(TiltElement item)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: 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_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: 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)
		string text = ((Object)item.RT).name.ToLower();
		if (text.Contains("temporaryslotroot"))
		{
			item.BaseRotation = ModConfig.TempSlotBaseRot.Value;
			item.InitialScale = Vector3.one * ModConfig.TempSlotScale.Value;
			item.InitialAnchoredPos = ModConfig.TempSlotOffset.Value;
		}
		else if (text.Contains("extrastaminaroot"))
		{
			item.BaseRotation = ModConfig.ExtraStaminaBaseRot.Value;
			item.InitialScale = Vector3.one * ModConfig.ExtraStaminaScale.Value;
			item.InitialAnchoredPos = ModConfig.ExtraStaminaOffset.Value;
		}
		else if (text.Contains("bar"))
		{
			item.BaseRotation = ModConfig.StaminaBaseRot.Value;
			item.InitialScale = Vector3.one * ModConfig.StaminaScale.Value;
			item.InitialAnchoredPos = ModConfig.StaminaOffset.Value;
		}
		else if (text.Contains("inventory3droot"))
		{
			item.BaseRotation = ModConfig.InvBaseRot.Value;
			item.InitialScale = Vector3.one * ModConfig.InvScale.Value;
			item.InitialAnchoredPos = ModConfig.InvOffset.Value;
		}
		else if (text.Contains("promptsroot"))
		{
			item.BaseRotation = ModConfig.PromptBaseRot.Value;
			item.InitialScale = Vector3.one * ModConfig.PromptScale.Value;
			item.InitialAnchoredPos = ModConfig.PromptOffset.Value;
		}
		else if (text.Contains("numbroot"))
		{
			item.BaseRotation = ModConfig.StaminaBaseRot.Value;
			item.InitialScale = Vector3.one * ModConfig.StaminaScale.Value;
			item.InitialAnchoredPos = ModConfig.StaminaOffset.Value + ModConfig.NumbOffset.Value;
		}
	}

	private Vector2 GetWheelInput()
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		float value = ModConfig.WheelMaxTilt.Value;
		float num = Input.GetAxis("Mouse X") * 10f;
		float num2 = Input.GetAxis("Mouse Y") * 10f;
		return new Vector2(Mathf.Clamp(num, 0f - value, value), Mathf.Clamp(num2, 0f - value, value));
	}

	private TiltElement Register(GameObject go, float speed, Vector3 baseRot, float zDepth, float scale, bool allowStretch, bool isWheel)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)go == (Object)null || _registered.Contains(go))
		{
			return null;
		}
		RectTransform component = go.GetComponent<RectTransform>();
		TiltElement tiltElement = new TiltElement
		{
			RT = component,
			SpeedMult = speed,
			BaseRotation = baseRot,
			ZDepth = zDepth,
			InitialScale = Vector3.one * scale,
			InitialAnchoredPos = component.anchoredPosition,
			AllowStretch = allowStretch,
			IsWheel = isWheel
		};
		_tiltElements.Add(tiltElement);
		_registered.Add(go);
		return tiltElement;
	}

	private void UpdateWheelWrapper()
	{
		GameObject val = null;
		if ((Object)(object)_gui.backpackWheel != (Object)null && ((Component)_gui.backpackWheel).gameObject.activeInHierarchy)
		{
			val = ((Component)_gui.backpackWheel).gameObject;
		}
		else if ((Object)(object)_gui.emoteWheel != (Object)null && _gui.emoteWheel.activeInHierarchy)
		{
			val = _gui.emoteWheel;
		}
		if ((Object)(object)val == (Object)null)
		{
			if ((Object)(object)_lastActiveWheel != (Object)null)
			{
				ResetWheelWrapper();
				_lastActiveWheel = null;
			}
		}
		else if ((Object)(object)val != (Object)(object)_lastActiveWheel)
		{
			if ((Object)(object)_lastActiveWheel != (Object)null)
			{
				ResetWheelWrapper();
			}
			_lastActiveWheel = val;
			PrepareWheel(val);
		}
	}

	private void PrepareWheel(GameObject wheelGO)
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Expected O, but got Unknown
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_wheelWrapper == (Object)null)
		{
			GameObject val = new GameObject("[3DUI] WheelWrapper", new Type[1] { typeof(RectTransform) });
			_wheelWrapper = val.GetComponent<RectTransform>();
		}
		((Transform)_wheelWrapper).SetParent(wheelGO.transform, false);
		((Transform)_wheelWrapper).SetAsLastSibling();
		_wheelWrapper.anchoredPosition = Vector2.zero;
		((Transform)_wheelWrapper).localRotation = Quaternion.identity;
		((Transform)_wheelWrapper).localScale = Vector3.one;
		List<Transform> list = new List<Transform>();
		foreach (Transform item in wheelGO.transform)
		{
			Transform val2 = item;
			if (!((Object)(object)val2 == (Object)(object)_wheelWrapper))
			{
				string text = ((Object)val2).name.ToLower();
				if (!text.Contains("back") && !text.Contains("dim") && !text.Contains("bg") && !text.Contains("shadow"))
				{
					list.Add(val2);
				}
			}
		}
		foreach (Transform item2 in list)
		{
			item2.SetParent((Transform)(object)_wheelWrapper, true);
		}
		if (!_registered.Contains(((Component)_wheelWrapper).gameObject))
		{
			Register(((Component)_wheelWrapper).gameObject, 1.2f, Vector3.zero, -35f, 1f, allowStretch: false, isWheel: true);
			return;
		}
		TiltElement tiltElement = _tiltElements.Find((TiltElement e) => (Object)(object)e.RT == (Object)(object)_wheelWrapper);
		if (tiltElement != null)
		{
			tiltElement.BaseRotation = Vector3.zero;
		}
	}

	private void ResetWheelWrapper()
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		if ((Object)(object)_wheelWrapper == (Object)null || (Object)(object)_lastActiveWheel == (Object)null)
		{
			return;
		}
		List<Transform> list = new List<Transform>();
		foreach (Transform item2 in (Transform)_wheelWrapper)
		{
			Transform item = item2;
			list.Add(item);
		}
		foreach (Transform item3 in list)
		{
			item3.SetParent(_lastActiveWheel.transform, true);
		}
		Plugin.Log.LogInfo((object)("[3DUI] Wheel reset: children returned to " + ((Object)_lastActiveWheel).name));
	}

	private void ResetToFlatUI()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		foreach (TiltElement tiltElement in _tiltElements)
		{
			if (!((Object)(object)tiltElement.RT == (Object)null))
			{
				((Transform)tiltElement.RT).localRotation = Quaternion.identity;
				tiltElement.RT.anchoredPosition = tiltElement.InitialAnchoredPos;
				((Transform)tiltElement.RT).localScale = Vector3.one;
			}
		}
	}

	public void TriggerPhysicalImpulse(Vector3 force)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		_physicalRecoil += force * 70f;
	}

	public void TriggerLand(float vel)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		if (vel < -4f)
		{
			TriggerPhysicalImpulse(Vector3.down * Mathf.Abs(vel) * 0.5f);
		}
	}

	internal void TriggerDamageShake(float intensity)
	{
		foreach (TiltElement tiltElement in _tiltElements)
		{
			tiltElement.ShakeIntensity = Mathf.Clamp(tiltElement.ShakeIntensity + intensity * 35f, 0f, 45f);
		}
	}
}
internal class UILayer
{
	internal RectTransform RT;

	internal float DepthMult;

	internal float SpeedMult;

	internal float CurrentX;

	internal float CurrentZ;

	internal UILayer(RectTransform rt, float depthMult = 1f, float speedMult = 1f)
	{
		RT = rt;
		DepthMult = depthMult;
		SpeedMult = speedMult;
	}

	internal void Apply(float targetX, float targetZ, float baseSpeed, float dt)
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)RT == (Object)null))
		{
			float num = baseSpeed * SpeedMult;
			CurrentX = Mathf.Lerp(CurrentX, targetX * DepthMult, dt * num);
			CurrentZ = Mathf.Lerp(CurrentZ, targetZ * DepthMult, dt * num);
			((Transform)RT).localRotation = Quaternion.Euler(CurrentX, 0f, CurrentZ);
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace _3DGUI
{
	internal static class ModConfig
	{
		internal static ConfigEntry<bool> UIEnabled;

		internal static ConfigEntry<bool> GlobalHUDVisible;

		internal static ConfigEntry<float> TiltStrength;

		internal static ConfigEntry<float> CameraFOV;

		internal static ConfigEntry<float> WheelMaxTilt;

		internal static ConfigEntry<Vector3> StaminaBaseRot;

		internal static ConfigEntry<Vector2> StaminaOffset;

		internal static ConfigEntry<float> StaminaScale;

		internal static ConfigEntry<Vector3> ExtraStaminaBaseRot;

		internal static ConfigEntry<Vector2> ExtraStaminaOffset;

		internal static ConfigEntry<float> ExtraStaminaScale;

		internal static ConfigEntry<Vector3> InvBaseRot;

		internal static ConfigEntry<Vector2> InvOffset;

		internal static ConfigEntry<float> InvScale;

		internal static ConfigEntry<Vector3> PromptBaseRot;

		internal static ConfigEntry<Vector2> PromptOffset;

		internal static ConfigEntry<float> PromptScale;

		internal static ConfigEntry<bool> HideWhileClimbing;

		internal static ConfigEntry<float> HiddenAlpha;

		internal static ConfigEntry<string> PresetData1;

		internal static ConfigEntry<string> PresetData2;

		internal static ConfigEntry<string> PresetData3;

		internal static ConfigEntry<Vector3> TempSlotBaseRot;

		internal static ConfigEntry<Vector2> TempSlotOffset;

		internal static ConfigEntry<float> TempSlotScale;

		internal static ConfigEntry<Vector2> NumbOffset;

		private static ConfigFile _cfg;

		internal static void Init(ConfigFile cfg)
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			_cfg = cfg;
			UIEnabled = cfg.Bind<bool>("Global", "3DEffectEnabled", true, "");
			GlobalHUDVisible = cfg.Bind<bool>("Global", "GlobalHUDVisible", true, "");
			TiltStrength = cfg.Bind<float>("3D", "TiltStrength", 0.5f, "");
			CameraFOV = cfg.Bind<float>("3D", "CameraFOV", 60f, "");
			WheelMaxTilt = cfg.Bind<float>("3D", "WheelMaxTilt", 20f, "");
			StaminaBaseRot = cfg.Bind<Vector3>("Stamina", "BaseRotation", new Vector3(-16.9f, -18f, 0f), "");
			StaminaOffset = cfg.Bind<Vector2>("Stamina", "Offset", new Vector2(0f, -129.4f), "");
			StaminaScale = cfg.Bind<float>("Stamina", "Scale", 0.5f, "");
			ExtraStaminaBaseRot = cfg.Bind<Vector3>("ExtraStamina", "BaseRotation", new Vector3(-14.8f, -18.5f, 0f), "");
			ExtraStaminaOffset = cfg.Bind<Vector2>("ExtraStamina", "Offset", new Vector2(0f, -166.5f), "");
			ExtraStaminaScale = cfg.Bind<float>("ExtraStamina", "Scale", 0.4f, "");
			InvBaseRot = cfg.Bind<Vector3>("Inventory", "BaseRotation", new Vector3(9.2f, 36.8f, 0f), "");
			InvOffset = cfg.Bind<Vector2>("Inventory", "Offset", new Vector2(-427.4f, 163f), "");
			InvScale = cfg.Bind<float>("Inventory", "Scale", 0.4f, "");
			PromptBaseRot = cfg.Bind<Vector3>("Prompts", "BaseRotation", new Vector3(9.2f, 45f, 0f), "");
			PromptOffset = cfg.Bind<Vector2>("Prompts", "Offset", new Vector2(-250f, 32.9f), "");
			PromptScale = cfg.Bind<float>("Prompts", "Scale", 0.8f, "");
			TempSlotBaseRot = cfg.Bind<Vector3>("TempSlot", "BaseRotation", new Vector3(14.2f, 8f, 0f), "");
			TempSlotOffset = cfg.Bind<Vector2>("TempSlot", "Offset", new Vector2(39f, 65.8f), "");
			TempSlotScale = cfg.Bind<float>("TempSlot", "Scale", 1.4f, "");
			HideWhileClimbing = cfg.Bind<bool>("Visibility", "HideWhileClimbing", true, "");
			HiddenAlpha = cfg.Bind<float>("Visibility", "HiddenAlpha", 0.05f, "");
			NumbOffset = cfg.Bind<Vector2>("Stamina", "NumbOffset", new Vector2(0f, 0f), "Додаткове зміщення грибів відносно стаміни");
			string text = "-16.9|-18.0|0.0|-129.4|0.5|-14.8|-18.5|0.0|-166.5|0.4|9.2|36.8|-427.4|163.0|0.4|9.2|45.0|-250.0|32.9|0.8|20.0|60.0|0.5|0.05|1|14.2|8.0|39.0|65.8|1.4|61.6|264.4";
			PresetData1 = cfg.Bind<string>("Presets", "Slot1", text, "");
			string text2 = "-16.9|-18.0|0.0|-129.4|0.2|-14.8|-18.5|0.0|-150.1|0.2|9.2|36.8|-232.2|156.2|0.2|9.2|45.0|-106.8|-271.2|0.2|5.0|20.0|0.1|0.0|1|30.8|16.6|-91.1|-98.6|0.9|61.6|264.4";
			PresetData2 = cfg.Bind<string>("Presets", "Slot2", text2, "");
			string text3 = "-16.9|-18.0|0.0|-113.0|0.7|-14.8|-18.5|0.0|-150.1|0.6|9.2|36.8|-505.4|179.5|0.6|11.1|-8.0|-950.0|600.0|1.0|60.0|110.0|3.0|0.0|1|-25.3|-24.7|-26.0|600.0|1.8|61.6|264.4";
			PresetData3 = cfg.Bind<string>("Presets", "Slot3", text3, "");
		}

		public static void Save()
		{
			_cfg.Save();
		}

		public static void ResetToDefaults()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			StaminaBaseRot.Value = new Vector3(-16.9f, -18f, 0f);
			StaminaOffset.Value = new Vector2(0f, -129.4f);
			StaminaScale.Value = 0.5f;
			ExtraStaminaBaseRot.Value = new Vector3(-14.8f, -18.5f, 0f);
			ExtraStaminaOffset.Value = new Vector2(0f, -166.5f);
			ExtraStaminaScale.Value = 0.4f;
			InvBaseRot.Value = new Vector3(9.2f, 36.8f, 0f);
			InvOffset.Value = new Vector2(-427.4f, 163f);
			InvScale.Value = 0.4f;
			PromptBaseRot.Value = new Vector3(9.2f, 45f, 0f);
			PromptOffset.Value = new Vector2(-250f, 32.9f);
			PromptScale.Value = 0.8f;
			WheelMaxTilt.Value = 20f;
			CameraFOV.Value = 60f;
			TempSlotBaseRot.Value = new Vector3(14.2f, 8f, 0f);
			TempSlotOffset.Value = new Vector2(39f, 65.8f);
			TempSlotScale.Value = 1.4f;
			WheelMaxTilt.Value = 20f;
			CameraFOV.Value = 60f;
			TiltStrength.Value = 0.5f;
			HiddenAlpha.Value = 0.05f;
			HideWhileClimbing.Value = true;
			NumbOffset.Value = new Vector2(61.6f, 264.4f);
			Save();
		}
	}
	[HarmonyPatch(typeof(GUIManager), "Grasp")]
	internal static class Patch_Grasp
	{
		[HarmonyPostfix]
		private static void Postfix(GUIManager __instance)
		{
			//IL_0035: 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)
			if (__instance.items == null)
			{
				return;
			}
			for (int i = 0; i < __instance.items.Length; i++)
			{
				InventoryItemUI obj = __instance.items[i];
				RectTransform val = ((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null);
				if (!((Object)(object)val == (Object)null))
				{
					float num = (float)i * 0.04f;
					TweenSettingsExtensions.SetDelay<Tweener>(ShortcutExtensions.DOPunchScale((Transform)(object)val, Vector3.one * 0.12f, 0.35f, 5, 0.5f), num);
				}
			}
		}
	}
	[HarmonyPatch(typeof(GUIManager), "AddStatusFX")]
	internal static class Patch_GUIManager_AddStatusFX
	{
		[HarmonyPostfix]
		private static void Postfix(GUIManager __instance, STATUSTYPE type, float amount)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected I4, but got Unknown
			UI3DController component = ((Component)__instance).GetComponent<UI3DController>();
			if (!((Object)(object)component == (Object)null))
			{
				component.TriggerDamageShake((int)type switch
				{
					0 => amount, 
					5 => amount * 2.5f, 
					3 => 0.45f, 
					9 => 0.45f, 
					2 => 0.25f, 
					8 => 0.25f, 
					10 => 0.35f, 
					_ => 0.2f, 
				});
			}
		}
	}
	[HarmonyPatch(typeof(GUIManager), "Awake")]
	internal static class Patch_GUIManager_Awake
	{
		[HarmonyPostfix]
		private static void Postfix(GUIManager __instance)
		{
			UI3DController uI3DController = ((Component)__instance).gameObject.AddComponent<UI3DController>();
			uI3DController.Init(__instance);
			Plugin.Log.LogInfo((object)"[Dynamic3DUI] UI3DController додано до GUIManager.");
		}
	}
	[HarmonyPatch(typeof(GUIManager), "ReticleLand")]
	internal static class Patch_GUIManager_ReticleLand
	{
		[HarmonyPostfix]
		private static void Postfix(GUIManager __instance)
		{
			UI3DController component = ((Component)__instance).GetComponent<UI3DController>();
			float y = Character.localCharacter.data.avarageVelocity.y;
			if (y < -5f)
			{
				component.TriggerLand(y);
			}
		}
	}
	[HarmonyPatch(typeof(GUIManager), "StartNumb")]
	internal static class Patch_StartNumb
	{
		[HarmonyPostfix]
		private static void Postfix(GUIManager __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			UI3DController component = ((Component)__instance).GetComponent<UI3DController>();
			if ((Object)(object)component != (Object)null)
			{
				component.TriggerPhysicalImpulse(Vector3.up * 0.1f);
			}
		}
	}
	[BepInPlugin("com.github.azen.3DGUI", "_3DGUI", "0.1.5")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private Harmony _harmony;

		public const string Id = "com.github.azen.3DGUI";

		public static string Name => "_3DGUI";

		public static string Version => "0.1.5";

		private void Awake()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			ModConfig.Init(((BaseUnityPlugin)this).Config);
			GameObject val = new GameObject("3DUI_Settings");
			val.AddComponent<UI3DSettingsPanel>();
			Object.DontDestroyOnLoad((Object)(object)val);
			_harmony = new Harmony("com.azen.dynamic3dui");
			_harmony.PatchAll();
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	public class UI3DSettingsPanel : MonoBehaviour
	{
		private bool _show;

		private Rect _windowRect = new Rect(20f, 40f, 340f, 700f);

		private int _tab;

		private Vector2 _scrollPos;

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)287))
			{
				_show = !_show;
				Cursor.visible = _show;
				Cursor.lockState = (CursorLockMode)((!_show) ? 1 : 0);
			}
		}

		private void OnGUI()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (_show)
			{
				GUI.backgroundColor = new Color(0.05f, 0.05f, 0.05f, 0.98f);
				_windowRect = GUI.Window(8888, _windowRect, new WindowFunction(DrawWindow), "\ud83d\udee0 3D UI MASTER EDITOR");
			}
		}

		private void DrawWindow(int id)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("\ud83d\udcbe SAVE ALL", Array.Empty<GUILayoutOption>()))
			{
				ModConfig.Save();
			}
			GUI.color = Color.red;
			if (GUILayout.Button("\ud83d\udd04 RESET", Array.Empty<GUILayoutOption>()))
			{
				ModConfig.ResetToDefaults();
			}
			GUI.color = Color.white;
			GUILayout.EndHorizontal();
			GUILayout.Space(5f);
			ModConfig.GlobalHUDVisible.Value = GUILayout.Toggle(ModConfig.GlobalHUDVisible.Value, " SHOW HUD (GLOBAL)", Array.Empty<GUILayoutOption>());
			ModConfig.UIEnabled.Value = GUILayout.Toggle(ModConfig.UIEnabled.Value, " ENABLE 3D EFFECT", Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			_tab = GUILayout.Toolbar(_tab, new string[3] { "UI", "Presets", "Global" }, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			_scrollPos = GUILayout.BeginScrollView(_scrollPos, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.Height(500f)
			});
			if (_tab == 0)
			{
				DrawAdjustTab();
			}
			else if (_tab == 1)
			{
				DrawPresetsTab();
			}
			else
			{
				DrawGlobalTab();
			}
			GUILayout.EndScrollView();
			GUI.DragWindow();
		}

		private void DrawAdjustTab()
		{
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			DrawElement("MAIN STAMINA", ModConfig.StaminaBaseRot, ModConfig.StaminaOffset, ModConfig.StaminaScale);
			GUILayout.Space(10f);
			DrawElement("EXTRA STAMINA (RED/EXTRA)", ModConfig.ExtraStaminaBaseRot, ModConfig.ExtraStaminaOffset, ModConfig.ExtraStaminaScale);
			GUILayout.Space(10f);
			DrawElement("INVENTORY", ModConfig.InvBaseRot, ModConfig.InvOffset, ModConfig.InvScale);
			GUILayout.Space(10f);
			DrawElement("ADDITIONAL SLOT (TEMP)", ModConfig.TempSlotBaseRot, ModConfig.TempSlotOffset, ModConfig.TempSlotScale);
			GUILayout.Space(10f);
			DrawElement("PROMPTS (TEXT)", ModConfig.PromptBaseRot, ModConfig.PromptOffset, ModConfig.PromptScale);
			GUILayout.Label("--- NUMB (MUSHROOMS) ---", Array.Empty<GUILayoutOption>());
			GUILayout.Label("Currently SYNCED with Main Stamina", Array.Empty<GUILayoutOption>());
			Vector2 value = ModConfig.NumbOffset.Value;
			value.x = DrawSlider("Numb Off X", value.x, -500f, 500f);
			value.y = DrawSlider("Numb Off Y", value.y, -500f, 500f);
			ModConfig.NumbOffset.Value = value;
		}

		private void DrawPresetsTab()
		{
			GUILayout.Label("<b>PRESET SLOTS</b>", Array.Empty<GUILayoutOption>());
			DrawPresetRow(1, ModConfig.PresetData1);
			DrawPresetRow(2, ModConfig.PresetData2);
			DrawPresetRow(3, ModConfig.PresetData3);
		}

		private void DrawPresetRow(int id, ConfigEntry<string> slot)
		{
			GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Slot {id}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (!string.IsNullOrEmpty(slot.Value) && GUILayout.Button("LOAD", Array.Empty<GUILayoutOption>()))
			{
				LoadPreset(slot.Value);
			}
			if (GUILayout.Button("SAVE CURRENT", Array.Empty<GUILayoutOption>()))
			{
				slot.Value = CaptureCurrentState();
				ModConfig.Save();
			}
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		private void DrawGlobalTab()
		{
			ModConfig.WheelMaxTilt.Value = DrawSlider("Wheel Limit", ModConfig.WheelMaxTilt.Value, 5f, 60f);
			ModConfig.CameraFOV.Value = DrawSlider("Cam FOV", ModConfig.CameraFOV.Value, 20f, 110f);
			ModConfig.TiltStrength.Value = DrawSlider("Tilt Power", ModConfig.TiltStrength.Value, 0.1f, 3f);
			GUILayout.Space(10f);
			ModConfig.HideWhileClimbing.Value = GUILayout.Toggle(ModConfig.HideWhileClimbing.Value, " Hide on Ropes", Array.Empty<GUILayoutOption>());
			ModConfig.HiddenAlpha.Value = DrawSlider("Hide Alpha", ModConfig.HiddenAlpha.Value, 0f, 0.5f);
		}

		private float DrawSlider(string label, float val, float min, float max)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) });
			float result = GUILayout.HorizontalSlider(val, min, max, Array.Empty<GUILayoutOption>());
			GUILayout.Label(result.ToString("F1", CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
			GUILayout.EndHorizontal();
			return result;
		}

		private void DrawElement(string label, ConfigEntry<Vector3> rot, ConfigEntry<Vector2> pos, ConfigEntry<float> scale)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<b>--- " + label + " ---</b>", Array.Empty<GUILayoutOption>());
			Vector3 value = rot.Value;
			value.x = DrawSlider("Rot X", value.x, -45f, 45f);
			value.y = DrawSlider("Rot Y", value.y, -45f, 45f);
			rot.Value = value;
			Vector2 value2 = pos.Value;
			value2.x = DrawSlider("Pos X", value2.x, -950f, 950f);
			value2.y = DrawSlider("Pos Y", value2.y, -600f, 600f);
			pos.Value = value2;
			scale.Value = DrawSlider("Scale", scale.Value, 0.2f, 1.8f);
		}

		private string CaptureCurrentState()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			return string.Format(CultureInfo.InvariantCulture, "{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}|{20}|{21}|{22}|{23}|{24}|{25}|{26}|{27}|{28}|{29}|{30}|{31}", ModConfig.StaminaBaseRot.Value.x, ModConfig.StaminaBaseRot.Value.y, ModConfig.StaminaOffset.Value.x, ModConfig.StaminaOffset.Value.y, ModConfig.StaminaScale.Value, ModConfig.ExtraStaminaBaseRot.Value.x, ModConfig.ExtraStaminaBaseRot.Value.y, ModConfig.ExtraStaminaOffset.Value.x, ModConfig.ExtraStaminaOffset.Value.y, ModConfig.ExtraStaminaScale.Value, ModConfig.InvBaseRot.Value.x, ModConfig.InvBaseRot.Value.y, ModConfig.InvOffset.Value.x, ModConfig.InvOffset.Value.y, ModConfig.InvScale.Value, ModConfig.PromptBaseRot.Value.x, ModConfig.PromptBaseRot.Value.y, ModConfig.PromptOffset.Value.x, ModConfig.PromptOffset.Value.y, ModConfig.PromptScale.Value, ModConfig.WheelMaxTilt.Value, ModConfig.CameraFOV.Value, ModConfig.TiltStrength.Value, ModConfig.HiddenAlpha.Value, ModConfig.HideWhileClimbing.Value ? 1 : 0, ModConfig.TempSlotBaseRot.Value.x, ModConfig.TempSlotBaseRot.Value.y, ModConfig.TempSlotOffset.Value.x, ModConfig.TempSlotOffset.Value.y, ModConfig.TempSlotScale.Value, ModConfig.NumbOffset.Value.x, ModConfig.NumbOffset.Value.y);
		}

		private void LoadPreset(string data)
		{
			//IL_0042: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(data))
			{
				return;
			}
			try
			{
				string[] array = data.Split('|');
				int num = 0;
				ModConfig.StaminaBaseRot.Value = new Vector3(float.Parse(array[num++], CultureInfo.InvariantCulture), float.Parse(array[num++], CultureInfo.InvariantCulture), 0f);
				ModConfig.StaminaOffset.Value = new Vector2(float.Parse(array[num++], CultureInfo.InvariantCulture), float.Parse(array[num++], CultureInfo.InvariantCulture));
				ModConfig.StaminaScale.Value = float.Parse(array[num++], CultureInfo.InvariantCulture);
				ModConfig.ExtraStaminaBaseRot.Value = new Vector3(float.Parse(array[num++], CultureInfo.InvariantCulture), float.Parse(array[num++], CultureInfo.InvariantCulture), 0f);
				ModConfig.ExtraStaminaOffset.Value = new Vector2(float.Parse(array[num++], CultureInfo.InvariantCulture), float.Parse(array[num++], CultureInfo.InvariantCulture));
				ModConfig.ExtraStaminaScale.Value = float.Parse(array[num++], CultureInfo.InvariantCulture);
				ModConfig.InvBaseRot.Value = new Vector3(float.Parse(array[num++], CultureInfo.InvariantCulture), float.Parse(array[num++], CultureInfo.InvariantCulture), 0f);
				ModConfig.InvOffset.Value = new Vector2(float.Parse(array[num++], CultureInfo.InvariantCulture), float.Parse(array[num++], CultureInfo.InvariantCulture));
				ModConfig.InvScale.Value = float.Parse(array[num++], CultureInfo.InvariantCulture);
				ModConfig.PromptBaseRot.Value = new Vector3(float.Parse(array[num++], CultureInfo.InvariantCulture), float.Parse(array[num++], CultureInfo.InvariantCulture), 0f);
				ModConfig.PromptOffset.Value = new Vector2(float.Parse(array[num++], CultureInfo.InvariantCulture), float.Parse(array[num++], CultureInfo.InvariantCulture));
				ModConfig.PromptScale.Value = float.Parse(array[num++], CultureInfo.InvariantCulture);
				if (array.Length >= 25)
				{
					ModConfig.WheelMaxTilt.Value = float.Parse(array[num++], CultureInfo.InvariantCulture);
					ModConfig.CameraFOV.Value = float.Parse(array[num++], CultureInfo.InvariantCulture);
					ModConfig.TiltStrength.Value = float.Parse(array[num++], CultureInfo.InvariantCulture);
					ModConfig.HiddenAlpha.Value = float.Parse(array[num++], CultureInfo.InvariantCulture);
					ModConfig.HideWhileClimbing.Value = array[num++] == "1";
				}
				if (array.Length >= 30)
				{
					ModConfig.TempSlotBaseRot.Value = new Vector3(float.Parse(array[num++], CultureInfo.InvariantCulture), float.Parse(array[num++], CultureInfo.InvariantCulture), 0f);
					ModConfig.TempSlotOffset.Value = new Vector2(float.Parse(array[num++], CultureInfo.InvariantCulture), float.Parse(array[num++], CultureInfo.InvariantCulture));
					ModConfig.TempSlotScale.Value = float.Parse(array[num++], CultureInfo.InvariantCulture);
				}
				if (array.Length >= 32)
				{
					ModConfig.NumbOffset.Value = new Vector2(float.Parse(array[30], CultureInfo.InvariantCulture), float.Parse(array[31], CultureInfo.InvariantCulture));
				}
				Plugin.Log.LogInfo((object)("Preset loaded! Indices processed: " + num));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Failed to load preset: " + ex.Message));
			}
		}
	}
	internal enum UIState
	{
		Visible,
		FadingOut,
		Hidden,
		FadingIn
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}