Decompiled source of KeepInventoryExtended v1.3.0

Mods/KeepInventoryextended.dll

Decompiled 14 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSystem.Collections.Generic;
using KeepInventoryextended;
using KeepInventoryextended.Config;
using KeepInventoryextended.Core;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Keep), "KeepInventoryextended", "1.0.0", "Zetnik", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("KeepInventoryextended")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KeepInventoryextended")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d4de396e-71bd-4965-8db1-a47370c708ef")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 KeepInventoryextended
{
	public class Keep : MelonMod
	{
		public override void OnInitializeMelon()
		{
			ModConfig.Load();
			HolsterLoadoutManager.Instance.Initialize();
			InputLockManager.Instance.Initialize((MelonMod)(object)this);
			RadialMenuController.Instance.Initialize();
			Hooking.OnUIRigCreated += OnUIRigCreated;
			Hooking.OnLevelLoaded += OnLevelLoaded;
			Hooking.OnLevelUnloaded += OnLevelUnloaded;
			MelonLogger.Msg("KeepInventoryExtended loaded.");
		}

		private void OnUIRigCreated()
		{
			BonMenuIntegration.Initialize();
		}

		private void OnLevelLoaded(LevelInfo info)
		{
			BonMenuIntegration.Refresh();
		}

		private void OnLevelUnloaded()
		{
			HolsterLoadoutManager.Instance.AutoSaveOnLevelEnd();
			RadialMenuController.Instance.Close();
		}

		public override void OnUpdate()
		{
			InputLockManager.Instance.Tick();
			RadialMenuController.Instance.Update();
			VRRadialMenuUI.Tick();
		}
	}
}
namespace KeepInventoryextended.Core
{
	[Serializable]
	public class LoadoutPreset
	{
		public string Id;

		public string Name;

		public string CreatedUtc;

		public List<SlotEntry> Slots = new List<SlotEntry>();

		[JsonIgnore]
		public string DisplayName
		{
			get
			{
				if (!string.IsNullOrEmpty(Name))
				{
					return Name;
				}
				return "Unnamed";
			}
		}

		public static LoadoutPreset Create(string name)
		{
			return new LoadoutPreset
			{
				Id = Guid.NewGuid().ToString("N"),
				Name = name,
				CreatedUtc = DateTime.UtcNow.ToString("o"),
				Slots = new List<SlotEntry>()
			};
		}
	}
	[Serializable]
	public class SlotEntry
	{
		public string Barcode;

		public int SlotType;

		public int BodyRegion;

		public string DisplayName;
	}
	public static class PresetStorage
	{
		public static List<LoadoutPreset> LoadAll()
		{
			List<LoadoutPreset> list = new List<LoadoutPreset>();
			string presetsFolder = ModConfig.Instance.PresetsFolder;
			try
			{
				if (!Directory.Exists(presetsFolder))
				{
					Directory.CreateDirectory(presetsFolder);
				}
				string[] files = Directory.GetFiles(presetsFolder, "*.json");
				foreach (string path in files)
				{
					try
					{
						LoadoutPreset loadoutPreset = JsonConvert.DeserializeObject<LoadoutPreset>(File.ReadAllText(path));
						if (loadoutPreset != null && !string.IsNullOrEmpty(loadoutPreset.Id))
						{
							if (string.IsNullOrEmpty(loadoutPreset.Name))
							{
								loadoutPreset.Name = Path.GetFileNameWithoutExtension(path);
							}
							list.Add(loadoutPreset);
						}
					}
					catch (Exception ex)
					{
						MelonLogger.Warning("KeepInventoryExtended: failed to read presets " + Path.GetFileName(path) + ": " + ex.Message);
					}
				}
			}
			catch (Exception arg)
			{
				MelonLogger.Error($"KeepInventoryExtended: failed to load presets: {arg}");
			}
			return list.OrderBy((LoadoutPreset p) => p.CreatedUtc).ToList();
		}

		public static bool Save(LoadoutPreset preset)
		{
			try
			{
				string presetsFolder = ModConfig.Instance.PresetsFolder;
				if (!Directory.Exists(presetsFolder))
				{
					Directory.CreateDirectory(presetsFolder);
				}
				string text = SanitizeFileName(preset.DisplayName);
				string path = Path.Combine(presetsFolder, text + ".json");
				string contents = JsonConvert.SerializeObject((object)preset, (Formatting)1);
				File.WriteAllText(path, contents);
				return true;
			}
			catch (Exception arg)
			{
				MelonLogger.Error($"KeepInventoryExtended: failed to save preset: {arg}");
				return false;
			}
		}

		public static bool Delete(LoadoutPreset preset)
		{
			if (preset == null)
			{
				return false;
			}
			try
			{
				string presetsFolder = ModConfig.Instance.PresetsFolder;
				if (!Directory.Exists(presetsFolder))
				{
					return false;
				}
				string[] files = Directory.GetFiles(presetsFolder, "*.json");
				foreach (string path in files)
				{
					try
					{
						LoadoutPreset loadoutPreset = JsonConvert.DeserializeObject<LoadoutPreset>(File.ReadAllText(path));
						if (loadoutPreset != null && loadoutPreset.Id == preset.Id)
						{
							File.Delete(path);
							return true;
						}
					}
					catch
					{
					}
				}
			}
			catch (Exception arg)
			{
				MelonLogger.Error($"KeepInventoryExtended: failed to del preset: {arg}");
			}
			return false;
		}

		private static string SanitizeFileName(string name)
		{
			if (string.IsNullOrWhiteSpace(name))
			{
				name = "Loadout";
			}
			char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
			foreach (char oldChar in invalidFileNameChars)
			{
				name = name.Replace(oldChar, '_');
			}
			name = name.Trim();
			if (name.Length == 0)
			{
				name = "Loadout";
			}
			if (name.Length <= 80)
			{
				return name;
			}
			return name.Substring(0, 80);
		}
	}
	public class HolsterInfo
	{
		public SlotContainer Container;

		public InventorySlotReceiver Receiver;

		public string Barcode;

		public string ItemName;

		public SlotType SlotType;

		public int BodyRegion;

		public bool IsOccupied
		{
			get
			{
				if ((Object)(object)Receiver != (Object)null)
				{
					return HolsterScanner.SafeGetHost(Receiver) != null;
				}
				return false;
			}
		}
	}
	public static class HolsterScanner
	{
		public static List<HolsterInfo> Scan(Inventory inventory)
		{
			List<HolsterInfo> list = new List<HolsterInfo>();
			if ((Object)(object)inventory == (Object)null)
			{
				return list;
			}
			if (inventory.bodySlots != null)
			{
				foreach (SlotContainer item in (Il2CppArrayBase<SlotContainer>)(object)inventory.bodySlots)
				{
					Process(item, list);
				}
			}
			if (inventory.specialItems != null)
			{
				foreach (SlotContainer item2 in (Il2CppArrayBase<SlotContainer>)(object)inventory.specialItems)
				{
					Process(item2, list);
				}
			}
			return list;
		}

		private static void Process(SlotContainer container, List<HolsterInfo> into)
		{
			//IL_0030: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected I4, but got Unknown
			if ((Object)(object)container == (Object)null)
			{
				return;
			}
			InventorySlotReceiver inventorySlotReceiver = container.inventorySlotReceiver;
			if ((Object)(object)inventorySlotReceiver == (Object)null)
			{
				return;
			}
			HolsterInfo holsterInfo = new HolsterInfo
			{
				Container = container,
				Receiver = inventorySlotReceiver,
				SlotType = inventorySlotReceiver.slotType,
				BodyRegion = (int)container.bodyRegion
			};
			IGrippable val = SafeGetHost(inventorySlotReceiver);
			if (val != null)
			{
				try
				{
					GameObject hostGameObject = val.GetHostGameObject();
					if ((Object)(object)hostGameObject != (Object)null)
					{
						Poolee componentInParent = hostGameObject.GetComponentInParent<Poolee>();
						if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.SpawnableCrate != (Object)null)
						{
							Barcode barcode = ((Scannable)componentInParent.SpawnableCrate).Barcode;
							holsterInfo.Barcode = ((barcode != (Barcode)null) ? barcode.ID : null);
							holsterInfo.ItemName = ((Scannable)componentInParent.SpawnableCrate).Title;
						}
					}
				}
				catch
				{
				}
			}
			into.Add(holsterInfo);
		}

		public static IGrippable SafeGetHost(InventorySlotReceiver receiver)
		{
			if ((Object)(object)receiver == (Object)null)
			{
				return null;
			}
			try
			{
				return receiver.GetHost();
			}
			catch
			{
				return null;
			}
		}

