Decompiled source of CommandQueueExtended v2.0.0

CommandQueue.dll

Decompiled 2 weeks 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.Versioning;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using HG;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.UI;
using RoR2;
using RoR2.Artifacts;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CommandQueue")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5e30264f4c2dbd72f0d76cccb05182f498ae1b06")]
[assembly: AssemblyProduct("CommandQueue")]
[assembly: AssemblyTitle("CommandQueue")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CommandQueue;

[BepInPlugin("com.kuberoot.commandqueuewithsave", "CommandQueueWithSave", "2.0.0")]
public class CommandQueue : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <<CommandArtifactManager_Init>g__coroutine|10_0>d : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

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

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

		[DebuggerHidden]
		public <<CommandArtifactManager_Init>g__coroutine|10_0>d(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

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

		private bool MoveNext()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if ((Object)(object)CommandArtifactManager.commandCubePrefab == (Object)null)
			{
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			}
			GameObject commandCubePrefab = CommandArtifactManager.commandCubePrefab;
			commandUIPrefab = ((commandCubePrefab != null) ? commandCubePrefab.GetComponent<PickupPickerController>().panelPrefab : null);
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <<FakeReload>g__doFakeReload|7_0>d : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public CommandQueue <>4__this;

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

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

		[DebuggerHidden]
		public <<FakeReload>g__doFakeReload|7_0>d(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

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

		private bool MoveNext()
		{
			int num = <>1__state;
			CommandQueue commandQueue = <>4__this;
			switch (num)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = 0;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				commandQueue.OnDisable();
				<>2__current = 0;
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				commandQueue.OnEnable();
				commandQueue.isFakeReloading = false;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass11_0
	{
		public PickupPickerController self;
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass11_1
	{
		public int j;

		public <>c__DisplayClass11_0 CS$<>8__locals1;
	}

	public static bool IsLoaded;

	private static GameObject commandUIPrefab;

	private bool isFakeReloading;

	public static event Action PluginUnloaded;

	public void Awake()
	{
		ModConfig.OnReady += delegate
		{
			ModConfig.enabledTabs.SettingChanged += delegate
			{
				FakeReload();
			};
			ModConfig.bigItemButtonContainer.SettingChanged += delegate
			{
				FakeReload();
			};
			ModConfig.bigItemButtonScale.SettingChanged += delegate
			{
				FakeReload();
			};
		};
		ModConfig.InitConfig(((BaseUnityPlugin)this).Config);
	}

	private void FakeReload()
	{
		if (!isFakeReloading)
		{
			isFakeReloading = true;
			((MonoBehaviour)this).StartCoroutine(doFakeReload());
		}
		[IteratorStateMachine(typeof(<<FakeReload>g__doFakeReload|7_0>d))]
		IEnumerator doFakeReload()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <<FakeReload>g__doFakeReload|7_0>d(0)
			{
				<>4__this = this
			};
		}
	}

	public void OnEnable()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		GameObject commandCubePrefab = CommandArtifactManager.commandCubePrefab;
		commandUIPrefab = ((commandCubePrefab != null) ? commandCubePrefab.GetComponent<PickupPickerController>().panelPrefab : null);
		IsLoaded = true;
		PickupPickerController.OnDisplayBegin += new hook_OnDisplayBegin(HandleCommandDisplayBegin);
		ScoreboardController.Awake += new hook_Awake(ScoreboardController_Awake);
		CommandArtifactManager.Init += new hook_Init(CommandArtifactManager_Init);
		QueueManager.Enable();
		HUD[] array = Object.FindObjectsOfType<HUD>();
		for (int i = 0; i < array.Length; i++)
		{
			array[i].scoreboardPanel.AddComponent<UIManager>();
		}
	}

	public void OnDisable()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		IsLoaded = false;
		CommandQueue.PluginUnloaded?.Invoke();
		PickupPickerController.OnDisplayBegin -= new hook_OnDisplayBegin(HandleCommandDisplayBegin);
		ScoreboardController.Awake -= new hook_Awake(ScoreboardController_Awake);
		CommandArtifactManager.Init -= new hook_Init(CommandArtifactManager_Init);
		QueueManager.Disable();
	}

	private void CommandArtifactManager_Init(orig_Init orig)
	{
		orig.Invoke();
		((MonoBehaviour)this).StartCoroutine(coroutine());
		[IteratorStateMachine(typeof(<<CommandArtifactManager_Init>g__coroutine|10_0>d))]
		static IEnumerator coroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <<CommandArtifactManager_Init>g__coroutine|10_0>d(0);
		}
	}

	private void HandleCommandDisplayBegin(orig_OnDisplayBegin orig, PickupPickerController self, NetworkUIPromptController networkUIPromptController, LocalUser localUser, CameraRigController cameraRigController)
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0050: 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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		<>c__DisplayClass11_0 <>c__DisplayClass11_ = new <>c__DisplayClass11_0();
		<>c__DisplayClass11_.self = self;
		if ((Object)(object)<>c__DisplayClass11_.self.panelPrefab == (Object)(object)commandUIPrefab)
		{
			foreach (var (tier, val) in QueueManager.PeekAll())
			{
				if (!<>c__DisplayClass11_.self.IsChoiceAvailable(val))
				{
					continue;
				}
				QueueManager.Pop(tier);
				Option[] options = <>c__DisplayClass11_.self.options;
				<>c__DisplayClass11_1 CS$<>8__locals0 = new <>c__DisplayClass11_1();
				CS$<>8__locals0.CS$<>8__locals1 = <>c__DisplayClass11_;
				CS$<>8__locals0.j = 0;
				while (CS$<>8__locals0.j < options.Length)
				{
					if (options[CS$<>8__locals0.j].pickup.pickupIndex == val && options[CS$<>8__locals0.j].available)
					{
						((MonoBehaviour)CS$<>8__locals0.CS$<>8__locals1.self).StartCoroutine(submitChoiceNextFrame());
						break;
					}
					CS$<>8__locals0.j++;
				}
				return;
				[IteratorStateMachine(typeof(<>c__DisplayClass11_1.<<HandleCommandDisplayBegin>g__submitChoiceNextFrame|0>d))]
				IEnumerator submitChoiceNextFrame()
				{
					//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
					return new <>c__DisplayClass11_1.<<HandleCommandDisplayBegin>g__submitChoiceNextFrame|0>d(0)
					{
						<>4__this = CS$<>8__locals0
					};
				}
			}
		}
		orig.Invoke(<>c__DisplayClass11_.self, networkUIPromptController, localUser, cameraRigController);
	}

	private void ScoreboardController_Awake(orig_Awake orig, ScoreboardController self)
	{
		((Component)self).gameObject.AddComponent<UIManager>();
		orig.Invoke(self);
	}
}
public static class ModConfig
{
	public class ItemTierSet : SortedSet<ItemTier>
	{
		public static Dictionary<ItemTier, string> ItemTierToName = new Dictionary<ItemTier, string>();

		public static Dictionary<string, ItemTier> NameToItemTier = new Dictionary<string, ItemTier>();

		internal static void Initialize()
		{
			//IL_0014: 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_001c: 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_0032: 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)
			ItemTierToName.Clear();
			NameToItemTier.Clear();
			Enumerator<ItemTierDef> enumerator = ItemTierCatalog.allItemTierDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ItemTierDef current = enumerator.Current;
					ItemTierToName[current.tier] = ((Object)current).name;
					NameToItemTier[((Object)current).name] = current.tier;
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		public static string Serialize(ItemTierSet self)
		{
			string value;
			return string.Join(", ", self.Select((ItemTier x) => (!ItemTierToName.TryGetValue(x, out value)) ? ((object)(ItemTier)(ref x)).ToString() : value));
		}

		public static ItemTierSet Deserialize(string src)
		{
			//IL_0052: 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)
			ItemTierSet itemTierSet = new ItemTierSet();
			foreach (string item in from s in src.Split(',')
				select s.Trim())
			{
				int result;
				if (NameToItemTier.TryGetValue(item, out var value))
				{
					itemTierSet.Add(value);
				}
				else if (Enum.TryParse<ItemTier>(item, out value))
				{
					itemTierSet.Add(value);
				}
				else if (int.TryParse(item, out result))
				{
					itemTierSet.Add((ItemTier)result);
				}
			}
			return itemTierSet;
		}

		public override string ToString()
		{
			return Serialize(this);
		}
	}

	public class SaveData
	{
		public string id;

		public string name;

		public string queueData;

		public long createdAt;

		public SaveData()
		{
		}

		public SaveData(string name, string queueData)
		{
			id = Guid.NewGuid().ToString("N").Substring(0, 8);
			this.name = name;
			this.queueData = queueData;
			createdAt = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
		}
	}

