Decompiled source of ScrollableLobbyUI v1.9.1

plugins/ScrollableLobbyUI/ScrollableLobbyUI.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using IL.RoR2.UI;
using InLobbyConfig;
using InLobbyConfig.Fields;
using LeTai.Asset.TranslucentImage;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using On.RoR2.UI;
using Rewired;
using RoR2;
using RoR2.UI;
using RoR2.UI.SkinControllers;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.9.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ScrollableLobbyUI
{
	public class ButtonsNavigationController : MonoBehaviour
	{
		private bool buttonsWereActive;

		private MPEventSystemLocator eventSystemLocator;

		public UILayerKey requiredTopLayer;

		public LoadoutPanelController loadoutPanel;

		protected MPEventSystem eventSystem
		{
			get
			{
				MPEventSystemLocator obj = eventSystemLocator;
				if (obj == null)
				{
					return null;
				}
				return obj.eventSystem;
			}
		}

		public void Awake()
		{
			eventSystemLocator = ((Component)this).GetComponent<MPEventSystemLocator>();
			buttonsWereActive = true;
		}

		public void Update()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			bool flag = ButtonsShouldBeActive();
			if (buttonsWereActive != flag && Object.op_Implicit((Object)(object)loadoutPanel))
			{
				HGButton[] componentsInChildren = ((Component)loadoutPanel).GetComponentsInChildren<HGButton>();
				foreach (HGButton obj in componentsInChildren)
				{
					Navigation val;
					Navigation navigation;
					if (!flag)
					{
						val = default(Navigation);
						((Navigation)(ref val)).mode = (Mode)0;
						navigation = val;
					}
					else
					{
						val = default(Navigation);
						((Navigation)(ref val)).mode = (Mode)3;
						navigation = val;
					}
					((Selectable)obj).navigation = navigation;
				}
			}
			buttonsWereActive = flag;
		}

		protected bool ButtonsShouldBeActive()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Invalid comparison between Unknown and I4
			if (((Component)this).gameObject.activeInHierarchy && Object.op_Implicit((Object)(object)eventSystem))
			{
				if ((int)eventSystem.currentInputSource != 0)
				{
					if (!Object.op_Implicit((Object)(object)requiredTopLayer) || requiredTopLayer.representsTopLayer)
					{
						return (int)eventSystem.currentInputSource == 1;
					}
					return false;
				}
				return true;
			}
			return false;
		}
	}
	[RequireComponent(typeof(CharacterSelectBarController))]
	public class CharacterSelectBarControllerExtra : MonoBehaviour
	{
		public class VariantArrowToggler : MonoBehaviour
		{
			public GameObject arrow;

			private void Start()
			{
				if (Object.op_Implicit((Object)(object)arrow))
				{
					arrow.SetActive(false);
				}
			}

			private void OnEnable()
			{
				if (Object.op_Implicit((Object)(object)arrow))
				{
					arrow.SetActive(false);
				}
			}

			private void OnDisable()
			{
				if (Object.op_Implicit((Object)(object)arrow))
				{
					arrow.SetActive(true);
				}
			}
		}

		private const int iconSize = 70;

		private const int iconSpacing = 4;

		private const int iconPadding = 6;

		private const int buttonSide = 37;

		private CharacterSelectBarController characterSelectBar;

		private HGButtonHistory buttonHistory;

		private int fillerCount;

		private SurvivorDef pickedSurvivor;

		private readonly List<LayoutElement> trackingHeightElements;

		private readonly List<SurvivorDef> survivorDefList;

		private HGButton arrowPreviousButtonComponent;

		private HGButton arrowNextButtonComponent;

		private HGButton inlinePreviousButtonComponent;

		private HGButton inlineNextButtonComponent;

		private int SurvivorRows => ScrollableLobbyUIPlugin.CharacterSelectRows.Value;

		private int SurvivorsPerRow { get; set; }

		private int SurvivorsPerPage => SurvivorsPerRow * SurvivorRows;

		private int ContainerHeight => 74 * SurvivorRows - 4 + 12;

		private GridLayoutGroup IconContainerGrid => characterSelectBar.iconContainerGrid;

		private UIElementAllocator<SurvivorIconController> SurvivorIconControllers => characterSelectBar.survivorIconControllers;

		private UIElementAllocator<RectTransform> FillerIconControllers => characterSelectBar.fillerIcons;

		private MPEventSystemLocator EventSystemLocator => characterSelectBar.eventSystemLocator;

		private LocalUser LocalUser
		{
			get
			{
				EventSystem current = EventSystem.current;
				return ((MPEventSystem)(((current is MPEventSystem) ? current : null)?)).localUser;
			}
		}

		public int PageCount { get; private set; }

		public int CurrentPageIndex { get; private set; }

		public bool IsOnFirstPage => CurrentPageIndex == 0;

		public bool IsOnLastPage => PageCount == CurrentPageIndex + 1;

		private void RebuildPage()
		{
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Expected O, but got Unknown
			characterSelectBar.pickedIcon = null;
			IList<SurvivorDef> list;
			if (ScrollableLobbyUIPlugin.InlinePageArrows.Value)
			{
				if (PageCount == 1)
				{
					list = survivorDefList;
					((Component)inlinePreviousButtonComponent).gameObject.SetActive(false);
					((Component)inlineNextButtonComponent).gameObject.SetActive(false);
				}
				else if (IsOnFirstPage)
				{
					list = survivorDefList.Take(SurvivorsPerPage - 1).ToArray();
					((Component)inlinePreviousButtonComponent).gameObject.SetActive(false);
					((Component)inlineNextButtonComponent).gameObject.SetActive(true);
				}
				else
				{
					((Component)inlinePreviousButtonComponent).gameObject.SetActive(true);
					((Component)inlineNextButtonComponent).gameObject.SetActive(!IsOnLastPage);
					int num = SurvivorsPerPage - 2;
					list = survivorDefList.Skip(SurvivorsPerPage - 1 + num * (CurrentPageIndex - 1)).Take(IsOnLastPage ? (num + 1) : num).ToArray();
				}
				((Component)inlinePreviousButtonComponent).transform.SetSiblingIndex(0);
				RectTransform? obj = FillerIconControllers.elements.FirstOrDefault();
				int siblingIndex = ((obj != null) ? ((Transform)obj).GetSiblingIndex() : ((Component)inlineNextButtonComponent).transform.parent.childCount);
				((Component)inlineNextButtonComponent).transform.SetSiblingIndex(siblingIndex);
			}
			else
			{
				list = survivorDefList.Skip(CurrentPageIndex * SurvivorsPerPage).Take(SurvivorsPerPage).ToArray();
				if (Object.op_Implicit((Object)(object)arrowPreviousButtonComponent) && Object.op_Implicit((Object)(object)arrowNextButtonComponent))
				{
					((Selectable)arrowPreviousButtonComponent).interactable = !IsOnFirstPage;
					((Selectable)arrowNextButtonComponent).interactable = !IsOnLastPage;
				}
			}
			ReadOnlyCollection<SurvivorIconController> elements = SurvivorIconControllers.elements;
			for (int i = 0; i < elements.Count; i++)
			{
				SurvivorIconController val = elements[i];
				if (i >= list.Count)
				{
					((Component)val).gameObject.SetActive(false);
					continue;
				}
				((Component)val).gameObject.SetActive(true);
				SurvivorDef val3 = (val.survivorDef = list[i]);
				if ((Object)(object)pickedSurvivor == (Object)(object)val3)
				{
					characterSelectBar.pickedIcon = val;
				}
			}
			foreach (RectTransform element in FillerIconControllers.elements)
			{
				((Component)element).gameObject.SetActive(IsOnLastPage);
			}
			if (!Object.op_Implicit((Object)(object)buttonHistory) || !Object.op_Implicit((Object)(object)buttonHistory.lastRememberedGameObject) || !Object.op_Implicit((Object)(object)EventSystemLocator) || !Object.op_Implicit((Object)(object)EventSystemLocator.eventSystem))
			{
				return;
			}
			if (buttonHistory.lastRememberedGameObject.activeInHierarchy)
			{
				((Selectable)buttonHistory.lastRememberedGameObject.GetComponent<HGButton>()).OnSelect(new BaseEventData(EventSystem.current));
				return;
			}
			SurvivorIconController? obj2 = ((IEnumerable<SurvivorIconController>)elements).LastOrDefault((Func<SurvivorIconController, bool>)((SurvivorIconController el) => ((Component)el).gameObject.activeInHierarchy));
			if (obj2 != null)
			{
				((Selectable)((Component)obj2).GetComponent<HGButton>()).Select();
			}
		}

		private void GatherSurvivorsInfo()
		{
			if (survivorDefList.Count > 0)
			{
				return;
			}
			foreach (SurvivorDef orderedSurvivorDef in SurvivorCatalog.orderedSurvivorDefs)
			{
				if (characterSelectBar.ShouldDisplaySurvivor(orderedSurvivorDef))
				{
					survivorDefList.Add(orderedSurvivorDef);
				}
			}
		}

		private void PrepareContainer()
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Expected O, but got Unknown
			Object.DestroyImmediate((Object)(object)((Component)this).GetComponent<AdjustGridLayoutCellSize>());
			LayoutElement component = ((Component)this).GetComponent<LayoutElement>();
			trackingHeightElements.Add(component);
			component.preferredWidth = float.MaxValue;
			LayoutElement item = ((Component)((Component)this).transform.parent).GetComponent<LayoutElement>() ?? ((Component)((Component)this).transform.parent).gameObject.AddComponent<LayoutElement>();
			trackingHeightElements.Add(item);
			ContentSizeFitter obj = ((Component)((Component)this).transform.parent).gameObject.AddComponent<ContentSizeFitter>();
			obj.verticalFit = (FitMode)2;
			obj.horizontalFit = (FitMode)0;
			GameObject val = new GameObject("SurvivorChoiceGridContainer");
			val.transform.SetParent(((Component)this).transform.parent, false);
			val.transform.SetSiblingIndex(2);
			((Component)this).transform.SetParent(val.transform, false);
			val.AddComponent<HorizontalLayoutGroup>();
			LayoutElement item2 = val.AddComponent<LayoutElement>();
			trackingHeightElements.Add(item2);
			IconContainerGrid.cellSize = new Vector2(70f, 70f);
			IconContainerGrid.constraint = (Constraint)1;
			((LayoutGroup)IconContainerGrid).childAlignment = (TextAnchor)4;
			Transform parent = ((Component)this).transform.parent;
			object obj2;
			if (parent == null)
			{
				obj2 = null;
			}
			else
			{
				Transform parent2 = parent.parent;
				obj2 = ((parent2 != null) ? parent2.parent : null);
			}
			VerticalLayoutGroup component2 = ((Component)obj2).GetComponent<VerticalLayoutGroup>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				RectOffset padding = ((LayoutGroup)component2).padding;
				((LayoutGroup)component2).padding = new RectOffset(padding.left, padding.right, 0, padding.bottom);
			}
		}

		private void AllocateCells()
		{
			SurvivorIconControllers.AllocateElements(Mathf.Min(SurvivorsPerPage, survivorDefList.Count));
			SurvivorIconController val = SurvivorIconControllers.elements.FirstOrDefault();
			if (Object.op_Implicit((Object)(object)val))
			{
				((Component)val).GetComponent<MPButton>().defaultFallbackButton = true;
			}
			FillerIconControllers.AllocateElements(fillerCount);
			FillerIconControllers.MoveElementsToContainerEnd();
		}

		private void SetupPagingStuff()
		{
			MPEventSystemLocator mpEventSystemLocator2 = ((Component)this).GetComponent<MPEventSystemLocator>();
			GameObject survivorChoiceGrid2 = ((Component)((Component)this).transform.parent).gameObject;
			UILayerKey uiLayerKey2 = survivorChoiceGrid2.GetComponentInParent<UILayerKey>();
			arrowPreviousButtonComponent = SetupPagingButton("Previous", "Left", SelectPreviousPage, "UITabLeft", 0, 2);
			arrowNextButtonComponent = SetupPagingButton("Next", "Right", SelectNextPage, "UITabRight", 10, 6);
			inlinePreviousButtonComponent = SetupPagingButtonCharacterSlot("Previous", SelectPreviousPage, "UITabLeft", 0, 2, mpEventSystemLocator2, survivorChoiceGrid2, uiLayerKey2);
			inlineNextButtonComponent = SetupPagingButtonCharacterSlot("Next", SelectNextPage, "UITabRight", 10, 6, mpEventSystemLocator2, survivorChoiceGrid2, uiLayerKey2);
			HGButton SetupPagingButton(string prefix, string buttonPrefix, Action action, string actionName, int siblingIndex, int glyphIndex)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Expected O, but got Unknown
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Expected O, but got Unknown
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f8: Expected O, but got Unknown
				//IL_013d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0143: Invalid comparison between Unknown and I4
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_017d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ce: Expected O, but got Unknown
				//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_020f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0229: Unknown result type (might be due to invalid IL or missing references)
				//IL_0243: Unknown result type (might be due to invalid IL or missing references)
				//IL_0257: Unknown result type (might be due to invalid IL or missing references)
				//IL_027a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0288: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0368: Unknown result type (might be due to invalid IL or missing references)
				//IL_036d: Unknown result type (might be due to invalid IL or missing references)
				//IL_037f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0386: Unknown result type (might be due to invalid IL or missing references)
				//IL_039c: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b6: 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_03d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_03de: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ee: Expected O, but got Unknown
				//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0403: Unknown result type (might be due to invalid IL or missing references)
				//IL_0425: Unknown result type (might be due to invalid IL or missing references)
				//IL_042a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0477: Unknown result type (might be due to invalid IL or missing references)
				//IL_0481: Expected O, but got Unknown
				//IL_048f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0499: Expected O, but got Unknown
				GameObject val17 = new GameObject(prefix + "ButtonContainer");
				val17.transform.SetParent(((Component)this).transform.parent, false);
				val17.transform.SetSiblingIndex(siblingIndex);
				val17.layer = 5;
				VerticalLayoutGroup obj10 = val17.AddComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)obj10).childControlHeight = true;
				((HorizontalOrVerticalLayoutGroup)obj10).childControlWidth = true;
				LayoutElement item = val17.AddComponent<LayoutElement>();
				trackingHeightElements.Add(item);
				GameObject obj11 = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)("RoR2/Base/UI/" + buttonPrefix + "Button.prefab")).WaitForCompletion(), val17.transform, false);
				((Object)obj11).name = prefix + "Page";
				obj11.layer = 5;
				HGButton component = obj11.GetComponent<HGButton>();
				((Button)component).onClick = new ButtonClickedEvent();
				((UnityEvent)((Button)component).onClick).AddListener(new UnityAction(action.Invoke));
				LayoutElement component2 = obj11.GetComponent<LayoutElement>();
				component2.preferredWidth = 37f;
				component2.minWidth = 37f;
				GameObject val18 = new GameObject(prefix + "Glyph");
				val18.transform.SetParent(val17.transform, false);
				val18.layer = 5;
				val18.transform.SetSiblingIndex(0);
				val18.SetActive(Object.op_Implicit((Object)(object)mpEventSystemLocator2.eventSystem) && (int)mpEventSystemLocator2.eventSystem.currentInputSource == 1);
				RectTransform obj12 = val18.AddComponent<RectTransform>();
				obj12.anchoredPosition3D = new Vector3(0f, 0f, 0f);
				((Transform)obj12).localScale = new Vector3(1f, 1f, 1f);
				obj12.sizeDelta = new Vector2(0f, 0f);
				Image obj13 = val18.AddComponent<Image>();
				((Graphic)obj13).color = Color.white;
				((Behaviour)obj13).enabled = false;
				val18.AddComponent<LayoutElement>().minWidth = 37f;
				GameObject val19 = new GameObject("Text");
				val19.transform.SetParent(val18.transform);
				val19.layer = 5;
				RectTransform obj14 = val19.AddComponent<RectTransform>();
				obj14.anchorMin = new Vector2(0f, 0f);
				obj14.anchorMax = new Vector2(1f, 1f);
				obj14.anchoredPosition3D = new Vector3(0f, 0f, 0f);
				((Transform)obj14).localScale = new Vector3(1f, 1f, 1f);
				obj14.sizeDelta = new Vector2(48f, 48f);
				val19.AddComponent<MPEventSystemLocator>();
				InputBindingDisplayController obj15 = val19.AddComponent<InputBindingDisplayController>();
				obj15.actionName = actionName;
				obj15.axisRange = (AxisRange)0;
				obj15.useExplicitInputSource = true;
				obj15.explicitInputSource = (InputSource)1;
				obj15.Awake();
				LayoutElement obj16 = val19.AddComponent<LayoutElement>();
				obj16.preferredHeight = 37f;
				obj16.preferredWidth = 37f;
				TMP_FontAsset fontAsset2 = Addressables.LoadAssetAsync<TMP_FontAsset>((object)"RoR2/Base/Common/Fonts/Bombardier/tmpbombdropshadow.asset").WaitForCompletion();
				HGTextMeshProUGUI val20 = val19.AddComponent<HGTextMeshProUGUI>();
				((Graphic)val20).raycastTarget = false;
				((TMP_Text)val20).text = $"<sprite=\"tmpsprXboxOneGlyphs\" name=\"texXBoxOneGlyphs_{glyphIndex}\">";
				((TextMeshProUGUI)val20).UpdateFontAsset();
				((TMP_Text)val20).fontSize = 24f;
				((TMP_Text)val20).fontSizeMin = 18f;
				((TMP_Text)val20).fontSizeMax = 72f;
				((TMP_Text)val20).fontWeight = (FontWeight)400;
				((TMP_Text)val20).alignment = (TextAlignmentOptions)514;
				((TMP_Text)val20).wordWrappingRatios = 0.4f;
				((TMP_Text)val20).overflowMode = (TextOverflowModes)0;
				((TMP_Text)val20).enableKerning = true;
				((TMP_Text)val20).richText = true;
				((TMP_Text)val20).parseCtrlCharacters = true;
				((TMP_Text)val20).isOrthographic = true;
				GameObject val21 = new GameObject("TMP SubMeshUI");
				val21.transform.SetParent(val19.transform);
				val21.layer = 5;
				RectTransform obj17 = val21.AddComponent<RectTransform>();
				obj17.anchoredPosition3D = new Vector3(0f, 0f, 0f);
				((Transform)obj17).localScale = new Vector3(1f, 1f, 1f);
				obj17.sizeDelta = new Vector2(0f, 0f);
				Material val22 = new Material(Addressables.LoadAssetAsync<Shader>((object)"TextMesh Pro/FormerResources/Shaders/TMP_Sprite.shader").WaitForCompletion());
				Texture val23 = Addressables.LoadAssetAsync<Texture>((object)"TextMesh Pro/FormerResources/Sprite Assets/texXBoxOneGlyphs.png").WaitForCompletion();
				val21.AddComponent<CanvasRenderer>().SetMaterial(val22, val23);
				TMP_SubMeshUI obj18 = val21.AddComponent<TMP_SubMeshUI>();
				obj18.fontAsset = fontAsset2;
				obj18.spriteAsset = Addressables.LoadAssetAsync<TMP_SpriteAsset>((object)"TextMesh Pro/FormerResources/Sprite Assets/tmpsprXboxOneGlyphs.asset").WaitForCompletion();
				obj18.m_TextComponent = (TextMeshProUGUI)(object)val20;
				HGGamepadInputEvent val24 = survivorChoiceGrid2.AddComponent<HGGamepadInputEvent>();
				val24.requiredTopLayer = uiLayerKey2;
				val24.actionName = actionName;
				val24.enabledObjectsIfActive = (GameObject[])(object)new GameObject[1] { val18 };
				val24.actionEvent = new UnityEvent();
				val24.actionEvent.AddListener(new UnityAction(action.Invoke));
				return component;
			}
			HGButton SetupPagingButtonCharacterSlot(string prefix, Action action, string actionName, int siblingIndex, int glyphIndex, MPEventSystemLocator mpEventSystemLocator, GameObject survivorChoiceGrid, UILayerKey uiLayerKey)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Expected O, but got Unknown
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Expected O, but got Unknown
				//IL_0141: Unknown result type (might be due to invalid IL or missing references)
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0170: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_0187: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01db: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0205: Unknown result type (might be due to invalid IL or missing references)
				//IL_021f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0234: Unknown result type (might be due to invalid IL or missing references)
				//IL_023f: Unknown result type (might be due to invalid IL or missing references)
				//IL_024a: Unknown result type (might be due to invalid IL or missing references)
				//IL_025f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0273: Unknown result type (might be due to invalid IL or missing references)
				//IL_027d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0284: Unknown result type (might be due to invalid IL or missing references)
				//IL_0290: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a5: 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_02db: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e2: Expected O, but got Unknown
				//IL_030e: Unknown result type (might be due to invalid IL or missing references)
				//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_03af: Unknown result type (might be due to invalid IL or missing references)
				//IL_03be: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0405: Unknown result type (might be due to invalid IL or missing references)
				//IL_040a: Unknown result type (might be due to invalid IL or missing references)
				//IL_042a: Unknown result type (might be due to invalid IL or missing references)
				//IL_042f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0446: 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_046e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0487: Unknown result type (might be due to invalid IL or missing references)
				//IL_048e: Expected O, but got Unknown
				//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_04d3: Invalid comparison between Unknown and I4
				//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_050e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0522: Unknown result type (might be due to invalid IL or missing references)
				//IL_0534: Unknown result type (might be due to invalid IL or missing references)
				//IL_055a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0561: Expected O, but got Unknown
				//IL_058e: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_060d: Unknown result type (might be due to invalid IL or missing references)
				//IL_061b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0646: Unknown result type (might be due to invalid IL or missing references)
				//IL_064b: Unknown result type (might be due to invalid IL or missing references)
				//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0700: Unknown result type (might be due to invalid IL or missing references)
				//IL_0712: Unknown result type (might be due to invalid IL or missing references)
				//IL_0719: Unknown result type (might be due to invalid IL or missing references)
				//IL_072f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0749: Unknown result type (might be due to invalid IL or missing references)
				//IL_075d: Unknown result type (might be due to invalid IL or missing references)
				//IL_076c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0771: Unknown result type (might be due to invalid IL or missing references)
				//IL_077a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0781: Expected O, but got Unknown
				//IL_0786: 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_0796: Unknown result type (might be due to invalid IL or missing references)
				//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_07bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0800: Unknown result type (might be due to invalid IL or missing references)
				//IL_080a: Expected O, but got Unknown
				GameObject val = new GameObject(prefix + "ButtonContainer");
				val.transform.SetParent(((Component)this).transform, false);
				val.transform.SetSiblingIndex(siblingIndex);
				val.layer = 5;
				val.AddComponent<RectTransform>().sizeDelta = new Vector2(48f, 48f);
				val.AddComponent<CanvasRenderer>();
				Image val2 = val.AddComponent<Image>();
				val2.sprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUICleanButton.png").WaitForCompletion();
				val2.overrideSprite = val2.sprite;
				val2.type = (Type)1;
				val2.fillMethod = (FillMethod)4;
				HGButton val3 = val.AddComponent<HGButton>();
				((Selectable)val3).image = val2;
				((Selectable)val3).targetGraphic = (Graphic)(object)val2;
				((Button)val3).onClick = new ButtonClickedEvent();
				((UnityEvent)((Button)val3).onClick).AddListener(new UnityAction(action.Invoke));
				((Selectable)val3).interactable = true;
				AnimationTriggers animationTriggers = ((Selectable)val3).animationTriggers;
				animationTriggers.normalTrigger = "Normal";
				animationTriggers.highlightedTrigger = "Highlighted";
				animationTriggers.pressedTrigger = "Pressed";
				animationTriggers.selectedTrigger = "Highlighted";
				animationTriggers.disabledTrigger = "Disabled";
				ButtonSkinController obj = val.AddComponent<ButtonSkinController>();
				obj.useRecommendedImage = true;
				obj.useRecommendedMaterial = true;
				obj.useRecommendedAlignment = true;
				obj.useRecommendedLabel = true;
				obj.useRecommendedButtonHeight = false;
				obj.useRecommendedButtonWidth = false;
				((BaseSkinController)obj).skinData = Addressables.LoadAssetAsync<UISkinData>((object)"RoR2/Base/UI/skinCleanButton.asset").WaitForCompletion();
				GameObject val4 = new GameObject("InteractableHighlight");
				val4.transform.SetParent(val.transform, false);
				val4.layer = 5;
				val4.AddComponent<RectTransform>().sizeDelta = new Vector2(72f, 72f);
				val4.AddComponent<CanvasRenderer>();
				Image val5 = val4.AddComponent<Image>();
				val5.sprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUIOutlineOnly.png").WaitForCompletion();
				val5.overrideSprite = val5.sprite;
				val5.type = (Type)1;
				val5.fillMethod = (FillMethod)4;
				GameObject val6 = new GameObject("HoverHighlight");
				val6.transform.SetParent(val.transform, false);
				val6.layer = 5;
				RectTransform obj2 = val6.AddComponent<RectTransform>();
				obj2.sizeDelta = new Vector2(8f, 8f);
				((Transform)obj2).localScale = new Vector3(1.1f, 1.1f, 1.1f);
				obj2.anchoredPosition = new Vector2(4f, -4f);
				obj2.anchorMin = Vector2.zeroVector;
				obj2.anchorMax = Vector2.oneVector;
				obj2.offsetMin = new Vector2(0f, -8f);
				obj2.offsetMax = new Vector2(8f, 0f);
				val6.AddComponent<Canvas>();
				val6.AddComponent<RefreshCanvasDrawOrder>().canvasSortingOrderDelta = 1;
				val6.AddComponent<CanvasRenderer>();
				Image val7 = val6.AddComponent<Image>();
				val7.sprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUIHighlightBoxOutlineThick.png").WaitForCompletion();
				val7.overrideSprite = val7.sprite;
				val7.type = (Type)1;
				val7.fillMethod = (FillMethod)4;
				GameObject val8 = new GameObject("ArrowText");
				val8.transform.SetParent(val.transform, false);
				val8.layer = 5;
				val8.AddComponent<RectTransform>().anchoredPosition = new Vector2(0f, 2f);
				val8.AddComponent<CanvasRenderer>();
				HGTextMeshProUGUI val9 = val8.AddComponent<HGTextMeshProUGUI>();
				if (prefix == "Next")
				{
					((TMP_Text)val9).text = ">";
				}
				else
				{
					((TMP_Text)val9).text = "<";
				}
				((TMP_Text)val9).fontSize = 56f;
				((TMP_Text)val9).fontSizeMin = 55f;
				((TMP_Text)val9).fontSizeMax = 57f;
				((TMP_Text)val9).enableKerning = true;
				((TMP_Text)val9).enableAutoSizing = true;
				((Graphic)val9).raycastTarget = false;
				val3.imageOnHover = val7;
				val3.imageOnInteractable = val5;
				((MPButton)val3).allowAllEventSystems = true;
				((MPButton)val3).submitOnPointerUp = true;
				ColorBlock colors = ((Selectable)val3).colors;
				((ColorBlock)(ref colors)).normalColor = Color32.op_Implicit(new Color32((byte)83, (byte)103, (byte)120, byte.MaxValue));
				((ColorBlock)(ref colors)).highlightedColor = Color32.op_Implicit(new Color32((byte)252, byte.MaxValue, (byte)177, (byte)187));
				((ColorBlock)(ref colors)).pressedColor = Color32.op_Implicit(new Color32((byte)189, (byte)192, (byte)113, (byte)251));
				((ColorBlock)(ref colors)).selectedColor = Color32.op_Implicit(new Color32((byte)252, byte.MaxValue, (byte)177, (byte)187));
				((ColorBlock)(ref colors)).disabledColor = Color32.op_Implicit(new Color32((byte)65, (byte)51, (byte)51, (byte)182));
				((ColorBlock)(ref colors)).colorMultiplier = 1f;
				((ColorBlock)(ref colors)).fadeDuration = 0f;
				((Selectable)val3).colors = colors;
				val3.showImageOnHover = true;
				GameObject val10 = new GameObject(prefix + "Glyph");
				val10.transform.SetParent(val.transform, false);
				val10.layer = 5;
				val10.transform.SetSiblingIndex(0);
				val10.SetActive(Object.op_Implicit((Object)(object)mpEventSystemLocator.eventSystem) && (int)mpEventSystemLocator.eventSystem.currentInputSource == 1);
				RectTransform obj3 = val10.AddComponent<RectTransform>();
				obj3.anchoredPosition3D = new Vector3(0f, 0f, 0f);
				((Transform)obj3).localScale = new Vector3(1f, 1f, 1f);
				obj3.sizeDelta = new Vector2(0f, 0f);
				Image obj4 = val10.AddComponent<Image>();
				((Graphic)obj4).color = Color.white;
				((Behaviour)obj4).enabled = false;
				val10.AddComponent<LayoutElement>().minWidth = 37f;
				GameObject val11 = new GameObject("Text");
				val11.transform.SetParent(val10.transform);
				val11.layer = 5;
				RectTransform obj5 = val11.AddComponent<RectTransform>();
				obj5.anchorMin = new Vector2(0f, 0f);
				obj5.anchorMax = new Vector2(1f, 1f);
				obj5.anchoredPosition3D = new Vector3(0f, 0f, 0f);
				((Transform)obj5).localScale = new Vector3(1f, 1f, 1f);
				obj5.sizeDelta = new Vector2(48f, 48f);
				val11.AddComponent<MPEventSystemLocator>();
				InputBindingDisplayController obj6 = val11.AddComponent<InputBindingDisplayController>();
				obj6.actionName = actionName;
				obj6.axisRange = (AxisRange)0;
				obj6.useExplicitInputSource = true;
				obj6.explicitInputSource = (InputSource)1;
				obj6.Awake();
				LayoutElement obj7 = val11.AddComponent<LayoutElement>();
				obj7.preferredHeight = 37f;
				obj7.preferredWidth = 37f;
				TMP_FontAsset fontAsset = Addressables.LoadAssetAsync<TMP_FontAsset>((object)"RoR2/Base/Common/Fonts/Bombardier/tmpbombdropshadow.asset").WaitForCompletion();
				HGTextMeshProUGUI val12 = val11.AddComponent<HGTextMeshProUGUI>();
				((Graphic)val12).raycastTarget = false;
				((TMP_Text)val12).text = $"<sprite=\"tmpsprXboxOneGlyphs\" name=\"texXBoxOneGlyphs_{glyphIndex}\">";
				((TextMeshProUGUI)val12).UpdateFontAsset();
				((TMP_Text)val12).fontSize = 24f;
				((TMP_Text)val12).fontSizeMin = 18f;
				((TMP_Text)val12).fontSizeMax = 72f;
				((TMP_Text)val12).fontWeight = (FontWeight)400;
				((TMP_Text)val12).alignment = (TextAlignmentOptions)514;
				((TMP_Text)val12).wordWrappingRatios = 0.4f;
				((TMP_Text)val12).overflowMode = (TextOverflowModes)0;
				((TMP_Text)val12).enableKerning = true;
				((TMP_Text)val12).richText = true;
				((TMP_Text)val12).parseCtrlCharacters = true;
				((TMP_Text)val12).isOrthographic = true;
				GameObject val13 = new GameObject("TMP SubMeshUI");
				val13.transform.SetParent(val11.transform);
				val13.layer = 5;
				RectTransform obj8 = val13.AddComponent<RectTransform>();
				obj8.anchoredPosition3D = new Vector3(0f, 0f, 0f);
				((Transform)obj8).localScale = new Vector3(1f, 1f, 1f);
				obj8.sizeDelta = new Vector2(0f, 0f);
				Material val14 = new Material(Addressables.LoadAssetAsync<Shader>((object)"TextMesh Pro/FormerResources/Shaders/TMP_Sprite.shader").WaitForCompletion());
				Texture val15 = Addressables.LoadAssetAsync<Texture>((object)"TextMesh Pro/FormerResources/Sprite Assets/texXBoxOneGlyphs.png").WaitForCompletion();
				val13.AddComponent<CanvasRenderer>().SetMaterial(val14, val15);
				TMP_SubMeshUI obj9 = val13.AddComponent<TMP_SubMeshUI>();
				obj9.fontAsset = fontAsset;
				obj9.spriteAsset = Addressables.LoadAssetAsync<TMP_SpriteAsset>((object)"TextMesh Pro/FormerResources/Sprite Assets/tmpsprXboxOneGlyphs.asset").WaitForCompletion();
				obj9.m_TextComponent = (TextMeshProUGUI)(object)val12;
				HGGamepadInputEvent val16 = survivorChoiceGrid.AddComponent<HGGamepadInputEvent>();
				val16.requiredTopLayer = uiLayerKey;
				val16.actionName = actionName;
				val16.enabledObjectsIfActive = (GameObject[])(object)new GameObject[1] { val10 };
				val16.actionEvent = new UnityEvent();
				val10.AddComponent<VariantArrowToggler>().arrow = val8;
				return val3;
			}
		}

		private void Awake()
		{
			buttonHistory = ((Component)this).GetComponent<HGButtonHistory>();
			characterSelectBar = ((Component)this).GetComponent<CharacterSelectBarController>();
			((UnityEvent<SurvivorPickInfo>)(object)characterSelectBar.onSurvivorPicked).AddListener((UnityAction<SurvivorPickInfo>)delegate(SurvivorPickInfo survivorInfo)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				pickedSurvivor = survivorInfo.pickedSurvivor;
			});
			PrepareContainer();
			SetupPagingStuff();
			UpdateHeights();
			SurvivorsPerRow = CalculateSurvivorsPerRow();
		}

		private void OnEnable()
		{
			ScrollableLobbyUIPlugin.CharacterSelectRows.SettingChanged += OnCharacterSelectRowsSettingsChanged;
			ScrollableLobbyUIPlugin.InlinePageArrows.SettingChanged += OnInlinePageArrowsSettingsChanged;
		}

		private void OnDisable()
		{
			ScrollableLobbyUIPlugin.CharacterSelectRows.SettingChanged -= OnCharacterSelectRowsSettingsChanged;
			ScrollableLobbyUIPlugin.InlinePageArrows.SettingChanged -= OnInlinePageArrowsSettingsChanged;
		}

		private void OnCharacterSelectRowsSettingsChanged(object sender, EventArgs e)
		{
			SurvivorIconController? obj = SurvivorIconControllers.elements.FirstOrDefault();
			SurvivorDef item = ((obj != null) ? obj.survivorDef : null);
			int num = survivorDefList.IndexOf(item);
			if (num == -1)
			{
				CurrentPageIndex = 0;
			}
			else
			{
				int num2 = RecalculateSurvivorIndexWithInlineButtons(num);
				CurrentPageIndex = num2 / SurvivorsPerPage;
			}
			Build();
		}

		private void OnInlinePageArrowsSettingsChanged(object sender, EventArgs e)
		{
			int survivorsPerRow = CalculateSurvivorsPerRow();
			int num = CurrentPageIndex * SurvivorsPerPage;
			SurvivorsPerRow = survivorsPerRow;
			CurrentPageIndex = num / SurvivorsPerPage;
			Build();
		}

		private void Update()
		{
			int num = CalculateSurvivorsPerRow();
			if (num != SurvivorsPerRow)
			{
				int num2 = CurrentPageIndex * SurvivorsPerPage;
				SurvivorsPerRow = num;
				CurrentPageIndex = num2 / SurvivorsPerPage;
				Build();
			}
		}

		private int CalculateSurvivorsPerRow()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			Transform parent = ((Component)IconContainerGrid).transform.parent.parent.parent;
			Rect rect = ((RectTransform)((parent is RectTransform) ? parent : null)).rect;
			float width = ((Rect)(ref rect)).width;
			int num = ((!ScrollableLobbyUIPlugin.InlinePageArrows.Value) ? 12 : 0);
			int num2 = Math.Max(1, (int)(width + 4f - (float)num) / 74);
			if (!ScrollableLobbyUIPlugin.InlinePageArrows.Value)
			{
				if (num2 * SurvivorRows < survivorDefList.Count)
				{
					((Component)((Component)arrowPreviousButtonComponent).transform.parent).gameObject.SetActive(true);
					((Component)((Component)arrowNextButtonComponent).transform.parent).gameObject.SetActive(true);
					num2 = Math.Max(1, num2 - 1);
				}
				else
				{
					((Component)((Component)arrowPreviousButtonComponent).transform.parent).gameObject.SetActive(false);
					((Component)((Component)arrowNextButtonComponent).transform.parent).gameObject.SetActive(false);
				}
			}
			else if (num2 * SurvivorRows < survivorDefList.Count)
			{
				num2 = Math.Max(SurvivorRows switch
				{
					1 => 3, 
					2 => 2, 
					_ => 1, 
				}, num2);
			}
			return num2;
		}

		private void UpdateHeights()
		{
			foreach (LayoutElement trackingHeightElement in trackingHeightElements)
			{
				trackingHeightElement.minHeight = ContainerHeight;
				trackingHeightElement.preferredHeight = ContainerHeight;
			}
		}

		internal void Build()
		{
			((Component)inlinePreviousButtonComponent).gameObject.SetActive(ScrollableLobbyUIPlugin.InlinePageArrows.Value);
			((Component)inlineNextButtonComponent).gameObject.SetActive(ScrollableLobbyUIPlugin.InlinePageArrows.Value);
			((Component)((Component)arrowPreviousButtonComponent).transform.parent).gameObject.SetActive(!ScrollableLobbyUIPlugin.InlinePageArrows.Value);
			((Component)((Component)arrowNextButtonComponent).transform.parent).gameObject.SetActive(!ScrollableLobbyUIPlugin.InlinePageArrows.Value);
			GatherSurvivorsInfo();
			if (ScrollableLobbyUIPlugin.InlinePageArrows.Value)
			{
				int count = survivorDefList.Count;
				int num = survivorDefList.Count - (SurvivorsPerPage - 1) * 2;
				_ = survivorDefList.Count;
				int num2 = ((survivorDefList.Count > SurvivorsPerPage) ? (2 + (num / (SurvivorsPerPage - 2) + ((num % (SurvivorsPerPage - 2) > 0) ? 1 : 0)) * 2) : 0);
				int num3 = num2;
				count += num3;
				PageCount = count / SurvivorsPerPage + ((count % SurvivorsPerPage > 0) ? 1 : 0);
				fillerCount = PageCount * SurvivorsPerPage - count;
			}
			else
			{
				int count2 = survivorDefList.Count;
				PageCount = count2 / SurvivorsPerPage + ((count2 % SurvivorsPerPage > 0) ? 1 : 0);
				fillerCount = PageCount * SurvivorsPerPage - count2;
			}
			CurrentPageIndex = Mathf.Clamp(CurrentPageIndex, 0, PageCount - 1);
			IconContainerGrid.constraintCount = SurvivorsPerRow;
			UpdateHeights();
			AllocateCells();
			RebuildPage();
		}

		internal void EnforceValidChoice()
		{
			if ((Object.op_Implicit((Object)(object)characterSelectBar.pickedIcon) && characterSelectBar.pickedIcon.survivorIsAvailable) || SurvivorIsAvailable(pickedSurvivor))
			{
				return;
			}
			int num = survivorDefList.IndexOf(pickedSurvivor);
			for (int num2 = -1; num2 < survivorDefList.Count; num2 *= -1)
			{
				int num3 = num + num2;
				if (0 <= num3 && num3 < survivorDefList.Count)
				{
					SurvivorDef val = survivorDefList[num3];
					if (SurvivorIsAvailable(val))
					{
						characterSelectBar.PickIconBySurvivorDef(val);
						break;
					}
				}
				if (num2 >= 0)
				{
					num2++;
				}
			}
		}

		private bool SurvivorIsAvailable(SurvivorDef survivorDef)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)survivorDef) && SurvivorCatalog.SurvivorIsUnlockedOnThisClient(survivorDef.survivorIndex) && survivorDef.CheckRequiredExpansionEnabled((NetworkUser)null))
			{
				return survivorDef.CheckUserHasRequiredEntitlement(LocalUser);
			}
			return false;
		}

		public void SelectNextPage()
		{
			if (!IsOnLastPage)
			{
				CurrentPageIndex++;
				RebuildPage();
			}
		}

		public void SelectPreviousPage()
		{
			if (!IsOnFirstPage)
			{
				CurrentPageIndex--;
				RebuildPage();
			}
		}

		public void OpenPageWithCharacter(SurvivorIndex survivorIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			OpenPageWithCharacter(SurvivorCatalog.GetSurvivorDef(survivorIndex));
		}

		public void OpenPageWithCharacter(SurvivorDef survivorDef)
		{
			int num = survivorDefList.FindIndex((SurvivorDef el) => (Object)(object)el == (Object)(object)survivorDef);
			if (num != -1)
			{
				CurrentPageIndex = RecalculateSurvivorIndexWithInlineButtons(num) / SurvivorsPerPage;
				RebuildPage();
			}
		}

		private int RecalculateSurvivorIndexWithInlineButtons(int index)
		{
			if (!ScrollableLobbyUIPlugin.InlinePageArrows.Value)
			{
				return index;
			}
			if (PageCount == 1)
			{
				return index;
			}
			if (index == survivorDefList.Count)
			{
				return index + 2 + (PageCount - 2) * 2;
			}
			if (index < SurvivorsPerPage - 1)
			{
				return index;
			}
			int num = SurvivorsPerPage - 2;
			index -= SurvivorsPerPage - 1;
			while (index > 0)
			{
				num += 2;
				index -= SurvivorsPerPage - 2;
				num = ((index <= 0) ? (num + (SurvivorsPerPage - 2 + index)) : (num + (SurvivorsPerPage - 2)));
			}
			return num;
		}

		public CharacterSelectBarControllerExtra()
		{
			int num = ((!ScrollableLobbyUIPlugin.InlinePageArrows.Value) ? 1 : (ScrollableLobbyUIPlugin.CharacterSelectRows.Value switch
			{
				1 => 3, 
				2 => 2, 
				_ => 1, 
			}));
			SurvivorsPerRow = num;
			trackingHeightElements = new List<LayoutElement>();
			survivorDefList = new List<SurvivorDef>();
			PageCount = 1;
			((MonoBehaviour)this)..ctor();
		}
	}
	public class ClearTextOnDisable : MonoBehaviour
	{
		public List<LanguageTextMeshController> textObjects;

		private void OnDisable()
		{
			if (textObjects == null)
			{
				return;
			}
			foreach (LanguageTextMeshController textObject in textObjects)
			{
				if (Object.op_Implicit((Object)(object)textObject))
				{
					textObject.token = string.Empty;
				}
			}
		}
	}
	public class ConstrainedScrollRect : ScrollRect
	{
		public enum Constraint
		{
			None,
			OnlyDrag,
			OnlyScroll
		}

		public Constraint scrollConstraint;

		public ScrollRect redirectConstrained;

		private void RedirectEvent<T>(Action<T> action) where T : IEventSystemHandler
		{
			if (Object.op_Implicit((Object)(object)redirectConstrained))
			{
				T[] components = ((Component)redirectConstrained).GetComponents<T>();
				foreach (T obj in components)
				{
					action(obj);
				}
			}
		}

		public override void OnInitializePotentialDrag(PointerEventData eventData)
		{
			RedirectEvent<IInitializePotentialDragHandler>((Action<IInitializePotentialDragHandler>)delegate(IInitializePotentialDragHandler redirectObject)
			{
				redirectObject.OnInitializePotentialDrag(eventData);
			});
			((ScrollRect)this).OnInitializePotentialDrag(eventData);
		}

		public override void OnDrag(PointerEventData eventData)
		{
			if (scrollConstraint == Constraint.OnlyScroll)
			{
				RedirectEvent<IDragHandler>((Action<IDragHandler>)delegate(IDragHandler redirectObject)
				{
					redirectObject.OnDrag(eventData);
				});
			}
			else
			{
				((ScrollRect)this).OnDrag(eventData);
			}
		}

		public override void OnBeginDrag(PointerEventData eventData)
		{
			if (scrollConstraint == Constraint.OnlyScroll)
			{
				RedirectEvent<IBeginDragHandler>((Action<IBeginDragHandler>)delegate(IBeginDragHandler redirectObject)
				{
					redirectObject.OnBeginDrag(eventData);
				});
			}
			else
			{
				((ScrollRect)this).OnBeginDrag(eventData);
			}
		}

		public override void OnEndDrag(PointerEventData eventData)
		{
			if (scrollConstraint == Constraint.OnlyScroll)
			{
				RedirectEvent<IEndDragHandler>((Action<IEndDragHandler>)delegate(IEndDragHandler redirectObject)
				{
					redirectObject.OnEndDrag(eventData);
				});
			}
			else
			{
				((ScrollRect)this).OnEndDrag(eventData);
			}
		}

		public override void OnScroll(PointerEventData eventData)
		{
			if (scrollConstraint == Constraint.OnlyDrag)
			{
				RedirectEvent<IScrollHandler>((Action<IScrollHandler>)delegate(IScrollHandler redirectObject)
				{
					redirectObject.OnScroll(eventData);
				});
			}
			else
			{
				((ScrollRect)this).OnScroll(eventData);
			}
		}
	}
	public class ContinuousScrollOnPress : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler
	{
		public float sensitivity = 150f;

		public MoveDirection moveDirection = (MoveDirection)4;

		public ScrollRect scrollRect;

		private bool mouseDown;

		private HGButton button;

		private void Awake()
		{
			button = ((Component)this).GetComponent<HGButton>();
		}

		private void OnEnable()
		{
			mouseDown = false;
		}

		private void Update()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected I4, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (mouseDown && ((Selectable)button).interactable)
			{
				float num = sensitivity * Time.deltaTime;
				MoveDirection val = moveDirection;
				switch ((int)val)
				{
				case 0:
				{
					RectTransform content4 = scrollRect.content;
					((Transform)content4).localPosition = ((Transform)content4).localPosition - new Vector3(num, 0f);
					break;
				}
				case 1:
				{
					RectTransform content3 = scrollRect.content;
					((Transform)content3).localPosition = ((Transform)content3).localPosition + new Vector3(0f, num);
					break;
				}
				case 2:
				{
					RectTransform content2 = scrollRect.content;
					((Transform)content2).localPosition = ((Transform)content2).localPosition + new Vector3(num, 0f);
					break;
				}
				case 3:
				{
					RectTransform content = scrollRect.content;
					((Transform)content).localPosition = ((Transform)content).localPosition - new Vector3(0f, num);
					break;
				}
				}
			}
		}

		public void OnPointerDown(PointerEventData eventData)
		{
			mouseDown = true;
		}

		public void OnPointerUp(PointerEventData eventData)
		{
			mouseDown = false;
		}
	}
	[RequireComponent(typeof(LayoutElement))]
	public class DynamicContentSizeFitter : MonoBehaviour
	{
		private LayoutElement layoutElement;

		public RectTransform watchTransform;

		public float maxWidth = -1f;

		public float maxHeight = -1f;

		public bool useMaxHeight;

		public bool useMaxWidth;

		public float MaxHeight
		{
			get
			{
				if (!(maxHeight < 0f))
				{
					return maxHeight;
				}
				return float.MaxValue;
			}
		}

		public float MaxWidth
		{
			get
			{
				if (!(maxWidth < 0f))
				{
					return maxWidth;
				}
				return float.MaxValue;
			}
		}

		private void Start()
		{
			layoutElement = ((Component)this).GetComponent<LayoutElement>();
		}

		private void OnGUI()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)watchTransform))
			{
				Rect rect = watchTransform.rect;
				if (useMaxWidth)
				{
					layoutElement.preferredWidth = Mathf.Min(((Rect)(ref rect)).width, MaxWidth);
				}
				if (useMaxHeight)
				{
					layoutElement.preferredHeight = Mathf.Min(((Rect)(ref rect)).height, MaxHeight);
				}
			}
		}
	}
	internal class GamepadScrollRectHelper : MonoBehaviour
	{
		public UILayerKey requiredTopLayer;

		public float stickScale = 3000f;

		private ScrollRect scrollRect;

		private MPEventSystemLocator eventSystemLocator;

		private void Start()
		{
			scrollRect = ((Component)this).GetComponent<ScrollRect>();
			eventSystemLocator = ((Component)this).GetComponent<MPEventSystemLocator>();
		}

		private bool GamepadIsCurrentInputSource()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Invalid comparison between Unknown and I4
			if (Object.op_Implicit((Object)(object)eventSystemLocator) && Object.op_Implicit((Object)(object)eventSystemLocator.eventSystem))
			{
				return (int)eventSystemLocator.eventSystem.currentInputSource == 1;
			}
			return false;
		}

		private bool CanAcceptInput()
		{
			if (Object.op_Implicit((Object)(object)requiredTopLayer))
			{
				return requiredTopLayer.representsTopLayer;
			}
			return true;
		}

		private void Update()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (GamepadIsCurrentInputSource() && CanAcceptInput())
			{
				Rect rect = scrollRect.content.rect;
				float height = ((Rect)(ref rect)).height;
				float axis = eventSystemLocator.eventSystem.player.GetAxis(13);
				scrollRect.verticalNormalizedPosition = Mathf.Clamp01(scrollRect.verticalNormalizedPosition + axis * stickScale * Time.unscaledDeltaTime / height);
			}
		}
	}
	public static class InLobbyConfigIntegration
	{
		public const string GUID = "com.KingEnderBrine.InLobbyConfig";

		private static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.InLobbyConfig");

		private static object ModConfig { get; set; }

		public static void OnStart()
		{
			if (Enabled)
			{
				OnStartInternal();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static void OnStartInternal()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			ModConfigEntry val = new ModConfigEntry();
			val.DisplayName = "Scrollable lobby UI";
			string section = ((ConfigEntryBase)ScrollableLobbyUIPlugin.CharacterSelectRows).Definition.Section;
			val.SectionFields[section] = (IEnumerable<IConfigField>)(object)new IConfigField[4]
			{
				(IConfigField)new IntConfigField(((ConfigEntryBase)ScrollableLobbyUIPlugin.CharacterSelectRows).Definition.Key, ((ConfigEntryBase)ScrollableLobbyUIPlugin.CharacterSelectRows).Description.Description, (Func<int>)(() => ScrollableLobbyUIPlugin.CharacterSelectRows.Value), (Action<int>)null, (Action<int>)delegate(int newValue)
				{
					ScrollableLobbyUIPlugin.CharacterSelectRows.Value = newValue;
				}, (int?)1, (int?)50),
				(IConfigField)new BooleanConfigField(((ConfigEntryBase)ScrollableLobbyUIPlugin.InlinePageArrows).Definition.Key, ((ConfigEntryBase)ScrollableLobbyUIPlugin.InlinePageArrows).Description.Description, (Func<bool>)(() => ScrollableLobbyUIPlugin.InlinePageArrows.Value), (Action<bool>)delegate(bool newValue)
				{
					ScrollableLobbyUIPlugin.InlinePageArrows.Value = newValue;
				}),
				(IConfigField)new BooleanConfigField(((ConfigEntryBase)ScrollableLobbyUIPlugin.ScrollRowsWithMouseWheel).Definition.Key, ((ConfigEntryBase)ScrollableLobbyUIPlugin.ScrollRowsWithMouseWheel).Description.Description, (Func<bool>)(() => ScrollableLobbyUIPlugin.ScrollRowsWithMouseWheel.Value), (Action<bool>)delegate(bool newValue)
				{
					ScrollableLobbyUIPlugin.ScrollRowsWithMouseWheel.Value = newValue;
				}),
				(IConfigField)new IntConfigField(((ConfigEntryBase)ScrollableLobbyUIPlugin.SkillRowHeight).Definition.Key, ((ConfigEntryBase)ScrollableLobbyUIPlugin.SkillRowHeight).Description.Description, (Func<int>)(() => ScrollableLobbyUIPlugin.SkillRowHeight.Value), (Action<int>)null, (Action<int>)delegate(int newValue)
				{
					ScrollableLobbyUIPlugin.SkillRowHeight.Value = newValue;
				}, (int?)1, (int?)320)
			};
			ModConfigCatalog.Add(val);
			ModConfig = val;
		}
	}
	[BepInPlugin("com.KingEnderBrine.ScrollableLobbyUI", "Scrollable lobby UI", "1.9.1")]
	public class ScrollableLobbyUIPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__CharacterSelectControllerRebuildLocal;

			public static hook_Awake <1>__LoadoutPanelControllerAwake;

			public static hook_ctor <2>__LoadoutPanelControllerRowCtor;

			public static hook_FinishSetup <3>__LoadoutPanelControllerRowFinishSetup;

			public static hook_OnDestroy <4>__LoadoutPanelControllerOnDestroy;

			public static hook_Awake <5>__CharacterSelectBarControllerAwake;

			public static hook_Build <6>__CharacterSelectBarControllerBuild;

			public static hook_EnforceValidChoice <7>__CharacterSelectBarControllerEnforceValidChoice;

			public static hook_PickIconBySurvivorDef <8>__CharacterSelectBarControllerPickIconBySurvivorDef;

			public static hook_Awake <9>__RuleBookViewerAwake;

			public static hook_SetData <10>__RuleCategoryControllerSetData;

			public static hook_Update <11>__RuleBookViewerStripUpdate;

			public static hook_SetData <12>__RuleBookViewerStripSetData;
		}

		public const string GUID = "com.KingEnderBrine.ScrollableLobbyUI";

		public const string Name = "Scrollable lobby UI";

		public const string Version = "1.9.1";

		internal static ConfigEntry<int> CharacterSelectRows { get; private set; }

		internal static ConfigEntry<bool> InlinePageArrows { get; private set; }

		internal static ConfigEntry<bool> ScrollRowsWithMouseWheel { get; private set; }

		internal static ConfigEntry<int> SkillRowHeight { get; private set; }

		private void Awake()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Expected O, but got Unknown
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Expected O, but got Unknown
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Expected O, but got Unknown
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Expected O, but got Unknown
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Expected O, but got Unknown
			CharacterSelectRows = ((BaseUnityPlugin)this).Config.Bind<int>("Main", "CharacterSelectRows", 2, new ConfigDescription("The amount of rows that should be displayed in character select screen", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>()));
			InlinePageArrows = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "CharacterPageArrowsInline", false, new ConfigDescription("Sets if the arrows should be placed to the side of the character list (false) or if they should be placed in a survivor square (true).", (AcceptableValueBase)null, Array.Empty<object>()));
			ScrollRowsWithMouseWheel = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "SkillsSkinsWheelScrolling", false, new ConfigDescription("Sets if rows of skills or skins with too many entries should be scrollable with mouse wheel.", (AcceptableValueBase)null, Array.Empty<object>()));
			SkillRowHeight = ((BaseUnityPlugin)this).Config.Bind<int>("Main", "SkillsSkinsRowHeight", 96, new ConfigDescription("The height of a single skill/skin row.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 320), Array.Empty<object>()));
			object obj = <>O.<0>__CharacterSelectControllerRebuildLocal;
			if (obj == null)
			{
				Manipulator val = UIHooks.CharacterSelectControllerRebuildLocal;
				<>O.<0>__CharacterSelectControllerRebuildLocal = val;
				obj = (object)val;
			}
			CharacterSelectController.RebuildLocal += (Manipulator)obj;
			object obj2 = <>O.<1>__LoadoutPanelControllerAwake;
			if (obj2 == null)
			{
				hook_Awake val2 = UIHooks.LoadoutPanelControllerAwake;
				<>O.<1>__LoadoutPanelControllerAwake = val2;
				obj2 = (object)val2;
			}
			LoadoutPanelController.Awake += (hook_Awake)obj2;
			object obj3 = <>O.<2>__LoadoutPanelControllerRowCtor;
			if (obj3 == null)
			{
				hook_ctor val3 = UIHooks.LoadoutPanelControllerRowCtor;
				<>O.<2>__LoadoutPanelControllerRowCtor = val3;
				obj3 = (object)val3;
			}
			Row.ctor += (hook_ctor)obj3;
			object obj4 = <>O.<3>__LoadoutPanelControllerRowFinishSetup;
			if (obj4 == null)
			{
				hook_FinishSetup val4 = UIHooks.LoadoutPanelControllerRowFinishSetup;
				<>O.<3>__LoadoutPanelControllerRowFinishSetup = val4;
				obj4 = (object)val4;
			}
			Row.FinishSetup += (hook_FinishSetup)obj4;
			object obj5 = <>O.<4>__LoadoutPanelControllerOnDestroy;
			if (obj5 == null)
			{
				hook_OnDestroy val5 = UIHooks.LoadoutPanelControllerOnDestroy;
				<>O.<4>__LoadoutPanelControllerOnDestroy = val5;
				obj5 = (object)val5;
			}
			LoadoutPanelController.OnDestroy += (hook_OnDestroy)obj5;
			object obj6 = <>O.<5>__CharacterSelectBarControllerAwake;
			if (obj6 == null)
			{
				hook_Awake val6 = UIHooks.CharacterSelectBarControllerAwake;
				<>O.<5>__CharacterSelectBarControllerAwake = val6;
				obj6 = (object)val6;
			}
			CharacterSelectBarController.Awake += (hook_Awake)obj6;
			object obj7 = <>O.<6>__CharacterSelectBarControllerBuild;
			if (obj7 == null)
			{
				hook_Build val7 = UIHooks.CharacterSelectBarControllerBuild;
				<>O.<6>__CharacterSelectBarControllerBuild = val7;
				obj7 = (object)val7;
			}
			CharacterSelectBarController.Build += (hook_Build)obj7;
			object obj8 = <>O.<7>__CharacterSelectBarControllerEnforceValidChoice;
			if (obj8 == null)
			{
				hook_EnforceValidChoice val8 = UIHooks.CharacterSelectBarControllerEnforceValidChoice;
				<>O.<7>__CharacterSelectBarControllerEnforceValidChoice = val8;
				obj8 = (object)val8;
			}
			CharacterSelectBarController.EnforceValidChoice += (hook_EnforceValidChoice)obj8;
			object obj9 = <>O.<8>__CharacterSelectBarControllerPickIconBySurvivorDef;
			if (obj9 == null)
			{
				hook_PickIconBySurvivorDef val9 = UIHooks.CharacterSelectBarControllerPickIconBySurvivorDef;
				<>O.<8>__CharacterSelectBarControllerPickIconBySurvivorDef = val9;
				obj9 = (object)val9;
			}
			CharacterSelectBarController.PickIconBySurvivorDef += (hook_PickIconBySurvivorDef)obj9;
			object obj10 = <>O.<9>__RuleBookViewerAwake;
			if (obj10 == null)
			{
				hook_Awake val10 = UIHooks.RuleBookViewerAwake;
				<>O.<9>__RuleBookViewerAwake = val10;
				obj10 = (object)val10;
			}
			RuleBookViewer.Awake += (hook_Awake)obj10;
			object obj11 = <>O.<10>__RuleCategoryControllerSetData;
			if (obj11 == null)
			{
				hook_SetData val11 = UIHooks.RuleCategoryControllerSetData;
				<>O.<10>__RuleCategoryControllerSetData = val11;
				obj11 = (object)val11;
			}
			RuleCategoryController.SetData += (hook_SetData)obj11;
			object obj12 = <>O.<11>__RuleBookViewerStripUpdate;
			if (obj12 == null)
			{
				hook_Update val12 = UIHooks.RuleBookViewerStripUpdate;
				<>O.<11>__RuleBookViewerStripUpdate = val12;
				obj12 = (object)val12;
			}
			RuleBookViewerStrip.Update += (hook_Update)obj12;
			object obj13 = <>O.<12>__RuleBookViewerStripSetData;
			if (obj13 == null)
			{
				hook_SetData val13 = UIHooks.RuleBookViewerStripSetData;
				<>O.<12>__RuleBookViewerStripSetData = val13;
				obj13 = (object)val13;
			}
			RuleBookViewerStrip.SetData += (hook_SetData)obj13;
		}

		private void Start()
		{
			InLobbyConfigIntegration.OnStart();
		}
	}
	public class ScrollButtonsController : MonoBehaviour
	{
		public GameObject left;

		public GameObject right;

		public float deadzone = 0.0001f;

		private ScrollRect scrollRect;

		private RectTransform rectTransform;

		private bool _contentOutOfRect;

		public bool ContentOutOfRect
		{
			get
			{
				return _contentOutOfRect;
			}
			set
			{
				if (_contentOutOfRect != value)
				{
					_contentOutOfRect = value;
					this.OnContentOutOfRectChanged?.Invoke(this, new PropertyChangedEventArgs("ContentOutOfRect"));
				}
			}
		}

		public event PropertyChangedEventHandler OnContentOutOfRectChanged;

		private void Awake()
		{
			scrollRect = ((Component)this).GetComponent<ScrollRect>();
			rectTransform = ((Component)this).GetComponent<RectTransform>();
		}

		private void Update()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = rectTransform.rect;
			float width = ((Rect)(ref rect)).width;
			rect = scrollRect.content.rect;
			ContentOutOfRect = width < ((Rect)(ref rect)).width;
			left.SetActive(ContentOutOfRect && scrollRect.horizontalNormalizedPosition > deadzone);
			right.SetActive(ContentOutOfRect && scrollRect.horizontalNormalizedPosition < 1f - deadzone);
		}
	}
	internal static class UIHooks
	{
		private const int ruleFillerWidth = 87;

		private const int ruleFillerHeight = 64;

		private const float ruleScrollDuration = 0.1f;

		private const float skillRowDefaultHeight = 96f;

		private const float skillIconDefaultHeight = 76f;

		private const float skillHighlightDefaultHeight = 64f;

		private static readonly List<HGButton> buttonsWithListeners = new List<HGButton>();

		internal static void LoadoutPanelControllerAwake(orig_Awake orig, LoadoutPanelController self)
		{
			orig.Invoke(self);
			UILayerKey componentInParent = ((Component)self).GetComponentInParent<UILayerKey>();
			ButtonsNavigationController buttonsNavigationController = ((Component)componentInParent).gameObject.AddComponent<ButtonsNavigationController>();
			buttonsNavigationController.requiredTopLayer = componentInParent;
			buttonsNavigationController.loadoutPanel = self;
			GameObject panel2 = AddScrollPanel(((Component)self).transform, "LoadoutScrollPanel");
			GameObject panel3 = AddScrollPanel(((Component)self).transform.parent.parent.Find("SkillPanel"), "SkillsScrollPanel");
			Transform obj = ((Component)self).transform.parent.parent.Find("OverviewPanel");
			GameObject val = AddScrollPanel(obj, "OverviewScrollPanel");
			VerticalLayoutGroup obj2 = ((Component)obj).gameObject.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true;
			val.AddComponent<GamepadScrollRectHelper>().requiredTopLayer = componentInParent;
			((Component)((Component)self).transform.parent.parent.parent.parent.Find("SurvivorInfoPanel, Inactive/DescriptionPanel, Naked")).gameObject.AddComponent<RectMask2D>();
			MoveUpDescription("DescriptionPanel, Loadout", "LoadoutScrollContainer", panel2);
			MoveUpDescription("DescriptionPanel, Skill", "SkillScrollContainer", panel3);
			static GameObject AddScrollPanel(Transform panel, string name)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				GameObject val4 = new GameObject(name);
				val4.layer = 5;
				val4.transform.SetParent(((Component)panel).transform.parent, false);
				((Component)panel).transform.SetParent(val4.transform, false);
				val4.AddComponent<MPEventSystemLocator>();
				val4.AddComponent<RectMask2D>();
				ConstrainedScrollRect constrainedScrollRect = val4.AddComponent<ConstrainedScrollRect>();
				((ScrollRect)constrainedScrollRect).horizontal = false;
				((ScrollRect)constrainedScrollRect).content = ((Component)panel).GetComponent<RectTransform>();
				((ScrollRect)constrainedScrollRect).scrollSensitivity = 30f;
				((ScrollRect)constrainedScrollRect).movementType = (MovementType)2;
				constrainedScrollRect.scrollConstraint = ConstrainedScrollRect.Constraint.None;
				ContentSizeFitter obj4 = ((Component)panel).gameObject.AddComponent<ContentSizeFitter>();
				obj4.horizontalFit = (FitMode)0;
				obj4.verticalFit = (FitMode)2;
				RectTransform component = ((Component)constrainedScrollRect).GetComponent<RectTransform>();
				component.pivot = new Vector2(0.5f, 1f);
				component.anchorMin = new Vector2(0f, 0f);
				component.anchorMax = new Vector2(1f, 1f);
				component.sizeDelta = new Vector2(0f, 0f);
				((Component)panel).GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
				Image val5 = ((Component)panel).GetComponent<Image>();
				if (!Object.op_Implicit((Object)(object)val5))
				{
					val5 = ((Component)panel).gameObject.AddComponent<Image>();
				}
				((Behaviour)val5).enabled = true;
				((Graphic)val5).color = new Color(0f, 0f, 0f, 0f);
				((Graphic)val5).raycastTarget = true;
				return val4;
			}
			static void MoveUpDescription(string descriptionPanelName, string parentName, GameObject panel)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0061: 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_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				Transform val2 = panel.transform.GetChild(0).Find(descriptionPanelName);
				GameObject val3 = new GameObject(parentName);
				val3.transform.SetParent(panel.transform.parent, false);
				panel.transform.SetParent(val3.transform, false);
				val2.SetParent(val3.transform, false);
				RectTransform obj3 = val3.AddComponent<RectTransform>();
				obj3.anchorMin = new Vector2(0f, 0f);
				obj3.anchorMax = new Vector2(1f, 1f);
				obj3.pivot = new Vector2(0.5f, 1f);
				obj3.sizeDelta = new Vector2(0f, 0f);
				((Component)panel.transform.GetChild(0)).gameObject.AddComponent<ClearTextOnDisable>().textObjects = new List<LanguageTextMeshController> { ((Component)val2).GetComponentInChildren<LanguageTextMeshController>() };
			}
		}

		internal static void LoadoutPanelControllerOnDestroy(orig_OnDestroy orig, LoadoutPanelController self)
		{
			orig.Invoke(self);
			buttonsWithListeners.Clear();
		}

		internal static void LoadoutPanelControllerRowFinishSetup(orig_FinishSetup orig, object selfObject, bool addWIPIcons)
		{
			//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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			Row val = (Row)((selfObject is Row) ? selfObject : null);
			orig.Invoke((object)val, addWIPIcons);
			RectTransform rowRectTransform = val.rowPanelTransform;
			_ = val.buttonContainerTransform;
			foreach (RowData rowDatum in val.rowData)
			{
				MPButton button = rowDatum.button;
				button.onSelect.AddListener((UnityAction)delegate
				{
					//IL_0035: Unknown result type (might be due to invalid IL or missing references)
					//IL_003b: Invalid comparison between Unknown and I4
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_005b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0060: Unknown result type (might be due to invalid IL or missing references)
					//IL_0065: Unknown result type (might be due to invalid IL or missing references)
					//IL_006d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_0088: Unknown result type (might be due to invalid IL or missing references)
					//IL_008d: Unknown result type (might be due to invalid IL or missing references)
					//IL_009e: Unknown result type (might be due to invalid IL or missing references)
					//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00af: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
					//IL_013e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0143: Unknown result type (might be due to invalid IL or missing references)
					//IL_0148: Unknown result type (might be due to invalid IL or missing references)
					//IL_014d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0155: Unknown result type (might be due to invalid IL or missing references)
					//IL_015a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0167: Unknown result type (might be due to invalid IL or missing references)
					//IL_016c: Unknown result type (might be due to invalid IL or missing references)
					//IL_017a: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
					//IL_0109: Unknown result type (might be due to invalid IL or missing references)
					//IL_0117: Unknown result type (might be due to invalid IL or missing references)
					//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
					//IL_0193: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
					//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
					//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
					//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
					ConstrainedScrollRect componentInParent = ((Component)button).GetComponentInParent<ConstrainedScrollRect>();
					ScrollRect redirectConstrained = componentInParent.redirectConstrained;
					MPEventSystemLocator component = ((Component)redirectConstrained).GetComponent<MPEventSystemLocator>();
					if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.eventSystem) && (int)component.eventSystem.currentInputSource == 1)
					{
						RectTransform content = redirectConstrained.content;
						Vector2 val3 = Vector2.op_Implicit(((Component)redirectConstrained).transform.InverseTransformPoint(((Transform)rowRectTransform).position));
						Rect rect = ((Component)redirectConstrained).GetComponent<RectTransform>().rect;
						float height = ((Rect)(ref rect)).height;
						rect = rowRectTransform.rect;
						float num3 = ((Rect)(ref rect)).height / 2f;
						if (val3.y - num3 < 0f - height)
						{
							content.anchoredPosition = new Vector2(content.anchoredPosition.x, 0f - rowRectTransform.anchoredPosition.y - height + num3);
						}
						else if (val3.y + num3 > 0f)
						{
							content.anchoredPosition = new Vector2(content.anchoredPosition.x, 0f - rowRectTransform.anchoredPosition.y - num3);
						}
						RectTransform content2 = ((ScrollRect)componentInParent).content;
						RectTransform component2 = ((Component)button).GetComponent<RectTransform>();
						Vector2 val4 = Vector2.op_Implicit(((Component)componentInParent).transform.InverseTransformPoint(((Transform)component2).position));
						rect = ((Component)componentInParent).GetComponent<RectTransform>().rect;
						float width = ((Rect)(ref rect)).width;
						rect = component2.rect;
						float width2 = ((Rect)(ref rect)).width;
						int num4 = 8;
						if (val4.x + width2 + (float)num4 > 0f)
						{
							content2.anchoredPosition = new Vector2(0f - component2.anchoredPosition.x - width2 + width - (float)num4 - 24f, content2.anchoredPosition.y);
						}
						else if (val4.x - (float)num4 < 0f - width)
						{
							content2.anchoredPosition = new Vector2(0f - component2.anchoredPosition.x + (float)num4 + 24f, content2.anchoredPosition.y);
						}
					}
				});
				LayoutElement buttonLayout = ((Component)button).GetComponent<LayoutElement>();
				buttonLayout.minHeight = 8f;
				buttonLayout.minWidth = 8f;
				_ = ScrollableLobbyUIPlugin.SkillRowHeight.Value;
				Transform val2 = ((Component)button).transform.Find("ButtonSelectionHighlight, Checkbox");
				RectTransform highlightRect;
				if (Object.op_Implicit((Object)(object)val2))
				{
					highlightRect = ((Component)val2).GetComponent<RectTransform>();
					OnSkillRowHeightChangedHighlight(null, null);
					ScrollableLobbyUIPlugin.SkillRowHeight.SettingChanged += OnSkillRowHeightChangedHighlight;
					OnDestroyCallback.AddCallback(((Component)buttonLayout).gameObject, (Action<OnDestroyCallback>)delegate
					{
						ScrollableLobbyUIPlugin.SkillRowHeight.SettingChanged -= OnSkillRowHeightChangedHighlight;
					});
				}
				OnSkillRowHeightChanged(null, null);
				ScrollableLobbyUIPlugin.SkillRowHeight.SettingChanged += OnSkillRowHeightChanged;
				OnDestroyCallback.AddCallback(((Component)buttonLayout).gameObject, (Action<OnDestroyCallback>)delegate
				{
					ScrollableLobbyUIPlugin.SkillRowHeight.SettingChanged -= OnSkillRowHeightChanged;
				});
				void OnSkillRowHeightChanged(object sender, EventArgs eventArgs)
				{
					float num = (float)ScrollableLobbyUIPlugin.SkillRowHeight.Value / 96f * 76f;
					buttonLayout.preferredHeight = num;
					buttonLayout.preferredWidth = num;
				}
				void OnSkillRowHeightChangedHighlight(object sender, EventArgs eventArgs)
				{
					//IL_0020: Unknown result type (might be due to invalid IL or missing references)
					float num2 = (float)ScrollableLobbyUIPlugin.SkillRowHeight.Value / 96f * 64f;
					highlightRect.sizeDelta = new Vector2(num2, num2);
				}
			}
		}

		internal static void LoadoutPanelControllerRowCtor(orig_ctor orig, object selfObject, LoadoutPanelController owner, BodyIndex bodyIndex, string titleToken)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Expected O, but got Unknown
			Row val = (Row)((selfObject is Row) ? selfObject : null);
			orig.Invoke((object)val, owner, bodyIndex, titleToken);
			RectTransform choiceHighlightRect = val.choiceHighlightRect;
			((Behaviour)((Component)choiceHighlightRect).GetComponent<RefreshCanvasDrawOrder>()).enabled = false;
			((Component)choiceHighlightRect).GetComponent<Canvas>().overrideSorting = false;
			RectTransform buttonContainerTransform = val.buttonContainerTransform;
			RectTransform rowPanelTransform = val.rowPanelTransform;
			LayoutElement rowPanelLayout = ((Component)rowPanelTransform).GetComponent<LayoutElement>();
			OnSkillRowHeightChanged(null, null);
			ScrollableLobbyUIPlugin.SkillRowHeight.SettingChanged += OnSkillRowHeightChanged;
			OnDestroyCallback.AddCallback(((Component)rowPanelTransform).gameObject, (Action<OnDestroyCallback>)delegate
			{
				ScrollableLobbyUIPlugin.SkillRowHeight.SettingChanged -= OnSkillRowHeightChanged;
			});
			((Component)rowPanelTransform).gameObject.AddComponent<HorizontalLayoutGroup>();
			Transform obj = ((Transform)rowPanelTransform).Find("Panel");
			Transform val2 = ((Transform)rowPanelTransform).Find("SlotLabel");
			GameObject val3 = new GameObject("LabelContainer");
			val3.transform.SetParent((Transform)(object)rowPanelTransform, false);
			obj.SetParent(val3.transform, false);
			val2.SetParent(val3.transform, false);
			((Component)val2).GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 0f);
			LayoutElement obj2 = val3.AddComponent<LayoutElement>();
			obj2.minHeight = 0f;
			obj2.preferredHeight = 96f;
			obj2.minWidth = 128f;
			RectTransform component = val3.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(0f, 0f);
			GameObject val4 = new GameObject("RowScrollPanel");
			val4.transform.SetParent((Transform)(object)rowPanelTransform, false);
			GameObject val5 = new GameObject("Viewport");
			val5.transform.SetParent(val4.transform, false);
			RectTransform val6 = val5.AddComponent<RectTransform>();
			val6.pivot = new Vector2(0.5f, 0.5f);
			val6.anchorMin = new Vector2(0f, 0f);
			val6.anchorMax = new Vector2(1f, 1f);
			val6.sizeDelta = new Vector2(0f, 0f);
			((Transform)buttonContainerTransform).SetParent(val5.transform, false);
			((Transform)choiceHighlightRect).SetParent(val5.transform, false);
			val4.AddComponent<RectMask2D>();
			val4.AddComponent<LayoutElement>().preferredWidth = 100000f;
			ConstrainedScrollRect scrollRect = val4.AddComponent<ConstrainedScrollRect>();
			((ScrollRect)scrollRect).horizontal = true;
			((ScrollRect)scrollRect).vertical = false;
			((ScrollRect)scrollRect).viewport = val6;
			((ScrollRect)scrollRect).content = buttonContainerTransform;
			((ScrollRect)scrollRect).scrollSensitivity = -30f;
			((ScrollRect)scrollRect).movementType = (MovementType)2;
			scrollRect.redirectConstrained = (ScrollRect)(object)((Component)rowPanelTransform).GetComponentInParent<ConstrainedScrollRect>();
			RectTransform component2 = val4.GetComponent<RectTransform>();
			component2.pivot = new Vector2(1f, 0.5f);
			component2.anchorMin = new Vector2(0f, 0f);
			component2.anchorMax = new Vector2(1f, 1f);
			ContentSizeFitter obj3 = ((Component)buttonContainerTransform).gameObject.AddComponent<ContentSizeFitter>();
			obj3.horizontalFit = (FitMode)2;
			obj3.verticalFit = (FitMode)0;
			buttonContainerTransform.pivot = new Vector2(0f, 0.5f);
			Image obj4 = ((Component)buttonContainerTransform).GetComponent<Image>() ?? ((Component)buttonContainerTransform).gameObject.AddComponent<Image>();
			((Behaviour)obj4).enabled = true;
			((Graphic)obj4).color = Color.clear;
			((Component)((Transform)buttonContainerTransform).Find("Spacer")).gameObject.SetActive(false);
			((LayoutGroup)((Component)buttonContainerTransform).GetComponent<HorizontalLayoutGroup>()).padding = new RectOffset(8, 8, 8, 8);
			GameObject right = SetupButton("Right", (Transform)(object)component2, (MoveDirection)2, 1f);
			GameObject left = SetupButton("Left", (Transform)(object)component2, (MoveDirection)0, 0f);
			ScrollButtonsController scrollButtonsController = val4.AddComponent<ScrollButtonsController>();
			scrollButtonsController.left = left;
			scrollButtonsController.right = right;
			scrollButtonsController.OnContentOutOfRectChanged += delegate
			{
				OnScrollRowsWithMouseWheelUpdate(null, null);
			};
			OnScrollRowsWithMouseWheelUpdate(null, null);
			ScrollableLobbyUIPlugin.ScrollRowsWithMouseWheel.SettingChanged += OnScrollRowsWithMouseWheelUpdate;
			OnDestroyCallback.AddCallback(val4, (Action<OnDestroyCallback>)delegate
			{
				ScrollableLobbyUIPlugin.ScrollRowsWithMouseWheel.SettingChanged -= OnScrollRowsWithMouseWheelUpdate;
			});
			void OnScrollRowsWithMouseWheelUpdate(object sender, EventArgs args)
			{
				if (scrollButtonsController.ContentOutOfRect && ScrollableLobbyUIPlugin.ScrollRowsWithMouseWheel.Value)
				{
					scrollRect.scrollConstraint = ConstrainedScrollRect.Constraint.None;
				}
				else
				{
					scrollRect.scrollConstraint = ConstrainedScrollRect.Constraint.OnlyDrag;
				}
			}
			void OnSkillRowHeightChanged(object sender, EventArgs eventArgs)
			{
				rowPanelLayout.preferredHeight = ScrollableLobbyUIPlugin.SkillRowHeight.Value;
			}
			GameObject SetupButton(string buttonPrefix, Transform parent, MoveDirection moveDirection, float xNormalized)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Expected O, but got Unknown
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: 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_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_0173: Unknown result type (might be due to invalid IL or missing references)
				//IL_0187: Unknown result type (might be due to invalid IL or missing references)
				GameObject val7 = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)("RoR2/Base/UI/" + buttonPrefix + "Button.prefab")).WaitForCompletion(), parent, false);
				((Object)val7).name = buttonPrefix + "ScrollButton";
				val7.layer = 5;
				HGButton component3 = val7.GetComponent<HGButton>();
				GameObject val8 = new GameObject("Arrow");
				val8.transform.SetParent(val7.transform, false);
				RectTransform obj5 = val8.AddComponent<RectTransform>();
				obj5.pivot = new Vector2(0.5f, 0.5f);
				obj5.anchorMin = new Vector2(0f, 0f);
				obj5.anchorMax = new Vector2(1f, 1f);
				obj5.sizeDelta = new Vector2(-8f, 0f);
				Graphic targetGraphic = ((Selectable)component3).targetGraphic;
				Image val9 = (Image)(object)((targetGraphic is Image) ? targetGraphic : null);
				Image val10 = val8.AddComponent<Image>();
				val10.sprite = val9.sprite;
				Object.DestroyImmediate((Object)(object)((Selectable)component3).targetGraphic);
				TranslucentImage obj6 = val7.AddComponent<TranslucentImage>();
				((Graphic)obj6).material = Addressables.LoadAssetAsync<Material>((object)"TranslucentImage/Default-Translucent.mat").WaitForCompletion();
				((Graphic)obj6).color = Color.black;
				((Selectable)component3).targetGraphic = (Graphic)(object)val10;
				ContinuousScrollOnPress continuousScrollOnPress = val7.AddComponent<ContinuousScrollOnPress>();
				continuousScrollOnPress.scrollRect = (ScrollRect)(object)scrollRect;
				continuousScrollOnPress.sensitivity = -400f;
				continuousScrollOnPress.moveDirection = moveDirection;
				Object.DestroyImmediate((Object)(object)val7.GetComponent<LayoutElement>());
				RectTransform component4 = val7.GetComponent<RectTransform>();
				component4.anchorMin = new Vector2(xNormalized, 0f);
				component4.anchorMax = new Vector2(xNormalized, 1f);
				component4.pivot = new Vector2(xNormalized, 0.5f);
				component4.sizeDelta = new Vector2(24f, 0f);
				val7.SetActive(false);
				return val7;
			}
		}

		internal static void CharacterSelectControllerRebuildLocal(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			FieldReference val3 = default(FieldReference);
			val.GotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterSelectController>(x, "skillStripAllocator"),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val3)
			});
			List<Instruction> list = new List<Instruction>();
			for (int i = 0; i < 8; i++)
			{
				list.Add(val.Next);
				val.Index += 1;
			}
			val.Index += 1;
			foreach (Instruction item in list)
			{
				val.Emit(item.OpCode, item.Operand);
			}
			FieldInfo field = typeof(StripDisplayData).GetField("enabled");
			val.Emit(OpCodes.Ldfld, field);
			val.EmitDelegate<Action<RectTransform, bool>>((Action<RectTransform, bool>)delegate(RectTransform skillStrip, bool enabled)
			{
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Expected O, but got Unknown
				HGButton button;
				if (enabled)
				{
					LayoutElement component = ((Component)skillStrip).GetComponent<LayoutElement>();
					((Behaviour)component).enabled = true;
					component.minHeight = 0f;
					component.preferredHeight = 96f;
					button = ((Component)skillStrip).GetComponent<HGButton>();
					if (!buttonsWithListeners.Contains(button))
					{
						((MPButton)button).onSelect.AddListener(new UnityAction(OnScrollListener));
						buttonsWithListeners.Add(button);
					}
				}
				void OnScrollListener()
				{
					//IL_002e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0034: Invalid comparison between Unknown and I4
					//IL_0051: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_005b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0060: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_006d: Unknown result type (might be due to invalid IL or missing references)
					//IL_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_008f: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ab: 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_00da: Unknown result type (might be due to invalid IL or missing references)
					//IL_00e5: 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)
					ConstrainedScrollRect componentInParent = ((Component)button).GetComponentInParent<ConstrainedScrollRect>();
					MPEventSystemLocator component2 = ((Component)componentInParent).GetComponent<MPEventSystemLocator>();
					if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.eventSystem) && (int)component2.eventSystem.currentInputSource == 1)
					{
						RectTransform content = ((ScrollRect)componentInParent).content;
						RectTransform component3 = ((Component)button).GetComponent<RectTransform>();
						Vector2 val2 = Vector2.op_Implicit(((Component)componentInParent).transform.InverseTransformPoint(((Transform)component3).position));
						Rect rect = ((Component)componentInParent).GetComponent<RectTransform>().rect;
						float height = ((Rect)(ref rect)).height;
						rect = component3.rect;
						float num = ((Rect)(ref rect)).height / 2f;
						if (val2.y - num < 0f - height)
						{
							content.anchoredPosition = new Vector2(content.anchoredPosition.x, 0f - component3.anchoredPosition.y - height + num);
						}
						else if (val2.y + num > 0f)
						{
							content.anchoredPosition = new Vector2(content.anchoredPosition.x, 0f - component3.anchoredPosition.y - num);
						}
					}
				}
			});
		}

		internal static void RuleBookViewerStripUpdate(orig_Update orig, RuleBookViewerStrip self)
		{
		}

		internal static void CharacterSelectBarControllerAwake(orig_Awake orig, CharacterSelectBarController self)
		{
			orig.Invoke(self);
			((Component)self).gameObject.AddComponent<CharacterSelectBarControllerExtra>();
		}

		internal static void CharacterSelectBarControllerBuild(orig_Build orig, CharacterSelectBarController self)
		{
			((Component)self).GetComponent<CharacterSelectBarControllerExtra>().Build();
		}

		internal static void CharacterSelectBarControllerEnforceValidChoice(orig_EnforceValidChoice orig, CharacterSelectBarController self)
		{
			((Component)self).GetComponent<CharacterSelectBarControllerExtra>().EnforceValidChoice();
		}

		internal static void CharacterSelectBarControllerPickIconBySurvivorDef(orig_PickIconBySurvivorDef orig, CharacterSelectBarController self, SurvivorDef survivorDef)
		{
			((Component)self).GetComponent<CharacterSelectBarControllerExtra>().OpenPageWithCharacter(survivorDef);
			orig.Invoke(self, survivorDef);
		}

		internal static void RuleCategoryControllerSetData(orig_SetData orig, RuleCategoryController self, RuleCategoryDef categoryDef, RuleChoiceMask availability, RuleBook ruleBook)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Invalid comparison between Unknown and I4
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			orig.Invoke(self, categoryDef, availability, ruleBook);
			if ((int)self.ruleCategoryType == 0)
			{
				Transform val = ((Component)self).transform.Find("StripContainer");
				if (((Component)val).gameObject.activeInHierarchy)
				{
					for (int i = 0; i < val.childCount; i++)
					{
						Transform child = val.GetChild(i);
						((Component)child.Find("FrameContainer")).gameObject.SetActive(false);
						if (((Component)child).gameObject.activeSelf)
						{
							SetupStripPrefab(child);
						}
					}
				}
			}
			if ((int)self.ruleCategoryType != 1)
			{
				return;
			}
			foreach (RuleChoiceController element in self.popoutButtonIconAllocator.elements)
			{
				HGButton button = element.hgButton;
				((MPButton)button).onSelect.AddListener((UnityAction)delegate
				{
					//IL_002e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0034: Invalid comparison between Unknown and I4
					//IL_0052: Unknown result type (might be due to invalid IL or missing references)
					//IL_0057: Unknown result type (might be due to invalid IL or missing references)
					//IL_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_0065: 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_006f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_007a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0086: Unknown resul