		public static string ExtractBarcode(GameObject go)
		{
			if ((Object)(object)go == (Object)null)
			{
				return null;
			}
			try
			{
				Poolee componentInParent = go.GetComponentInParent<Poolee>();
				if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.SpawnableCrate != (Object)null)
				{
					Barcode barcode = ((Scannable)componentInParent.SpawnableCrate).Barcode;
					return (barcode != (Barcode)null) ? barcode.ID : null;
				}
			}
			catch
			{
			}
			return null;
		}
	}
	public class HolsterLoadoutManager
	{
		private List<LoadoutPreset> _presets = new List<LoadoutPreset>();

		private bool _isLoading;

		public static HolsterLoadoutManager Instance { get; } = new HolsterLoadoutManager();

		public IReadOnlyList<LoadoutPreset> Presets => _presets;

		public event Action OnPresetsChanged;

		public void Initialize()
		{
			RefreshPresets();
		}

		public void RefreshPresets()
		{
			_presets = PresetStorage.LoadAll();
			this.OnPresetsChanged?.Invoke();
		}

		public LoadoutPreset FindById(string id)
		{
			return _presets.FirstOrDefault((LoadoutPreset p) => p.Id == id);
		}

		public LoadoutPreset CaptureCurrentLoadout(string name)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected I4, but got Unknown
			RigManager rigManager = Player.RigManager;
			Inventory val = ((rigManager != null) ? rigManager.inventory : null);
			if ((Object)(object)val == (Object)null)
			{
				MelonLogger.Warning("KeepInventoryExtended: Inventory is not available - nothing to save.");
				return null;
			}
			LoadoutPreset loadoutPreset = LoadoutPreset.Create(name);
			foreach (HolsterInfo item in HolsterScanner.Scan(val))
			{
				if (!string.IsNullOrEmpty(item.Barcode))
				{
					loadoutPreset.Slots.Add(new SlotEntry
					{
						Barcode = item.Barcode,
						SlotType = (int)item.SlotType,
						BodyRegion = item.BodyRegion,
						DisplayName = (string.IsNullOrEmpty(item.ItemName) ? item.Barcode : item.ItemName)
					});
				}
			}
			return loadoutPreset;
		}

		public bool SaveCurrentLoadout(string name)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_006e: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			if (string.IsNullOrWhiteSpace(name))
			{
				return false;
			}
			LoadoutPreset loadoutPreset = CaptureCurrentLoadout(name);
			if (loadoutPreset == null || loadoutPreset.Slots.Count == 0)
			{
				Notifier.Send(new Notification
				{
					Title = NotificationText.op_Implicit("Holster Loadouts"),
					Message = NotificationText.op_Implicit("Holsters doesn't have any items - nothing to save."),
					Type = (NotificationType)1,
					PopupLength = 3f
				});
				return false;
			}
			if (PresetStorage.Save(loadoutPreset))
			{
				RefreshPresets();
				Notifier.Send(new Notification
				{
					Title = NotificationText.op_Implicit("Holster Loadouts"),
					Message = NotificationText.op_Implicit($"saved: {loadoutPreset.DisplayName} ({loadoutPreset.Slots.Count} items)"),
					Type = (NotificationType)3,
					PopupLength = 3f
				});
				return true;
			}
			return false;
		}

		public void AutoSaveOnLevelEnd()
		{
			if (!ModConfig.Instance.AutoSaveOnLevelEnd)
			{
				return;
			}
			try
			{
				LoadoutPreset loadoutPreset = CaptureCurrentLoadout("Autosave");
				if (loadoutPreset != null && loadoutPreset.Slots.Count != 0)
				{
					PresetStorage.Save(loadoutPreset);
					MelonLogger.Msg($"KeepInventoryExtended: autosave loadout saved ({loadoutPreset.Slots.Count} items).");
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("KeepInventoryExtended: autosave is failed: " + ex.Message);
			}
		}

		public bool LoadPreset(LoadoutPreset preset)
		{
			//IL_0028: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			if (preset == null || _isLoading)
			{
				return false;
			}
			RigManager rigManager = Player.RigManager;
			Inventory val = ((rigManager != null) ? rigManager.inventory : null);
			if ((Object)(object)val == (Object)null)
			{
				Notifier.Send(new Notification
				{
					Title = NotificationText.op_Implicit("Holster Loadouts"),
					Message = NotificationText.op_Implicit("Inventory is not available."),
					Type = (NotificationType)2,
					PopupLength = 3f
				});
				return false;
			}
			_isLoading = true;
			try
			{
				List<HolsterInfo> holsters = HolsterScanner.Scan(val);
				HashSet<InventorySlotReceiver> hashSet = new HashSet<InventorySlotReceiver>();
				List<KeyValuePair<InventorySlotReceiver, SlotEntry>> list = new List<KeyValuePair<InventorySlotReceiver, SlotEntry>>();
				foreach (SlotEntry slot in preset.Slots)
				{
					if (!string.IsNullOrEmpty(slot.Barcode))
					{
						HolsterInfo holsterInfo = PickTarget(holsters, slot, hashSet);
						if (holsterInfo != null)
						{
							hashSet.Add(holsterInfo.Receiver);
							list.Add(new KeyValuePair<InventorySlotReceiver, SlotEntry>(holsterInfo.Receiver, slot));
						}
					}
				}
				if (list.Count == 0)
				{
					Notifier.Send(new Notification
					{
						Title = NotificationText.op_Implicit("Holster Loadouts"),
						Message = NotificationText.op_Implicit("No matching holsters for this loadout."),
						Type = (NotificationType)1,
						PopupLength = 3f
					});
					return false;
				}
				PresetLoadRunner.Run(list, holsters, ModConfig.Instance.ClearUnmatchedSlotsOnLoad, preset.DisplayName, preset.Slots.Count);
				return true;
			}
			catch (Exception arg)
			{
				MelonLogger.Error($"KeepInventoryExtended: error load preset: {arg}");
				return false;
			}
			finally
			{
				_isLoading = false;
			}
		}

		private HolsterInfo PickTarget(List<HolsterInfo> holsters, SlotEntry entry, HashSet<InventorySlotReceiver> used)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			SlotType wanted = (SlotType)entry.SlotType;
			int region = entry.BodyRegion;
			HolsterInfo holsterInfo = holsters.FirstOrDefault((HolsterInfo h) => !used.Contains(h.Receiver) && h.SlotType == wanted && h.BodyRegion == region);
			if (holsterInfo != null)
			{
				return holsterInfo;
			}
			HolsterInfo holsterInfo2 = holsters.FirstOrDefault((HolsterInfo h) => !used.Contains(h.Receiver) && h.SlotType == wanted);
			if (holsterInfo2 != null)
			{
				return holsterInfo2;
			}
			HolsterInfo holsterInfo3 = holsters.FirstOrDefault((HolsterInfo h) => !used.Contains(h.Receiver) && (int)h.SlotType != 8 && (h.SlotType & wanted) != 0 && h.BodyRegion == region);
			if (holsterInfo3 != null)
			{
				return holsterInfo3;
			}
			HolsterInfo holsterInfo4 = holsters.FirstOrDefault((HolsterInfo h) => !used.Contains(h.Receiver) && (int)h.SlotType != 8 && (h.SlotType & wanted) > 0);
			if (holsterInfo4 != null)
			{
				return holsterInfo4;
			}
			return holsters.FirstOrDefault((HolsterInfo h) => !used.Contains(h.Receiver) && (int)h.SlotType != 8);
		}
	}
	public enum ButtonRef
	{
		None,
		Primary,
		Secondary,
		Trigger,
		Grip,
		StickClick,
		StickUp,
		StickDown,
		StickLeft,
		StickRight,
		AnyButton
	}
	public enum HandRef
	{
		Any,
		Left,
		Right
	}
	public class ChordKey
	{
		public HandRef Hand;

		public ButtonRef Button;

		public bool IsHeld(MenuInputSnapshot snap)
		{
			switch (Button)
			{
			case ButtonRef.Primary:
				return AnyHand(snap, (MenuInputSnapshot s) => s.AL, (MenuInputSnapshot s) => s.AR);
			case ButtonRef.Secondary:
				return AnyHand(snap, (MenuInputSnapshot s) => s.BL, (MenuInputSnapshot s) => s.BR);
			case ButtonRef.Trigger:
				return AnyHand(snap, (MenuInputSnapshot s) => s.TriggerL > 0.6f, (MenuInputSnapshot s) => s.TriggerR > 0.6f);
			case ButtonRef.Grip:
				return AnyHand(snap, (MenuInputSnapshot s) => s.GripL > 0.5f, (MenuInputSnapshot s) => s.GripR > 0.5f);
			case ButtonRef.StickClick:
				return AnyHand(snap, (MenuInputSnapshot s) => s.StickClickL, (MenuInputSnapshot s) => s.StickClickR);
			case ButtonRef.StickUp:
				return AnyHand(snap, (MenuInputSnapshot s) => s.StickL.y > 0.6f, (MenuInputSnapshot s) => s.StickR.y > 0.6f);
			case ButtonRef.StickDown:
				return AnyHand(snap, (MenuInputSnapshot s) => s.StickL.y < -0.6f, (MenuInputSnapshot s) => s.StickR.y < -0.6f);
			case ButtonRef.StickLeft:
				return AnyHand(snap, (MenuInputSnapshot s) => s.StickL.x < -0.6f, (MenuInputSnapshot s) => s.StickR.x < -0.6f);
			case ButtonRef.StickRight:
				return AnyHand(snap, (MenuInputSnapshot s) => s.StickL.x > 0.6f, (MenuInputSnapshot s) => s.StickR.x > 0.6f);
			case ButtonRef.AnyButton:
				if (!snap.AL && !snap.AR && !snap.BL)
				{
					return snap.BR;
				}
				return true;
			default:
				return false;
			}
		}

		private bool AnyHand(MenuInputSnapshot snap, Func<MenuInputSnapshot, bool> left, Func<MenuInputSnapshot, bool> right)
		{
			switch (Hand)
			{
			case HandRef.Left:
				return left(snap);
			case HandRef.Right:
				return right(snap);
			default:
				if (!left(snap))
				{
					return right(snap);
				}
				return true;
			}
		}
	}
	public class InputChord
	{
		public List<ChordKey> Keys = new List<ChordKey>();

		public bool IsHeld(MenuInputSnapshot snap)
		{
			if (Keys.Count == 0)
			{
				return false;
			}
			foreach (ChordKey key in Keys)
			{
				if (key != null && !key.IsHeld(snap))
				{
					return false;
				}
			}
			return true;
		}

		public static InputChord Parse(string text)
		{
			InputChord inputChord = new InputChord();
			if (string.IsNullOrWhiteSpace(text))
			{
				return inputChord;
			}
			string[] array = text.Split(new char[1] { '+' });
			for (int i = 0; i < array.Length; i++)
			{
				string text2 = array[i].Trim();
				if (text2.Length != 0)
				{
					string[] array2 = text2.Split(new char[1] { '.' });
					ChordKey chordKey = new ChordKey();
					if (array2.Length >= 2)
					{
						chordKey.Hand = ParseHand(array2[0].Trim());
						chordKey.Button = ParseButton(array2[1].Trim());
					}
					else
					{
						chordKey.Hand = HandRef.Any;
						chordKey.Button = ParseButton(array2[0].Trim());
					}
					if (chordKey.Button != ButtonRef.None)
					{
						inputChord.Keys.Add(chordKey);
					}
				}
			}
			return inputChord;
		}

		private static HandRef ParseHand(string s)
		{
			switch (s.ToLowerInvariant())
			{
			case "l":
			case "left":
				return HandRef.Left;
			case "r":
			case "right":
				return HandRef.Right;
			default:
				return HandRef.Any;
			}
		}

		private static ButtonRef ParseButton(string s)
		{
			string text = s.ToLowerInvariant();
			if (text != null)
			{
				switch (text.Length)
				{
				case 7:
					switch (text[0])
					{
					case 'p':
						break;
					case 't':
						if (!(text == "trigger"))
						{
							goto end_IL_0017;
						}
						return ButtonRef.Trigger;
					case 's':
						goto IL_0172;
					default:
						goto end_IL_0017;
					}
					if (!(text == "primary"))
					{
						break;
					}
					goto IL_0292;
				case 1:
				{
					char c = text[0];
					if ((uint)c <= 98u)
					{
						if (c == 'a')
						{
							goto IL_0292;
						}
						if (c != 'b')
						{
							break;
						}
					}
					else
					{
						if (c == 'x')
						{
							goto IL_0292;
						}
						if (c != 'y')
						{
							break;
						}
					}
					goto IL_0294;
				}
				case 9:
				{
					char c = text[6];
					if (c != 'a')
					{
						if (c != 'e')
						{
							if (c != 'o' || !(text == "stickdown"))
							{
								break;
							}
							goto IL_029e;
						}
						if (!(text == "stickleft"))
						{
							break;
						}
						goto IL_02a0;
					}
					if (!(text == "secondary"))
					{
						break;
					}
					goto IL_0294;
				}
				case 4:
				{
					char c = text[2];
					if ((uint)c <= 102u)
					{
						if (c != 'a')
						{
							if (c != 'f' || !(text == "left"))
							{
								break;
							}
							goto IL_02a0;
						}
						if (!(text == "grab"))
						{
							break;
						}
					}
					else
					{
						if (c != 'i')
						{
							if (c != 'w' || !(text == "down"))
							{
								break;
							}
							goto IL_029e;
						}
						if (!(text == "grip"))
						{
							break;
						}
					}
					return ButtonRef.Grip;
				}
				case 10:
				{
					char c = text[5];
					if (c != 'c')
					{
						if (c != 'r' || !(text == "stickright"))
						{
							break;
						}
						goto IL_02a2;
					}
					if (!(text == "stickclick"))
					{
						break;
					}
					goto IL_029a;
				}
				case 5:
				{
					char c = text[0];
					if (c != 'c')
					{
						if (c == 'r')
						{
							if (!(text == "right"))
							{
								break;
							}
							goto IL_02a2;
						}
						if (c != 's' || !(text == "stick"))
						{
							break;
						}
					}
					else if (!(text == "click"))
					{
						break;
					}
					goto IL_029a;
				}
				case 8:
					if (!(text == "joystick"))
					{
						break;
					}
					goto IL_029a;
				case 2:
					if (!(text == "up"))
					{
						break;
					}
					goto IL_029c;
				case 3:
					{
						if (!(text == "any"))
						{
							break;
						}
						return ButtonRef.AnyButton;
					}
					IL_0294:
					return ButtonRef.Secondary;
					IL_029e:
					return ButtonRef.StickDown;
					IL_02a0:
					return ButtonRef.StickLeft;
					IL_0172:
					if (!(text == "stickup"))
					{
						break;
					}
					goto IL_029c;
					IL_0292:
					return ButtonRef.Primary;
					IL_02a2:
					return ButtonRef.StickRight;
					IL_029c:
					return ButtonRef.StickUp;
					IL_029a:
					return ButtonRef.StickClick;
					end_IL_0017:
					break;
				}
			}
			return ButtonRef.None;
		}
	}
	public class MenuInputSnapshot
	{
		public float TriggerL;

		public float TriggerR;

		public float GripL;

		public float GripR;

		public bool AL;

		public bool AR;

		public bool BL;

		public bool BR;

		public bool StickClickL;

		public bool StickClickR;

		public Vector2 StickL;

		public Vector2 StickR;

		public bool TouchpadUpL;

		public bool TouchpadUpR;

		public bool TouchpadDownL;

		public bool TouchpadDownR;

		public void Reset()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			TriggerL = (TriggerR = (GripL = (GripR = 0f)));
			AL = (AR = (BL = (BR = false)));
			StickClickL = (StickClickR = false);
			StickL = (StickR = Vector2.zero);
			TouchpadUpL = (TouchpadUpR = (TouchpadDownL = (TouchpadDownR = false)));
		}
	}
	public class InputLockManager
	{
		private Harmony _harmony;

		private bool _hasControllers;

		public static InputLockManager Instance { get; } = new InputLockManager();

		public MenuInputSnapshot Snapshot { get; } = new MenuInputSnapshot();

		public bool IsLocked { get; private set; }

		public bool HasControllers => _hasControllers;

		private BaseController Left => GetController(Player.LeftController, left: true);

		private BaseController Right => GetController(Player.RightController, left: false);

		private static BaseController GetController(BaseController cached, bool left)
		{
			if ((Object)(object)cached != (Object)null)
			{
				return cached;
			}
			try
			{
				ControllerRig controllerRig = (ControllerRig)(object)Player.ControllerRig;
				if ((Object)(object)controllerRig == (Object)null && (Object)(object)Player.RigManager != (Object)null)
				{
					controllerRig = Player.RigManager.ControllerRig;
				}
				if ((Object)(object)controllerRig == (Object)null)
				{
					return null;
				}
				return left ? controllerRig.leftController : controllerRig.rightController;
			}
			catch
			{
				return null;
			}
		}

		public void Initialize(MelonMod mod)
		{
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			_harmony = ((MelonBase)mod).HarmonyInstance;
			PatchReturnNeutral(typeof(ControllerRig), "GetPrimaryAxis");
			PatchReturnNeutral(typeof(ControllerRig), "GetPrimaryAxisDirty");
			PatchReturnNeutral(typeof(ControllerRig), "GetSecondaryAButton");
			PatchReturnNeutral(typeof(ControllerRig), "GetSecondaryAButtonUp");
			PatchReturnNeutral(typeof(ControllerRig), "GetCrouch");
			PatchReturnNeutral(typeof(ControllerRig), "GetCrouchInput");
			PatchReturnNeutral(typeof(ControllerRig), "GetSmoothTwist");
			_harmony.Patch((MethodBase)typeof(Gun).GetMethod("Fire"), new HarmonyMethod(typeof(InputLockManager).GetMethod("Prefix_Gun_Fire")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			Hooking.OnUIRigCreated += OnPlayerAvailable;
			Hooking.OnLevelUnloaded += OnLevelUnloaded;
		}

		private void OnPlayerAvailable()
		{
		}

		private void OnLevelUnloaded()
		{
			IsLocked = false;
		}

		private void PatchReturnNeutral(Type type, string methodName)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			MethodInfo method = type.GetMethod(methodName);
			if (method == null)
			{
				MelonLogger.Warning("KeepInventoryExtended: method " + type.Name + "." + methodName + " not found — patch skipped.");
			}
			else
			{
				_harmony.Patch((MethodBase)method, new HarmonyMethod(typeof(InputLockManager).GetMethod("ReturnNeutralWhenLocked")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		public static bool ReturnNeutralWhenLocked()
		{
			return !Instance.IsLocked;
		}

		public static bool Prefix_Gun_Fire(Gun __instance)
		{
			if (!Instance.IsLocked)
			{
				return true;
			}
			return !IsPlayerHeld(__instance);
		}

		private static bool IsPlayerHeld(Gun gun)
		{
			try
			{
				if ((Object)(object)gun == (Object)null || (Object)(object)gun.host == (Object)null)
				{
					return false;
				}
				List<Hand> hands = gun.host._hands;
				if (hands == null)
				{
					return false;
				}
				if ((Object)(object)Player.LeftHand != (Object)null && hands.Contains(Player.LeftHand))
				{
					return true;
				}
				if ((Object)(object)Player.RightHand != (Object)null && hands.Contains(Player.RightHand))
				{
					return true;
				}
			}
			catch
			{
			}
			return false;
		}

		public void Tick()
		{
			CaptureSnapshot();
			if (IsLocked)
			{
				ForceReleaseHeldGuns();
			}
		}

		private void CaptureSnapshot()
		{
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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)
			BaseController left = Left;
			BaseController right = Right;
			if ((Object)(object)left == (Object)null || (Object)(object)right == (Object)null)
			{
				_hasControllers = false;
				return;
			}
			_hasControllers = true;
			Snapshot.Reset();
			Snapshot.TriggerL = left._primaryAxis;
			Snapshot.TriggerR = right._primaryAxis;
			Snapshot.GripL = left._gripForce;
			Snapshot.GripR = right._gripForce;
			Snapshot.AL = left._aButton;
			Snapshot.AR = right._aButton;
			Snapshot.BL = left._bButton;
			Snapshot.BR = right._bButton;
			Snapshot.StickClickL = left._thumbstick;
			Snapshot.StickClickR = right._thumbstick;
			Snapshot.StickL = left._thumbstickAxis;
			Snapshot.StickR = right._thumbstickAxis;
			Snapshot.TouchpadUpL = left._touchPadUp;
			Snapshot.TouchpadUpR = right._touchPadUp;
			Snapshot.TouchpadDownL = left._touchPadDown;
			Snapshot.TouchpadDownR = right._touchPadDown;
			if (IsLocked && ModConfig.Instance.LockInputWhileMenuOpen)
			{
				ZeroController(left);
				ZeroController(right);
				ControllerRig controllerRig = (ControllerRig)(object)Player.ControllerRig;
				if ((Object)(object)controllerRig == (Object)null && (Object)(object)Player.RigManager != (Object)null)
				{
					controllerRig = Player.RigManager.ControllerRig;
				}
				if ((Object)(object)controllerRig != (Object)null)
				{
					ZeroRig(controllerRig);
				}
			}
		}

		private static void ZeroController(BaseController c)
		{
			//IL_0051: 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)
			if (!((Object)(object)c == (Object)null))
			{
				c._aButton = false;
				c._aButtonDown = false;
				c._aButtonUp = false;
				c._bButton = false;
				c._bButtonDown = false;
				c._bButtonUp = false;
				c._thumbstick = false;
				c._thumbstickUp = false;
				c._thumbstickDown = false;
				c._thumbstickTouch = false;
				c._thumbstickAxis = Vector2.zero;
				c._touchPad = false;
				c._touchPadUp = false;
				c._touchPadDown = false;
				c._touchPadTouch = false;
				c._touchPadAxis = Vector2.zero;
				c._primaryAxis = 0f;
				c._gripForce = 0f;
				c.isGrabInputPressedFinal = false;
				c.isGrabInputReleasedFinal = false;
				c._isGrabInputPressedState = false;
				c._isGrabInputReleasedState = false;
			}
		}

		private static void ZeroRig(ControllerRig rig)
		{
			if (!((Object)(object)rig == (Object)null))
			{
				rig._primaryStick = false;
				rig._primaryStickUp = false;
				rig._primaryStickDown = false;
				rig._primaryStickTouch = false;
				rig._secondaryStick = false;
				rig._secondaryStickUp = false;
				rig._secondaryStickDown = false;
				rig._secondaryStickTouch = false;
				rig._primaryAButton = false;
				rig._primaryAButtonUp = false;
				rig._primaryAButtonDown = false;
				rig._secondaryAButton = false;
				rig._secondaryAButtonUp = false;
				rig._secondaryAButtonDown = false;
				rig._crouch = 0f;
				rig._crouchInput = false;
				rig._smoothTwist = 0f;
			}
		}

		public void Lock()
		{
			if (!IsLocked)
			{
				IsLocked = true;
				ForceReleaseHeldGuns();
			}
		}

		public void Unlock()
		{
			if (IsLocked)
			{
				IsLocked = false;
				ForceReleaseHeldGuns();
			}
		}

		public void ForceReleaseHeldGuns()
		{
			if (!ModConfig.Instance.ForceReleaseTriggers)
			{
				return;
			}
			try
			{
				if ((Object)(object)Player.LeftHand != (Object)null)
				{
					ReleaseGun(Player.LeftHand);
				}
				if ((Object)(object)Player.RightHand != (Object)null)
				{
					ReleaseGun(Player.RightHand);
				}
			}
			catch
			{
			}
		}

		private void ReleaseGun(Hand hand)
		{
			Gun componentInHand = Player.GetComponentInHand<Gun>(hand);
			if ((Object)(object)componentInHand == (Object)null)
			{
				return;
			}
			componentInHand.isTriggerPulled = false;
			componentInHand.isTriggerPressed = false;
			try
			{
				componentInHand.CeaseFire();
			}
			catch
			{
			}
		}
	}
	public enum MenuState
	{
		Closed,
		Open
	}
	public class RadialMenuController
	{
		private InputChord _openChord;

		private InputChord _cancelChord;

		private bool _prevChordHeld;

		private bool _prevCancelHeld;

		private bool _prevConfirm;

		private bool _stickMoved;

		private bool _lockScheduled;

		private float _lockTime;

		public static RadialMenuController Instance { get; } = new RadialMenuController();

		public MenuState State { get; private set; }

		public bool IsOpen => State == MenuState.Open;

		public int SelectedIndex { get; private set; }

		public LoadoutPreset SelectedPreset
		{
			get
			{
				IReadOnlyList<LoadoutPreset> presets = HolsterLoadoutManager.Instance.Presets;
				if (presets.Count == 0)
				{
					return null;
				}
				int index = Mathf.Clamp(SelectedIndex, 0, presets.Count - 1);
				return presets[index];
			}
		}

		public void Initialize()
		{
			ReloadConfig();
			HolsterLoadoutManager.Instance.OnPresetsChanged += OnPresetsChanged;
		}

		public void ReloadConfig()
		{
			_openChord = InputChord.Parse(ModConfig.Instance.OpenChord);
			_cancelChord = InputChord.Parse(ModConfig.Instance.CancelChord);
			ClampSelection();
		}

		private void OnPresetsChanged()
		{
			ClampSelection();
		}

		private void ClampSelection()
		{
			int count = HolsterLoadoutManager.Instance.Presets.Count;
			SelectedIndex = ((count != 0) ? Mathf.Clamp(SelectedIndex, 0, count - 1) : 0);
		}

		public void Open()
		{
			//IL_0039: 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_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)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			if (!IsOpen)
			{
				State = MenuState.Open;
				ClampSelection();
				_lockScheduled = true;
				_lockTime = Time.time + ModConfig.Instance.LockDelaySeconds;
				HapticClickBoth();
				Notifier.Send(new Notification
				{
					Title = NotificationText.op_Implicit("Holster Loadouts"),
					Message = NotificationText.op_Implicit("Menu open. Stick: select · Stick click: load · X + A: close"),
					Type = (NotificationType)0,
					PopupLength = 2f
				});
			}
		}

		public void Close()
		{
			if (IsOpen)
			{
				State = MenuState.Closed;
				_lockScheduled = false;
				InputLockManager.Instance.Unlock();
				HapticClickBoth();
			}
		}

		public void LoadSelected()
		{
			LoadoutPreset selectedPreset = SelectedPreset;
			if (selectedPreset != null && HolsterLoadoutManager.Instance.LoadPreset(selectedPreset))
			{
				HapticHardBoth();
			}
		}

		public void Update()
		{
			if (!InputLockManager.Instance.HasControllers)
			{
				if (IsOpen)
				{
					Close();
				}
				_prevChordHeld = false;
				_prevCancelHeld = false;
				_prevConfirm = false;
				_lockScheduled = false;
				return;
			}
			MenuInputSnapshot snapshot = InputLockManager.Instance.Snapshot;
			bool flag = _openChord.IsHeld(snapshot);
			if (!IsOpen)
			{
				if (flag && !_prevChordHeld)
				{
					Open();
				}
				_prevChordHeld = flag;
				_prevCancelHeld = _cancelChord.IsHeld(snapshot);
				_prevConfirm = false;
				return;
			}
			if (_lockScheduled && Time.time >= _lockTime)
			{
				_lockScheduled = false;
				InputLockManager.Instance.Lock();
			}
			bool flag2 = _cancelChord.IsHeld(snapshot);
			if (flag2 && !_prevCancelHeld)
			{
				Close();
				_prevChordHeld = flag;
				_prevCancelHeld = flag2;
				return;
			}
			_prevCancelHeld = flag2;
			if (ModConfig.Instance.OpenBehavior.Equals("Hold", StringComparison.OrdinalIgnoreCase))
			{
				if (!flag)
				{
					Close();
					_prevChordHeld = flag;
					return;
				}
			}
			else if (flag && !_prevChordHeld)
			{
				Close();
				_prevChordHeld = flag;
				return;
			}
			_prevChordHeld = flag;
			bool flag3 = IsConfirmPressed(snapshot);
			if (flag3 && !_prevConfirm)
			{
				HapticClickLeft();
				LoadSelected();
			}
			_prevConfirm = flag3;
			HandleNavigation(snapshot);
		}

		private bool IsConfirmPressed(MenuInputSnapshot snap)
		{
			switch (ModConfig.Instance.ConfirmAction.Trim().ToLowerInvariant())
			{
			case "trigger":
				if (!(snap.TriggerL > 0.9f))
				{
					return snap.TriggerR > 0.9f;
				}
				return true;
			case "grip":
				if (!(snap.GripL > 0.9f))
				{
					return snap.GripR > 0.9f;
				}
				return true;
			case "primary":
				if (!snap.AL)
				{
					return snap.AR;
				}
				return true;
			case "secondary":
				if (!snap.BL)
				{
					return snap.BR;
				}
				return true;
			default:
				if (!snap.StickClickL)
				{
					return snap.StickClickR;
				}
				return true;
			}
		}

		private void HandleNavigation(MenuInputSnapshot snap)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00ca: 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)
			if (HolsterLoadoutManager.Instance.Presets.Count == 0)
			{
				return;
			}
			Vector2 val = snap.StickL + snap.StickR;
			if (Math.Abs(val.x) < 0.01f && Math.Abs(val.y) < 0.01f)
			{
				if (snap.TouchpadUpL || snap.TouchpadUpR)
				{
					val.y += 1f;
				}
				if (snap.TouchpadDownL || snap.TouchpadDownR)
				{
					val.y -= 1f;
				}
			}
			if (((Vector2)(ref val)).magnitude > 0.5f)
			{
				if (!_stickMoved)
				{
					if (val.x < -0.5f)
					{
						MoveSelection(-1);
					}
					else if (val.x > 0.5f)
					{
						MoveSelection(1);
					}
					else if (val.y > 0.7f)
					{
						MoveSelection(1);
					}
					else if (val.y < -0.7f)
					{
						MoveSelection(-1);
					}
					_stickMoved = true;
				}
			}
			else
			{
				_stickMoved = false;
			}
		}

		private void MoveSelection(int delta)
		{
			int count = HolsterLoadoutManager.Instance.Presets.Count;
			if (count != 0)
			{
				SelectedIndex = (SelectedIndex + delta + count) % count;
				HapticSoftLeft();
			}
		}

		private void HapticClickBoth()
		{
			try
			{
				if ((Object)(object)Player.LeftController != (Object)null)
				{
					Player.LeftController.haptor.Haptic_Click(true);
				}
				if ((Object)(object)Player.RightController != (Object)null)
				{
					Player.RightController.haptor.Haptic_Click(true);
				}
			}
			catch
			{
			}
		}

		private void HapticClickLeft()
		{
			try
			{
				if ((Object)(object)Player.LeftController != (Object)null)
				{
					Player.LeftController.haptor.Haptic_Click(true);
				}
			}
			catch
			{
			}
		}

		private void HapticSoftLeft()
		{
			try
			{
				if ((Object)(object)Player.LeftController != (Object)null)
				{
					Player.LeftController.haptor.Haptic_SoftSin(0, 0f);
				}
			}
			catch
			{
			}
		}

		private void HapticHardBoth()
		{
			try
			{
				if ((Object)(object)Player.LeftController != (Object)null)
				{
					Player.LeftController.haptor.Haptic_HardSin(0, 0f);
				}
				if ((Object)(object)Player.RightController != (Object)null)
				{
					Player.RightController.haptor.Haptic_HardSin(0, 0f);
				}
			}
			catch
			{
			}
		}
	}
	public static class RadialMenuUI
	{
		private static Texture2D _roundTex;

		private static Texture2D _ringTex;

		private static Texture2D _whiteTex;

		private static bool _texturesReady;

		private static readonly Color PanelColor = new Color(0.05f, 0.06f, 0.09f, 0.92f);

		private static readonly Color AccentColor = new Color(0.2f, 0.85f, 1f, 1f);

		private static readonly Color IdleColor = new Color(0.32f, 0.38f, 0.48f, 0.9f);

		private static readonly Color HintColor = new Color(1f, 0.78f, 0.3f, 1f);

		private static readonly Color SubHintColor = new Color(0.9f, 0.9f, 0.9f, 0.85f);

		private static readonly Color TextColor = new Color(1f, 1f, 1f, 1f);

		public static void EnsureTextures()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (!_texturesReady)
			{
				_roundTex = MakeRadialTexture(256, 1f);
				_ringTex = MakeRingTexture(256);
				_whiteTex = new Texture2D(1, 1);
				_whiteTex.SetPixel(0, 0, Color.white);
				_whiteTex.Apply();
				_texturesReady = true;
			}
		}

		public static void Render()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			if (!RadialMenuController.Instance.IsOpen)
			{
				return;
			}
			EnsureTextures();
			IReadOnlyList<LoadoutPreset> presets = HolsterLoadoutManager.Instance.Presets;
			float menuRadius = ModConfig.Instance.MenuRadius;
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor((float)Screen.width / 2f, (float)Screen.height / 2f);
			DrawPanel(val, menuRadius + 100f);
			if (presets.Count == 0)
			{
				DrawCenteredText(val + new Vector2(0f, -20f), "No presets", 28f, HintColor);
				DrawCenteredText(val + new Vector2(0f, 20f), "Open BoneMenu → Holster Loadouts → Save Current Loadout", 16f, SubHintColor);
			}
			else
			{
				int count = presets.Count;
				int selectedIndex = RadialMenuController.Instance.SelectedIndex;
				float num = -90f;
				float num2 = 360f / (float)count;
				Vector2 val2 = default(Vector2);
				for (int i = 0; i < count; i++)
				{
					float num3 = (num + (float)i * num2) * ((float)Math.PI / 180f);
					((Vector2)(ref val2))..ctor(Mathf.Cos(num3), Mathf.Sin(num3));
					bool flag = i == selectedIndex;
					float num4 = (flag ? menuRadius : (menuRadius * 0.76f));
					Vector2 pos = val + val2 * num4;
					float diameter = (flag ? 58f : 42f);
					DrawRound(pos, diameter, flag ? AccentColor : IdleColor, flag);
					DrawCenteredText(pos, ShortName(presets[i].DisplayName, flag ? 16 : 12), flag ? 15f : 11f, flag ? Color.white : SubHintColor);
				}
				DrawCenteredText(val + new Vector2(0f, menuRadius + 50f), presets[selectedIndex].DisplayName, 22f, TextColor);
			}
			DrawCenteredText(val + new Vector2(0f, 0f - menuRadius - 62f), "HOLSTER LOADOUTS", 26f, AccentColor);
			if (ModConfig.Instance.ShowPanicHint)
			{
				DrawCenteredText(new Vector2(val.x, (float)Screen.height - 64f), "Press 2 triggers on your controller for exit", 20f, HintColor);
			}
			DrawCenteredText(new Vector2(val.x, (float)Screen.height - 94f), "Stick ← → : select   ·   Click on stick : load", 15f, SubHintColor);
		}

		private static void DrawPanel(Vector2 center, float half)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			Rect val = new Rect(center.x - half, center.y - half, half * 2f, half * 2f);
			GUI.color = PanelColor;
			GUI.DrawTexture(val, (Texture)(object)_whiteTex);
			GUI.color = Color.white;
		}

		private static void DrawRound(Vector2 pos, float diameter, Color color, bool ring)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			Rect val = new Rect(pos.x - diameter / 2f, pos.y - diameter / 2f, diameter, diameter);
			GUI.color = color;
			GUI.DrawTexture(val, (Texture)(object)_roundTex);
			if (ring)
			{
				float num = diameter * 1.3f;
				Rect val2 = new Rect(pos.x - num / 2f, pos.y - num / 2f, num, num);
				GUI.color = AccentColor;
				GUI.DrawTexture(val2, (Texture)(object)_ringTex);
			}
			GUI.color = Color.white;
		}

		private static void DrawCenteredText(Vector2 pos, string text, float size, Color color)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//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_0050: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = Mathf.RoundToInt(size * ModConfig.Instance.HintScale),
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			};
			val.normal.textColor = color;
			GUIContent val2 = new GUIContent(text);
			Vector2 val3 = val.CalcSize(val2);
			GUI.Label(new Rect(pos.x - val3.x / 2f, pos.y - val3.y / 2f, val3.x, val3.y), val2, val);
		}

		private static string ShortName(string name, int max)
		{
			if (name == null)
			{
				return "";
			}
			if (name.Length > max)
			{
				return name.Substring(0, max) + "…";
			}
			return name;
		}

		private static Texture2D MakeRadialTexture(int size, float falloff)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			float num = (float)size / 2f;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num2 = (float)j - num + 0.5f;
					float num3 = (float)i - num + 0.5f;
					float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3);
					float num5 = 1f - Mathf.Clamp01((num4 - num * (1f - falloff)) / (num * falloff + 0.0001f));
					num5 = Mathf.Pow(Mathf.Clamp01(num5), 1.4f);
					val.SetPixel(j, i, new Color(1f, 1f, 1f, num5));
				}
			}
			val.Apply();
			return val;
		}

		private static Texture2D MakeRingTexture(int size)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			float num = (float)size / 2f;
			float num2 = num * 0.8f;
			float num3 = num * 0.98f;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num4 = (float)j - num + 0.5f;
					float num5 = (float)i - num + 0.5f;
					float num6 = Mathf.Sqrt(num4 * num4 + num5 * num5);
					float num7 = Mathf.SmoothStep(num2, num2 + 2f, num6) * (1f - Mathf.SmoothStep(num3, num3 + 5f, num6));
					val.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Clamp01(num7)));
				}
			}
			val.Apply();
			return val;
		}
	}
	public static class VRRadialMenuUI
	{
		private enum MenuState
		{
			Closed,
			Opening,
			Open,
			Closing
		}

		private static bool _created;

		private static bool _diagLogged;

		private static Transform _anchor;

		private static GameObject _root;

		private static Material _mat;

		private static Material _stripMat;

		private static Mesh _quadMesh;

		private static readonly List<TextMesh> _allTexts = new List<TextMesh>();

		private static readonly List<Color> _allTextColors = new List<Color>();

		private static TextMesh _titleText;

		private static TextMesh _subtitleText;

		private static TextMesh _labelText;

		private static TextMesh _nameText;

		private static TextMesh _hintText;

		private static readonly TextMesh[] _creditTexts = (TextMesh[])(object)new TextMesh[3];

		private static MenuState _state = MenuState.Closed;

		private static float _animStart;

		private const float OpenDur = 0.38f;

		private const float CloseDur = 0.16f;

		private static GameObject _glowGo;

		private static Material _glowMat;

		private static GameObject _sweepGo;

		private static Material _sweepMat;

		private static GameObject[] _particleGo;

		private static Material[] _particleMat;

		private static Vector3[] _pVel;

		private static float[] _pLife;

		private static float[] _pMaxLife;

		private const int ParticleCount = 14;

		private static int _lastSelected = -1;

		private static float _switchFx;

		private const float PanelW = 0.5f;

		private const float PanelH = 0.36f;

		private const float BorderW = 0.55f;

		private const float BorderH = 0.41f;

		private static readonly Color TitleColor = new Color(0.92f, 0.96f, 1f, 1f);

		private static readonly Color AccentColor = new Color(0.3f, 0.9f, 1f, 1f);

		private static readonly Color LabelColor = new Color(0.78f, 0.81f, 0.86f, 1f);

		private static readonly Color HintColor = new Color(0.6f, 0.65f, 0.72f, 1f);

		private static readonly Color CreditColor = new Color(0.58f, 0.62f, 0.68f, 1f);

		public static void Tick()
		{
			EnsureCreated();
			if (!_created)
			{
				return;
			}
			Transform anchor = GetAnchor();
			Transform head = GetHead();
			if ((Object)(object)anchor == (Object)null || (Object)(object)head == (Object)null)
			{
				_root.SetActive(false);
				return;
			}
			bool isOpen = RadialMenuController.Instance.IsOpen;
			if (isOpen && _state == MenuState.Closed)
			{
				BeginOpen();
			}
			if (!isOpen && (_state == MenuState.Open || _state == MenuState.Opening))
			{
				BeginClose();
			}
			switch (_state)
			{
			case MenuState.Closed:
				_root.SetActive(false);
				break;
			case MenuState.Opening:
				UpdateOpen(anchor, head);
				break;
			case MenuState.Open:
				UpdateOpen(anchor, head);
				break;
			case MenuState.Closing:
				UpdateClosing(anchor, head);
				break;
			}
		}

		private static float AnimT(float dur)
		{
			return (Time.time - _animStart) / dur;
		}

		private static void BeginOpen()
		{
			_state = MenuState.Opening;
			_animStart = Time.time;
			_root.SetActive(true);
			MelonLogger.Msg("KeepInventoryExtended: VR menu opened.");
			SpawnParticles();
		}

		private static void BeginClose()
		{
			_state = MenuState.Closing;
			_animStart = Time.time;
			MelonLogger.Msg("KeepInventoryExtended: VR menu closed.");
		}

		private static void UpdateOpen(Transform anchor, Transform head)
		{
			if (_state == MenuState.Opening)
			{
				float num = Mathf.Clamp01(AnimT(0.38f));
				if (num >= 1f)
				{
					_state = MenuState.Open;
				}
				ApplyOpenAnim(num);
			}
			else
			{
				ApplyOpenAnim(1f);
			}
			PositionAtAnchor(anchor, head);
			UpdateMenu();
			UpdateEffects();
		}

		private static void UpdateClosing(Transform anchor, Transform head)
		{
			float num = Mathf.Clamp01(AnimT(0.16f));
			if (num >= 1f)
			{
				_state = MenuState.Closed;
				_root.SetActive(false);
			}
			else
			{
				ApplyCloseAnim(num);
				PositionAtAnchor(anchor, head);
				UpdateEffects();
			}
		}

		private static void ApplyOpenAnim(float openT)
		{
			//IL_0011: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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_015e: Unknown result type (might be due to invalid IL or missing references)
			float num = EaseOutBack(openT);
			_root.transform.localScale = Vector3.one * Mathf.Lerp(0.62f, 1f, num);
			float num2 = Mathf.SmoothStep(0f, 1f, openT);
			_mat.color = new Color(1f, 1f, 1f, num2);
			_stripMat.color = new Color(1f, 1f, 1f, num2);
			SetAllTextAlpha(num2);
			_sweepGo.SetActive(true);
			_sweepGo.transform.localPosition = new Vector3(0f, Mathf.Lerp(0.21f, -0.21f, openT), 0.002f);
			_sweepMat.color = new Color(1f, 1f, 1f, Mathf.Sin(Mathf.Clamp01(openT) * (float)Math.PI) * 0.9f);
			_glowGo.SetActive(true);
			_glowGo.transform.localScale = new Vector3(0.55f, 0.41f, 1f) * (0.95f + 0.22f * openT);
			_glowMat.color = new Color(1f, 1f, 1f, Mathf.Pow(1f - openT, 1.6f) * 0.85f);
		}

		private static void ApplyCloseAnim(float closeT)
		{
			//IL_0011: 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_005c: 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)
			float num = EaseOutBack(closeT);
			_root.transform.localScale = Vector3.one * Mathf.Lerp(1f, 0.82f, num);
			float num2 = 1f - Mathf.SmoothStep(0f, 1f, closeT);
			_mat.color = new Color(1f, 1f, 1f, num2);
			_stripMat.color = new Color(1f, 1f, 1f, num2);
			SetAllTextAlpha(num2);
			_sweepGo.SetActive(false);
			_glowGo.SetActive(false);
		}

		private static void UpdateEffects()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			UpdateParticles();
			if (_switchFx > 0f)
			{
				_switchFx -= Time.deltaTime / 0.3f;
				float num = 1f + 0.18f * Mathf.Sin(Mathf.Clamp01(1f - _switchFx) * (float)Math.PI);
				((Component)_nameText).transform.localScale = new Vector3(num, num, 1f);
				if (_switchFx <= 0f)
				{
					((Component)_nameText).transform.localScale = Vector3.one;
				}
			}
			Transform transform = _root.transform;
			transform.position += _root.transform.up * (Mathf.Sin(Time.time * 2.1f) * 0.006f);
		}

		private static void EnsureCreated()
		{
			if (_created)
			{
				return;
			}
			try
			{
				CreateMenu();
				_created = true;
				MelonLogger.Msg("KeepInventoryExtended: VR panel menu created.");
			}
			catch (Exception arg)
			{
				MelonLogger.Error($"KeepInventoryExtended: failed to create VR panel menu: {arg}");
			}
		}

		private static Transform GetAnchor()
		{
			Transform handAnchor = GetHandAnchor();
			if ((Object)(object)handAnchor != (Object)null)
			{
				if ((Object)(object)_anchor == (Object)null)
				{
					LogAnchorDiagnostics(handAnchor);
				}
				_anchor = handAnchor;
				return handAnchor;
			}
			if ((Object)(object)_anchor != (Object)null)
			{
				return _anchor;
			}
			Transform head = GetHead();
			if ((Object)(object)head != (Object)null)
			{
				_anchor = head;
			}
			return _anchor;
		}

		private static Transform GetHandAnchor()
		{
			if ((Object)(object)Player.RightController != (Object)null)
			{
				return ((Component)Player.RightController).transform;
			}
			if ((Object)(object)Player.RightHand != (Object)null)
			{
				return ((Component)Player.RightHand).transform;
			}
			RigManager val = Object.FindObjectOfType<RigManager>();
			if ((Object)(object)val != (Object)null && (Object)(object)val.physicsRig != (Object)null)
			{
				if ((Object)(object)val.physicsRig.rightHand != (Object)null)
				{
					return ((Component)val.physicsRig.rightHand).transform;
				}
				if ((Object)(object)val.physicsRig.leftHand != (Object)null)
				{
					return ((Component)val.physicsRig.leftHand).transform;
				}
			}
			return null;
		}

		private static Transform GetHead()
		{
			if ((Object)(object)Player.Head != (Object)null)
			{
				return Player.Head;
			}
			Camera val = Camera.main;
			if ((Object)(object)val == (Object)null)
			{
				val = Object.FindObjectOfType<Camera>();
			}
			if (!((Object)(object)val != (Object)null))
			{
				return null;
			}
			return ((Component)val).transform;
		}

		private static void LogAnchorDiagnostics(Transform anchor)
		{
			if (!_diagLogged)
			{
				_diagLogged = true;
				MelonLogger.Msg($"KeepInventoryExtended: hand anchor found: '{((Object)anchor).name}'. Controllers:{Player.ControllersExist} Hands:{Player.HandsExist} BoneLibHeadNull:{(Object)(object)Player.Head == (Object)null}");
			}
		}

		private static void CreateMenu()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0023: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			_root = new GameObject("KeepInventoryVRMenu");
			Object.DontDestroyOnLoad((Object)(object)_root);
			_root.transform.localScale = Vector3.one;
			_mat = CreateUiMaterial();
			_quadMesh = BuildQuadMesh();
			_stripMat = CloneMat();
			_stripMat.renderQueue = 3005;
			CreateCard("PanelBorder", 0.55f, 0.41f, new Color(0.03f, 0.04f, 0.07f, 1f), new Color(0.03f, 0.04f, 0.07f, 1f), -0.006f);
			CreateCard("Panel", 0.5f, 0.36f, new Color(0.24f, 0.28f, 0.35f, 1f), new Color(0.13f, 0.16f, 0.21f, 1f), 0f);
			CreateStrip("AccentTop", 0f, 0.155f, 0.42f, 0.012f, new Color(0.25f, 0.85f, 1f, 1f));
			CreateStrip("Divider", 0f, -0.102f, 0.44f, 0.006f, new Color(0.07f, 0.09f, 0.12f, 1f));
			_titleText = CreateText("Title", "KEEP INVENTORY", 0.024f, TitleColor, new Vector3(0f, 0.135f, 0.002f));
			_subtitleText = CreateText("Subtitle", "EXTENDED EDITION", 0.015f, AccentColor, new Vector3(0f, 0.108f, 0.002f));
			_labelText = CreateText("Label", "Selected preset:", 0.02f, LabelColor, new Vector3(0f, 0.052f, 0.002f));
			_nameText = CreateText("Name", "", 0.038f, AccentColor, new Vector3(0f, 0.014f, 0.002f));
			CreateStrip("NameUnderline", 0f, -0.024f, 0.26f, 0.007f, new Color(0.25f, 0.85f, 1f, 0.9f));
			_hintText = CreateText("Hint", "Stick: select   ·   Click: load   ·   X + A: close", 0.013f, HintColor, new Vector3(0f, -0.066f, 0.002f));
			string[] array = new string[3] { "KeepInventory-Extended Edition by Hanchik", "Bugs / ideas? Discord: zetnikfromrussia", "And have a nice day bro)" };
			for (int i = 0; i < array.Length; i++)
			{
				_creditTexts[i] = CreateText("Credit" + i, array[i], 0.013f, CreditColor, new Vector3(0f, -0.128f - (float)i * 0.023f, 0.002f));
			}
			CreateGlow();
			CreateSweep();
			CreateParticles();
			_root.SetActive(false);
		}

		private static void PositionAtAnchor(Transform anchor, Transform head)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_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)
			//IL_004e: 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_0051: 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)
			//IL_00a4: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val2;
			Vector3 val3;
			if ((Object)(object)anchor != (Object)(object)head)
			{
				Vector3 val = head.position - anchor.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				val2 = anchor.position + anchor.up * 0.3f + normalized * 0.08f;
				val3 = val2 - head.position;
			}
			else
			{
				val2 = head.position + head.forward * 0.6f;
				val3 = -head.forward;
			}
			if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f)
			{
				val3 = Vector3.forward;
			}
			_root.transform.SetPositionAndRotation(val2, Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up));
		}

		private static void UpdateMenu()
		{
			IReadOnlyList<LoadoutPreset> presets = HolsterLoadoutManager.Instance.Presets;
			int count = presets.Count;
			int selectedIndex = RadialMenuController.Instance.SelectedIndex;
			if (count == 0)
			{
				_labelText.text = "No presets saved";
				_nameText.text = "";
				_hintText.text = "Save one via BoneMenu -> Holster Loadouts";
				_lastSelected = -1;
				return;
			}
			int num = Mathf.Clamp(selectedIndex, 0, count - 1);
			if (_lastSelected >= 0 && num != _lastSelected)
			{
				_switchFx = 1f;
				SpawnBurst(6, 0.16f, 0.38f, 0.35f, 0.6f);
			}
			_lastSelected = num;
			string text = presets[num].DisplayName;
			if (text != null && text.Length > 20)
			{
				text = text.Substring(0, 20) + "...";
			}
			_labelText.text = "Selected preset:";
			_nameText.text = text ?? "";
			_hintText.text = "Stick (move): select   ·   Stick (press): load   ·   X + A: close";
		}

		private static Material CreateUiMaterial()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			Shader val = Shader.Find("Sprites/Default");
			if ((Object)(object)val == (Object)null)
			{
				val = Shader.Find("Unlit/Transparent");
			}
			if ((Object)(object)val == (Object)null)
			{
				val = Shader.Find("Hidden/Internal-Colored");
			}
			if ((Object)(object)val == (Object)null)
			{
				val = Shader.Find("Unlit/Color");
			}
			return new Material(val)
			{
				mainTexture = (Texture)(object)Texture2D.whiteTexture
			};
		}

		private static Material CloneMat()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			return new Material(_mat.shader)
			{
				mainTexture = (Texture)(object)Texture2D.whiteTexture
			};
		}

		private static Mesh BuildQuadMesh()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			Mesh val = new Mesh();
			val.vertices = Il2CppStructArray<Vector3>.op_Implicit((Vector3[])(object)new Vector3[4]
			{
				new Vector3(-0.5f, 0.5f, 0f),
				new Vector3(0.5f, 0.5f, 0f),
				new Vector3(0.5f, -0.5f, 0f),
				new Vector3(-0.5f, -0.5f, 0f)
			});
			val.colors = Il2CppStructArray<Color>.op_Implicit((Color[])(object)new Color[4]
			{
				Color.white,
				Color.white,
				Color.white,
				Color.white
			});
			val.triangles = Il2CppStructArray<int>.op_Implicit(new int[6] { 0, 1, 2, 0, 2, 3 });
			val.RecalculateNormals();
			val.RecalculateBounds();
			return val;
		}

		private static Mesh BuildFeatheredQuadMesh(Color topColor, Color bottomColor)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_00ec: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			Mesh val = new Mesh();
			Vector3[] array = (Vector3[])(object)new Vector3[9];
			Color[] array2 = (Color[])(object)new Color[9];
			List<int> list = new List<int>();
			array[0] = Vector3.zero;
			array2[0] = Color.Lerp(topColor, bottomColor, 0.5f);
			array[1] = new Vector3(-0.5f, 0.5f, 0f);
			array2[1] = topColor;
			array[2] = new Vector3(0.5f, 0.5f, 0f);
			array2[2] = topColor;
			array[3] = new Vector3(0.5f, -0.5f, 0f);
			array2[3] = bottomColor;
			array[4] = new Vector3(-0.5f, -0.5f, 0f);
			array2[4] = bottomColor;
			float num = 0.54f;
			array[5] = new Vector3(0f - num, num, 0f);
			array2[5] = new Color(topColor.r, topColor.g, topColor.b, 0f);
			array[6] = new Vector3(num, num, 0f);
			array2[6] = new Color(topColor.r, topColor.g, topColor.b, 0f);
			array[7] = new Vector3(num, 0f - num, 0f);
			array2[7] = new Color(bottomColor.r, bottomColor.g, bottomColor.b, 0f);
			array[8] = new Vector3(0f - num, 0f - num, 0f);
			array2[8] = new Color(bottomColor.r, bottomColor.g, bottomColor.b, 0f);
			for (int i = 0; i < 4; i++)
			{
				int item = 1 + i;
				int item2 = 1 + (i + 1) % 4;
				int item3 = 5 + i;
				int item4 = 5 + (i + 1) % 4;
				list.Add(0);
				list.Add(item);
				list.Add(item2);
				list.Add(item);
				list.Add(item2);
				list.Add(item4);
				list.Add(item);
				list.Add(item4);
				list.Add(item3);
			}
			val.vertices = Il2CppStructArray<Vector3>.op_Implicit(array);
			val.colors = Il2CppStructArray<Color>.op_Implicit(array2);
			val.triangles = Il2CppStructArray<int>.op_Implicit(list.ToArray());
			val.RecalculateNormals();
			val.RecalculateBounds();
			return val;
		}

		private static Mesh BuildRingMesh(Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00a5: 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_00b2: 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)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: 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)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: 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_01fe: 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_02bd: 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)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Expected O, but got Unknown
			Mesh val = new Mesh();
			Vector3[] array = (Vector3[])(object)new Vector3[8];
			Color[] array2 = (Color[])(object)new Color[8];
			array[0] = new Vector3(-0.55f, 0.55f, 0f);
			array2[0] = new Color(color.r, color.g, color.b, 0f);
			array[1] = new Vector3(0.55f, 0.55f, 0f);
			array2[1] = new Color(color.r, color.g, color.b, 0f);
			array[2] = new Vector3(0.55f, -0.55f, 0f);
			array2[2] = new Color(color.r, color.g, color.b, 0f);
			array[3] = new Vector3(-0.55f, -0.55f, 0f);
			array2[3] = new Color(color.r, color.g, color.b, 0f);
			array[4] = new Vector3(-0.5f, 0.5f, 0f);
			array2[4] = new Color(color.r, color.g, color.b, 1f);
			array[5] = new Vector3(0.5f, 0.5f, 0f);
			array2[5] = new Color(color.r, color.g, color.b, 1f);
			array[6] = new Vector3(0.5f, -0.5f, 0f);
			array2[6] = new Color(color.r, color.g, color.b, 1f);
			array[7] = new Vector3(-0.5f, -0.5f, 0f);
			array2[7] = new Color(color.r, color.g, color.b, 1f);
			List<int> list = new List<int>
			{
				4, 5, 1, 4, 1, 0, 5, 6, 2, 5,
				2, 1, 6, 7, 3, 6, 3, 2, 7, 4,
				0, 7, 0, 3
			};
			val.vertices = Il2CppStructArray<Vector3>.op_Implicit(array);
			val.colors = Il2CppStructArray<Color>.op_Implicit(array2);
			val.triangles = Il2CppStructArray<int>.op_Implicit(list.ToArray());
			val.RecalculateNormals();
			val.RecalculateBounds();
			return val;
		}

		private static Mesh MakeTintedQuad(Color c)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			Mesh val = Object.Instantiate<Mesh>(_quadMesh);
			Color[] array = (Color[])(object)new Color[((Il2CppArrayBase<Color>)(object)val.colors).Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = c;
			}
			val.colors = Il2CppStructArray<Color>.op_Implicit(array);
			return val;
		}

		private static void CreateCard(string name, float width, float height, Color topColor, Color bottomColor, float z)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0038: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0072: 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_0081: 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)
			GameObject val = new GameObject(name);
			val.transform.SetParent(_root.transform, false);
			val.transform.localPosition = new Vector3(0f, 0f, z);
			val.transform.localScale = new Vector3(width, height, 1f);
			val.AddComponent<MeshFilter>().sharedMesh = BuildFeatheredQuadMesh(topColor, bottomColor);
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = _mat;
			((Renderer)obj).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
		}

		private static void CreateStrip(string name, float x, float y, float width, float height, Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0051: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(_root.transform, false);
			val.transform.localPosition = new Vector3(x, y, 0.001f);
			val.transform.localScale = new Vector3(width, height, 1f);
			val.AddComponent<MeshFilter>().sharedMesh = MakeTintedQuad(color);
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = _stripMat;
			((Renderer)obj).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
		}

		private static TextMesh CreateText(string name, string text, float height, Color color, Vector3 localPos)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Text_" + name);
			val.transform.SetParent(_root.transform, false);
			val.transform.localPosition = localPos;
			val.transform.localRotation = Quaternion.identity;
			TextMesh val2 = val.AddComponent<TextMesh>();
			val2.text = text;
			val2.fontSize = 32;
			val2.characterSize = height * 10f / 32f;
			val2.anchor = (TextAnchor)4;
			val2.alignment = (TextAlignment)1;
			val2.color = color;
			MeshRenderer component = ((Component)val2).GetComponent<MeshRenderer>();
			((Renderer)component).sortingOrder = 30;
			if ((Object)(object)((Renderer)component).material != (Object)null)
			{
				((Renderer)component).material.renderQueue = 3100;
			}
			_allTexts.Add(val2);
			_allTextColors.Add(color);
			return val2;
		}

		private static void SetAllTextAlpha(float a)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < _allTexts.Count; i++)
			{
				Color val = _allTextColors[i];
				_allTexts[i].color = new Color(val.r, val.g, val.b, val.a * a);
			}
		}

		private static void CreateGlow()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00ed: 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_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)
			_glowGo = new GameObject("Glow");
			_glowGo.transform.SetParent(_root.transform, false);
			_glowGo.transform.localPosition = new Vector3(0f, 0f, -0.011f);
			_glowGo.transform.localScale = new Vector3(0.55f, 0.41f, 1f);
			_glowGo.AddComponent<MeshFilter>().sharedMesh = BuildRingMesh(new Color(0.25f, 0.8f, 1f, 1f));
			_glowMat = CloneMat();
			_glowMat.color = new Color(1f, 1f, 1f, 0f);
			_glowMat.renderQueue = 2990;
			MeshRenderer obj = _glowGo.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = _glowMat;
			((Renderer)obj).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
			_glowGo.SetActive(false);
		}

		private static void CreateSweep()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00ed: 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_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)
			_sweepGo = new GameObject("Sweep");
			_sweepGo.transform.SetParent(_root.transform, false);
			_sweepGo.transform.localPosition = new Vector3(0f, 0f, 0.002f);
			_sweepGo.transform.localScale = new Vector3(0.52f, 0.022f, 1f);
			_sweepGo.AddComponent<MeshFilter>().sharedMesh = MakeTintedQuad(new Color(0.75f, 0.97f, 1f, 1f));
			_sweepMat = CloneMat();
			_sweepMat.color = new Color(1f, 1f, 1f, 0f);
			_sweepMat.renderQueue = 3005;
			MeshRenderer obj = _sweepGo.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = _sweepMat;
			((Renderer)obj).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
			_sweepGo.SetActive(false);
		}

		private static void CreateParticles()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			_particleGo = (GameObject[])(object)new GameObject[14];
			_particleMat = (Material[])(object)new Material[14];
			_pVel = (Vector3[])(object)new Vector3[14];
			_pLife = new float[14];
			_pMaxLife = new float[14];
			for (int i = 0; i < 14; i++)
			{
				GameObject val = new GameObject("Particle" + i);
				val.transform.SetParent(_root.transform, false);
				val.AddComponent<MeshFilter>().sharedMesh = MakeTintedQuad(new Color(0.6f, 0.95f, 1f, 1f));
				_particleMat[i] = CloneMat();
				_particleMat[i].color = new Color(1f, 1f, 1f, 0f);
				_particleMat[i].renderQueue = 3005;
				MeshRenderer obj = val.AddComponent<MeshRenderer>();
				((Renderer)obj).sharedMaterial = _particleMat[i];
				((Renderer)obj).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
				val.SetActive(false);
				_particleGo[i] = val;
			}
		}

		private static void SpawnParticles()
		{
			SpawnBurst(14, 0.1f, 0.32f, 0.45f, 0.85f);
		}

		private static void SpawnBurst(int count, float minSpeed, float maxSpeed, float minLife, float maxLife)
		{
			//IL_003d: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			for (int i = 0; i < count && i < 14; i++)
			{
				float num = Random.Range(0f, (float)Math.PI * 2f);
				((Vector3)(ref val))..ctor(Mathf.Cos(num), Mathf.Sin(num), 0f);
				float num2 = Random.Range(minSpeed, maxSpeed);
				_pVel[i] = val * num2;
				_pMaxLife[i] = Random.Range(minLife, maxLife);
				_pLife[i] = _pMaxLife[i];
				_particleGo[i].SetActive(true);
				_particleGo[i].transform.localPosition = val * Random.Range(0.01f, 0.05f);
				_particleGo[i].transform.localRotation = Quaternion.identity;
				_particleGo[i].transform.localScale = new Vector3(0.04f, 0.04f, 1f);
				_particleMat[i].color = new Color(1f, 1f, 1f, 1f);
			}
		}

		private static void UpdateParticles()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			float deltaTime = Time.