	public class SaveFile
	{
		public List<SaveData> saves = new List<SaveData>();
	}

	public static bool Ready;

	private static ConfigFile config;

	public static ConfigEntry<ItemTierSet> enabledTabs;

	public static ConfigEntry<bool> bigItemButtonContainer;

	public static ConfigEntry<float> bigItemButtonScale;

	public static ConfigEntry<bool> rightClickRemovesStack;

	private const string SaveFileName = "commandQueueSaves.json";

	private static SaveFile _saveFile;

	private static string SaveFilePath => Path.Combine(Paths.ConfigPath, "commandQueueSaves.json");

	public static event Action OnReady;

	public static event Action OnSavesChanged;

	internal static void InitConfig(ConfigFile _config)
	{
		//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_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		config = _config;
		TomlTypeConverter.AddConverter(typeof(ItemTierSet), new TypeConverter
		{
			ConvertToObject = (string str, Type type) => ItemTierSet.Deserialize(str),
			ConvertToString = (object obj, Type type) => obj.ToString()
		});
		((ResourceAvailability)(ref ItemTierCatalog.availability)).CallWhenAvailable((Action)InitConfigInternal);
	}

	internal static void InitConfigInternal()
	{
		//IL_001c: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Expected O, but got Unknown
		//IL_00c1: Expected O, but got Unknown
		//IL_00d5: 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_00f0: Expected O, but got Unknown
		//IL_00f0: Expected O, but got Unknown
		//IL_0104: 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_0123: Expected O, but got Unknown
		//IL_0123: Expected O, but got Unknown
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Expected O, but got Unknown
		//IL_0152: Expected O, but got Unknown
		if (!Ready)
		{
			ItemTierSet.Initialize();
			enabledTabs = config.Bind<ItemTierSet>(new ConfigDefinition("General", "EnabledQueues"), new ItemTierSet
			{
				(ItemTier)0,
				(ItemTier)1,
				(ItemTier)2,
				(ItemTier)4,
				(ItemTier)3,
				(ItemTier)6,
				(ItemTier)7,
				(ItemTier)8,
				(ItemTier)9
			}, new ConfigDescription("Which item tiers should have queues?\nValid values: " + string.Join(", ", ((IEnumerable<ItemTierDef>)(object)ItemTierCatalog.allItemTierDefs).Select((ItemTierDef def) => GetTierName(def.tier))), (AcceptableValueBase)null, Array.Empty<object>()));
			bigItemButtonContainer = config.Bind<bool>(new ConfigDefinition("General", "BigItemSelectionContainer"), true, new ConfigDescription("false: Default command button layout\ntrue: Increase the space for buttons, helps avoid overflow with modded items", (AcceptableValueBase)null, Array.Empty<object>()));
			bigItemButtonScale = config.Bind<float>(new ConfigDefinition("General", "BigItemSelectionScale"), 1f, new ConfigDescription("Scale applied to item buttons in the menu - decrease it if your buttons don't fit\nApplies only if BigItemSelectionContainer is true", (AcceptableValueBase)null, Array.Empty<object>()));
			rightClickRemovesStack = config.Bind<bool>(new ConfigDefinition("General", "RightClickRemovesStack"), true, new ConfigDescription("Should right-clicking an item in the queue remove the whole stack?", (AcceptableValueBase)null, Array.Empty<object>()));
			Ready = true;
			ModConfig.OnReady?.Invoke();
		}
	}

	public static string GetTierName(ItemTier tier)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		if (ItemTierSet.ItemTierToName.TryGetValue(tier, out var value))
		{
			return value;
		}
		return ((object)(ItemTier)(ref tier)).ToString();
	}

	public static SaveFile GetSaveFile()
	{
		if (_saveFile == null)
		{
			LoadSaveFile();
		}
		return _saveFile;
	}

	private static void LoadSaveFile()
	{
		try
		{
			if (File.Exists(SaveFilePath))
			{
				string[] array = File.ReadAllLines(SaveFilePath);
				_saveFile = new SaveFile();
				string[] array2 = array;
				foreach (string text in array2)
				{
					if (!string.IsNullOrWhiteSpace(text))
					{
						string[] array3 = text.Split('|');
						if (array3.Length >= 4)
						{
							_saveFile.saves.Add(new SaveData
							{
								id = array3[0],
								name = array3[1],
								queueData = array3[2],
								createdAt = (long.TryParse(array3[3], out var result) ? result : 0)
							});
						}
					}
				}
			}
			else
			{
				_saveFile = new SaveFile();
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("Error loading save file: " + ex.Message));
			_saveFile = new SaveFile();
		}
	}

	private static void WriteSaveFile()
	{
		try
		{
			IEnumerable<string> contents = _saveFile.saves.Select((SaveData s) => $"{s.id}|{s.name}|{s.queueData}|{s.createdAt}");
			File.WriteAllLines(SaveFilePath, contents);
			ModConfig.OnSavesChanged?.Invoke();
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("Error writing save file: " + ex.Message));
		}
	}

	public static List<SaveData> GetAllSaves()
	{
		return GetSaveFile().saves;
	}

	public static void CreateSave(string name)
	{
		string queueData = QueueManager.mainQueues.Where((KeyValuePair<ItemTier, List<QueueManager.QueueEntry>> entry) => entry.Value.Count > 0).SelectMany((KeyValuePair<ItemTier, List<QueueManager.QueueEntry>> pair) => pair.Value).Aggregate("", (string current, QueueManager.QueueEntry queueEntry) => current + $"{((object)(PickupIndex)(ref queueEntry.pickupIndex)).ToString()}*{queueEntry.count},");
		SaveData item = new SaveData(name, queueData);
		GetSaveFile().saves.Insert(0, item);
		WriteSaveFile();
	}

	public static void LoadSave(string id)
	{
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		SaveData saveData = GetSaveFile().saves.FirstOrDefault((SaveData s) => s.id == id);
		if (saveData == null)
		{
			return;
		}
		QueueManager.ClearAllQueues();
		if (string.IsNullOrEmpty(saveData.queueData))
		{
			return;
		}
		try
		{
			string[] array = saveData.queueData.Split(',');
			foreach (string text in array)
			{
				if (!string.IsNullOrEmpty(text))
				{
					string[] array2 = text.Split('*');
					for (int j = 0; j < int.Parse(array2[1]); j++)
					{
						QueueManager.Enqueue(PickupCatalog.FindPickupIndex(array2[0]));
					}
				}
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("Error loading save: " + ex.Message));
		}
	}

	public static void RenameSave(string id, string newName)
	{
		SaveData saveData = GetSaveFile().saves.FirstOrDefault((SaveData s) => s.id == id);
		if (saveData != null)
		{
			saveData.name = newName;
			WriteSaveFile();
		}
	}

	public static void DeleteSave(string id)
	{
		GetSaveFile().saves.RemoveAll((SaveData s) => s.id == id);
		WriteSaveFile();
	}

	public static int GetSaveItemCount(SaveData save)
	{
		if (string.IsNullOrEmpty(save?.queueData))
		{
			return 0;
		}
		try
		{
			return (from o in save.queueData.Split(',')
				where !string.IsNullOrEmpty(o)
				select o.Split('*') into o
				where o.Length >= 2
				select int.Parse(o[1])).Sum();
		}
		catch
		{
			return 0;
		}
	}

	public static void MigrateOldSaves()
	{
		for (int i = 1; i <= 10; i++)
		{
			string path = $"commandQueueSlot_{i}.save";
			if (!File.Exists(path))
			{
				continue;
			}
			try
			{
				string text = File.ReadAllText(path).Trim();
				if (!string.IsNullOrEmpty(text))
				{
					SaveData item = new SaveData($"Migrated Slot {i}", text);
					GetSaveFile().saves.Add(item);
				}
				File.Delete(path);
			}
			catch
			{
			}
		}
		if (GetSaveFile().saves.Count > 0)
		{
			WriteSaveFile();
		}
	}
}
internal class QueueDisplay : MonoBehaviour
{
	public class QueueItemBehavior : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler, IPointerClickHandler
	{
		private GameObject m_DraggingIcon;

		private QueueDisplay m_Queue;

		private ItemIcon m_ItemIcon;

		public void Init(QueueDisplay queue)
		{
			m_Queue = queue;
			m_ItemIcon = ((Component)this).GetComponent<ItemIcon>();
		}

