Decompiled source of CENI RELOAD v1.0.0

plugins/CENI_RELOAD/CENI_RELOAD.dll

Decompiled 9 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jaosnake.CeniReload.Core;
using Jaosnake.CeniReload.Localization;
using Jaosnake.CeniReload.Model;
using Jaosnake.CeniReload.Storage;
using Jaosnake.CeniReload.UI;
using Microsoft.CodeAnalysis;
using Rewired;
using RoR2;
using RoR2.Artifacts;
using RoR2.UI;
using RoR2.UI.MainMenu;
using SimpleJSON;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
using Zio;
using Zio.FileSystems;

[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("Jaosnake")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Original stage checkpoint vault for Risk of Rain 2 with 5 slots per survivor, redesigned card UI, controller navigation, and EN/pt-BR localization.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c1897201b22445fd1a7f1e8f00ded34fc2352431")]
[assembly: AssemblyProduct("CENI_RELOAD")]
[assembly: AssemblyTitle("CENI_RELOAD")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Jaosnake.CeniReload
{
	[BepInPlugin("com.Jaosnake.CENI_RELOAD", "CENI_RELOAD", "1.0.0")]
	public class CeniReloadPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.Jaosnake.CENI_RELOAD";

		public const string PluginName = "CENI_RELOAD";

		public const string PluginVersion = "1.0.0";

		private Harmony _harmony;

		public static ManualLogSource Log { get; private set; }

		public static ConfigEntry<bool> AutoSaveEnabled { get; private set; }

		public static ConfigEntry<bool> ShowChatNotifications { get; private set; }

		public static ConfigEntry<bool> UseCloudStorage { get; private set; }

		public static ConfigEntry<string> CloudStorageSubDirectory { get; private set; }

		public static bool IsApplicationQuitting { get; private set; }

		private void Awake()
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			AutoSaveEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Checkpoints", "AutoSaveOnStageStart", true, "Automatically record a checkpoint at the start of every gameplay stage from Stage 2 onward.");
			ShowChatNotifications = ((BaseUnityPlugin)this).Config.Bind<bool>("Notifications", "ShowChatMessages", true, "Show a chat notification when CENI_RELOAD saves or restores a checkpoint.");
			UseCloudStorage = ((BaseUnityPlugin)this).Config.Bind<bool>("Storage", "UseCloudStorage", false, "Store the 5-slot Checkpoint Vault in Steam / Epic Games Cloud Storage instead of local BepInEx/config.");
			CloudStorageSubDirectory = ((BaseUnityPlugin)this).Config.Bind<string>("Storage", "CloudStorageSubDirectory", "CENI_RELOAD", "Subdirectory inside Steam / Epic Cloud Storage used when UseCloudStorage is enabled (change to isolate mod profiles).");
			CeniReloadStrings.LoadExternalOverrides(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location));
			_harmony = new Harmony("com.Jaosnake.CENI_RELOAD");
			_harmony.PatchAll(typeof(CeniReloadPlugin).Assembly);
			Log.LogInfo((object)"CENI_RELOAD v1.0.0 initialized (100% original standalone architecture).");
		}

		private void OnApplicationQuit()
		{
			IsApplicationQuitting = true;
		}

		private void OnDestroy()
		{
			if (!IsApplicationQuitting)
			{
				Harmony harmony = _harmony;
				if (harmony != null)
				{
					harmony.UnpatchSelf();
				}
			}
		}
	}
}
namespace Jaosnake.CeniReload.UI
{
	public class CeniReloadVaultController : MonoBehaviour
	{
		private sealed class SlotCardView
		{
			public int SlotNumber;

			public CheckpointSnapshot Snapshot;

			public MPButton Button;

			public Image AccentStrip;

			public Image PortraitFrame;

			public RawImage LockBadge;

			public VaultFocusHighlight Highlight;
		}

		private enum VaultFilterMode
		{
			CurrentSurvivor,
			Multiplayer,
			All
		}

		private CharacterSelectController _lobby;

		private MainMenuController _mainMenu;

		private bool _isMainMenuMode;

		private MPButton _triggerButton;

		private TextMeshProUGUI _triggerLabel;

		private GameObject _modalRoot;

		private MPEventSystemProvider _modalEventSystemProvider;

		private UILayer _modalLayer;

		private UILayerKey _modalLayerKey;

		private TextMeshProUGUI _titleText;

		private TextMeshProUGUI _subtitleText;

		private MPButton _filterButton;

		private TextMeshProUGUI _filterButtonLabel;

		private MPButton _closeButton;

		private TextMeshProUGUI _closeButtonLabel;

		private TextMeshProUGUI _footerHintText;

		private ScrollRect _scrollRect;

		private Image _leftPanelImage;

		private RectTransform _leftPanelRect;

		private RectTransform _rightPanelRect;

		private Transform _cardsContainer;

		private Image _inspectorPortraitFrame;

		private RawImage _inspectorLockBadge;

		private TextMeshProUGUI _inspectorTitle;

		private TextMeshProUGUI _inspectorBody;

		private TextMeshProUGUI _inspectorModStatus;

		private GameObject _allLockedWarningBanner;

		private TextMeshProUGUI _allLockedWarningText;

		private MPButton _loadButton;

		private TextMeshProUGUI _loadButtonLabel;

		private MPButton _deleteButton;

		private TextMeshProUGUI _deleteButtonLabel;

		private GameObject _deleteConfirmBar;

		private TextMeshProUGUI _confirmPromptText;

		private MPButton _confirmYesButton;

		private TextMeshProUGUI _confirmYesLabel;

		private MPButton _confirmNoButton;

		private TextMeshProUGUI _confirmNoLabel;

		private VaultFilterMode _filterMode;

		private CheckpointSnapshot _selectedSnapshot;

		private readonly List<GameObject> _spawnedCards = new List<GameObject>();

		private readonly List<SlotCardView> _cardViews = new List<SlotCardView>();

		private bool _hasCachedDock;

		private Vector2 _cachedDockSize;

		private Vector3 _cachedDockLocalPos;

		private InputSource _lastInputSource;

		private bool _hasLastInputSource;

		private string _lastLanguageName;

		private int _openedFrame = -1;

		private int _closedFrame = -1;

		private int _lastActionFrame = -1;

		private float _lastLockToggleTime = -10f;

		private bool _loggedLobbyGamepadInfo;

		private Coroutine _alignCoroutine;

		private Coroutine _focusCoroutine;

		public static CeniReloadVaultController AttachTo(CharacterSelectController controller)
		{
			return AttachToLobby(controller);
		}

		public static CeniReloadVaultController AttachToLobby(CharacterSelectController controller)
		{
			if ((Object)(object)controller == (Object)null)
			{
				return null;
			}
			CeniReloadVaultController component = ((Component)controller).GetComponent<CeniReloadVaultController>();
			if ((Object)(object)component != (Object)null)
			{
				return component;
			}
			CeniReloadVaultController ceniReloadVaultController = ((Component)controller).gameObject.AddComponent<CeniReloadVaultController>();
			ceniReloadVaultController.InitializeLobby(controller);
			return ceniReloadVaultController;
		}

		public static CeniReloadVaultController AttachToMainMenu(MainMenuController controller)
		{
			if ((Object)(object)controller == (Object)null)
			{
				return null;
			}
			CeniReloadVaultController component = ((Component)controller).GetComponent<CeniReloadVaultController>();
			if ((Object)(object)component != (Object)null)
			{
				return component;
			}
			CeniReloadVaultController ceniReloadVaultController = ((Component)controller).gameObject.AddComponent<CeniReloadVaultController>();
			ceniReloadVaultController.InitializeMainMenu(controller);
			return ceniReloadVaultController;
		}

		private void InitializeLobby(CharacterSelectController controller)
		{
			_lobby = controller;
			_isMainMenuMode = false;
			_filterMode = (IsInMultiplayerLobby() ? VaultFilterMode.Multiplayer : VaultFilterMode.CurrentSurvivor);
			BuildLobbyTriggerButton();
			BuildVaultModal();
			SetModalOpen(open: false);
		}

		private void InitializeMainMenu(MainMenuController controller)
		{
			_mainMenu = controller;
			_isMainMenuMode = true;
			_filterMode = VaultFilterMode.All;
			BuildMainMenuTriggerButton();
			BuildVaultModal();
			SetModalOpen(open: false);
		}

		private static bool IsInMultiplayerLobby()
		{
			if ((Object)(object)PreGameController.instance != (Object)null && NetworkUser.readOnlyInstancesList != null)
			{
				return NetworkUser.readOnlyInstancesList.Count > 1;
			}
			return false;
		}

		private bool IsLobbyHostAllowed()
		{
			if (_isMainMenuMode)
			{
				return true;
			}
			if ((Object)(object)PreGameController.instance != (Object)null && !NetworkServer.active)
			{
				return false;
			}
			return true;
		}