		public void OnBeginDrag(PointerEventData eventData)
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_00ad: 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_00cf: 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)
			InputButton button = eventData.button;
			if ((int)button <= 1)
			{
				m_DraggingIcon = new GameObject("QueueItemDragIcon");
				m_DraggingIcon.transform.SetParent(((Component)m_Queue).transform, false);
				m_DraggingIcon.transform.SetAsLastSibling();
				RawImage obj = m_DraggingIcon.AddComponent<RawImage>();
				obj.texture = m_ItemIcon.image.texture;
				RectTransform rectTransform = ((Graphic)obj).rectTransform;
				Rect rect = ((Graphic)m_ItemIcon.image).rectTransform.rect;
				float height = ((Rect)(ref rect)).height;
				rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
				rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
				rectTransform.sizeDelta = new Vector2(height, height);
				((Transform)rectTransform).localScale = ((Transform)m_ItemIcon.rectTransform).localScale;
				((Graphic)obj).color = new Color(1f, 1f, 1f, 0.6f);
				SetDraggedPosition(eventData);
				((AbstractEventData)eventData).Use();
			}
		}

		public void OnDrag(PointerEventData eventData)
		{
			if (Object.op_Implicit((Object)(object)m_DraggingIcon))
			{
				SetDraggedPosition(eventData);
				((AbstractEventData)eventData).Use();
			}
		}

		public void OnEndDrag(PointerEventData eventData)
		{
			//IL_0025: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)m_DraggingIcon))
			{
				return;
			}
			Object.Destroy((Object)(object)m_DraggingIcon);
			Vector2 val = default(Vector2);
			if (RectTransformUtility.ScreenPointToLocalPointInRectangle(m_Queue.rectTransform, eventData.position, eventData.pressEventCamera, ref val))
			{
				int newIndex = Mathf.RoundToInt(val.x / (m_Queue.iconScale * (m_Queue.itemIconPrefabWidth + 5f)));
				int num = m_Queue.icons.FindIndex((ItemIcon icon) => (Object)(object)((Component)icon).gameObject == (Object)(object)((Component)this).gameObject);
				List<QueueManager.QueueEntry> queue = m_Queue.queue;
				if (num < 0 || num > queue.Count)
				{
					return;
				}
				int num2 = m_Queue.queue[num].count;
				if ((int)eventData.button == 1 && num2 > 1)
				{
					num2 /= 2;
				}
				QueueManager.Move(m_Queue.tier, num, newIndex, num2);
			}
			((AbstractEventData)eventData).Use();
		}

		private void SetDraggedPosition(PointerEventData data)
		{
			//IL_0018: 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)
			RectTransform component = m_DraggingIcon.GetComponent<RectTransform>();
			Vector3 position = default(Vector3);
			if (RectTransformUtility.ScreenPointToWorldPointInRectangle(m_Queue.rectTransform, data.position, data.pressEventCamera, ref position))
			{
				((Transform)component).position = position;
			}
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0056: 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)
			if ((int)eventData.button != 1 || !ModConfig.rightClickRemovesStack.Value)
			{
				return;
			}
			List<ItemIcon> icons = m_Queue.icons;
			for (int i = 0; i < icons.Count; i++)
			{
				if ((Object)(object)((Component)icons[i]).gameObject == (Object)(object)((Component)this).gameObject)
				{
					QueueManager.QueueEntry queueEntry = m_Queue.queue[i];
					QueueManager.Remove(m_Queue.tier, i, queueEntry.count);
					break;
				}
			}
			((AbstractEventData)eventData).Use();
		}
	}

	public GameObject itemIconPrefab;

	public float itemIconPrefabWidth = 64f;

	public ItemTier tier;

	private float iconScale = 1f;

	private RectTransform rectTransform;

	private readonly List<ItemIcon> icons = new List<ItemIcon>();

	private List<QueueManager.QueueEntry> queue;

	public void Awake()
	{
		ref RectTransform reference = ref rectTransform;
		Transform transform = ((Component)this).transform;
		reference = (RectTransform)(object)((transform is RectTransform) ? transform : null);
	}

	public void Start()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		Rect rect = rectTransform.rect;
		iconScale = (((Rect)(ref rect)).height - 10f) / itemIconPrefabWidth;
		LayoutIcons();
	}

	public void LayoutIcon(int index, RectTransform transform)
	{
		//IL_001c: 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)
		transform.anchoredPosition = new Vector2((float)index * iconScale * (itemIconPrefabWidth + 5f), 5f);
		((Transform)transform).localScale = new Vector3(iconScale, iconScale, 1f);
	}

	public void LayoutIcons(int first = 0)
	{
		for (int i = first; i < icons.Count; i++)
		{
			LayoutIcon(i, icons[i].rectTransform);
		}
	}

	public ItemIcon AllocateIcon(int index)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Expected O, but got Unknown
		//IL_005f: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		ItemIcon icon = Object.Instantiate<GameObject>(itemIconPrefab, (Transform)(object)rectTransform, false).GetComponent<ItemIcon>();
		RectTransform val = icon.rectTransform;
		Button obj = ((Component)icon).gameObject.AddComponent<Button>();
		((UnityEvent)obj.onClick).AddListener((UnityAction)delegate
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < icons.Count; i++)
			{
				if ((Object)(object)icons[i] == (Object)(object)icon)
				{
					QueueManager.Remove(tier, i);
					break;
				}
			}
		});
		Navigation navigation = default(Navigation);
		((Navigation)(ref navigation)).mode = (Mode)0;
		((Selectable)obj).navigation = navigation;
		val.anchorMin = new Vector2(0f, 1f);
		val.anchorMax = new Vector2(0f, 1f);
		LayoutIcon(index, val);
		((Component)icon).gameObject.AddComponent<QueueItemBehavior>().Init(this);
		icons.Insert(index, icon);
		return icon;
	}

	public void AllocateIcons(int count, Action<int, ItemIcon> action = null)
	{
		for (int num = icons.Count - 1; num >= count; num--)
		{
			Object.Destroy((Object)(object)((Component)icons[num]).gameObject);
			icons.RemoveAt(num);
		}
		for (int i = icons.Count; i < count; i++)
		{
			ItemIcon arg = AllocateIcon(i);
			action?.Invoke(i, arg);
		}
	}

	public void DestroyUI()
	{
		foreach (ItemIcon icon in icons)
		{
			Object.Destroy((Object)(object)((Component)icon).gameObject);
		}
		icons.Clear();
	}

	public void UpdateUI()
	{
		AllocateIcons(queue.Count);
		UpdateIcons();
	}

	private void UpdateIcon(int i)
	{
		//IL_001a: 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)
		ItemIcon obj = icons[i];
		QueueManager.QueueEntry queueEntry = queue[i];
		obj.SetItemIndex(PickupCatalog.GetPickupDef(queueEntry.pickupIndex).itemIndex, queueEntry.count);
	}

	private void UpdateIcons()
	{
		for (int i = 0; i < icons.Count; i++)
		{
			UpdateIcon(i);
		}
	}

	private void HandleQueueChange(QueueManager.QueueChange change, ItemTier tier, int index)
	{
		//IL_000e: 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)
		if (Object.op_Implicit((Object)(object)itemIconPrefab) && tier == this.tier)
		{
			switch (change)
			{
			case QueueManager.QueueChange.Changed:
				UpdateIcon(index);
				break;
			case QueueManager.QueueChange.Added:
				AllocateIcon(index);
				UpdateIcon(index);
				break;
			case QueueManager.QueueChange.Removed:
				Object.Destroy((Object)(object)((Component)icons[index]).gameObject);
				icons.RemoveAt(index);
				LayoutIcons(index);
				break;
			case QueueManager.QueueChange.Moved:
				UpdateUI();
				break;
			}
		}
	}

	public void OnEnable()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)itemIconPrefab))
		{
			queue = QueueManager.mainQueues[tier];
			UpdateUI();
			QueueManager.OnQueueChanged += HandleQueueChange;
		}
	}

	public void OnDisable()
	{
		QueueManager.OnQueueChanged -= HandleQueueChange;
	}
}
public static class QueueManager
{
	public struct QueueEntry
	{
		public PickupIndex pickupIndex;

		public int count;
	}

	public enum QueueChange
	{
		Removed,
		Added,
		Changed,
		Moved
	}

	public static Dictionary<ItemTier, List<QueueEntry>> mainQueues = new Dictionary<ItemTier, List<QueueEntry>>
	{
		{
			(ItemTier)0,
			new List<QueueEntry>()
		},
		{
			(ItemTier)1,
			new List<QueueEntry>()
		},
		{
			(ItemTier)2,
			new List<QueueEntry>()
		}
	};

	public static Dictionary<ItemTier, bool> queueRepeat = new Dictionary<ItemTier, bool>();

	public static event Action<Run> OnRunQueueInit;

	public static event Action<QueueChange, ItemTier, int> OnQueueChanged;

	internal static void Enable()
	{
		Run.onRunStartGlobal += InitQueues;
		ModConfig.OnReady += UpdateQueueAvailability;
		UpdateQueueAvailability();
	}

	internal static void Disable()
	{
		Run.onRunStartGlobal -= InitQueues;
		ModConfig.OnReady -= UpdateQueueAvailability;
	}

	public static void UpdateQueueAvailability()
	{
		//IL_002a: 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_0039: 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_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		if (!ModConfig.Ready)
		{
			return;
		}
		ModConfig.ItemTierSet value = ModConfig.enabledTabs.Value;
		ItemTier[] array = mainQueues.Keys.ToArray();
		foreach (ItemTier val in array)
		{
			if (!value.Contains(val))
			{
				mainQueues.Remove(val);
			}
		}
		foreach (ItemTier item in value)
		{
			if (!mainQueues.ContainsKey(item))
			{
				mainQueues.Add(item, new List<QueueEntry>());
			}
		}
	}

	private static void InitQueues(Run run)
	{
		mainQueues.Clear();
		UpdateQueueAvailability();
		QueueManager.OnRunQueueInit?.Invoke(run);
	}

	public static bool DoesRepeat(ItemTier tier)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		bool value;
		return queueRepeat.TryGetValue(tier, out value) && value;
	}

	public static void ToggleRepeat(ItemTier tier)
	{
		//IL_0005: 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)
		queueRepeat[tier] = !DoesRepeat(tier);
	}

	public static void Enqueue(PickupIndex pickupIndex)
	{
		//IL_0000: 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_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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: 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_006e: Unknown result type (might be due to invalid IL or missing references)
		ItemTier tier = ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(pickupIndex).itemIndex).tier;
		List<QueueEntry> list = mainQueues[tier];
		if (list.Count > 0)
		{
			QueueEntry value = list[list.Count - 1];
			if (value.pickupIndex == pickupIndex)
			{
				value.count++;
				list[list.Count - 1] = value;
				QueueManager.OnQueueChanged?.Invoke(QueueChange.Changed, tier, list.Count - 1);
				return;
			}
		}
		QueueEntry queueEntry = default(QueueEntry);
		queueEntry.pickupIndex = pickupIndex;
		queueEntry.count = 1;
		QueueEntry item = queueEntry;
		list.Add(item);
		QueueManager.OnQueueChanged?.Invoke(QueueChange.Added, tier, list.Count - 1);
	}

	public static PickupIndex Peek(ItemTier tier)
	{
		//IL_0005: 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_0014: Unknown result type (might be due to invalid IL or missing references)
		List<QueueEntry> list = mainQueues[tier];
		if (list.Count == 0)
		{
			return PickupIndex.none;
		}
		return list[0].pickupIndex;
	}

	public static PickupIndex Pop(ItemTier tier)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: 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_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		PickupIndex val = Remove(tier, 0);
		if (DoesRepeat(tier))
		{
			Enqueue(val);
		}
		return val;
	}

	public static PickupIndex Remove(ItemTier tier, int index, int count = 1)
	{
		//IL_0005: 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_003c: 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_0043: 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_006e: Unknown result type (might be due to invalid IL or missing references)
		List<QueueEntry> list = mainQueues[tier];
		QueueEntry value = list[index];
		value.count -= count;
		if (value.count <= 0)
		{
			list.RemoveAt(index);
			QueueManager.OnQueueChanged?.Invoke(QueueChange.Removed, tier, index);
			if (TryMerge(tier, index - 1, index))
			{
				QueueManager.OnQueueChanged?.Invoke(QueueChange.Removed, tier, index);
				QueueManager.OnQueueChanged?.Invoke(QueueChange.Changed, tier, index - 1);
			}
		}
		else
		{
			list[index] = value;
			QueueManager.OnQueueChanged?.Invoke(QueueChange.Changed, tier, index);
		}
		return value.pickupIndex;
	}

	private static bool TryMerge(ItemTier tier, int into, int from)
	{
		//IL_0005: 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_003f: Unknown result type (might be due to invalid IL or missing references)
		List<QueueEntry> list = mainQueues[tier];
		if (into < 0 || into >= list.Count || from < 0 || from >= list.Count)
		{
			return false;
		}
		QueueEntry value = list[into];
		QueueEntry queueEntry = list[from];
		if (value.pickupIndex != queueEntry.pickupIndex)
		{
			return false;
		}
		value.count += queueEntry.count;
		list[into] = value;
		list.RemoveAt(from);
		return true;
	}

	public static void ClearAllQueues()
	{
		mainQueues.Clear();
		UpdateQueueAvailability();
	}

	public static void Move(ItemTier tier, int oldIndex, int newIndex, int count = 1)
	{
		//IL_0005: 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_0093: 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)
		List<QueueEntry> list = mainQueues[tier];
		newIndex = Math.Max(0, Math.Min(list.Count, newIndex));
		if (newIndex == oldIndex)
		{
			return;
		}
		QueueEntry item = list[oldIndex];
		if (item.count < count)
		{
			return;
		}
		if (item.count == count)
		{
			list.RemoveAt(oldIndex);
			if (newIndex > oldIndex)
			{
				newIndex--;
			}
		}
		else
		{
			QueueEntry value = list[oldIndex];
			value.count -= count;
			list[oldIndex] = value;
		}
		item.count = count;
		if (TryMerge(tier, oldIndex - 1, oldIndex) && newIndex > oldIndex)
		{
			newIndex--;
		}
		list.Insert(newIndex, item);
		TryMerge(tier, newIndex - 1, newIndex);
		TryMerge(tier, newIndex, newIndex + 1);
		QueueManager.OnQueueChanged?.Invoke(QueueChange.Moved, tier, -1);
	}

	public static IEnumerable<(ItemTier, PickupIndex)> PeekAll()
	{
		return from entry in mainQueues
			where entry.Value.Count > 0
			select (entry.Key, entry.Value.First().pickupIndex);
	}
}
internal class UIManager : MonoBehaviour
{
	private struct ButtonWrapper
	{
		public HGButton hgButton { get; private set; }

		public TextMeshProUGUI textComponent { get; private set; }

		public RectTransform rectTransform { get; private set; }

		public LanguageTextMeshController languageTextMeshController { get; private set; }

		public ButtonClickedEvent _onClick => ((Button)hgButton).onClick;

		public string text
		{
			get
			{
				return languageTextMeshController.token;
			}
			set
			{
				languageTextMeshController.token = value;
			}
		}

		public string directText
		{
			get
			{
				TextMeshProUGUI obj = textComponent;
				if (obj == null)
				{
					return null;
				}
				return ((TMP_Text)obj).text;
			}
			set
			{
				((TMP_Text)textComponent).text = value;
			}
		}

		public event UnityAction onClick
		{
			add
			{
				((UnityEvent)_onClick).AddListener(value);
			}
			remove
			{
				((UnityEvent)_onClick).RemoveListener(value);
			}
		}

		public ButtonWrapper(HGButton button)
		{
			hgButton = button;
			textComponent = ((Component)button).GetComponentInChildren<TextMeshProUGUI>();
			rectTransform = ((Component)button).GetComponent<RectTransform>();
			languageTextMeshController = ((Component)button).GetComponent<LanguageTextMeshController>();
		}
	}

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

		private object <>2__current;

		public Action action;

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

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

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

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

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = 0;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				action();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private static GameObject commandUIPrefab;

	private static GameObject commandCancelButton;

	private static PickupPickerPanel prefabPickupPickerPanel;

	private static GameObject commandItemButton;

	private static GameObject commandItemContainer;

	private static Texture2D repeatIconTexture;

	private static bool staticInitialized = false;

	private static readonly Color selectedColorMult = new Color(0.3f, 0.3f, 0.3f);

	private Sprite missingUnlockIcon;

	private GameObject itemIconPrefab;

	private ItemInventoryDisplay itemInventoryDisplayPrefab;

	private ScoreboardController scoreboard;

	private HUD hud;

	private GameObject container;

	private GameObject origContainer;

	private GameObject saveLoadContainer;

	private ColorBlock origButtonColors;

	private ColorBlock selectedButtonColors;

	private ButtonWrapper scoreboardButton;

	private ButtonWrapper queueButton;

	private ButtonWrapper saveLoadButton;

	private GameObject queueContainer;

	private readonly Dictionary<ItemTier, GameObject> queueDisplays = new Dictionary<ItemTier, GameObject>();

	private readonly Dictionary<ItemTier, ButtonWrapper> queueButtons = new Dictionary<ItemTier, ButtonWrapper>();

	private int displayingQueues = 1;

	private ItemTier selectedQueue;

	private int savePageIndex;

	private const int savesPerPage = 4;

	private List<GameObject> saveListElements = new List<GameObject>();

	private GameObject saveListContainer;

	private ButtonWrapper prevPageButton;

	private ButtonWrapper nextPageButton;

	private ButtonWrapper pageIndicator;

	private TMP_InputField saveNameInput;

	private string renamingSaveId;

	private List<GameObject> uiElements = new List<GameObject>();