		private void OnEnable()
		{
			if (!_isMainMenuMode && (Object)(object)_triggerButton != (Object)null)
			{
				ScheduleLobbyAlignment();
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)_modalLayerKey != (Object)null)
			{
				((Behaviour)_modalLayerKey).enabled = false;
			}
			if (!CeniReloadPlugin.IsApplicationQuitting)
			{
				if ((Object)(object)_modalRoot != (Object)null)
				{
					Object.Destroy((Object)(object)_modalRoot);
					_modalRoot = null;
				}
				if ((Object)(object)_triggerButton != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)_triggerButton).gameObject);
					_triggerButton = null;
				}
				if ((Object)(object)_modalLayer != (Object)null)
				{
					Object.Destroy((Object)(object)_modalLayer);
					_modalLayer = null;
				}
			}
		}

		private void Update()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Invalid comparison between Unknown and I4
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Invalid comparison between Unknown and I4
			MPEventSystem val = ResolveActiveEventSystem();
			string currentLanguageName = Language.currentLanguageName;
			if (!string.Equals(currentLanguageName, _lastLanguageName, StringComparison.Ordinal))
			{
				_lastLanguageName = currentLanguageName;
				if ((Object)(object)_modalRoot != (Object)null && _modalRoot.activeSelf)
				{
					RefreshLocalization();
					RebuildSlotCards();
				}
				else
				{
					RefreshTriggerLabel();
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				InputSource currentInputSource = val.currentInputSource;
				if (!_hasLastInputSource || currentInputSource != _lastInputSource)
				{
					_hasLastInputSource = true;
					_lastInputSource = currentInputSource;
					if (!_isMainMenuMode && (Object)(object)_triggerButton != (Object)null)
					{
						UpdateLobbyTriggerText(val);
						ScheduleLobbyAlignment();
					}
					UpdateFooterHint(val);
				}
			}
			if (!_isMainMenuMode && (Object)(object)_triggerButton != (Object)null)
			{
				bool flag = IsLobbyHostAllowed();
				if (((Component)_triggerButton).gameObject.activeSelf != flag)
				{
					((Component)_triggerButton).gameObject.SetActive(flag);
					if (!flag && (Object)(object)_modalRoot != (Object)null && _modalRoot.activeSelf)
					{
						SetModalOpen(open: false);
					}
				}
				if (flag)
				{
					if (!_loggedLobbyGamepadInfo && (Object)(object)val != (Object)null && (int)val.currentInputSource == 1)
					{
						_loggedLobbyGamepadInfo = true;
						LogLobbyGamepadDiagnostics(val);
					}
					if ((Object)(object)_modalRoot != (Object)null && !_modalRoot.activeSelf && Time.frameCount > _openedFrame && Time.frameCount > _closedFrame && ((Component)_triggerButton).gameObject.activeInHierarchy && IsGamepadVaultShortcutPressed(val) && !IsLobbyBlockedByOverlay())
					{
						ManualLogSource log = CeniReloadPlugin.Log;
						if (log != null)
						{
							log.LogInfo((object)"Opening Checkpoint Vault via Lobby gamepad shortcut.");
						}
						SetModalOpen(open: true);
						return;
					}
				}
			}
			if (!((Object)(object)_modalRoot != (Object)null) || !_modalRoot.activeSelf || Time.frameCount <= _openedFrame)
			{
				return;
			}
			if ((Object)(object)val != (Object)null && (int)val.currentInputSource == 1 && ((Object)(object)_modalLayerKey == (Object)null || _modalLayerKey.representsTopLayer))
			{
				GameObject currentSelectedGameObject = ((EventSystem)val).currentSelectedGameObject;
				if ((Object)(object)currentSelectedGameObject == (Object)null || !currentSelectedGameObject.activeInHierarchy || !currentSelectedGameObject.transform.IsChildOf(_modalRoot.transform))
				{
					FocusDefaultModalControl();
				}
			}
			if (_selectedSnapshot != null && _lastActionFrame != Time.frameCount && ((Object)(object)_deleteConfirmBar == (Object)null || !_deleteConfirmBar.activeSelf) && IsGamepadLockButtonPressed(val))
			{
				_lastActionFrame = Time.frameCount;
				ToggleLockOnSnapshot(_selectedSnapshot);
				return;
			}
			bool flag2 = Input.GetKeyDown((KeyCode)27) || Input.GetKeyDown((KeyCode)331);
			if (!flag2 && (Object)(object)val != (Object)null && val.player != null && val.player.GetButtonDown(15))
			{
				flag2 = true;
			}
			if (flag2 && _lastActionFrame != Time.frameCount)
			{
				_lastActionFrame = Time.frameCount;
				if ((Object)(object)_deleteConfirmBar != (Object)null && _deleteConfirmBar.activeSelf)
				{
					SetDeleteConfirmVisible(visible: false);
				}
				else
				{
					SetModalOpen(open: false);
				}
			}
		}

		public void RefreshTriggerLabel()
		{
			if ((Object)(object)_triggerLabel != (Object)null)
			{
				if (_isMainMenuMode)
				{
					((TMP_Text)_triggerLabel).text = CeniReloadStrings.Get("CENIRELOAD_MAINMENU_LOAD");
				}
				else
				{
					UpdateLobbyTriggerText(MPEventSystemManager.primaryEventSystem);
				}
			}
			if (!_isMainMenuMode && ((Behaviour)this).isActiveAndEnabled && (Object)(object)_triggerButton != (Object)null)
			{
				ScheduleLobbyAlignment();
			}
		}

		private void UpdateLobbyTriggerText(MPEventSystem es)
		{
			if (!((Object)(object)_triggerLabel == (Object)null))
			{
				string text = CeniReloadStrings.Get("CENIRELOAD_BTN_OPEN_VAULT");
				string gamepadVaultGlyph = GetGamepadVaultGlyph(es);
				((TMP_Text)_triggerLabel).text = (string.IsNullOrEmpty(gamepadVaultGlyph) ? text : (gamepadVaultGlyph + text));
			}
		}

		private static string GetGamepadVaultGlyph(MPEventSystem es)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Invalid comparison between Unknown and I4
			if ((Object)(object)es == (Object)null || (int)es.currentInputSource != 1)
			{
				return string.Empty;
			}
			string text = string.Empty;
			ControllerHelper val = es.player?.controllers;
			Controller val2 = ((val != null) ? val.GetLastActiveController() : null);
			if (val2 != null && (int)val2.type == 2)
			{
				text = (val2.name + " " + val2.hardwareName).ToLowerInvariant();
			}
			else if (val != null && val.Joysticks != null && val.Joysticks.Count > 0)
			{
				Joystick val3 = val.Joysticks[0];
				if (val3 != null)
				{
					text = (((Controller)val3).name + " " + ((Controller)val3).hardwareName).ToLowerInvariant();
				}
			}
			if (text.Contains("dualsense") || text.Contains("ps5"))
			{
				return "<sprite=\"tmpsprPS5GlyphsUnified\" name=\"texPS5GlyphsUnified_Triangle\"> ";
			}
			if (text.Contains("dualshock") || text.Contains("ps4") || text.Contains("playstation") || text.Contains("sony"))
			{
				return "<sprite=\"tmpsprPS4GlyphsUnified\" name=\"texPS4GlyphsUnified_1\"> ";
			}
			if (text.Contains("switch") || text.Contains("pro controller") || text.Contains("joy-con"))
			{
				return "<sprite=\"tmpsprSwitchGlyphsUnified\" name=\"texSwitchGlyphsUnified_2\"> ";
			}
			return "<sprite=\"tmpsprXboxOneGlyphs\" name=\"texXBoxOneGlyphs_11\"> ";
		}

		private MPEventSystem ResolveActiveEventSystem()
		{
			if ((Object)(object)_lobby != (Object)null)
			{
				MPEventSystemLocator component = ((Component)_lobby).GetComponent<MPEventSystemLocator>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.eventSystem != (Object)null)
				{
					return component.eventSystem;
				}
			}
			return MPEventSystemManager.primaryEventSystem ?? MPEventSystemManager.combinedEventSystem;
		}

		private bool IsGamepadActive(MPEventSystem es = null)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Invalid comparison between Unknown and I4
			MPEventSystem val = es ?? ResolveActiveEventSystem();
			if ((Object)(object)val != (Object)null)
			{
				return (int)val.currentInputSource == 1;
			}
			return false;
		}

		private static string GetGamepadLockGlyph(MPEventSystem es)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Invalid comparison between Unknown and I4
			if ((Object)(object)es == (Object)null || (int)es.currentInputSource != 1)
			{
				return string.Empty;
			}
			string text = string.Empty;
			ControllerHelper val = es.player?.controllers;
			Controller val2 = ((val != null) ? val.GetLastActiveController() : null);
			if (val2 != null && (int)val2.type == 2)
			{
				text = (val2.name + " " + val2.hardwareName).ToLowerInvariant();
			}
			else if (val != null && val.Joysticks != null && val.Joysticks.Count > 0)
			{
				Joystick val3 = val.Joysticks[0];
				if (val3 != null)
				{
					text = (((Controller)val3).name + " " + ((Controller)val3).hardwareName).ToLowerInvariant();
				}
			}
			if (text.Contains("dualsense") || text.Contains("ps5"))
			{
				return "<sprite=\"tmpsprPS5GlyphsUnified\" name=\"texPS5GlyphsUnified_Square\"> ";
			}
			if (text.Contains("dualshock") || text.Contains("ps4") || text.Contains("playstation") || text.Contains("sony"))
			{
				return "<sprite=\"tmpsprPS4GlyphsUnified\" name=\"texPS4GlyphsUnified_3\"> ";
			}
			if (text.Contains("switch") || text.Contains("pro controller") || text.Contains("joy-con"))
			{
				return "<sprite=\"tmpsprSwitchGlyphsUnified\" name=\"texSwitchGlyphsUnified_3\"> ";
			}
			return "<sprite=\"tmpsprXboxOneGlyphs\" name=\"texXBoxOneGlyphs_7\"> ";
		}

		private void UpdateFooterHint(MPEventSystem es = null)
		{
			if (!((Object)(object)_footerHintText == (Object)null))
			{
				MPEventSystem es2 = es ?? ResolveActiveEventSystem();
				if (IsGamepadActive(es2))
				{
					string gamepadLockGlyph = GetGamepadLockGlyph(es2);
					((TMP_Text)_footerHintText).text = CeniReloadStrings.Format("CENIRELOAD_UI_HINT_GAMEPAD", gamepadLockGlyph);
				}
				else
				{
					((TMP_Text)_footerHintText).text = CeniReloadStrings.Get("CENIRELOAD_UI_HINT_KBM");
				}
			}
		}

		private bool IsGamepadLockButtonPressed(MPEventSystem es)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			bool flag = false;
			MPEventSystem val = es ?? ResolveActiveEventSystem();
			if ((Object)(object)val != (Object)null && val.player != null)
			{
				if ((int)val.currentInputSource == 1 && val.player.GetButtonDown(31))
				{
					return true;
				}
				if (val.player.controllers != null)
				{
					IList<Joystick> joysticks = val.player.controllers.Joysticks;
					if (joysticks.Count > 0)
					{
						flag = true;
					}
					for (int i = 0; i < joysticks.Count; i++)
					{
						if (IsJoystickLeftFaceButtonJustPressed(joysticks[i]))
						{
							return true;
						}
					}
				}
			}
			if (ReInput.isReady && ReInput.controllers != null)
			{
				IList<Joystick> joysticks2 = ReInput.controllers.Joysticks;
				if (joysticks2.Count > 0)
				{
					flag = true;
				}
				for (int j = 0; j < joysticks2.Count; j++)
				{
					if (IsJoystickLeftFaceButtonJustPressed(joysticks2[j]))
					{
						return true;
					}
				}
			}
			if (!flag)
			{
				return Input.GetKeyDown((KeyCode)332);
			}
			return false;
		}

		private static bool IsJoystickLeftFaceButtonJustPressed(Joystick joy)
		{
			if (joy == null)
			{
				return false;
			}
			IList<IControllerTemplate> templates = ((Controller)joy).Templates;
			if (templates != null)
			{
				for (int i = 0; i < templates.Count; i++)
				{
					IControllerTemplate val = templates[i];
					if (val == null || val.elements == null)
					{
						continue;
					}
					IList<IControllerTemplateElement> elements = val.elements;
					for (int j = 0; j < elements.Count; j++)
					{
						IControllerTemplateElement obj = elements[j];
						IControllerTemplateButton val2 = (IControllerTemplateButton)(object)((obj is IControllerTemplateButton) ? obj : null);
						if (val2 != null && ((IControllerTemplateElement)val2).exists && val2.justPressed)
						{
							string text = elements[j].descriptiveName ?? string.Empty;
							if (text.IndexOf("Action Top Row 1", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Action Left", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Left Face", StringComparison.OrdinalIgnoreCase) >= 0)
							{
								return true;
							}
						}
					}
				}
			}
			string text2 = (((Controller)joy).name + " " + ((Controller)joy).hardwareName).ToLowerInvariant();
			bool flag = text2.Contains("switch") || text2.Contains("pro controller") || text2.Contains("joy-con");
			if (flag)
			{
				if (((Controller)joy).GetButtonDownById(6))
				{
					return true;
				}
			}
			else if (((Controller)joy).GetButtonDownById(8))
			{
				return true;
			}
			IList<Button> buttons = ((Controller)joy).Buttons;
			for (int k = 0; k < buttons.Count; k++)
			{
				Button val3 = buttons[k];
				if (val3 != null && val3.justPressed)
				{
					string text3 = ((((Element)val3).elementIdentifier != null) ? (((Element)val3).elementIdentifier.name ?? string.Empty) : string.Empty);
					int num = ((((Element)val3).elementIdentifier != null) ? ((Element)val3).elementIdentifier.id : (-1));
					if ((!flag && num == 8) || (flag && num == 6) || (!flag && text3.Equals("X", StringComparison.OrdinalIgnoreCase)) || (flag && text3.Equals("Y", StringComparison.OrdinalIgnoreCase)) || text3.Equals("Square", StringComparison.OrdinalIgnoreCase) || text3.Equals("Action Top Row 1", StringComparison.OrdinalIgnoreCase) || text3.Equals("Button X", StringComparison.OrdinalIgnoreCase))
					{
						return true;
					}
					if (k == 2 && IsGenericOrUnlabeledButton(text3))
					{
						return true;
					}
				}
			}
			return false;
		}

		private bool IsLobbyBlockedByOverlay()
		{
			if (PauseScreenController.instancesList != null && PauseScreenController.instancesList.Count > 0)
			{
				return true;
			}
			if (SimpleDialogBox.instancesList != null && SimpleDialogBox.instancesList.Count > 0)
			{
				return true;
			}
			UILayerKey val = (((Object)(object)_triggerButton != (Object)null) ? _triggerButton.requiredTopLayer : null);
			if ((Object)(object)val != (Object)null && ((Behaviour)val).isActiveAndEnabled && !val.representsTopLayer)
			{
				return true;
			}
			return false;
		}

		private void LogLobbyGamepadDiagnostics(MPEventSystem es)
		{
			try
			{
				string text = "none";
				if ((Object)(object)es != (Object)null && es.player != null && es.player.controllers != null && es.player.controllers.Joysticks.Count > 0)
				{
					Joystick val = es.player.controllers.Joysticks[0];
					if (val != null)
					{
						text = $"'{((Controller)val).name}' (hw='{((Controller)val).hardwareName}', buttons={((Controller)val).buttonCount}, templates={((Controller)val).templateCount})";
					}
				}
				else if (ReInput.isReady && ReInput.controllers != null && ReInput.controllers.Joysticks.Count > 0)
				{
					Joystick val2 = ReInput.controllers.Joysticks[0];
					if (val2 != null)
					{
						text = $"global '{((Controller)val2).name}' (hw='{((Controller)val2).hardwareName}', buttons={((Controller)val2).buttonCount}, templates={((Controller)val2).templateCount})";
					}
				}
				UILayerKey val3 = (((Object)(object)_triggerButton != (Object)null) ? _triggerButton.requiredTopLayer : null);
				string text2 = (((Object)(object)val3 != (Object)null) ? $"{((Object)val3).name} (active={((Behaviour)val3).isActiveAndEnabled}, top={val3.representsTopLayer})" : "null");
				ManualLogSource log = CeniReloadPlugin.Log;
				if (log != null)
				{
					log.LogInfo((object)("Lobby gamepad ready: joystick=" + text + ", lobbyLayer=" + text2));
				}
			}
			catch
			{
			}
		}

		private bool IsGamepadVaultShortcutPressed(MPEventSystem es)
		{
			MPEventSystem val = es ?? ResolveActiveEventSystem();
			if ((Object)(object)val != (Object)null && val.player != null && val.player.controllers != null)
			{
				IList<Joystick> joysticks = val.player.controllers.Joysticks;
				for (int i = 0; i < joysticks.Count; i++)
				{
					if (IsJoystickTopFaceButtonJustPressed(joysticks[i]))
					{
						return true;
					}
				}
			}
			ReadOnlyCollection<MPEventSystem> readOnlyInstancesList = MPEventSystem.readOnlyInstancesList;
			if (readOnlyInstancesList != null)
			{
				for (int j = 0; j < readOnlyInstancesList.Count; j++)
				{
					MPEventSystem val2 = readOnlyInstancesList[j];
					if ((Object)(object)val2 == (Object)null || (Object)(object)val2 == (Object)(object)val || val2.player == null || val2.player.controllers == null)
					{
						continue;
					}
					IList<Joystick> joysticks2 = val2.player.controllers.Joysticks;
					for (int k = 0; k < joysticks2.Count; k++)
					{
						if (IsJoystickTopFaceButtonJustPressed(joysticks2[k]))
						{
							return true;
						}
					}
				}
			}
			if (ReInput.isReady && ReInput.controllers != null)
			{
				IList<Joystick> joysticks3 = ReInput.controllers.Joysticks;
				for (int l = 0; l < joysticks3.Count; l++)
				{
					if (IsJoystickTopFaceButtonJustPressed(joysticks3[l]))
					{
						return true;
					}
				}
			}
			return Input.GetKeyDown((KeyCode)333);
		}

		private static bool IsJoystickTopFaceButtonJustPressed(Joystick joy)
		{
			if (joy == null)
			{
				return false;
			}
			IList<IControllerTemplate> templates = ((Controller)joy).Templates;
			if (templates != null)
			{
				for (int i = 0; i < templates.Count; i++)
				{
					IControllerTemplate val = templates[i];
					if (val == null || val.elements == null)
					{
						continue;
					}
					IList<IControllerTemplateElement> elements = val.elements;
					for (int j = 0; j < elements.Count; j++)
					{
						IControllerTemplateElement obj = elements[j];
						IControllerTemplateButton val2 = (IControllerTemplateButton)(object)((obj is IControllerTemplateButton) ? obj : null);
						if (val2 != null && ((IControllerTemplateElement)val2).exists && val2.justPressed)
						{
							string text = elements[j].descriptiveName ?? string.Empty;
							if (text.IndexOf("Action Top Row 2", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Top Face", StringComparison.OrdinalIgnoreCase) >= 0)
							{
								return true;
							}
						}
					}
				}
			}
			string text2 = (((Controller)joy).name + " " + ((Controller)joy).hardwareName).ToLowerInvariant();
			bool flag = text2.Contains("switch") || text2.Contains("pro controller") || text2.Contains("joy-con");
			if (flag)
			{
				if (((Controller)joy).GetButtonDownById(7))
				{
					return true;
				}
			}
			else if (((Controller)joy).GetButtonDownById(9))
			{
				return true;
			}
			IList<Button> buttons = ((Controller)joy).Buttons;
			for (int k = 0; k < buttons.Count; k++)
			{
				Button val3 = buttons[k];
				if (val3 != null && val3.justPressed)
				{
					string text3 = ((((Element)val3).elementIdentifier != null) ? (((Element)val3).elementIdentifier.name ?? string.Empty) : string.Empty);
					int num = ((((Element)val3).elementIdentifier != null) ? ((Element)val3).elementIdentifier.id : (-1));
					if ((!flag && num == 9) || (flag && num == 7) || text3.Equals("Y", StringComparison.OrdinalIgnoreCase) || text3.Equals("Triangle", StringComparison.OrdinalIgnoreCase) || text3.Equals("Action Top Row 2", StringComparison.OrdinalIgnoreCase) || text3.Equals("Button Y", StringComparison.OrdinalIgnoreCase) || text3.Equals("Face Button Top", StringComparison.OrdinalIgnoreCase))
					{
						return true;
					}
					if (k == 3 && IsGenericOrUnlabeledButton(text3))
					{
						return true;
					}
				}
			}
			return false;
		}

		private static bool IsGenericOrUnlabeledButton(string elName)
		{
			if (string.IsNullOrWhiteSpace(elName))
			{
				return true;
			}
			string text = elName.Trim();
			if (text.StartsWith("Button ", StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (!text.Equals("A", StringComparison.OrdinalIgnoreCase) && !text.Equals("B", StringComparison.OrdinalIgnoreCase) && !text.Equals("X", StringComparison.OrdinalIgnoreCase) && !text.Equals("Cross", StringComparison.OrdinalIgnoreCase) && !text.Equals("Circle", StringComparison.OrdinalIgnoreCase) && !text.Equals("Square", StringComparison.OrdinalIgnoreCase) && text.IndexOf("Left", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Right", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Shoulder", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Trigger", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Bumper", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Start", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Back", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Select", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Menu", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("View", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Options", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Share", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("Stick", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("D-Pad", StringComparison.OrdinalIgnoreCase) < 0)
			{
				text.IndexOf("DPad", StringComparison.OrdinalIgnoreCase);
				_ = 0;
			}
			return false;
		}

		private void ScheduleLobbyAlignment()
		{
			if (((Behaviour)this).isActiveAndEnabled && !_isMainMenuMode && !((Object)(object)_triggerButton == (Object)null))
			{
				if (_alignCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(_alignCoroutine);
				}
				_alignCoroutine = ((MonoBehaviour)this).StartCoroutine(AlignTriggerAboveBackButton());
			}
		}

		private Canvas ResolveHostCanvas()
		{
			Canvas val = null;
			if (_isMainMenuMode && (Object)(object)_mainMenu != (Object)null)
			{
				val = ((Component)_mainMenu).GetComponentInParent<Canvas>();
				if ((Object)(object)val == (Object)null && (Object)(object)_mainMenu.mainMenuButtonPanel != (Object)null)
				{
					val = _mainMenu.mainMenuButtonPanel.GetComponentInParent<Canvas>();
				}
				if ((Object)(object)val == (Object)null && (Object)(object)_mainMenu.singlePlayerButton != (Object)null)
				{
					val = ((Component)_mainMenu.singlePlayerButton).GetComponentInParent<Canvas>();
				}
			}
			else if ((Object)(object)_lobby != (Object)null)
			{
				val = ((Component)_lobby).GetComponentInParent<Canvas>();
			}
			if ((Object)(object)val != (Object)null && (Object)(object)val.rootCanvas != (Object)null)
			{
				return val.rootCanvas;
			}
			return val;
		}

		private UILayerKey FindLobbyLayerKey()
		{
			if ((Object)(object)_lobby == (Object)null)
			{
				return null;
			}
			if ((Object)(object)_lobby.readyButton != (Object)null && (Object)(object)_lobby.readyButton.requiredTopLayer != (Object)null && ((Behaviour)_lobby.readyButton.requiredTopLayer).isActiveAndEnabled)
			{
				return _lobby.readyButton.requiredTopLayer;
			}
			UILayerKey componentInParent = ((Component)_lobby).GetComponentInParent<UILayerKey>();
			if ((Object)(object)componentInParent != (Object)null && ((Behaviour)componentInParent).isActiveAndEnabled)
			{
				return componentInParent;
			}
			UILayerKey componentInChildren = ((Component)_lobby).GetComponentInChildren<UILayerKey>(false);
			if ((Object)(object)componentInChildren != (Object)null && ((Behaviour)componentInChildren).isActiveAndEnabled)
			{
				return componentInChildren;
			}
			return null;
		}

		private UILayerKey FindMainMenuLayerKey()
		{
			if ((Object)(object)_mainMenu == (Object)null)
			{
				return null;
			}
			if ((Object)(object)_mainMenu.singlePlayerButton != (Object)null && (Object)(object)((MPButton)_mainMenu.singlePlayerButton).requiredTopLayer != (Object)null)
			{
				return ((MPButton)_mainMenu.singlePlayerButton).requiredTopLayer;
			}
			return ((Component)_mainMenu).GetComponentInParent<UILayerKey>() ?? ((Component)_mainMenu).GetComponentInChildren<UILayerKey>(true);
		}

		private string GetSelectedSurvivorBodyName()
		{
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			object obj;
			if (firstLocalUser == null)
			{
				obj = null;
			}
			else
			{
				UserProfile userProfile = firstLocalUser.userProfile;
				obj = ((userProfile != null) ? userProfile.GetSurvivorPreference() : null);
			}
			SurvivorDef val = (SurvivorDef)obj;
			if ((Object)(object)val != (Object)null && (Object)(object)val.bodyPrefab != (Object)null)
			{
				return ((Object)val.bodyPrefab).name;
			}
			return string.Empty;
		}

		private string GetSelectedSurvivorDisplayName()
		{
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			object obj;
			if (firstLocalUser == null)
			{
				obj = null;
			}
			else
			{
				UserProfile userProfile = firstLocalUser.userProfile;
				obj = ((userProfile != null) ? userProfile.GetSurvivorPreference() : null);
			}
			SurvivorDef val = (SurvivorDef)obj;
			if ((Object)(object)val != (Object)null)
			{
				return CeniReloadStrings.LocalizeGameToken(val.displayNameToken, val.cachedName);
			}
			return "-";
		}

		private void BuildLobbyTriggerButton()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			Canvas val = ResolveHostCanvas();
			Transform val2 = (((Object)(object)val != (Object)null) ? ((Component)val).transform : ((Component)_lobby).transform);
			UILayerKey requiredTopLayer = FindLobbyLayerKey();
			_triggerButton = UiFactory.CreateButton("CENIRELOAD_OpenVaultButton", val2, CeniReloadStrings.Get("CENIRELOAD_BTN_OPEN_VAULT"), new Color(0.08f, 0.24f, 0.36f, 0.96f), UiFactory.AccentCyan, 14f, (UnityAction)delegate
			{
				SetModalOpen(open: true);
			}, out _triggerLabel, requiredTopLayer);
			if ((Object)(object)_triggerLabel != (Object)null)
			{
				((TMP_Text)_triggerLabel).enableAutoSizing = true;
				((TMP_Text)_triggerLabel).fontSizeMin = 10f;
				((TMP_Text)_triggerLabel).fontSizeMax = 15f;
				((TMP_Text)_triggerLabel).enableWordWrapping = false;
			}
			ApplyFallbackBottomRightDock(((Component)_triggerButton).GetComponent<RectTransform>(), (RectTransform)(object)((val2 is RectTransform) ? val2 : null));
			Navigation navigation = ((Selectable)_triggerButton).navigation;
			((Navigation)(ref navigation)).mode = (Mode)0;
			((Selectable)_triggerButton).navigation = navigation;
			VaultFocusHighlight component = ((Component)_triggerButton).gameObject.GetComponent<VaultFocusHighlight>();
			if ((Object)(object)component != (Object)null)
			{
				component.SetBaseColors(new Color(0.08f, 0.24f, 0.36f, 0.96f), UiFactory.AccentCyan);
			}
			else
			{
				Outline component2 = ((Component)_triggerButton).gameObject.GetComponent<Outline>();
				if ((Object)(object)component2 != (Object)null)
				{
					((Shadow)component2).effectColor = UiFactory.AccentCyan;
				}
			}
			ScheduleLobbyAlignment();
		}

		private void BuildMainMenuTriggerButton()
		{
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Expected O, but got Unknown
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Expected O, but got Unknown
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Expected O, but got Unknown
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Expected O, but got Unknown
			//IL_03ce: 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_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Expected O, but got Unknown
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Invalid comparison between Unknown and I4
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Invalid comparison between Unknown and I4
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_mainMenu == (Object)null)
			{
				return;
			}
			HGButton val = _mainMenu.singlePlayerButton;
			Transform val2 = (((Object)(object)val != (Object)null) ? ((Component)val).transform.parent : null);
			if ((Object)(object)val2 == (Object)null && (Object)(object)_mainMenu.mainMenuButtonPanel != (Object)null)
			{
				HGButton componentInChildren = _mainMenu.mainMenuButtonPanel.GetComponentInChildren<HGButton>(true);
				if ((Object)(object)componentInChildren != (Object)null)
				{
					val = componentInChildren;
					val2 = ((Component)componentInChildren).transform.parent;
				}
			}
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = ((Component)_mainMenu).transform;
			}
			string[] array = new string[2] { "CENIRELOAD_MainMenuLoadButton", "CENIRELOAD_MainMenuVaultButton" };
			foreach (string text in array)
			{
				Transform val3 = val2.Find(text);
				if ((Object)(object)val3 != (Object)null)
				{
					((Component)val3).gameObject.SetActive(false);
					val3.SetParent((Transform)null, false);
					Object.Destroy((Object)(object)((Component)val3).gameObject);
				}
			}
			HGButton val4 = null;
			if ((Object)(object)_mainMenu.onlineMultiplayerButtonTransition != (Object)null && (Object)(object)((Component)_mainMenu.onlineMultiplayerButtonTransition).transform.parent == (Object)(object)val2)
			{
				val4 = _mainMenu.onlineMultiplayerButtonTransition;
			}
			else
			{
				string value = Language.GetString("TITLE_MULTIPLAYER") ?? "Multiplayer";
				for (int j = 0; j < val2.childCount; j++)
				{
					Transform child = val2.GetChild(j);
					HGButton component = ((Component)child).GetComponent<HGButton>();
					if (!((Object)(object)component == (Object)null) && !((Object)(object)component == (Object)(object)val))
					{
						TextMeshProUGUI componentInChildren2 = ((Component)component).GetComponentInChildren<TextMeshProUGUI>(true);
						string text2 = (((Object)(object)componentInChildren2 != (Object)null) ? StripRichTextTags(((TMP_Text)componentInChildren2).text).Trim() : string.Empty);
						if (((Object)child).name.IndexOf("Multi", StringComparison.OrdinalIgnoreCase) >= 0 || text2.Equals(value, StringComparison.OrdinalIgnoreCase) || text2.Equals("Multiplayer", StringComparison.OrdinalIgnoreCase) || text2.Equals("Multijogador", StringComparison.OrdinalIgnoreCase))
						{
							val4 = component;
							break;
						}
					}
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				GameObject val5 = Object.Instantiate<GameObject>(((Component)val).gameObject, val2, false);
				((Object)val5).name = "CENIRELOAD_MainMenuLoadButton";
				val5.SetActive(true);
				LanguageTextMeshController[] componentsInChildren = val5.GetComponentsInChildren<LanguageTextMeshController>(true);
				for (int k = 0; k < componentsInChildren.Length; k++)
				{
					Object.DestroyImmediate((Object)(object)componentsInChildren[k]);
				}
				ViewableTag[] componentsInChildren2 = val5.GetComponentsInChildren<ViewableTag>(true);
				for (int l = 0; l < componentsInChildren2.Length; l++)
				{
					Object.DestroyImmediate((Object)(object)componentsInChildren2[l]);
				}
				for (int num = val5.transform.childCount - 1; num >= 0; num--)
				{
					Transform child2 = val5.transform.GetChild(num);
					if (((Object)child2).name.IndexOf("New", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)child2).name.IndexOf("Notification", StringComparison.OrdinalIgnoreCase) >= 0)
					{
						((Component)child2).gameObject.SetActive(false);
					}
				}
				HGButton val6 = (HGButton)(object)(_triggerButton = (MPButton)(object)val5.GetComponent<HGButton>());
				_triggerLabel = val5.GetComponentInChildren<TextMeshProUGUI>(true);
				if ((Object)(object)_triggerLabel != (Object)null)
				{
					((TMP_Text)_triggerLabel).text = CeniReloadStrings.Get("CENIRELOAD_MAINMENU_LOAD");
				}
				if ((Object)(object)val6 != (Object)null)
				{
					((Button)val6).onClick = new ButtonClickedEvent();
					((UnityEvent)((Button)val6).onClick).AddListener((UnityAction)delegate
					{
						SetModalOpen(open: true);
					});
					val6.updateTextOnHover = false;
					val6.hoverToken = string.Empty;
					LanguageTextMeshController hoverLanguageTextMeshController = val6.hoverLanguageTextMeshController;
					if ((Object)(object)hoverLanguageTextMeshController != (Object)null)
					{
						TextMeshProUGUI hoverTmp = ((Component)hoverLanguageTextMeshController).GetComponent<TextMeshProUGUI>();
						if ((Object)(object)hoverTmp != (Object)null)
						{
							((MPButton)val6).onSelect.AddListener((UnityAction)delegate
							{
								((TMP_Text)hoverTmp).text = CeniReloadStrings.Get("CENIRELOAD_MAINMENU_LOAD_DESC");
							});
							EventTrigger obj = val5.GetComponent<EventTrigger>() ?? val5.AddComponent<EventTrigger>();
							Entry val7 = new Entry
							{
								eventID = (EventTriggerType)0
							};
							((UnityEvent<BaseEventData>)(object)val7.callback).AddListener((UnityAction<BaseEventData>)delegate
							{
								((TMP_Text)hoverTmp).text = CeniReloadStrings.Get("CENIRELOAD_MAINMENU_LOAD_DESC");
							});
							obj.triggers.Add(val7);
						}
					}
				}
				int siblingIndex = (((Object)(object)val4 != (Object)null) ? (((Component)val4).transform.GetSiblingIndex() + 1) : Math.Min(((Component)val).transform.GetSiblingIndex() + 2, val2.childCount - 1));
				val5.transform.SetSiblingIndex(siblingIndex);
				Selectable val8 = (Selectable)(object)(((Object)(object)val4 != (Object)null) ? val4 : val);
				if (!((Object)(object)val8 != (Object)null) || !((Object)(object)_triggerButton != (Object)null))
				{
					return;
				}
				Navigation navigation = val8.navigation;
				if ((int)((Navigation)(ref navigation)).mode != 4)
				{
					return;
				}
				Navigation navigation2 = val8.navigation;
				Selectable selectOnDown = ((Navigation)(ref navigation2)).selectOnDown;
				((Navigation)(ref navigation2)).selectOnDown = (Selectable)(object)_triggerButton;
				val8.navigation = navigation2;
				Navigation navigation3 = ((Selectable)_triggerButton).navigation;
				((Navigation)(ref navigation3)).mode = (Mode)4;
				((Navigation)(ref navigation3)).selectOnUp = val8;
				((Navigation)(ref navigation3)).selectOnDown = selectOnDown;
				((Selectable)_triggerButton).navigation = navigation3;
				if ((Object)(object)selectOnDown != (Object)null)
				{
					Navigation navigation4 = selectOnDown.navigation;
					if ((int)((Navigation)(ref navigation4)).mode == 4)
					{
						((Navigation)(ref navigation4)).selectOnUp = (Selectable)(object)_triggerButton;
						selectOnDown.navigation = navigation4;
					}
				}
			}
			else
			{
				UILayerKey requiredTopLayer = FindMainMenuLayerKey();
				_triggerButton = UiFactory.CreateButton("CENIRELOAD_MainMenuLoadButton", val2, CeniReloadStrings.Get("CENIRELOAD_MAINMENU_LOAD"), new Color(0.16f, 0.2f, 0.26f, 0.94f), UiFactory.TextPrimary, 18f, (UnityAction)delegate
				{
					SetModalOpen(open: true);
				}, out _triggerLabel, requiredTopLayer);
				LayoutElement obj2 = ((Component)_triggerButton).gameObject.AddComponent<LayoutElement>();
				obj2.minHeight = 46f;
				obj2.preferredHeight = 46f;
				obj2.flexibleWidth = 1f;
			}
		}

		private void ApplyFallbackBottomRightDock(RectTransform trigRect, RectTransform canvasRect)
		{
			//IL_0034: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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)
			if (!((Object)(object)trigRect == (Object)null))
			{
				if ((Object)(object)canvasRect != (Object)null && (Object)(object)((Transform)trigRect).parent != (Object)(object)canvasRect)
				{
					((Transform)trigRect).SetParent((Transform)(object)canvasRect, false);
				}
				trigRect.anchorMin = new Vector2(1f, 0f);
				trigRect.anchorMax = new Vector2(1f, 0f);
				trigRect.pivot = new Vector2(1f, 0f);
				trigRect.sizeDelta = new Vector2(192f, 40f);
				trigRect.anchoredPosition = new Vector2(-92f, 88f);
				((Transform)trigRect).localScale = Vector3.one;
				((Transform)trigRect).localRotation = Quaternion.identity;
			}
		}

		private void ApplyCachedDock(RectTransform trigRect, RectTransform canvasRect)
		{
			//IL_0034: 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_005e: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)trigRect == (Object)null) && !((Object)(object)canvasRect == (Object)null))
			{
				if ((Object)(object)((Transform)trigRect).parent != (Object)(object)canvasRect)
				{
					((Transform)trigRect).SetParent((Transform)(object)canvasRect, false);
				}
				trigRect.anchorMin = new Vector2(0.5f, 0.5f);
				trigRect.anchorMax = new Vector2(0.5f, 0.5f);
				trigRect.pivot = new Vector2(0.5f, 0f);
				trigRect.sizeDelta = _cachedDockSize;
				((Transform)trigRect).localPosition = _cachedDockLocalPos;
				((Transform)trigRect).localScale = Vector3.one;
				((Transform)trigRect).localRotation = Quaternion.identity;
			}
		}

		private IEnumerator AlignTriggerAboveBackButton()
		{
			yield return null;
			yield return null;
			_alignCoroutine = null;
			if ((Object)(object)_triggerButton == (Object)null || (Object)(object)_lobby == (Object)null || _isMainMenuMode)
			{
				yield break;
			}
			if ((Object)(object)_triggerButton.requiredTopLayer == (Object)null)
			{
				UILayerKey val = FindLobbyLayerKey();
				if ((Object)(object)val != (Object)null)
				{
					_triggerButton.requiredTopLayer = val;
				}
			}
			Canvas val2 = ResolveHostCanvas();
			if ((Object)(object)val2 == (Object)null)
			{
				yield break;
			}
			RectTransform component = ((Component)_triggerButton).GetComponent<RectTransform>();
			Transform transform = ((Component)val2).transform;
			RectTransform val3 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			if ((Object)(object)component == (Object)null || (Object)(object)val3 == (Object)null)
			{
				yield break;
			}
			if ((Object)(object)_triggerLabel != (Object)null && (Object)(object)_lobby.readyButton != (Object)null)
			{
				TextMeshProUGUI componentInChildren = ((Component)_lobby.readyButton).GetComponentInChildren<TextMeshProUGUI>(true);
				if ((Object)(object)componentInChildren != (Object)null)
				{
					if ((Object)(object)((TMP_Text)componentInChildren).font != (Object)null)
					{
						((TMP_Text)_triggerLabel).font = ((TMP_Text)componentInChildren).font;
					}
					if ((Object)(object)((TMP_Text)componentInChildren).spriteAsset != (Object)null)
					{
						((TMP_Text)_triggerLabel).spriteAsset = ((TMP_Text)componentInChildren).spriteAsset;
					}
				}
			}
			MPEventSystem val4 = ResolveActiveEventSystem();
			if ((Object)(object)val4 != (Object)null && (int)val4.currentInputSource == 1)
			{
				ApplyFallbackBottomRightDock(component, val3);
				yield break;
			}
			RectTransform val5 = FindBackButtonRect(((Component)val2).transform, val3);
			float num;
			float num2;
			float num3;
			float y;
			int num4;
			if ((Object)(object)val5 != (Object)null && ((Component)val5).gameObject.activeInHierarchy)
			{
				Vector3[] array = (Vector3[])(object)new Vector3[4];
				val5.GetWorldCorners(array);
				Vector3 val6 = ((Transform)val3).InverseTransformPoint(array[0]);
				Vector3 val7 = ((Transform)val3).InverseTransformPoint(array[1]);
				Vector3 val8 = ((Transform)val3).InverseTransformPoint(array[2]);
				num = Mathf.Abs(val8.x - val7.x);
				num2 = Mathf.Abs(val7.y - val6.y);
				num3 = (val7.x + val8.x) * 0.5f;
				y = val7.y;
				if (num >= 110f && num2 >= 26f)
				{
					Rect rect = val3.rect;
					if (num3 >= ((Rect)(ref rect)).width * 0.25f)
					{
						rect = val3.rect;
						num4 = ((y <= (0f - ((Rect)(ref rect)).height) * 0.25f) ? 1 : 0);
						goto IL_02a8;
					}
				}
				num4 = 0;
				goto IL_02a8;
			}
			goto IL_032d;
			IL_032d:
			if (_hasCachedDock)
			{
				ApplyCachedDock(component, val3);
			}
			else
			{
				ApplyFallbackBottomRightDock(component, val3);
			}
			yield break;
			IL_02a8:
			if (num4 != 0)
			{
				Vector2 val9 = default(Vector2);
				((Vector2)(ref val9))..ctor(num, num2);
				Vector3 val10 = default(Vector3);
				((Vector3)(ref val10))..ctor(num3, y + 4f, 0f);
				Rect candidateLocalRect = default(Rect);
				((Rect)(ref candidateLocalRect))..ctor(val10.x - val9.x * 0.5f, val10.y, val9.x, val9.y);
				if (!OverlapsReadyButton(val3, candidateLocalRect))
				{
					_hasCachedDock = true;
					_cachedDockSize = val9;
					_cachedDockLocalPos = val10;
					ApplyCachedDock(component, val3);
					yield break;
				}
			}
			goto IL_032d;
		}

		private bool OverlapsReadyButton(RectTransform canvasRect, Rect candidateLocalRect)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_lobby == (Object)null || (Object)(object)_lobby.readyButton == (Object)null || !((Component)_lobby.readyButton).gameObject.activeInHierarchy)
			{
				return false;
			}
			RectTransform component = ((Component)_lobby.readyButton).GetComponent<RectTransform>();
			if ((Object)(object)component == (Object)null)
			{
				return false;
			}
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			component.GetWorldCorners(array);
			Vector3 val = ((Transform)canvasRect).InverseTransformPoint(array[0]);
			Vector3 val2 = ((Transform)canvasRect).InverseTransformPoint(array[2]);
			float num = Mathf.Min(val.x, val2.x);
			float num2 = Mathf.Max(val.x, val2.x);
			float num3 = Mathf.Min(val.y, val2.y);
			float num4 = Mathf.Max(val.y, val2.y);
			if (num2 - num < 10f || num4 - num3 < 10f)
			{
				return false;
			}
			Rect val3 = Rect.MinMaxRect(num, num3, num2, num4);
			return ((Rect)(ref candidateLocalRect)).Overlaps(val3);
		}

		private bool IsDisallowedDockButton(Button btn)
		{
			if ((Object)(object)btn == (Object)null || (Object)(object)btn == (Object)(object)_triggerButton)
			{
				return true;
			}
			if ((Object)(object)_lobby != (Object)null)
			{
				if ((Object)(object)_lobby.readyButton != (Object)null && (Object)(object)btn == (Object)(object)_lobby.readyButton)
				{
					return true;
				}
				if ((Object)(object)_lobby.unreadyButton != (Object)null && (Object)(object)btn == (Object)(object)_lobby.unreadyButton)
				{
					return true;
				}
			}
			string text = ((Object)btn).name ?? string.Empty;
			if (text.StartsWith("CENIRELOAD_", StringComparison.Ordinal))
			{
				return true;
			}
			if (text.IndexOf("Ready", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			if (text.IndexOf("Tutorial", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			return false;
		}

		private static string StripRichTextTags(string input)
		{
			if (string.IsNullOrEmpty(input))
			{
				return string.Empty;
			}
			return Regex.Replace(input, "<[^>]+>", string.Empty).Trim();
		}

		private bool IsBackButtonCandidate(Button btn, string localizedBack)
		{
			TextMeshProUGUI componentInChildren = ((Component)btn).GetComponentInChildren<TextMeshProUGUI>(true);
			if ((Object)(object)componentInChildren != (Object)null && !string.IsNullOrEmpty(((TMP_Text)componentInChildren).text))
			{
				string text = StripRichTextTags(((TMP_Text)componentInChildren).text);
				if (text.Equals(localizedBack, StringComparison.OrdinalIgnoreCase) || text.Equals("Voltar", StringComparison.OrdinalIgnoreCase) || text.Equals("Back", StringComparison.OrdinalIgnoreCase) || text.Equals("Cancelar", StringComparison.OrdinalIgnoreCase) || text.Equals("Cancel", StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
			}
			return (((Object)btn).name ?? string.Empty).IndexOf("Back", StringComparison.OrdinalIgnoreCase) >= 0;
		}

		private RectTransform FindBackButtonRect(Transform root, RectTransform canvasRect)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			string localizedBack = StripRichTextTags(Language.GetString("BACK") ?? "Back");
			Button[] componentsInChildren = ((Component)root).GetComponentsInChildren<Button>(true);
			RectTransform val = null;
			RectTransform val2 = null;
			RectTransform val3 = null;
			foreach (Button val4 in componentsInChildren)
			{
				if (IsDisallowedDockButton(val4))
				{
					continue;
				}
				RectTransform component = ((Component)val4).GetComponent<RectTransform>();
				if ((Object)(object)component == (Object)null)
				{
					continue;
				}
				Rect rect;
				if (IsBackButtonCandidate(val4, localizedBack))
				{
					if (((Component)val4).gameObject.activeInHierarchy)
					{
						rect = component.rect;
						if (((Rect)(ref rect)).width >= 40f)
						{
							rect = component.rect;
							if (((Rect)(ref rect)).height >= 16f)
							{
								val = component;
								break;
							}
						}
					}
					if ((Object)(object)val2 == (Object)null)
					{
						val2 = component;
					}
				}
				else
				{
					if (!((Object)(object)val3 == (Object)null) || !IsInsideFooterDock(((Component)val4).transform))
					{
						continue;
					}
					rect = component.rect;
					if (((Rect)(ref rect)).width >= 40f)
					{
						rect = component.rect;
						if (((Rect)(ref rect)).height >= 16f && IsInBottomRightQuadrant(component, canvasRect))
						{
							val3 = component;
						}
					}
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			if ((Object)(object)val2 != (Object)null)
			{
				return val2;
			}
			return val3;
		}

		private static bool IsInBottomRightQuadrant(RectTransform rt, RectTransform canvasRect)
		{
			//IL_0025: 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_0031: 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_0045: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)rt == (Object)null || (Object)(object)canvasRect == (Object)null)
			{
				return false;
			}
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			rt.GetWorldCorners(array);
			Vector3 val = ((Transform)canvasRect).InverseTransformPoint((array[0] + array[2]) * 0.5f);
			if (val.x >= 0f)
			{
				return val.y <= 0f;
			}
			return false;
		}

		private static bool IsInsideFooterDock(Transform t)
		{
			Transform val = (((Object)(object)t != (Object)null) ? t.parent : null);
			int num = 0;
			while ((Object)(object)val != (Object)null && num < 5)
			{
				string text = ((Object)val).name ?? string.Empty;
				if (text.IndexOf("FooterPanel", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("BackPanel", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					return true;
				}
				val = val.parent;
				num++;
			}
			return false;
		}

		private void BuildVaultModal()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: 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_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: 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_02aa: 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_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: 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_03f1: Expected O, but got Unknown
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: 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_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Expected O, but got Unknown
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0655: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fd: Expected O, but got Unknown
			//IL_0758: Unknown result type (might be due to invalid IL or missing references)
			//IL_078b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0816: Unknown result type (might be due to invalid IL or missing references)
			//IL_082b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0840: Unknown result type (might be due to invalid IL or missing references)
			//IL_0855: Unknown result type (might be due to invalid IL or missing references)
			//IL_0869: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0915: Unknown result type (might be due to invalid IL or missing references)
			//IL_096b: Unknown result type (might be due to invalid IL or missing references)
			//IL_098a: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b06: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bbc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bcd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be3: Expected O, but got Unknown
			//IL_0bfe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c28: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c86: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb2: Expected O, but got Unknown
			//IL_0ccd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d87: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e60: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eb6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ecc: Expected O, but got Unknown
			//IL_0ee7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0efc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f46: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f72: Expected O, but got Unknown
			//IL_0f8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1015: Unknown result type (might be due to invalid IL or missing references)
			//IL_102a: Unknown result type (might be due to invalid IL or missing references)
			//IL_103f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1054: Unknown result type (might be due to invalid IL or missing references)
			//IL_1068: Unknown result type (might be due to invalid IL or missing references)
			//IL_10aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_1131: Unknown result type (might be due to invalid IL or missing references)
			//IL_1159: Unknown result type (might be due to invalid IL or missing references)
			//IL_116e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1183: Unknown result type (might be due to invalid IL or missing references)
			//IL_1197: Unknown result type (might be due to invalid IL or missing references)
			//IL_11bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			Canvas val = ResolveHostCanvas();
			Transform parent = (((Object)(object)val != (Object)null) ? ((Component)val).transform : (_isMainMenuMode ? ((Component)_mainMenu).transform : ((Component)_lobby).transform));
			Image val2 = UiFactory.CreatePanel("CENIRELOAD_VaultModalBackdrop", parent, UiFactory.BackdropColor);
			UiFactory.StretchFull(((Graphic)val2).rectTransform);
			_modalRoot = ((Component)val2).gameObject;
			_modalRoot.SetActive(false);
			_modalEventSystemProvider = _modalRoot.AddComponent<MPEventSystemProvider>();
			_modalEventSystemProvider.fallBackToMainEventSystem = true;
			MPEventSystem val3 = ResolveActiveEventSystem();
			if ((Object)(object)val3 != (Object)null)
			{
				_modalEventSystemProvider.eventSystem = val3;
			}
			_modalLayer = ScriptableObject.CreateInstance<UILayer>();
			_modalLayer.priority = 100;
			_modalLayerKey = _modalRoot.AddComponent<UILayerKey>();
			_modalLayerKey.layer = _modalLayer;
			if (_modalLayerKey.onBeginRepresentTopLayer == null)
			{
				_modalLayerKey.onBeginRepresentTopLayer = new UnityEvent();
			}
			if (_modalLayerKey.onEndRepresentTopLayer == null)
			{
				_modalLayerKey.onEndRepresentTopLayer = new UnityEvent();
			}
			((Behaviour)_modalLayerKey).enabled = false;
			Image val4 = UiFactory.CreatePanel("CENIRELOAD_VaultWindow", ((Component)val2).transform, UiFactory.PanelBgColor, UiFactory.AccentCyan);
			RectTransform rectTransform = ((Graphic)val4).rectTransform;
			rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
			rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			rectTransform.sizeDelta = new Vector2(960f, 620f);
			Image val5 = UiFactory.CreatePanel("HeaderBar", ((Component)val4).transform, new Color(0.04f, 0.07f, 0.12f, 1f));
			RectTransform rectTransform2 = ((Graphic)val5).rectTransform;
			rectTransform2.anchorMin = new Vector2(0f, 1f);
			rectTransform2.anchorMax = new Vector2(1f, 1f);
			rectTransform2.pivot = new Vector2(0.5f, 1f);
			rectTransform2.sizeDelta = new Vector2(0f, 82f);
			_titleText = UiFactory.CreateText("Title", ((Component)val5).transform, CeniReloadStrings.Get("CENIRELOAD_UI_TITLE"), 22f, UiFactory.AccentCyan, (TextAlignmentOptions)513, (FontStyles)1);
			((TMP_Text)_titleText).rectTransform.anchorMin = new Vector2(0f, 0.5f);
			((TMP_Text)_titleText).rectTransform.anchorMax = new Vector2(0.58f, 1f);
			((TMP_Text)_titleText).rectTransform.offsetMin = new Vector2(24f, 2f);
			((TMP_Text)_titleText).rectTransform.offsetMax = new Vector2(0f, -8f);
			_subtitleText = UiFactory.CreateText("Subtitle", ((Component)val5).transform, CeniReloadStrings.Get("CENIRELOAD_UI_SUBTITLE"), 14f, UiFactory.TextMuted, (TextAlignmentOptions)513, (FontStyles)0);
			((TMP_Text)_subtitleText).rectTransform.anchorMin = new Vector2(0f, 0f);
			((TMP_Text)_subtitleText).rectTransform.anchorMax = new Vector2(0.58f, 0.5f);
			((TMP_Text)_subtitleText).rectTransform.offsetMin = new Vector2(24f, 8f);
			((TMP_Text)_subtitleText).rectTransform.offsetMax = new Vector2(0f, 0f);
			_filterButton = UiFactory.CreateButton("FilterButton", ((Component)val5).transform, "", new Color(0.12f, 0.2f, 0.32f, 1f), UiFactory.TextPrimary, 14f, new UnityAction(ToggleFilterMode), out _filterButtonLabel, _modalLayerKey);
			RectTransform component = ((Component)_filterButton).GetComponent<RectTransform>();
			component.anchorMin = new Vector2(1f, 0.5f);
			component.anchorMax = new Vector2(1f, 0.5f);
			component.pivot = new Vector2(1f, 0.5f);
			component.sizeDelta = new Vector2(240f, 38f);
			component.anchoredPosition = new Vector2(-126f, 0f);
			_closeButton = UiFactory.CreateButton("CloseButton", ((Component)val5).transform, CeniReloadStrings.Get("CENIRELOAD_UI_CLOSE"), new Color(0.32f, 0.14f, 0.18f, 1f), UiFactory.TextPrimary, 15f, new UnityAction(OnClickCloseModal), out _closeButtonLabel, _modalLayerKey);
			RectTransform component2 = ((Component)_closeButton).GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(1f, 0.5f);
			component2.anchorMax = new Vector2(1f, 0.5f);
			component2.pivot = new Vector2(1f, 0.5f);
			component2.sizeDelta = new Vector2(96f, 38f);
			component2.anchoredPosition = new Vector2(-20f, 0f);
			Image val6 = (_leftPanelImage = UiFactory.CreatePanel("LeftSlotList", ((Component)val4).transform, UiFactory.SubPanelBgColor));
			_leftPanelRect = ((Graphic)val6).rectTransform;
			_leftPanelRect.anchorMin = new Vector2(0f, 0f);
			_leftPanelRect.anchorMax = new Vector2(0.54f, 1f);
			_leftPanelRect.offsetMin = new Vector2(20f, 40f);
			_leftPanelRect.offsetMax = new Vector2(-10f, -98f);
			_scrollRect = ((Component)val6).gameObject.AddComponent<ScrollRect>();
			_scrollRect.horizontal = false;
			_scrollRect.vertical = true;
			_scrollRect.scrollSensitivity = 28f;
			RectTransform val7 = UiFactory.CreateRect("Viewport", ((Component)val6).transform);
			UiFactory.StretchFull(val7, 8f, 8f);
			((Graphic)((Component)val7).gameObject.AddComponent<Image>()).color = new Color(1f, 1f, 1f, 0.01f);
			((Component)val7).gameObject.AddComponent<Mask>().showMaskGraphic = false;
			RectTransform val8 = UiFactory.CreateRect("Content", (Transform)(object)val7);
			val8.anchorMin = new Vector2(0f, 1f);
			val8.anchorMax = new Vector2(1f, 1f);
			val8.pivot = new Vector2(0.5f, 1f);
			val8.sizeDelta = new Vector2(0f, 0f);
			VerticalLayoutGroup obj = ((Component)val8).gameObject.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj).spacing = 10f;
			((LayoutGroup)obj).padding = new RectOffset(4, 4, 4, 4);
			((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
			((Component)val8).gameObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			_scrollRect.viewport = val7;
			_scrollRect.content = val8;
			_cardsContainer = (Transform)(object)val8;
			Image val9 = UiFactory.CreatePanel("RightInspector", ((Component)val4).transform, UiFactory.SubPanelBgColor);
			_rightPanelRect = ((Graphic)val9).rectTransform;
			_rightPanelRect.anchorMin = new Vector2(0.54f, 0f);
			_rightPanelRect.anchorMax = new Vector2(1f, 1f);
			_rightPanelRect.offsetMin = new Vector2(10f, 40f);
			_rightPanelRect.offsetMax = new Vector2(-20f, -98f);
			_inspectorPortraitFrame = UiFactory.CreatePortraitFrame("InspectorPortrait", ((Component)val9).transform, null, UiFactory.AccentCyan);
			RectTransform rectTransform3 = ((Graphic)_inspectorPortraitFrame).rectTransform;
			rectTransform3.anchorMin = new Vector2(0f, 1f);
			rectTransform3.anchorMax = new Vector2(0f, 1f);
			rectTransform3.pivot = new Vector2(0f, 1f);
			rectTransform3.sizeDelta = new Vector2(48f, 48f);
			rectTransform3.anchoredPosition = new Vector2(18f, -14f);
			_inspectorLockBadge = UiFactory.CreatePadlockBadge("InspectorLockBadge", ((Component)val9).transform, 34f);
			RectTransform rectTransform4 = ((Graphic)_inspectorLockBadge).rectTransform;
			rectTransform4.anchorMin = new Vector2(1f, 1f);
			rectTransform4.anchorMax = new Vector2(1f, 1f);
			rectTransform4.pivot = new Vector2(1f, 1f);
			rectTransform4.anchoredPosition = new Vector2(-16f, -20f);
			((Component)_inspectorLockBadge).gameObject.SetActive(false);
			_inspectorTitle = UiFactory.CreateText("InspectorTitle", ((Component)val9).transform, "", 19f, UiFactory.AccentCyan, (TextAlignmentOptions)4097, (FontStyles)1);
			((TMP_Text)_inspectorTitle).enableAutoSizing = true;
			((TMP_Text)_inspectorTitle).fontSizeMin = 13f;
			((TMP_Text)_inspectorTitle).fontSizeMax = 19f;
			((TMP_Text)_inspectorTitle).rectTransform.anchorMin = new Vector2(0f, 1f);
			((TMP_Text)_inspectorTitle).rectTransform.anchorMax = new Vector2(1f, 1f);
			((TMP_Text)_inspectorTitle).rectTransform.pivot = new Vector2(0f, 1f);
			((TMP_Text)_inspectorTitle).rectTransform.offsetMin = new Vector2(76f, -62f);
			((TMP_Text)_inspectorTitle).rectTransform.offsetMax = new Vector2(-18f, -14f);
			_inspectorBody = UiFactory.CreateText("InspectorBody", ((Component)val9).transform, "", 14.5f, UiFactory.TextPrimary, (TextAlignmentOptions)257, (FontStyles)0);
			((TMP_Text)_inspectorBody).rectTransform.anchorMin = new Vector2(0f, 0f);
			((TMP_Text)_inspectorBody).rectTransform.anchorMax = new Vector2(1f, 1f);
			((TMP_Text)_inspectorBody).rectTransform.offsetMin = new Vector2(18f, 166f);
			((TMP_Text)_inspectorBody).rectTransform.offsetMax = new Vector2(-18f, -72f);
			_inspectorModStatus = UiFactory.CreateText("ModStatus", ((Component)val9).transform, "", 13f, UiFactory.AccentGreen, (TextAlignmentOptions)513, (FontStyles)2);
			((TMP_Text)_inspectorModStatus).enableAutoSizing = true;
			((TMP_Text)_inspectorModStatus).fontSizeMin = 10.5f;
			((TMP_Text)_inspectorModStatus).fontSizeMax = 13.5f;
			((TMP_Text)_inspectorModStatus).rectTransform.anchorMin = new Vector2(0f, 0f);
			((TMP_Text)_inspectorModStatus).rectTransform.anchorMax = new Vector2(1f, 0f);
			((TMP_Text)_inspectorModStatus).rectTransform.pivot = new Vector2(0.5f, 0f);
			((TMP_Text)_inspectorModStatus).rectTransform.sizeDelta = new Vector2(-36f, 50f);
			((TMP_Text)_inspectorModStatus).rectTransform.anchoredPosition = new Vector2(0f, 112f);
			_loadButton = UiFactory.CreateButton("LoadCheckpointButton", ((Component)val9).transform, CeniReloadStrings.Get("CENIRELOAD_UI_BTN_LOAD"), new Color(0.1f, 0.45f, 0.62f, 1f), Color.white, 16f, new UnityAction(OnClickLoadSelected), out _loadButtonLabel, _modalLayerKey);
			RectTransform component3 = ((Component)_loadButton).GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0f, 0f);
			component3.anchorMax = new Vector2(1f, 0f);
			component3.pivot = new Vector2(0.5f, 0f);
			component3.sizeDelta = new Vector2(-36f, 44f);
			component3.anchoredPosition = new Vector2(0f, 62f);
			_deleteButton = UiFactory.CreateButton("DeleteSlotButton", ((Component)val9).transform, CeniReloadStrings.Get("CENIRELOAD_UI_BTN_DELETE"), new Color(0.45f, 0.14f, 0.18f, 1f), Color.white, 14f, new UnityAction(OnClickRequestDelete), out _deleteButtonLabel, _modalLayerKey);
			RectTransform component4 = ((Component)_deleteButton).GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0f, 0f);
			component4.anchorMax = new Vector2(1f, 0f);
			component4.pivot = new Vector2(0.5f, 0f);
			component4.sizeDelta = new Vector2(-36f, 36f);
			component4.anchoredPosition = new Vector2(0f, 16f);
			Image val10 = UiFactory.CreatePanel("DeleteConfirmBar", ((Component)val9).transform, new Color(0.28f, 0.08f, 0.1f, 1f), UiFactory.AccentRed);
			RectTransform rectTransform5 = ((Graphic)val10).rectTransform;
			rectTransform5.anchorMin = new Vector2(0f, 0f);
			rectTransform5.anchorMax = new Vector2(1f, 0f);
			rectTransform5.pivot = new Vector2(0.5f, 0f);
			rectTransform5.sizeDelta = new Vector2(-36f, 40f);
			rectTransform5.anchoredPosition = new Vector2(0f, 14f);
			_deleteConfirmBar = ((Component)val10).gameObject;
			_confirmPromptText = UiFactory.CreateText("ConfirmText", ((Component)val10).transform, CeniReloadStrings.Get("CENIRELOAD_UI_CONFIRM_DELETE"), 13f, Color.white, (TextAlignmentOptions)513, (FontStyles)1);
			((TMP_Text)_confirmPromptText).rectTransform.anchorMin = new Vector2(0f, 0f);
			((TMP_Text)_confirmPromptText).rectTransform.anchorMax = new Vector2(0.46f, 1f);
			((TMP_Text)_confirmPromptText).rectTransform.offsetMin = new Vector2(10f, 2f);
			((TMP_Text)_confirmPromptText).rectTransform.offsetMax = new Vector2(0f, -2f);
			_confirmYesButton = UiFactory.CreateButton("ConfirmYes", ((Component)val10).transform, CeniReloadStrings.Get("CENIRELOAD_UI_BTN_CONFIRM_YES"), UiFactory.AccentRed, Color.white, 12f, new UnityAction(OnConfirmDeleteSelected), out _confirmYesLabel, _modalLayerKey);
			RectTransform component5 = ((Component)_confirmYesButton).GetComponent<RectTransform>();
			component5.anchorMin = new Vector2(0.47f, 0.12f);
			component5.anchorMax = new Vector2(0.73f, 0.88f);
			component5.offsetMin = Vector2.zero;
			component5.offsetMax = Vector2.zero;
			_confirmNoButton = UiFactory.CreateButton("ConfirmNo", ((Component)val10).transform, CeniReloadStrings.Get("CENIRELOAD_UI_BTN_CONFIRM_NO"), new Color(0.22f, 0.26f, 0.34f, 1f), Color.white, 12f, new UnityAction(OnClickCancelDelete), out _confirmNoLabel, _modalLayerKey);
			RectTransform component6 = ((Component)_confirmNoButton).GetComponent<RectTransform>();
			component6.anchorMin = new Vector2(0.75f, 0.12f);
			component6.anchorMax = new Vector2(0.98f, 0.88f);
			component6.offsetMin = Vector2.zero;
			component6.offsetMax = Vector2.zero;
			_deleteConfirmBar.SetActive(false);
			Image val11 = UiFactory.CreatePanel("AllLockedWarningBanner", ((Component)val4).transform, new Color(0.32f, 0.08f, 0.1f, 0.98f), UiFactory.AccentAmber);
			RectTransform rectTransform6 = ((Graphic)val11).rectTransform;
			rectTransform6.anchorMin = new Vector2(0f, 0f);
			rectTransform6.anchorMax = new Vector2(1f, 0f);
			rectTransform6.pivot = new Vector2(0.5f, 0f);
			rectTransform6.sizeDelta = new Vector2(-40f, 32f);
			rectTransform6.anchoredPosition = new Vector2(0f, 34f);
			_allLockedWarningBanner = ((Component)val11).gameObject;
			_allLockedWarningText = UiFactory.CreateText("AllLockedWarningText", ((Component)val11).transform, "", 12.5f, new Color(1f, 0.88f, 0.32f, 1f), (TextAlignmentOptions)514, (FontStyles)1);
			((TMP_Text)_allLockedWarningText).enableAutoSizing = true;
			((TMP_Text)_allLockedWarningText).fontSizeMin = 10f;
			((TMP_Text)_allLockedWarningText).fontSizeMax = 13f;
			UiFactory.StretchFull(((TMP_Text)_allLockedWarningText).rectTransform, 12f, 3f);
			_allLockedWarningBanner.SetActive(false);
			Image val12 = UiFactory.CreatePanel("FooterHintBar", ((Component)val4).transform, new Color(0.04f, 0.06f, 0.11f, 0.96f));
			RectTransform rectTransform7 = ((Graphic)val12).rectTransform;
			rectTransform7.anchorMin = new Vector2(0f, 0f);
			rectTransform7.anchorMax = new Vector2(1f, 0f);
			rectTransform7.pivot = new Vector2(0.5f, 0f);
			rectTransform7.sizeDelta = new Vector2(0f, 28f);
			_footerHintText = UiFactory.CreateText("FooterHintText", ((Component)val12).transform, CeniReloadStrings.Get("CENIRELOAD_UI_HINT_CLOSE"), 12f, UiFactory.TextMuted, (TextAlignmentOptions)514, (FontStyles)0);
			UiFactory.StretchFull(((TMP_Text)_footerHintText).rectTransform, 16f, 2f);
			SyncFooterSpriteAsset();
		}

		private void SyncFooterSpriteAsset()
		{
			if ((Object)(object)_footerHintText == (Object)null)
			{
				return;
			}
			TextMeshProUGUI val = null;
			if ((Object)(object)_lobby != (Object)null && (Object)(object)_lobby.readyButton != (Object)null)
			{
				val = ((Component)_lobby.readyButton).GetComponentInChildren<TextMeshProUGUI>(true);
			}
			else if ((Object)(object)_mainMenu != (Object)null && (Object)(object)_mainMenu.singlePlayerButton != (Object)null)
			{
				val = ((Component)_mainMenu.singlePlayerButton).GetComponentInChildren<TextMeshProUGUI>(true);
			}
			if ((Object)(object)val != (Object)null)
			{
				if ((Object)(object)((TMP_Text)val).font != (Object)null)
				{
					((TMP_Text)_footerHintText).font = ((TMP_Text)val).font;
				}
				if ((Object)(object)((TMP_Text)val).spriteAsset != (Object)null)
				{
					((TMP_Text)_footerHintText).spriteAsset = ((TMP_Text)val).spriteAsset;
				}
			}
		}

		private void SetModalOpen(bool open)
		{
			if ((Object)(object)_modalRoot == (Object)null)
			{
				return;
			}
			if (open)
			{
				MPEventSystem val = ResolveActiveEventSystem();
				if ((Object)(object)_modalEventSystemProvider != (Object)null && (Object)(object)val != (Object)null)
				{
					_modalEventSystemProvider.eventSystem = val;
				}
				_openedFrame = Time.frameCount;
				_lastActionFrame = Time.frameCount;
				if (!_isMainMenuMode && IsInMultiplayerLobby())
				{
					_filterMode = VaultFilterMode.Multiplayer;
				}
				_modalRoot.SetActive(true);
				if ((Object)(object)_modalLayerKey != (Object)null)
				{
					((Behaviour)_modalLayerKey).enabled = true;
				}
				_modalRoot.transform.SetAsLastSibling();
				RefreshLocalization();
				RebuildSlotCards();
				return;
			}
			bool activeSelf = _modalRoot.activeSelf;
			if (_focusCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(_focusCoroutine);
				_focusCoroutine = null;
			}
			if ((Object)(object)_modalLayerKey != (Object)null)
			{
				((Behaviour)_modalLayerKey).enabled = false;
			}
			_modalRoot.SetActive(false);
			if (!activeSelf)
			{
				return;
			}
			_closedFrame = Time.frameCount;
			if (_isMainMenuMode)
			{
				if ((Object)(object)_triggerButton != (Object)null && ((Component)_triggerButton).gameObject.activeInHierarchy && ((Selectable)_triggerButton).interactable)
				{
					SetSelectedGameObject(((Component)_triggerButton).gameObject);
				}
			}
			else if ((Object)(object)_lobby != (Object)null && (Object)(object)_lobby.readyButton != (Object)null && ((Component)_lobby.readyButton).gameObject.activeInHierarchy)
			{
				SetSelectedGameObject(((Component)_lobby.readyButton).gameObject);
			}
		}

		private bool CanHandleModalButtonClick()
		{
			if ((Object)(object)_modalRoot == (Object)null || !_modalRoot.activeSelf)
			{
				return false;
			}
			if (Time.frameCount <= _openedFrame || _lastActionFrame == Time.frameCount)
			{
				return false;
			}
			_lastActionFrame = Time.frameCount;
			return true;
		}

		private void OnClickCloseModal()
		{
			if (CanHandleModalButtonClick())
			{
				SetModalOpen(open: false);
			}
		}

		private void OnClickRequestDelete()
		{
			if (CanHandleModalButtonClick() && _selectedSnapshot != null && !_selectedSnapshot.isLocked)
			{
				SetDeleteConfirmVisible(visible: true);
			}
		}

		private void OnClickCancelDelete()
		{
			if (CanHandleModalButtonClick())
			{
				SetDeleteConfirmVisible(visible: false);
			}
		}

		private void ToggleFilterMode()
		{
			if (CanHandleModalButtonClick())
			{
				string currentProfileKey = VaultRepository.GetCurrentProfileKey();
				bool flag = IsInMultiplayerLobby() || VaultRepository.HasAnyMultiplayerSnapshots(currentProfileKey);
				bool flag2 = !string.IsNullOrEmpty(GetSelectedSurvivorBodyName());
				if (_filterMode == VaultFilterMode.CurrentSurvivor)
				{
					_filterMode = (flag ? VaultFilterMode.Multiplayer : VaultFilterMode.All);
				}
				else if (_filterMode == VaultFilterMode.Multiplayer)
				{
					_filterMode = VaultFilterMode.All;
				}
				else if (!_isMainMenuMode && IsInMultiplayerLobby())
				{
					_filterMode = VaultFilterMode.Multiplayer;
				}
				else if (flag2)
				{
					_filterMode = VaultFilterMode.CurrentSurvivor;
				}
				else if (flag)
				{
					_filterMode = VaultFilterMode.Multiplayer;
				}
				else
				{
					_filterMode = VaultFilterMode.All;
				}
				_selectedSnapshot = null;
				RefreshLocalization();
				RebuildSlotCards();
			}
		}

		private void RefreshLocalization()
		{
			RefreshTriggerLabel();
			((TMP_Text)_titleText).text = CeniReloadStrings.Get("CENIRELOAD_UI_TITLE");
			string text = CeniReloadStrings.Get("CENIRELOAD_UI_SUBTITLE");
			((TMP_Text)_subtitleText).text = (VaultRepository.IsUsingCloudStorage() ? (text + "  •  <color=#38bdf8>[" + CeniReloadStrings.Get("CENIRELOAD_UI_STORAGE_CLOUD") + "]</color>") : text);
			((TMP_Text)_closeButtonLabel).text = CeniReloadStrings.Get("CENIRELOAD_UI_CLOSE");
			((TMP_Text)_loadButtonLabel).text = CeniReloadStrings.Get("CENIRELOAD_UI_BTN_LOAD");
			((TMP_Text)_deleteButtonLabel).text = CeniReloadStrings.Get("CENIRELOAD_UI_BTN_DELETE");
			((TMP_Text)_confirmPromptText).text = CeniReloadStrings.Get("CENIRELOAD_UI_CONFIRM_DELETE");
			((TMP_Text)_confirmYesLabel).text = CeniReloadStrings.Get("CENIRELOAD_UI_BTN_CONFIRM_YES");
			((TMP_Text)_confirmNoLabel).text = CeniReloadStrings.Get("CENIRELOAD_UI_BTN_CONFIRM_NO");
			UpdateFooterHint();
			if (_filterMode == VaultFilterMode.All)
			{
				((TMP_Text)_filterButtonLabel).text = CeniReloadStrings.Get("CENIRELOAD_UI_FILTER_ALL");
				return;
			}
			if (_filterMode == VaultFilterMode.Multiplayer)
			{
				((TMP_Text)_filterButtonLabel).text = CeniReloadStrings.Get("CENIRELOAD_UI_FILTER_MULTIPLAYER");
				return;
			}
			((TMP_Text)_filterButtonLabel).text = CeniReloadStrings.Format("CENIRELOAD_UI_FILTER_SURVIVOR", GetSelectedSurvivorDisplayName());
		}

		private void RebuildSlotCards()
		{
			foreach (GameObject spawnedCard in _spawnedCards)
			{
				if ((Object)(object)spawnedCard != (Object)null)
				{
					spawnedCard.SetActive(false);
					spawnedCard.transform.SetParent((Transform)null, false);
					Object.Destroy((Object)(object)spawnedCard);
				}
			}
			_spawnedCards.Clear();
			_cardViews.Clear();
			string currentProfileKey = VaultRepository.GetCurrentProfileKey();
			if (_selectedSnapshot != null && !IsSnapshotStillValid(_selectedSnapshot, currentProfileKey))
			{
				_selectedSnapshot = null;
			}
			MPButton val = null;
			MPButton val2 = null;
			CheckpointSnapshot checkpointSnapshot = null;
			if (_filterMode == VaultFilterMode.All)
			{
				List<CheckpointSnapshot> allProfileSnapshots = VaultRepository.GetAllProfileSnapshots(currentProfileKey);
				if (allProfileSnapshots.Count == 0)
				{
					CreateEmptyNoticeCard();
				}
				else
				{
					if (_selectedSnapshot == null)
					{
						_selectedSnapshot = allProfileSnapshots[0];
					}
					for (int i = 0; i < allProfileSnapshots.Count; i++)
					{
						CheckpointSnapshot checkpointSnapshot2 = allProfileSnapshots[i];
						MPButton val3 = CreateSlotCard(checkpointSnapshot2.slotIndex, checkpointSnapshot2);
						if ((Object)(object)val == (Object)null)
						{
							val = val3;
						}
						if (checkpointSnapshot == null)
						{
							checkpointSnapshot = checkpointSnapshot2;
						}
						if (IsSameSnapshot(checkpointSnapshot2, _selectedSnapshot))
						{
							val2 = val3;
						}
					}
				}
			}
			else
			{
				string bucketKey = ((_filterMode == VaultFilterMode.Multiplayer) ? "Multiplayer" : GetSelectedSurvivorBodyName());
				CheckpointSnapshot[] survivorSlots = VaultRepository.GetSurvivorSlots(currentProfileKey, bucketKey);
				if (_selectedSnapshot == null)
				{
					for (int j = 0; j < 5; j++)
					{
						if (survivorSlots[j] != null)
						{
							_selectedSnapshot = survivorSlots[j];
							break;
						}
					}
				}
				for (int k = 0; k < 5; k++)
				{
					CheckpointSnapshot checkpointSnapshot3 = survivorSlots[k];
					MPButton val4 = CreateSlotCard(k + 1, checkpointSnapshot3);
					if (checkpointSnapshot3 != null && checkpointSnapshot == null)
					{
						checkpointSnapshot = checkpointSnapshot3;
						val = val4;
					}
					else if ((Object)(object)val == (Object)null)
					{
						val = val4;
					}
					if (checkpointSnapshot3 != null && IsSameSnapshot(checkpointSnapshot3, _selectedSnapshot))
					{
						val2 = val4;
					}
				}
			}
			if (_selectedSnapshot == null)
			{
				_selectedSnapshot = checkpointSnapshot;
			}
			UpdateCardVisualsInPlace();
			UpdateInspectorPanel();
			WireModalNavigation();
			MPButton val5 = val2 ?? val ?? _closeButton;
			if ((Object)(object)val5 != (Object)null)
			{
				ScheduleFocusNextFrame(((Component)val5).gameObject);
			}
		}

		private void SelectSnapshotInPlace(CheckpointSnapshot snapshot)
		{
			if (!IsSameSnapshot(_selectedSnapshot, snapshot) || _selectedSnapshot == null != (snapshot == null))
			{
				_selectedSnapshot = snapshot;
				UpdateCardVisualsInPlace();
				UpdateInspectorPanel();
				WireModalNavigation();
			}
		}

		private void ToggleLockOnSnapshot(CheckpointSnapshot snapshot)
		{
			if (snapshot == null || Time.unscaledTime - _lastLockToggleTime < 0.18f)
			{
				return;
			}
			_lastLockToggleTime = Time.unscaledTime;
			string currentProfileKey = VaultRepository.GetCurrentProfileKey();
			string storageBucket = snapshot.GetStorageBucket();
			if (!VaultRepository.ToggleSlotLock(currentProfileKey, storageBucket, snapshot.slotIndex, out var newLockedState))
			{
				return;
			}
			snapshot.isLocked = newLockedState;
			if (IsSameSnapshot(_selectedSnapshot, snapshot))
			{
				_selectedSnapshot.isLocked = newLockedState;
			}
			for (int i = 0; i < _cardViews.Count; i++)
			{
				SlotCardView slotCardView = _cardViews[i];
				if (slotCardView?.Snapshot != null && IsSameSnapshot(slotCardView.Snapshot, snapshot))
				{
					slotCardView.Snapshot.isLocked = newLockedState;
				}
			}
			UpdateCardVisualsInPlace();
			UpdateInspectorPanel();
			WireModalNavigation();
			MPEventSystem val = ResolveActiveEventSystem();
			if (newLockedState && (Object)(object)val != (Object)null && (Object)(object)_deleteButton != (Object)null && (Object)(object)((EventSystem)val).currentSelectedGameObject == (Object)(object)((Component)_deleteButton).gameObject)
			{
				MPButton val2 = GetPrimaryActionButton() ?? GetSelectedOrFirstCardButton() ?? _closeButton;
				if ((Object)(object)val2 != (Object)null)
				{
					ScheduleFocusNextFrame(((Component)val2).gameObject);
				}
			}
		}

		private static Color GetCardBackgroundColor(CheckpointSnapshot snapshot, bool isSelected)
		{
			//IL_0003: 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_0014: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (snapshot == null)
			{
				return UiFactory.CardEmptyColor;
			}
			if (snapshot.IsMultiplayer())
			{
				if (!isSelected)
				{
					return UiFactory.CardMultiplayerBgColor;
				}
				return UiFactory.CardMultiplayerSelectedColor;
			}
			if (snapshot.IsSpecialModeOrArtifact())
			{
				if (!isSelected)
				{
					return UiFactory.CardSpecialModeBgColor;
				}
				return UiFactory.CardSpecialModeSelectedColor;
			}
			if (!isSelected)
			{
				return UiFactory.CardBgColor;
			}
			return UiFactory.CardSelectedColor;
		}

		private static Color GetCardAccentColor(CheckpointSnapshot snapshot, bool missingSurvivor, bool modMismatch)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (snapshot == null)
			{
				return new Color(0.28f, 0.34f, 0.44f, 0.7f);
			}
			if (missingSurvivor)
			{
				return UiFactory.AccentRed;
			}
			if (snapshot.isLocked)
			{
				return UiFactory.AccentAmber;
			}
			if (snapshot.IsMultiplayer())
			{
				return UiFactory.AccentRed;
			}
			if (snapshot.IsSpecialModeOrArtifact())
			{
				return UiFactory.AccentGreen;
			}
			if (modMismatch)
			{
				return UiFactory.AccentAmber;
			}
			return UiFactory.AccentCyan;
		}

		private void UpdateLeftPanelThemeColor()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_leftPanelImage == (Object)null)
			{
				return;
			}
			bool flag = false;
			bool flag2 = false;
			if (_filterMode == VaultFilterMode.Multiplayer)
			{
				flag = true;
			}
			else if (_selectedSnapshot != null)
			{
				flag = _select