	private int DisplayingQueues
	{
		get
		{
			return displayingQueues;
		}
		set
		{
			if (displayingQueues == value)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)origContainer) && Object.op_Implicit((Object)(object)queueContainer) && Object.op_Implicit((Object)(object)saveLoadContainer))
			{
				switch (value)
				{
				case 0:
					container.SetActive(false);
					queueContainer.SetActive(true);
					saveLoadContainer.SetActive(false);
					break;
				case 1:
					container.SetActive(true);
					queueContainer.SetActive(false);
					saveLoadContainer.SetActive(false);
					break;
				default:
					container.SetActive(false);
					queueContainer.SetActive(false);
					saveLoadContainer.SetActive(true);
					break;
				}
			}
			displayingQueues = value;
			UpdateButtonColors();
		}
	}

	private ItemTier SelectedQueue
	{
		get
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return selectedQueue;
		}
		set
		{
			//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_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_0040: 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_006c: 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)
			if (selectedQueue != value)
			{
				queueDisplays[selectedQueue].SetActive(false);
				queueDisplays[value].SetActive(true);
				ButtonWrapper[] buttons = new ButtonWrapper[2]
				{
					queueButtons[value],
					queueButtons[selectedQueue]
				};
				TransitionEnabledButton(buttons);
				selectedQueue = value;
			}
		}
	}

	private static void InitializeStatic()
	{
		if (!staticInitialized && !((Object)(object)CommandArtifactManager.commandCubePrefab == (Object)null))
		{
			commandUIPrefab = CommandArtifactManager.commandCubePrefab.GetComponent<PickupPickerController>().panelPrefab;
			commandCancelButton = ((Component)commandUIPrefab.GetComponentsInChildren<HGButton>().First((HGButton a) => ((Object)a).name == "CancelButton")).gameObject;
			prefabPickupPickerPanel = commandUIPrefab.GetComponent<PickupPickerPanel>();
			commandItemButton = prefabPickupPickerPanel.buttonPrefab;
			commandItemContainer = ((Component)prefabPickupPickerPanel.buttonContainer).gameObject;
			staticInitialized = true;
		}
	}

	private static void CopyRectTransform(RectTransform dest, RectTransform source)
	{
		//IL_0002: 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_001a: 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_0032: Unknown result type (might be due to invalid IL or missing references)
		dest.anchorMin = source.anchorMin;
		dest.anchorMax = source.anchorMax;
		dest.anchoredPosition = source.anchoredPosition;
		((Transform)dest).position = ((Transform)source).position;
		dest.sizeDelta = source.sizeDelta;
	}

	private static void ReparentChildren(Transform dest, Transform source, bool keepWorldPos = false, Action<Transform> additionalAction = null)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		List<Transform> list = new List<Transform>();
		foreach (Transform item in source)
		{
			Transform val = item;
			if ((Object)(object)val != (Object)(object)dest)
			{
				list.Add(val);
			}
		}
		foreach (Transform item2 in list)
		{
			item2.SetParent(dest, keepWorldPos);
			additionalAction?.Invoke(item2);
		}
	}

	[IteratorStateMachine(typeof(<ExecuteNextFrameInner>d__11))]
	private static IEnumerator ExecuteNextFrameInner(Action action)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ExecuteNextFrameInner>d__11(0)
		{
			action = action
		};
	}

	private void ExecuteNextFrame(Action action)
	{
		((MonoBehaviour)this).StartCoroutine(ExecuteNextFrameInner(action));
	}

	private ButtonWrapper CreateButton(GameObject parent = null, UnityAction onClick = null, string text = null)
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		GameObject val = Object.Instantiate<GameObject>(commandCancelButton, (parent != null) ? parent.transform : null);
		uiElements.Add(val);
		HGButton component = val.GetComponent<HGButton>();
		((MPButton)component).onSelect = new UnityEvent();
		((MPButton)component).onDeselect = new UnityEvent();
		((Button)component).onClick = new ButtonClickedEvent();
		ButtonWrapper result = new ButtonWrapper(component);
		if (text != null)
		{
			result.text = text;
		}
		if (onClick != null)
		{
			result.onClick += onClick;
		}
		return result;
	}

	private void MarkButton(ButtonWrapper button, bool state)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: 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)
		((Selectable)button.hgButton).colors = (state ? selectedButtonColors : origButtonColors);
		((Graphic)button.hgButton.imageOnHover).color = (state ? selectedColorMult : Color.white);
	}

	private void TransitionEnabledButton(ButtonWrapper[] buttons)
	{
		int num = 0;
		foreach (ButtonWrapper button in buttons)
		{
			if (num == 0)
			{
				MarkButton(button, state: true);
			}
			else
			{
				MarkButton(button, state: false);
			}
			num++;
		}
	}

	private void UpdateButtonColors()
	{
		ButtonWrapper[] array = new ButtonWrapper[3];
		if (Object.op_Implicit((Object)(object)queueButton.hgButton) && Object.op_Implicit((Object)(object)scoreboardButton.hgButton) && Object.op_Implicit((Object)(object)saveLoadButton.hgButton))
		{
			if (DisplayingQueues == 0)
			{
				array[0] = queueButton;
				array[1] = scoreboardButton;
				array[2] = saveLoadButton;
			}
			else if (DisplayingQueues == 1)
			{
				array[0] = scoreboardButton;
				array[1] = queueButton;
				array[2] = saveLoadButton;
			}
			else
			{
				array[0] = saveLoadButton;
				array[1] = queueButton;
				array[2] = scoreboardButton;
			}
			TransitionEnabledButton(array);
		}
	}

	private void PrintObject(GameObject obj, bool components = false, int depth = 0)
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Expected O, but got Unknown
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.Append(' ', depth * 2);
		stringBuilder.Append(((object)obj).ToString());
		Debug.Log((object)stringBuilder.ToString());
		if (components)
		{
			Component[] components2 = obj.GetComponents<Component>();
			foreach (Component val in components2)
			{
				stringBuilder.Clear();
				stringBuilder.Append(' ', depth * 2);
				stringBuilder.Append('-');
				stringBuilder.Append(((object)val).ToString());
				Debug.Log((object)stringBuilder.ToString());
			}
		}
		foreach (Transform item in obj.transform)
		{
			Transform val2 = item;
			PrintObject(((Component)val2).gameObject, components, depth + 1);
		}
	}

	private PickupIndex GetPickupIndexOfItemTier(ItemTier itemTier)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//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_0007: 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_0016: 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_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_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_0042: 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_0065: Unknown result type (might be due to invalid IL or missing references)
		PickupIndex val = PickupCatalog.FindPickupIndex(itemTier);
		if (val != PickupIndex.none)
		{
			return val;
		}
		Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				ItemDef current = enumerator.Current;
				if (current.tier == itemTier)
				{
					return PickupCatalog.FindPickupIndex(current.itemIndex);
				}
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
		return PickupIndex.none;
	}

	private PickupIndex[] GetAllPickupsOfTier(ItemTier itemTier)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: 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_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_0032: 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_0036: 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)
		List<PickupIndex> list = new List<PickupIndex>();
		Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				ItemDef current = enumerator.Current;
				if (current.tier == itemTier)
				{
					PickupIndex val = PickupCatalog.FindPickupIndex(current.itemIndex);
					if (val != PickupIndex.none)
					{
						list.Add(val);
					}
				}
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
		return list.ToArray();
	}

	private RectTransform CreateQueueContainer(ItemTier itemTier, RectTransform parent, Action<PickupIndex> callback)
	{
		//IL_0007: 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_0021: 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_0049: Expected O, but got Unknown
		//IL_009c: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Expected O, but got Unknown
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_0267: 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_03bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_040b: Unknown result type (might be due to invalid IL or missing references)
		//IL_041d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0315: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0349: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_042c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0431: Unknown result type (might be due to invalid IL or missing references)
		//IL_0436: Unknown result type (might be due to invalid IL or missing references)
		//IL_0439: Unknown result type (might be due to invalid IL or missing references)
		//IL_045b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0483: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject($"{itemTier}QueueContainer", new Type[1] { typeof(RectTransform) });
		Transform transform = val.transform;
		RectTransform val2 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
		((Transform)val2).SetParent((Transform)(object)parent, false);
		GameObject val3 = Object.Instantiate<GameObject>(((Component)itemInventoryDisplayPrefab).gameObject, (Transform)(object)val2, false);
		Object.DestroyImmediate((Object)(object)val3.GetComponent<ItemInventoryDisplay>());
		Object.DestroyImmediate((Object)(object)val3.GetComponent<LayoutElement>());
		Transform transform2 = val3.transform;
		Transform obj = ((transform2 is RectTransform) ? transform2 : null);
		((RectTransform)obj).anchorMin = new Vector2(0f, 1f);
		((RectTransform)obj).anchorMax = new Vector2(1f, 1f);
		((RectTransform)obj).sizeDelta = new Vector2(-60f, 50f);
		((RectTransform)obj).anchoredPosition = new Vector2(0f, -5f);
		((RectTransform)obj).pivot = new Vector2(0f, 1f);
		ButtonWrapper repeatButton = default(ButtonWrapper);
		repeatButton = CreateButton(val, (UnityAction)delegate
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			QueueManager.ToggleRepeat(itemTier);
			MarkButton(repeatButton, QueueManager.DoesRepeat(itemTier));
		}, "");
		RectTransform rectTransform = repeatButton.rectTransform;
		rectTransform.anchorMin = new Vector2(1f, 1f);
		rectTransform.anchorMax = new Vector2(1f, 1f);
		rectTransform.sizeDelta = new Vector2(55f, 55f);
		rectTransform.anchoredPosition = new Vector2(0f, -2.5f);
		rectTransform.pivot = new Vector2(1f, 1f);
		GameObject val4 = new GameObject($"{itemTier}RepeatButtonImageHolder", new Type[1] { typeof(RectTransform) });
		Transform transform3 = val4.transform;
		Transform obj2 = ((transform3 is RectTransform) ? transform3 : null);
		obj2.SetParent((Transform)(object)rectTransform, false);
		((RectTransform)obj2).anchorMin = new Vector2(0f, 0f);
		((RectTransform)obj2).anchorMax = new Vector2(1f, 1f);
		((RectTransform)obj2).sizeDelta = new Vector2(-15f, -15f);
		val4.AddComponent<RawImage>().texture = (Texture)(object)repeatIconTexture;
		MarkButton(repeatButton, QueueManager.DoesRepeat(itemTier));
		QueueDisplay queueDisplay = val3.AddComponent<QueueDisplay>();
		queueDisplay.itemIconPrefab = itemIconPrefab;
		queueDisplay.itemIconPrefabWidth = itemInventoryDisplayPrefab.itemIconPrefabWidth;
		queueDisplay.tier = itemTier;
		GameObject val5 = Object.Instantiate<GameObject>(commandItemContainer, (Transform)(object)val2, false);
		RectTransform itemButtonsTransform = default(RectTransform);
		ref RectTransform reference = ref itemButtonsTransform;
		Transform transform4 = val5.transform;
		reference = (RectTransform)(object)((transform4 is RectTransform) ? transform4 : null);
		GridLayoutGroup component = val5.GetComponent<GridLayoutGroup>();
		UIElementAllocator<MPButton> val6 = new UIElementAllocator<MPButton>(itemButtonsTransform, commandItemButton, true, false);
		if (ModConfig.bigItemButtonContainer.Value)
		{
			Object.Destroy((Object)(object)val5.GetComponent<RawImage>());
			component.constraint = (Constraint)0;
			component.startCorner = (Corner)0;
			component.startAxis = (Axis)0;
			((LayoutGroup)component).childAlignment = (TextAnchor)1;
			component.cellSize *= ModConfig.bigItemButtonScale.Value;
			itemButtonsTransform.anchoredPosition = new Vector2(0f, 0f);
			itemButtonsTransform.anchorMin = new Vector2(0f, 0f);
			itemButtonsTransform.anchorMax = new Vector2(1f, 1f);
			itemButtonsTransform.sizeDelta = new Vector2(0f, -55f);
			itemButtonsTransform.pivot = new Vector2(0.5f, 0f);
		}
		else
		{
			component.constraint = (Constraint)1;
			component.constraintCount = prefabPickupPickerPanel.maxColumnCount;
			((LayoutGroup)component).childAlignment = (TextAnchor)1;
			itemButtonsTransform.anchorMin = new Vector2(0.5f, 1f);
			itemButtonsTransform.anchorMax = new Vector2(0.5f, 1f);
			itemButtonsTransform.anchoredPosition = new Vector2(0f, -55f);
			itemButtonsTransform.pivot = new Vector2(0f, 1f);
			itemButtonsTransform.sizeDelta = default(Vector2);
		}
		PickupIndex pickupIndexOfItemTier = GetPickupIndexOfItemTier(itemTier);
		PickupIndex[] itemOptions = (PickupIndex[])(((object)PickupTransmutationManager.GetGroupFromPickupIndex(pickupIndexOfItemTier)) ?? ((object)new PickupIndex[0]));
		if (itemOptions.Length == 0)
		{
			itemOptions = GetAllPickupsOfTier(itemTier);
		}
		PickupIndex[] availableItemOptions = ((itemOptions.Length != 0) ? (PickupTransmutationManager.GetAvailableGroupFromPickupIndex(itemOptions[0]) ?? itemOptions) : itemOptions);
		if (itemOptions != null)
		{
			val6.onCreateElement = delegate(int index, MPButton button)
			{
				//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_002e: 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_0099: 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_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Expected O, but got Unknown
				PickupIndex pickupIndex = itemOptions[index];
				bool num = availableItemOptions != null && availableItemOptions.Contains(pickupIndex);
				PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
				Image component2 = ((Component)((Component)button).GetComponent<ChildLocator>().FindChild("Icon")).GetComponent<Image>();
				if (num && pickupDef != null)
				{
					((Graphic)component2).color = Color.white;
					component2.sprite = pickupDef.iconSprite;
					((Selectable)button).interactable = true;
					((UnityEvent)((Button)button).onClick).AddListener((UnityAction)delegate
					{
						//IL_000c: Unknown result type (might be due to invalid IL or missing references)
						callback(pickupIndex);
						LayoutRebuilder.MarkLayoutForRebuild(itemButtonsTransform);
					});
				}
				else
				{
					((Graphic)component2).color = Color.gray;
					component2.sprite = missingUnlockIcon;
					((Selectable)button).interactable = false;
				}
			};
			val6.AllocateElements(itemOptions.Length);
		}
		return val2;
	}

	private TMP_InputField CreateInputField(GameObject parent, string placeholder = "Enter name...")
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: 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_011f: 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_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: 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_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("SaveNameInput", new Type[2]
		{
			typeof(RectTransform),
			typeof(Image)
		});
		RectTransform component = val.GetComponent<RectTransform>();
		((Transform)component).SetParent(parent.transform, false);
		((Graphic)val.GetComponent<Image>()).color = new Color(0.1f, 0.1f, 0.1f, 0.9f);
		RectTransform component2 = new GameObject("TextArea", new Type[2]
		{
			typeof(RectTransform),
			typeof(RectMask2D)
		}).GetComponent<RectTransform>();
		((Transform)component2).SetParent((Transform)(object)component, false);
		component2.anchorMin = Vector2.zero;
		component2.anchorMax = Vector2.one;
		component2.offsetMin = new Vector2(10f, 5f);
		component2.offsetMax = new Vector2(-10f, -5f);
		GameObject val2 = new GameObject("Placeholder", new Type[2]
		{
			typeof(RectTransform),
			typeof(TextMeshProUGUI)
		});
		RectTransform component3 = val2.GetComponent<RectTransform>();
		((Transform)component3).SetParent((Transform)(object)component2, false);
		component3.anchorMin = Vector2.zero;
		component3.anchorMax = Vector2.one;
		component3.offsetMin = Vector2.zero;
		component3.offsetMax = Vector2.zero;
		TextMeshProUGUI component4 = val2.GetComponent<TextMeshProUGUI>();
		((TMP_Text)component4).text = placeholder;
		((TMP_Text)component4).fontSize = 18f;
		((Graphic)component4).color = new Color(0.5f, 0.5f, 0.5f, 0.8f);
		((TMP_Text)component4).alignment = (TextAlignmentOptions)513;
		GameObject val3 = new GameObject("Text", new Type[2]
		{
			typeof(RectTransform),
			typeof(TextMeshProUGUI)
		});
		RectTransform component5 = val3.GetComponent<RectTransform>();
		((Transform)component5).SetParent((Transform)(object)component2, false);
		component5.anchorMin = Vector2.zero;
		component5.anchorMax = Vector2.one;
		component5.offsetMin = Vector2.zero;
		component5.offsetMax = Vector2.zero;
		TextMeshProUGUI component6 = val3.GetComponent<TextMeshProUGUI>();
		((TMP_Text)component6).fontSize = 18f;
		((Graphic)component6).color = Color.white;
		((TMP_Text)component6).alignment = (TextAlignmentOptions)513;
		TMP_InputField obj = val.AddComponent<TMP_InputField>();
		obj.textViewport = component2;
		obj.textComponent = (TMP_Text)(object)component6;
		obj.placeholder = (Graphic)(object)component4;
		obj.fontAsset = ((TMP_Text)component6).font;
		obj.pointSize = 18f;
		obj.characterLimit = 30;
		return obj;
	}

	private void CreateSaveLoadContainer(GameObject saveLoadCon)
	{
		//IL_002d: 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_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Expected O, but got Unknown
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Expected O, but got Unknown
		//IL_0113: 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_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Expected O, but got Unknown
		//IL_0183: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: 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_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Expected O, but got Unknown
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		ModConfig.MigrateOldSaves();
		saveNameInput = CreateInputField(saveLoadCon, "Enter save name...");
		RectTransform component = ((Component)saveNameInput).GetComponent<RectTransform>();
		component.anchorMin = new Vector2(0.05f, 0.88f);
		component.anchorMax = new Vector2(0.65f, 0.98f);
		component.offsetMin = Vector2.zero;
		component.offsetMax = Vector2.zero;
		RectTransform rectTransform = CreateButton(saveLoadCon, (UnityAction)delegate
		{
			ModConfig.CreateSave(string.IsNullOrWhiteSpace(saveNameInput.text) ? $"Save {ModConfig.GetAllSaves().Count + 1}" : saveNameInput.text);
			saveNameInput.text = "";
			RefreshSaveList();
		}, "Save").rectTransform;
		rectTransform.anchorMin = new Vector2(0.67f, 0.88f);
		rectTransform.anchorMax = new Vector2(0.95f, 0.98f);
		rectTransform.anchoredPosition = default(Vector2);
		rectTransform.sizeDelta = default(Vector2);
		saveListContainer = new GameObject("SaveListContainer", new Type[1] { typeof(RectTransform) });
		Transform transform = saveListContainer.transform;
		Transform obj = ((transform is RectTransform) ? transform : null);
		obj.SetParent(saveLoadCon.transform, false);
		((RectTransform)obj).anchorMin = new Vector2(0.05f, 0.15f);
		((RectTransform)obj).anchorMax = new Vector2(0.95f, 0.82f);
		((RectTransform)obj).anchoredPosition = default(Vector2);
		((RectTransform)obj).sizeDelta = default(Vector2);
		prevPageButton = CreateButton(saveLoadCon, (UnityAction)delegate
		{
			if (savePageIndex > 0)
			{
				savePageIndex--;
				RefreshSaveList();
			}
		}, "<");
		RectTransform rectTransform2 = prevPageButton.rectTransform;
		rectTransform2.anchorMin = new Vector2(0.1f, 0.02f);
		rectTransform2.anchorMax = new Vector2(0.25f, 0.12f);
		rectTransform2.anchoredPosition = default(Vector2);
		rectTransform2.sizeDelta = default(Vector2);
		pageIndicator = CreateButton(saveLoadCon, null, "Page 1");
		((Selectable)pageIndicator.hgButton).interactable = false;
		RectTransform rectTransform3 = pageIndicator.rectTransform;
		rectTransform3.anchorMin = new Vector2(0.3f, 0.02f);
		rectTransform3.anchorMax = new Vector2(0.7f, 0.12f);
		rectTransform3.anchoredPosition = default(Vector2);
		rectTransform3.sizeDelta = default(Vector2);
		nextPageButton = CreateButton(saveLoadCon, (UnityAction)delegate
		{
			int num = Mathf.CeilToInt((float)ModConfig.GetAllSaves().Count / 4f);
			if (savePageIndex < num - 1)
			{
				savePageIndex++;
				RefreshSaveList();
			}
		}, ">");
		RectTransform rectTransform4 = nextPageButton.rectTransform;
		rectTransform4.anchorMin = new Vector2(0.75f, 0.02f);
		rectTransform4.anchorMax = new Vector2(0.9f, 0.12f);
		rectTransform4.anchoredPosition = default(Vector2);
		rectTransform4.sizeDelta = default(Vector2);
		RefreshSaveList();
	}

	private void RefreshSaveList()
	{
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Expected O, but got Unknown
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: 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_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Expected O, but got Unknown
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_039c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03be: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Expected O, but got Unknown
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: 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_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Expected O, but got Unknown
		//IL_030d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0322: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0335: Unknown result type (might be due to invalid IL or missing references)
		//IL_033e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		foreach (GameObject saveListElement in saveListElements)
		{
			if ((Object)(object)saveListElement != (Object)null)
			{
				Object.Destroy((Object)(object)saveListElement);
			}
		}
		saveListElements.Clear();
		List<ModConfig.SaveData> allSaves = ModConfig.GetAllSaves();
		int num = Mathf.Max(1, Mathf.CeilToInt((float)allSaves.Count / 4f));
		savePageIndex = Mathf.Clamp(savePageIndex, 0, num - 1);
		if ((Object)(object)pageIndicator.hgButton != (Object)null)
		{
			pageIndicator.directText = $"Page {savePageIndex + 1}/{num}";
		}
		List<ModConfig.SaveData> list = allSaves.Skip(savePageIndex * 4).Take(4).ToList();
		for (int i = 0; i < list.Count; i++)
		{
			ModConfig.SaveData saveData = list[i];
			float num2 = 1f - (float)(i + 1) * 0.25f;
			float num3 = 0.225f;
			GameObject val = new GameObject($"SaveRow_{i}", new Type[1] { typeof(RectTransform) });
			Transform transform = val.transform;
			Transform obj = ((transform is RectTransform) ? transform : null);
			obj.SetParent(saveListContainer.transform, false);
			((RectTransform)obj).anchorMin = new Vector2(0f, num2);
			((RectTransform)obj).anchorMax = new Vector2(1f, num2 + num3);
			((RectTransform)obj).anchoredPosition = default(Vector2);
			((RectTransform)obj).sizeDelta = default(Vector2);
			saveListElements.Add(val);
			int saveItemCount = ModConfig.GetSaveItemCount(saveData);
			string saveId = saveData.id;
			string currentName = saveData.name;
			RectTransform rectTransform = CreateButton(text: $"{saveData.name} ({saveItemCount} items)", parent: val, onClick: (UnityAction)delegate
			{
				ModConfig.LoadSave(saveId);
			}).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 0.1f);
			rectTransform.anchorMax = new Vector2(0.55f, 0.9f);
			rectTransform.anchoredPosition = default(Vector2);
			rectTransform.sizeDelta = default(Vector2);
			RectTransform rectTransform2 = CreateButton(text: (renamingSaveId == saveId) ? "Apply" : "Edit", parent: val, onClick: (UnityAction)delegate
			{
				if (renamingSaveId == saveId)
				{
					if (!string.IsNullOrWhiteSpace(saveNameInput.text))
					{
						ModConfig.RenameSave(saveId, saveNameInput.text);
						saveNameInput.text = "";
					}
					renamingSaveId = null;
				}
				else
				{
					saveNameInput.text = currentName;
					((Selectable)saveNameInput).Select();
					saveNameInput.ActivateInputField();
					renamingSaveId = saveId;
				}
				RefreshSaveList();
			}).rectTransform;
			rectTransform2.anchorMin = new Vector2(0.57f, 0.1f);
			rectTransform2.anchorMax = new Vector2(0.78f, 0.9f);
			rectTransform2.anchoredPosition = default(Vector2);
			rectTransform2.sizeDelta = default(Vector2);
			RectTransform rectTransform3 = CreateButton(val, (UnityAction)delegate
			{
				ModConfig.DeleteSave(saveId);
				RefreshSaveList();
			}, "X").rectTransform;
			rectTransform3.anchorMin = new Vector2(0.8f, 0.1f);
			rectTransform3.anchorMax = new Vector2(0.98f, 0.9f);
			rectTransform3.anchoredPosition = default(Vector2);
			rectTransform3.sizeDelta = default(Vector2);
		}
		if (allSaves.Count == 0)
		{
			ButtonWrapper buttonWrapper = CreateButton(saveListContainer, null, "No saves yet. Create one!");
			((Selectable)buttonWrapper.hgButton).interactable = false;
			RectTransform rectTransform4 = buttonWrapper.rectTransform;
			rectTransform4.anchorMin = new Vector2(0.1f, 0.4f);
			rectTransform4.anchorMax = new Vector2(0.9f, 0.6f);
			rectTransform4.anchoredPosition = default(Vector2);
			rectTransform4.sizeDelta = default(Vector2);
			saveListElements.Add(((Component)buttonWrapper.hgButton).gameObject);
		}
	}

	private void DestroyUI()
	{
		foreach (GameObject uiElement in uiElements)
		{
			Object.Destroy((Object)(object)uiElement);
		}
		uiElements.Clear();
		if ((Object)(object)container != (Object)null)
		{
			RectTransform component = container.GetComponent<RectTransform>();
			ReparentChildren((Transform)(object)origContainer.GetComponent<RectTransform>(), (Transform)(object)component);
			Object.Destroy((Object)(object)container);
			Object.Destroy((Object)(object)queueContainer);
			Object.Destroy((Object)(object)saveLoadContainer);
			container = null;
		}
	}

	private void RebuildUI()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: 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_002f: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_007e: 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_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Expected O, but got Unknown
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Expected O, but got Unknown
		//IL_0112: 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_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: 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_0187: Expected O, but got Unknown
		//IL_027d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_0425: Unknown result type (might be due to invalid IL or missing references)
		//IL_042a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0436: Unknown result type (might be due to invalid IL or missing references)
		//IL_0489: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0505: Expected O, but got Unknown
		//IL_052a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0530: Unknown result type (might be due to invalid IL or missing references)
		//IL_054c: Unknown result type (might be due to invalid IL or missing references)
		//IL_056b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0582: Unknown result type (might be due to invalid IL or missing references)
		//IL_0588: Unknown result type (might be due to invalid IL or missing references)
		//IL_059c: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a6: Expected O, but got Unknown
		//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_060c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0623: Unknown result type (might be due to invalid IL or missing references)
		//IL_0629: Unknown result type (might be due to invalid IL or missing references)
		//IL_063d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0647: Expected O, but got Unknown
		//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d4: Expected O, but got Unknown
		//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0312: Unknown result type (might be due to invalid IL or missing references)
		//IL_0325: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_033b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0341: Unknown result type (might be due to invalid IL or missing references)
		//IL_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_039a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03db: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
		DestroyUI();
		origButtonColors = ((Selectable)commandCancelButton.GetComponent<HGButton>()).colors;
		ColorBlock val = origButtonColors;
		((ColorBlock)(ref val)).disabledColor = ((ColorBlock)(ref val)).disabledColor * selectedColorMult;
		((ColorBlock)(ref val)).pressedColor = ((ColorBlock)(ref val)).pressedColor * selectedColorMult;
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0.7f, 0.55f, 0.1f, 1f);
		((ColorBlock)(ref val)).normalColor = val2;
		((ColorBlock)(ref val)).highlightedColor = val2;
		selectedButtonColors = val;
		container = new GameObject("CommandQueueScoreboardWrapper", new Type[1] { typeof(RectTransform) });
		RectTransform component = container.GetComponent<RectTransform>();
		saveLoadContainer = new GameObject("SaveLoadContainer", new Type[1] { typeof(RectTransform) });
		RectTransform component2 = saveLoadContainer.GetComponent<RectTransform>();
		origContainer = ((Component)scoreboard).gameObject;
		RectTransform component3 = origContainer.GetComponent<RectTransform>();
		((Transform)component).SetParent((Transform)(object)component3, false);
		component.anchorMin = new Vector2(0f, 0f);
		component.anchorMax = new Vector2(1f, 0.83f);
		component.offsetMin = new Vector2(0f, 0f);
		component.offsetMax = new Vector2(0f, 0f);
		ReparentChildren((Transform)(object)component, (Transform)(object)component3);
		queueContainer = new GameObject("CommandQueueContainer", new Type[1] { typeof(RectTransform) });
		Transform transform = queueContainer.transform;
		RectTransform val3 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
		((Transform)component2).SetParent((Transform)(object)component3, false);
		saveLoadContainer.SetActive(false);
		CopyRectTransform(component2, component);
		CreateSaveLoadContainer(saveLoadContainer);
		((Transform)val3).SetParent((Transform)(object)component3, false);
		CopyRectTransform(val3, component);
		Dictionary<ItemTier, string> dictionary = new Dictionary<ItemTier, string>
		{
			{
				(ItemTier)0,
				"White"
			},
			{
				(ItemTier)1,
				"Green"
			},
			{
				(ItemTier)2,
				"Red"
			},
			{
				(ItemTier)4,
				"Boss"
			},
			{
				(ItemTier)3,
				"Lunar"
			},
			{
				(ItemTier)6,
				"Void W"
			},
			{
				(ItemTier)7,
				"Void G"
			},
			{
				(ItemTier)8,
				"Void R"
			},
			{
				(ItemTier)9,
				"Void B"
			}
		};
		ModConfig.ItemTierSet value = ModConfig.enabledTabs.Value;
		_ = value.Count;
		int num = 0;
		foreach (ItemTier tier in value)
		{
			string text = (dictionary.ContainsKey(tier) ? dictionary[tier] : ModConfig.GetTierName(tier));
			string text2 = text;
			ButtonWrapper value2 = CreateButton(queueContainer, (UnityAction)delegate
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				SelectedQueue = tier;
			}, text2);
			value2.rectTransform.anchorMin = new Vector2((float)num / (float)value.Count, 86f / 93f);
			value2.rectTransform.anchorMax = new Vector2((float)(num + 1) / (float)value.Count, 1f);
			value2.rectTransform.anchoredPosition = default(Vector2);
			value2.rectTransform.sizeDelta = default(Vector2);
			RectTransform val4 = CreateQueueContainer(tier, val3, delegate(PickupIndex index)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				QueueManager.Enqueue(index);
			});
			val4.anchorMin = new Vector2(0f, 0f);
			val4.anchorMax = new Vector2(1f, 86f / 93f);
			val4.sizeDelta = default(Vector2);
			val4.anchoredPosition = default(Vector2);
			((Component)val4).gameObject.SetActive(false);
			queueDisplays[tier] = ((Component)val4).gameObject;
			queueButtons[tier] = value2;
			num++;
		}
		selectedQueue = value.First();
		queueDisplays[selectedQueue].SetActive(true);
		ExecuteNextFrame(delegate
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			MarkButton(queueButtons[selectedQueue], state: true);
		});
		queueContainer.SetActive(false);
		scoreboardButton = CreateButton(origContainer, null, "Scoreboard");
		scoreboardButton.rectTransform.anchoredPosition = default(Vector2);
		scoreboardButton.rectTransform.anchorMin = new Vector2(0f, 0.93f);
		scoreboardButton.rectTransform.anchorMax = new Vector2(0.333f, 1f);
		scoreboardButton.rectTransform.sizeDelta = default(Vector2);
		scoreboardButton.onClick += (UnityAction)delegate
		{
			DisplayingQueues = 1;
		};
		queueButton = CreateButton(origContainer, null, "Command Queue");
		queueButton.rectTransform.anchoredPosition = default(Vector2);
		queueButton.rectTransform.anchorMin = new Vector2(0.333f, 0.93f);
		queueButton.rectTransform.anchorMax = new Vector2(0.667f, 1f);
		queueButton.rectTransform.sizeDelta = default(Vector2);
		queueButton.onClick += (UnityAction)delegate
		{
			DisplayingQueues = 0;
		};
		saveLoadButton = CreateButton(origContainer, null, "Saves");
		saveLoadButton.rectTransform.anchoredPosition = default(Vector2);
		saveLoadButton.rectTransform.anchorMin = new Vector2(0.666f, 0.93f);
		saveLoadButton.rectTransform.anchorMax = new Vector2(1f, 1f);
		saveLoadButton.rectTransform.sizeDelta = default(Vector2);
		saveLoadButton.onClick += (UnityAction)delegate
		{
			DisplayingQueues = 2;
		};
		ExecuteNextFrame(delegate
		{
			UpdateButtonColors();
		});
	}

	public void Awake()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		if (!CommandQueue.IsLoaded)
		{
			Object.Destroy((Object)(object)this);
			return;
		}
		InitializeStatic();
		if (!staticInitialized)
		{
			Object.Destroy((Object)(object)this);
			return;
		}
		repeatIconTexture = new Texture2D(0, 0);
		using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CommandQueue.repeat-solid.png"))
		{
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			byte[] array = memoryStream.ToArray();
			ImageConversion.LoadImage(repeatIconTexture, array);
		}
		scoreboard = ((Component)this).GetComponent<ScoreboardController>();
		hud = ((Component)this).GetComponentInParent<HUD>();
		missingUnlockIcon = Resources.Load<Sprite>("Textures/MiscIcons/texUnlockIcon");
		itemInventoryDisplayPrefab = scoreboard.stripPrefab.GetComponent<ScoreboardStrip>().itemInventoryDisplay;
		ItemInventoryDisplay itemInventoryDisplay = LegacyResourcesAPI.Load<GameObject>("Prefabs/HUDSimple").GetComponent<HUD>().itemInventoryDisplay;
		itemIconPrefab = itemInventoryDisplay.itemIconPrefab;
		CommandQueue.PluginUnloaded += delegate
		{
			Object.DestroyImmediate((Object)(object)this);
		};
	}

	private void OnDestroy()
	{
		DestroyUI();
		Object.Destroy((Object)(object)repeatIconTexture);
	}

	private void OnEnable()
	{
		if ((Object)(object)container == (Object)null)
		{
			RebuildUI();
		}
	}
}