Decompiled source of POG Config v1.0.7

POGConfig.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using HarmonyLib;
using Il2CppGame.Menu;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Reflection;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Preferences;
using POGMods.Config;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(PogConfigMelon), "POG Config", "1.0.7", "largo", "")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("POGConfig")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+45d9eb60ad08a6454809141f18e2f5aa355914f0")]
[assembly: AssemblyProduct("POGConfig")]
[assembly: AssemblyTitle("POGConfig")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace POGMods.Config;

internal static class Clicks
{
	internal static readonly Dictionary<RectTransform, Action> Map = new Dictionary<RectTransform, Action>();

	internal static void Register(RectTransform rt, Action cb)
	{
		Map[rt] = cb;
	}

	internal static void Clear()
	{
		Map.Clear();
	}
}
internal static class UI
{
	private static Sprite _white;

	internal static Sprite White
	{
		get
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			if ((Object)(object)_white != (Object)null)
			{
				return _white;
			}
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, Color.white);
			val.Apply();
			_white = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f));
			return _white;
		}
	}

	internal static GameObject Make(string name, Transform parent)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		GameObject val = new GameObject(name);
		val.AddComponent<RectTransform>();
		val.transform.SetParent(parent, false);
		return val;
	}

	internal static RectTransform Rt(GameObject go)
	{
		return go.GetComponent<RectTransform>();
	}

	internal static void Stretch(RectTransform rt, float l = 0f, float r = 0f, float b = 0f, float t = 0f)
	{
		//IL_0001: 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_0019: 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)
		rt.anchorMin = Vector2.zero;
		rt.anchorMax = Vector2.one;
		rt.offsetMin = new Vector2(l, b);
		rt.offsetMax = new Vector2(0f - r, 0f - t);
	}

	internal static Image AddImage(GameObject go, Color color, bool raycast = true)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		Image obj = go.AddComponent<Image>();
		obj.sprite = White;
		((Graphic)obj).color = color;
		((Graphic)obj).raycastTarget = raycast;
		return obj;
	}

	internal static TextMeshProUGUI AddText(GameObject go, string text, TMP_FontAsset font, int size, Color color, TextAlignmentOptions align = 4097)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		TextMeshProUGUI val = go.AddComponent<TextMeshProUGUI>();
		if ((Object)(object)font != (Object)null)
		{
			((TMP_Text)val).font = font;
		}
		((TMP_Text)val).text = text;
		((TMP_Text)val).fontSize = size;
		((Graphic)val).color = color;
		((TMP_Text)val).alignment = align;
		((Graphic)val).raycastTarget = false;
		return val;
	}

	internal static void PlaceFromTop(RectTransform rt, float yTop, float height, float padL = 0f, float padR = 0f)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		rt.anchorMin = new Vector2(0f, 1f);
		rt.anchorMax = new Vector2(1f, 1f);
		rt.pivot = new Vector2(0.5f, 1f);
		rt.offsetMin = new Vector2(padL, 0f - (yTop + height));
		rt.offsetMax = new Vector2(0f - padR, 0f - yTop);
	}
}
public abstract class ConfigEntry
{
	public string Label { get; protected set; }

	public virtual float Height => 36f;

	protected ConfigEntry(string label)
	{
		Label = label;
	}

	public virtual void Draw(float x, float y, float width, GUIStyle labelStyle)
	{
	}

	internal abstract void BuildRowInto(GameObject row, TMP_FontAsset font);

	internal virtual void BuildRow(Transform parent, TMP_FontAsset font)
	{
	}

	internal virtual void OnUpdate()
	{
	}

	internal virtual void BindPrefs(MelonPreferences_Category cat)
	{
	}
}
public class HeaderEntry : ConfigEntry
{
	public override float Height => 28f;

	public HeaderEntry(string label)
		: base(label)
	{
	}

	internal override void BuildRowInto(GameObject row, TMP_FontAsset font)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		UI.Rt(row);
		GameObject go = UI.Make("Underline", row.transform);
		RectTransform obj = UI.Rt(go);
		obj.anchorMin = new Vector2(0f, 0f);
		obj.anchorMax = new Vector2(1f, 0f);
		obj.pivot = new Vector2(0.5f, 0f);
		obj.sizeDelta = new Vector2(0f, 1f);
		obj.anchoredPosition = new Vector2(0f, 4f);
		UI.AddImage(go, new Color(1f, 0.82f, 0.3f, 0.25f), raycast: false);
		GameObject go2 = UI.Make("Header", row.transform);
		RectTransform obj2 = UI.Rt(go2);
		obj2.anchorMin = Vector2.zero;
		obj2.anchorMax = Vector2.one;
		Vector2 offsetMin = (obj2.offsetMax = Vector2.zero);
		obj2.offsetMin = offsetMin;
		((TMP_Text)UI.AddText(go2, base.Label, font, 13, new Color(1f, 0.82f, 0.3f), (TextAlignmentOptions)1025)).fontStyle = (FontStyles)17;
	}
}
public class ModInfo
{
	public string Version;

	public string Description;

	public string Author;

	public ModInfo()
	{
	}

	public ModInfo(string version, string description = null, string author = null)
	{
		Version = version;
		Description = description;
		Author = author;
	}
}
public class ToggleEntry : ConfigEntry
{
	private readonly Func<bool> _get;

	private Action<bool> _set;

	private readonly string _prefKey;

	private Toggle _toggle;

	private bool _lastValue;

	private bool _suppressToggleCallback;

	public ToggleEntry(string label, Func<bool> get, Action<bool> set)
		: this(label, get, set, null)
	{
	}

	public ToggleEntry(string label, Func<bool> get, Action<bool> set, string prefKey)
		: base(label)
	{
		_get = get;
		_set = set;
		_prefKey = prefKey;
	}

	internal override void BindPrefs(MelonPreferences_Category cat)
	{
		if (_prefKey != null)
		{
			MelonPreferences_Entry<bool> pref = cat.CreateEntry<bool>(_prefKey, _get(), (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_set(pref.Value);
			Action<bool> orig = _set;
			_set = delegate(bool v)
			{
				orig(v);
				pref.Value = v;
				MelonPreferences.Save();
			};
		}
	}

	internal override void BuildRowInto(GameObject row, TMP_FontAsset font)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		GameObject go = UI.Make("Label", row.transform);
		UI.Rt(go).anchorMin = Vector2.zero;
		UI.Rt(go).anchorMax = new Vector2(0.78f, 1f);
		Vector2 val2 = (UI.Rt(go).offsetMin = (UI.Rt(go).offsetMax = Vector2.zero));
		UI.AddText(go, base.Label, font, 14, new Color(0.88f, 0.88f, 0.88f), (TextAlignmentOptions)4097);
		GameObject val3 = UI.Make("Toggle", row.transform);
		RectTransform obj = UI.Rt(val3);
		((Vector2)(ref val2))..ctor(1f, 0.5f);
		obj.anchorMax = val2;
		obj.anchorMin = val2;
		obj.pivot = new Vector2(1f, 0.5f);
		obj.sizeDelta = new Vector2(40f, 24f);
		obj.anchoredPosition = Vector2.zero;
		_toggle = val3.AddComponent<Toggle>();
		GameObject val4 = UI.Make("BG", val3.transform);
		UI.Stretch(UI.Rt(val4));
		Image targetGraphic = UI.AddImage(val4, new Color(0.18f, 0.18f, 0.2f));
		GameObject go2 = UI.Make("Check", val4.transform);
		UI.Stretch(UI.Rt(go2), 3f, 3f, 3f, 3f);
		Image graphic = UI.AddImage(go2, new Color(1f, 0.82f, 0.3f));
		((Selectable)_toggle).targetGraphic = (Graphic)(object)targetGraphic;
		_toggle.graphic = (Graphic)(object)graphic;
		_lastValue = _get();
		_toggle.SetIsOnWithoutNotify(_lastValue);
		((UnityEvent<bool>)(object)_toggle.onValueChanged).AddListener(UnityAction<bool>.op_Implicit((Action<bool>)OnToggleChanged));
	}

	private void OnToggleChanged(bool value)
	{
		if (!_suppressToggleCallback && value != _lastValue)
		{
			_lastValue = value;
			_set(value);
		}
	}

	internal override void OnUpdate()
	{
		if (!((Object)(object)_toggle == (Object)null))
		{
			bool flag = _get();
			if (_toggle.isOn != flag)
			{
				_suppressToggleCallback = true;
				_toggle.SetIsOnWithoutNotify(flag);
				_suppressToggleCallback = false;
				_lastValue = flag;
			}
		}
	}
}
public class SliderEntry : ConfigEntry
{
	private readonly Func<float> _get;

	private Action<float> _set;

	private readonly float _min;

	private readonly float _max;

	private readonly Func<float, string> _fmt;

	private readonly string _prefKey;

	private readonly float _originValue;

	private readonly bool _showFill;

	private readonly bool _wholeNumbers;

	private readonly int _stepPointsCount;

	private Slider _slider;

	private TextMeshProUGUI _inputText;

	private RectTransform _valueBgRt;

	private Image _valueBgImg;

	private RectTransform _fillRt;

	private bool _editingInput;

	private string _inputBuffer = "";

	private RectTransform _labelMaskRt;

	private RectTransform _valueMaskRt;

	private RectTransform _labelTextRt;

	private RectTransform _valueTextRt;

	private TextMeshProUGUI _labelTmp;

	private float _lastValue;

	private float _marqueeTimer;

	private const float MarqueeSpeed = 52f;

	internal static bool AnyInputActive;

	public float LabelFraction { get; set; } = 0.35f;


	public float ValueFraction { get; set; } = 0.15f;


	public SliderEntry(string label, Func<float> get, Action<float> set, float min, float max, Func<float, string> fmt = null)
		: this(label, get, set, min, max, fmt, null)
	{
	}

	public SliderEntry(string label, Func<float> get, Action<float> set, float min, float max, Func<float, string> fmt, string prefKey)
		: this(label, get, set, min, max, fmt, prefKey, 0f, showFill: true, wholeNumbers: false, 0)
	{
	}

	public SliderEntry(string label, Func<float> get, Action<float> set, float min, float max, Func<float, string> fmt, string prefKey, float originValue, bool showFill, bool wholeNumbers)
		: this(label, get, set, min, max, fmt, prefKey, originValue, showFill, wholeNumbers, 0)
	{
	}

	public SliderEntry(string label, Func<float> get, Action<float> set, float min, float max, Func<float, string> fmt, string prefKey, float originValue, bool showFill, bool wholeNumbers, int stepPointsCount)
		: base(label)
	{
		_get = get;
		_set = set;
		_min = min;
		_max = max;
		_fmt = fmt ?? ((Func<float, string>)((float v) => v.ToString("F1")));
		_prefKey = prefKey;
		_originValue = Mathf.Clamp(originValue, min, max);
		_showFill = showFill;
		_wholeNumbers = wholeNumbers;
		_stepPointsCount = Math.Max(0, stepPointsCount);
	}

	internal override void BindPrefs(MelonPreferences_Category cat)
	{
		if (_prefKey != null)
		{
			MelonPreferences_Entry<float> pref = cat.CreateEntry<float>(_prefKey, _get(), (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_set(pref.Value);
			Action<float> orig = _set;
			_set = delegate(float v)
			{
				orig(v);
				pref.Value = v;
				MelonPreferences.Save();
			};
		}
	}

	internal override void BuildRowInto(GameObject row, TMP_FontAsset font)
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: 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_00fc: 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_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0300: Unknown result type (might be due to invalid IL or missing references)
		//IL_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Unknown result type (might be due to invalid IL or missing references)
		//IL_037e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0383: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_038b: Unknown result type (might be due to invalid IL or missing references)
		//IL_041d: Unknown result type (might be due to invalid IL or missing references)
		//IL_045a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0475: Unknown result type (might be due to invalid IL or missing references)
		//IL_048d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0492: Unknown result type (might be due to invalid IL or missing references)
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		//IL_049a: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0513: Unknown result type (might be due to invalid IL or missing references)
		//IL_059e: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a5: 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_05d8: Unknown result type (might be due to invalid IL or missing references)
		float labelFraction = LabelFraction;
		float num = labelFraction + ValueFraction;
		float num2 = num + 0.02f;
		GameObject val = UI.Make("LabelMask", row.transform);
		_labelMaskRt = UI.Rt(val);
		_labelMaskRt.anchorMin = Vector2.zero;
		_labelMaskRt.anchorMax = new Vector2(labelFraction, 1f);
		Vector2 val3 = (_labelMaskRt.offsetMin = (_labelMaskRt.offsetMax = Vector2.zero));
		val.AddComponent<RectMask2D>();
		GameObject go = UI.Make("Label", val.transform);
		_labelTextRt = UI.Rt(go);
		_labelTextRt.anchorMin = Vector2.zero;
		_labelTextRt.anchorMax = Vector2.one;
		val3 = (_labelTextRt.offsetMin = (_labelTextRt.offsetMax = Vector2.zero));
		_labelTmp = UI.AddText(go, base.Label, font, 14, new Color(0.88f, 0.88f, 0.88f), (TextAlignmentOptions)4097);
		((TMP_Text)_labelTmp).enableWordWrapping = false;
		((TMP_Text)_labelTmp).overflowMode = (TextOverflowModes)1;
		GameObject val5 = UI.Make("ValueMask", row.transform);
		_valueMaskRt = UI.Rt(val5);
		_valueMaskRt.anchorMin = new Vector2(labelFraction, 0f);
		_valueMaskRt.anchorMax = new Vector2(num, 1f);
		val3 = (_valueMaskRt.offsetMin = (_valueMaskRt.offsetMax = Vector2.zero));
		val5.AddComponent<RectMask2D>();
		GameObject val7 = UI.Make("ValueBG", val5.transform);
		_valueBgRt = UI.Rt(val7);
		_valueBgRt.anchorMin = new Vector2(0f, 0.18f);
		_valueBgRt.anchorMax = new Vector2(1f, 0.82f);
		_valueBgRt.offsetMin = new Vector2(2f, 0f);
		_valueBgRt.offsetMax = new Vector2(-2f, 0f);
		_valueBgImg = UI.AddImage(val7, new Color(0.16f, 0.16f, 0.18f, 0.95f));
		Clicks.Register(_valueBgRt, StartEditing);
		GameObject go2 = UI.Make("ValueInput", val7.transform);
		_valueTextRt = UI.Rt(go2);
		_valueTextRt.anchorMin = Vector2.zero;
		_valueTextRt.anchorMax = Vector2.one;
		_valueTextRt.offsetMin = new Vector2(6f, 0f);
		_valueTextRt.offsetMax = new Vector2(-6f, 0f);
		_inputText = UI.AddText(go2, _fmt(_get()), font, 13, new Color(1f, 0.82f, 0.3f), (TextAlignmentOptions)4100);
		((TMP_Text)_inputText).enableWordWrapping = false;
		((TMP_Text)_inputText).overflowMode = (TextOverflowModes)1;
		GameObject val8 = UI.Make("Slider", row.transform);
		UI.Rt(val8).anchorMin = new Vector2(num2, 0.25f);
		UI.Rt(val8).anchorMax = new Vector2(1f, 0.75f);
		val3 = (UI.Rt(val8).offsetMin = (UI.Rt(val8).offsetMax = Vector2.zero));
		_slider = val8.AddComponent<Slider>();
		_slider.minValue = _min;
		_slider.maxValue = _max;
		_slider.wholeNumbers = _wholeNumbers;
		_slider.direction = (Direction)0;
		GameObject go3 = UI.Make("Track", val8.transform);
		UI.Stretch(UI.Rt(go3));
		UI.AddImage(go3, new Color(0.2f, 0.2f, 0.22f));
		BuildStepPoints(val8.transform);
		GameObject val10 = UI.Make("FillArea", val8.transform);
		UI.Rt(val10).anchorMin = new Vector2(0f, 0.25f);
		UI.Rt(val10).anchorMax = new Vector2(1f, 0.75f);
		val3 = (UI.Rt(val10).offsetMin = (UI.Rt(val10).offsetMax = Vector2.zero));
		GameObject go4 = UI.Make("Fill", val10.transform);
		UI.Rt(go4).anchorMin = Vector2.zero;
		UI.Rt(go4).anchorMax = new Vector2(0f, 1f);
		val3 = (UI.Rt(go4).offsetMin = (UI.Rt(go4).offsetMax = Vector2.zero));
		UI.AddImage(go4, new Color(1f, 0.72f, 0.1f));
		_fillRt = UI.Rt(go4);
		val10.SetActive(_showFill);
		GameObject val13 = UI.Make("HandleArea", val8.transform);
		UI.Stretch(UI.Rt(val13));
		GameObject go5 = UI.Make("Handle", val13.transform);
		RectTransform obj = UI.Rt(go5);
		RectTransform obj2 = UI.Rt(go5);
		((Vector2)(ref val3))..ctor(0f, 0.5f);
		obj2.anchorMax = val3;
		obj.anchorMin = val3;
		UI.Rt(go5).sizeDelta = new Vector2(14f, 14f);
		Image targetGraphic = UI.AddImage(go5, new Color(1f, 0.82f, 0.3f));
		_slider.fillRect = null;
		_slider.handleRect = UI.Rt(go5);
		((Selectable)_slider).targetGraphic = (Graphic)(object)targetGraphic;
		_lastValue = _get();
		_slider.SetValueWithoutNotify(_lastValue);
		((UnityEvent<float>)(object)_slider.onValueChanged).AddListener(UnityAction<float>.op_Implicit((Action<float>)OnSliderChanged));
		UpdateFillFromOrigin(_lastValue);
	}

	private void BuildStepPoints(Transform sliderTransform)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		if (_stepPointsCount >= 2)
		{
			GameObject val = UI.Make("StepPoints", sliderTransform);
			RectTransform obj = UI.Rt(val);
			obj.anchorMin = new Vector2(0f, 0.5f);
			obj.anchorMax = new Vector2(1f, 0.5f);
			obj.offsetMin = new Vector2(0f, -1f);
			obj.offsetMax = new Vector2(0f, 1f);
			Vector2 val2 = default(Vector2);
			for (int i = 0; i < _stepPointsCount; i++)
			{
				float num = ((_stepPointsCount <= 1) ? 0f : ((float)i / (float)(_stepPointsCount - 1)));
				GameObject go = UI.Make("P" + i, val.transform);
				RectTransform obj2 = UI.Rt(go);
				((Vector2)(ref val2))..ctor(num, 0.5f);
				obj2.anchorMax = val2;
				obj2.anchorMin = val2;
				obj2.pivot = new Vector2(0.5f, 0.5f);
				obj2.sizeDelta = new Vector2(4f, 4f);
				obj2.anchoredPosition = Vector2.zero;
				UI.AddImage(go, new Color(0.48f, 0.48f, 0.52f, 0.75f), raycast: false);
			}
		}
	}

	private void StartEditing()
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		if (!AnyInputActive)
		{
			_editingInput = true;
			AnyInputActive = true;
			_marqueeTimer = 0f;
			_inputBuffer = ToEditableNumericString(_lastValue);
			if ((Object)(object)_valueBgImg != (Object)null)
			{
				((Graphic)_valueBgImg).color = new Color(0.28f, 0.22f, 0.08f);
			}
			if ((Object)(object)_inputText != (Object)null)
			{
				((TMP_Text)_inputText).text = _inputBuffer + "|";
			}
		}
	}

	private void StopEditing(bool commit)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		_editingInput = false;
		AnyInputActive = false;
		if ((Object)(object)_valueBgImg != (Object)null)
		{
			((Graphic)_valueBgImg).color = new Color(0.16f, 0.16f, 0.18f, 0.95f);
		}
		if (commit && TryParseValue(_inputBuffer, out var parsed))
		{
			ApplyValue(parsed, writeBack: true);
		}
		if ((Object)(object)_inputText != (Object)null)
		{
			((TMP_Text)_inputText).text = _fmt(_lastValue);
		}
	}

	private bool TryParseValue(string text, out float parsed)
	{
		text = (text ?? string.Empty).Trim();
		parsed = 0f;
		if (text.Length == 0)
		{
			return false;
		}
		Match match = Regex.Match(text, "[-+]?\\d+(?:[.,]\\d+)?");
		if (match.Success)
		{
			text = match.Value;
		}
		bool flag = float.TryParse(text.Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out parsed);
		if (!flag)
		{
			flag = float.TryParse(text, NumberStyles.Float, CultureInfo.CurrentCulture, out parsed);
		}
		if (!flag)
		{
			return false;
		}
		parsed = Mathf.Clamp(parsed, _min, _max);
		if (_wholeNumbers)
		{
			parsed = Mathf.Round(parsed);
		}
		return true;
	}

	private string ToEditableNumericString(float value)
	{
		if (_wholeNumbers)
		{
			return Mathf.RoundToInt(value).ToString(CultureInfo.InvariantCulture);
		}
		return value.ToString("0.###", CultureInfo.InvariantCulture);
	}

	private void OnSliderChanged(float value)
	{
		ApplyValue(value, writeBack: true);
	}

	private void ApplyValue(float value, bool writeBack)
	{
		value = Mathf.Clamp(value, _min, _max);
		if (_wholeNumbers)
		{
			value = Mathf.Round(value);
		}
		_lastValue = value;
		if ((Object)(object)_slider != (Object)null && Math.Abs(_slider.value - value) > 0.0001f)
		{
			_slider.SetValueWithoutNotify(value);
		}
		if (!_editingInput && (Object)(object)_inputText != (Object)null)
		{
			((TMP_Text)_inputText).text = _fmt(value);
		}
		UpdateFillFromOrigin(value);
		if (writeBack)
		{
			_set(value);
		}
	}

	private void UpdateFillFromOrigin(float current)
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_fillRt == (Object)null) && _showFill)
		{
			float num = Mathf.InverseLerp(_min, _max, _originValue);
			float num2 = Mathf.InverseLerp(_min, _max, current);
			_fillRt.anchorMin = new Vector2(Mathf.Min(num, num2), 0f);
			_fillRt.anchorMax = new Vector2(Mathf.Max(num, num2), 1f);
			_fillRt.offsetMin = Vector2.zero;
			_fillRt.offsetMax = Vector2.zero;
		}
	}

	private void UpdateMarquee(RectTransform maskRt, RectTransform textRt, TextMeshProUGUI tmp, bool hovered)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)maskRt == (Object)null) && !((Object)(object)textRt == (Object)null) && !((Object)(object)tmp == (Object)null))
		{
			float preferredWidth = ((TMP_Text)tmp).preferredWidth;
			Rect rect = maskRt.rect;
			if (!(preferredWidth > ((Rect)(ref rect)).width + 1f))
			{
				((TMP_Text)tmp).overflowMode = (TextOverflowModes)1;
				textRt.anchoredPosition = Vector2.zero;
				return;
			}
			if (!hovered)
			{
				((TMP_Text)tmp).overflowMode = (TextOverflowModes)1;
				textRt.anchoredPosition = Vector2.zero;
				_marqueeTimer = 0f;
				return;
			}
			((TMP_Text)tmp).overflowMode = (TextOverflowModes)0;
			_marqueeTimer += Time.unscaledDeltaTime * 52f;
			float preferredWidth2 = ((TMP_Text)tmp).preferredWidth;
			rect = maskRt.rect;
			float num = Mathf.Max(0f, preferredWidth2 - ((Rect)(ref rect)).width + 12f);
			float num2 = Mathf.PingPong(_marqueeTimer, num);
			textRt.anchoredPosition = new Vector2(0f - num2, 0f);
		}
	}

	internal override void OnUpdate()
	{
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_slider == (Object)null)
		{
			return;
		}
		if (_editingInput)
		{
			if (Input.GetMouseButtonDown(0) && !ConfigBehaviour.HitTest(_valueBgRt, Vector2.op_Implicit(Input.mousePosition)))
			{
				StopEditing(commit: true);
				return;
			}
			if (Input.GetKeyDown((KeyCode)27))
			{
				StopEditing(commit: false);
				return;
			}
			if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271))
			{
				StopEditing(commit: true);
				return;
			}
			string inputString = Input.inputString;
			for (int i = 0; i < inputString.Length; i++)
			{
				char c = inputString[i];
				if (c == '\b')
				{
					if (_inputBuffer.Length > 0)
					{
						_inputBuffer = _inputBuffer.Substring(0, _inputBuffer.Length - 1);
					}
					continue;
				}
				if (c == '\n' || c == '\r')
				{
					StopEditing(commit: true);
					return;
				}
				if (c >= ' ')
				{
					_inputBuffer += c;
				}
			}
			if ((Object)(object)_inputText != (Object)null)
			{
				((TMP_Text)_inputText).text = _inputBuffer + "|";
			}
		}
		else
		{
			float num = _get();
			if (Math.Abs(num - _lastValue) > 0.0001f)
			{
				ApplyValue(num, writeBack: false);
			}
			Vector2 screenPoint = Vector2.op_Implicit(Input.mousePosition);
			UpdateMarquee(_labelMaskRt, _labelTextRt, _labelTmp, ConfigBehaviour.HitTest(_labelMaskRt, screenPoint));
			UpdateMarquee(_valueMaskRt, _valueTextRt, _inputText, ConfigBehaviour.HitTest(_valueMaskRt, screenPoint));
		}
	}
}
public class OptionsSliderEntry : ConfigEntry
{
	private readonly Func<int> _get;

	private Action<int> _set;

	private readonly string[] _options;

	private readonly string _prefKey;

	private Slider _slider;

	private TextMeshProUGUI _displayText;

	private int _lastIndex;

	public OptionsSliderEntry(string label, Func<int> get, Action<int> set, string[] options, string prefKey = null)
		: base(label)
	{
		_get = get;
		_set = set;
		_options = options ?? Array.Empty<string>();
		_prefKey = prefKey;
	}

	internal override void BindPrefs(MelonPreferences_Category cat)
	{
		if (_prefKey != null && _options.Length != 0)
		{
			MelonPreferences_Entry<int> pref = cat.CreateEntry<int>(_prefKey, Mathf.Clamp(_get(), 0, _options.Length - 1), (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_set(Mathf.Clamp(pref.Value, 0, _options.Length - 1));
			Action<int> orig = _set;
			_set = delegate(int i)
			{
				orig(i);
				pref.Value = i;
				MelonPreferences.Save();
			};
		}
	}

	internal override void BuildRowInto(GameObject row, TMP_FontAsset font)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: 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_02c5: Unknown result type (might be due to invalid IL or missing references)
		GameObject go = UI.Make("Label", row.transform);
		UI.Rt(go).anchorMin = Vector2.zero;
		UI.Rt(go).anchorMax = new Vector2(0.26f, 1f);
		Vector2 val2 = (UI.Rt(go).offsetMin = (UI.Rt(go).offsetMax = Vector2.zero));
		TextMeshProUGUI obj = UI.AddText(go, base.Label, font, 14, new Color(0.88f, 0.88f, 0.88f), (TextAlignmentOptions)4097);
		((TMP_Text)obj).enableWordWrapping = false;
		((TMP_Text)obj).overflowMode = (TextOverflowModes)1;
		GameObject go2 = UI.Make("ValueText", row.transform);
		RectTransform obj2 = UI.Rt(go2);
		obj2.anchorMin = new Vector2(0.26f, 0f);
		obj2.anchorMax = new Vector2(0.52f, 1f);
		val2 = (obj2.offsetMin = (obj2.offsetMax = Vector2.zero));
		_displayText = UI.AddText(go2, "", font, 13, new Color(1f, 0.82f, 0.3f), (TextAlignmentOptions)4100);
		((TMP_Text)_displayText).enableWordWrapping = false;
		((TMP_Text)_displayText).overflowMode = (TextOverflowModes)1;
		GameObject val4 = UI.Make("Slider", row.transform);
		UI.Rt(val4).anchorMin = new Vector2(0.54f, 0.25f);
		UI.Rt(val4).anchorMax = new Vector2(1f, 0.75f);
		val2 = (UI.Rt(val4).offsetMin = (UI.Rt(val4).offsetMax = Vector2.zero));
		_slider = val4.AddComponent<Slider>();
		_slider.minValue = 0f;
		_slider.maxValue = Mathf.Max(0, _options.Length - 1);
		_slider.wholeNumbers = true;
		_slider.direction = (Direction)0;
		GameObject go3 = UI.Make("Track", val4.transform);
		UI.Stretch(UI.Rt(go3));
		UI.AddImage(go3, new Color(0.2f, 0.2f, 0.22f));
		GameObject val6 = UI.Make("HandleArea", val4.transform);
		UI.Stretch(UI.Rt(val6));
		GameObject go4 = UI.Make("Handle", val6.transform);
		RectTransform obj3 = UI.Rt(go4);
		RectTransform obj4 = UI.Rt(go4);
		((Vector2)(ref val2))..ctor(0f, 0.5f);
		obj4.anchorMax = val2;
		obj3.anchorMin = val2;
		UI.Rt(go4).sizeDelta = new Vector2(14f, 14f);
		Image targetGraphic = UI.AddImage(go4, new Color(1f, 0.82f, 0.3f));
		_slider.fillRect = null;
		_slider.handleRect = UI.Rt(go4);
		((Selectable)_slider).targetGraphic = (Graphic)(object)targetGraphic;
		((UnityEvent<float>)(object)_slider.onValueChanged).AddListener(UnityAction<float>.op_Implicit((Action<float>)OnSliderChanged));
		_lastIndex = Mathf.Clamp(_get(), 0, _options.Length - 1);
		_slider.SetValueWithoutNotify((float)_lastIndex);
		SyncText(_lastIndex);
	}

	private void OnSliderChanged(float value)
	{
		int num = Mathf.Clamp(Mathf.RoundToInt(value), 0, _options.Length - 1);
		if (num != _lastIndex)
		{
			_lastIndex = num;
			SyncText(num);
			_set(num);
		}
	}

	private void SyncText(int idx)
	{
		string text = ((_options.Length == 0 || idx < 0 || idx >= _options.Length) ? "-" : _options[idx]);
		if ((Object)(object)_displayText != (Object)null)
		{
			((TMP_Text)_displayText).text = text;
		}
	}

	internal override void OnUpdate()
	{
		if (!((Object)(object)_slider == (Object)null) && _options.Length != 0)
		{
			int num = Mathf.Clamp(_get(), 0, _options.Length - 1);
			if (num != _lastIndex)
			{
				_lastIndex = num;
				_slider.SetValueWithoutNotify((float)num);
				SyncText(num);
			}
		}
	}
}
public class KeyEntry : ConfigEntry
{
	private readonly Func<KeyCode> _get;

	private Action<KeyCode> _set;

	private readonly string _prefKey;

	internal static bool AnyWaiting;

	private bool _listening;

	private TextMeshProUGUI _keyText;

	private TextMeshProUGUI _btnText;

	private RectTransform _clearBtnRt;

	public bool AllowMouseButtons { get; set; }

	public KeyEntry(string label, Func<KeyCode> get, Action<KeyCode> set)
		: this(label, get, set, null)
	{
	}

	public KeyEntry(string label, Func<KeyCode> get, Action<KeyCode> set, string prefKey)
		: base(label)
	{
		_get = get;
		_set = set;
		_prefKey = prefKey;
	}

	internal override void BindPrefs(MelonPreferences_Category cat)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		if (_prefKey != null)
		{
			string prefKey = _prefKey;
			KeyCode val = _get();
			MelonPreferences_Entry<string> pref = cat.CreateEntry<string>(prefKey, ((object)(KeyCode)(ref val)).ToString(), (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			if (Enum.TryParse<KeyCode>(pref.Value, out KeyCode result))
			{
				_set(result);
			}
			Action<KeyCode> orig = _set;
			_set = delegate(KeyCode v)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				orig(v);
				pref.Value = ((object)(KeyCode)(ref v)).ToString();
				MelonPreferences.Save();
			};
		}
	}

	internal override void BuildRowInto(GameObject row, TMP_FontAsset font)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: 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_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: 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_01ad: 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_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0315: Unknown result type (might be due to invalid IL or missing references)
		GameObject go = UI.Make("Label", row.transform);
		UI.Rt(go).anchorMin = Vector2.zero;
		UI.Rt(go).anchorMax = new Vector2(0.42f, 1f);
		Vector2 val2 = (UI.Rt(go).offsetMin = (UI.Rt(go).offsetMax = Vector2.zero));
		UI.AddText(go, base.Label, font, 14, new Color(0.88f, 0.88f, 0.88f), (TextAlignmentOptions)4097);
		GameObject go2 = UI.Make("KeyName", row.transform);
		UI.Rt(go2).anchorMin = new Vector2(0.42f, 0f);
		UI.Rt(go2).anchorMax = new Vector2(0.7f, 1f);
		val2 = (UI.Rt(go2).offsetMin = (UI.Rt(go2).offsetMax = Vector2.zero));
		_keyText = UI.AddText(go2, KeyDisplayName(_get()), font, 13, new Color(1f, 0.82f, 0.3f), (TextAlignmentOptions)4100);
		GameObject val4 = UI.Make("ClearBtn", row.transform);
		_clearBtnRt = UI.Rt(val4);
		RectTransform clearBtnRt = _clearBtnRt;
		RectTransform clearBtnRt2 = _clearBtnRt;
		((Vector2)(ref val2))..ctor(1f, 0.5f);
		clearBtnRt2.anchorMax = val2;
		clearBtnRt.anchorMin = val2;
		_clearBtnRt.pivot = new Vector2(1f, 0.5f);
		_clearBtnRt.sizeDelta = new Vector2(56f, 28f);
		_clearBtnRt.anchoredPosition = new Vector2(-96f, 0f);
		UI.AddImage(val4, new Color(0.3f, 0.18f, 0.18f));
		GameObject go3 = UI.Make("Text", val4.transform);
		UI.Stretch(UI.Rt(go3));
		UI.AddText(go3, "Clear", font, 12, new Color(0.85f, 0.55f, 0.55f), (TextAlignmentOptions)514);
		Clicks.Register(_clearBtnRt, ClearBind);
		GameObject val5 = UI.Make("ChangeBtn", row.transform);
		RectTransform obj = UI.Rt(val5);
		((Vector2)(ref val2))..ctor(1f, 0.5f);
		obj.anchorMax = val2;
		obj.anchorMin = val2;
		obj.pivot = new Vector2(1f, 0.5f);
		obj.sizeDelta = new Vector2(90f, 28f);
		obj.anchoredPosition = Vector2.zero;
		UI.AddImage(val5, new Color(0.25f, 0.25f, 0.3f));
		GameObject go4 = UI.Make("Text", val5.transform);
		UI.Stretch(UI.Rt(go4));
		_btnText = UI.AddText(go4, "Change", font, 12, new Color(0.85f, 0.85f, 0.85f), (TextAlignmentOptions)514);
		Clicks.Register(obj, ToggleListen);
	}

	private static string KeyDisplayName(KeyCode kc)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		if ((int)kc != 0)
		{
			return ((object)(KeyCode)(ref kc)).ToString();
		}
		return "— none —";
	}

	private void ClearBind()
	{
		if (_listening)
		{
			_listening = false;
			AnyWaiting = false;
		}
		_set((KeyCode)0);
		if ((Object)(object)_keyText != (Object)null)
		{
			((TMP_Text)_keyText).text = KeyDisplayName((KeyCode)0);
		}
		if ((Object)(object)_btnText != (Object)null)
		{
			((TMP_Text)_btnText).text = "Change";
		}
	}

	private void ToggleListen()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		if (_listening)
		{
			_listening = false;
			AnyWaiting = false;
			if ((Object)(object)_keyText != (Object)null)
			{
				TextMeshProUGUI keyText = _keyText;
				KeyCode val = _get();
				((TMP_Text)keyText).text = ((object)(KeyCode)(ref val)).ToString();
			}
			if ((Object)(object)_btnText != (Object)null)
			{
				((TMP_Text)_btnText).text = "Change";
			}
		}
		else if (!AnyWaiting)
		{
			_listening = true;
			AnyWaiting = true;
			if ((Object)(object)_keyText != (Object)null)
			{
				((TMP_Text)_keyText).text = "[ press key ]";
			}
			if ((Object)(object)_btnText != (Object)null)
			{
				((TMP_Text)_btnText).text = "Cancel";
			}
		}
		else if ((Object)(object)_keyText != (Object)null)
		{
			((TMP_Text)_keyText).text = KeyDisplayName(_get());
		}
	}

	internal override void OnUpdate()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Invalid comparison between Unknown and I4
		//IL_0057: 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
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		if (!_listening || SliderEntry.AnyInputActive)
		{
			return;
		}
		foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
		{
			if ((int)value != 0 && (int)value != 27 && (AllowMouseButtons || (int)value < 323 || (int)value > 329) && Input.GetKeyDown(value))
			{
				_set(value);
				_listening = false;
				AnyWaiting = false;
				if ((Object)(object)_keyText != (Object)null)
				{
					((TMP_Text)_keyText).text = KeyDisplayName(value);
				}
				if ((Object)(object)_btnText != (Object)null)
				{
					((TMP_Text)_btnText).text = "Change";
				}
				break;
			}
		}
	}
}
internal class ModRecord
{
	public string Name;

	public List<ConfigEntry> Entries;

	public ModInfo Info;
}
public static class POGConfig
{
	[CompilerGenerated]
	private sealed class <GetAll>d__10 : IEnumerable<(string Name, List<ConfigEntry> Entries)>, IEnumerable, IEnumerator<(string Name, List<ConfigEntry> Entries)>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private (string Name, List<ConfigEntry> Entries) <>2__current;

		private int <>l__initialThreadId;

		private List<ModRecord>.Enumerator <>7__wrap1;

		(string, List<ConfigEntry>) IEnumerator<(string, List<ConfigEntry>)>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

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

		[DebuggerHidden]
		public <GetAll>d__10(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || num == 1)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
			<>7__wrap1 = default(List<ModRecord>.Enumerator);
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>7__wrap1 = _mods.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					break;
				}
				if (<>7__wrap1.MoveNext())
				{
					ModRecord current = <>7__wrap1.Current;
					<>2__current = (current.Name, current.Entries);
					<>1__state = 1;
					return true;
				}
				<>m__Finally1();
				<>7__wrap1 = default(List<ModRecord>.Enumerator);
				return false;
			}
			catch
			{
				//try-fault
				((IDisposable)this).Dispose();
				throw;
			}
		}

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

		private void <>m__Finally1()
		{
			<>1__state = -1;
			((IDisposable)<>7__wrap1).Dispose();
		}

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

		[DebuggerHidden]
		IEnumerator<(string Name, List<ConfigEntry> Entries)> IEnumerable<(string, List<ConfigEntry>)>.GetEnumerator()
		{
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				return this;
			}
			return new <GetAll>d__10(0);
		}

		[DebuggerHidden]
		IEnumerator IEnumerable.GetEnumerator()
		{
			return ((IEnumerable<(string, List<ConfigEntry>)>)this).GetEnumerator();
		}
	}

	private static readonly List<ModRecord> _mods = new List<ModRecord>();

	private static int _registryVersion;

	public static bool PanelOpen { get; internal set; }

	internal static int RegistryVersion => _registryVersion;

	public static void Register(string modName, List<ConfigEntry> entries)
	{
		Register(modName, entries, null);
	}

	public static void Register(string modName, List<ConfigEntry> entries, ModInfo info)
	{
		try
		{
			MelonPreferences_Category cat = MelonPreferences.CreateCategory(modName.Replace(" ", "_"));
			foreach (ConfigEntry entry in entries)
			{
				try
				{
					entry.BindPrefs(cat);
				}
				catch (Exception ex)
				{
					MelonLogger.Warning("[POGConfig] BindPrefs '" + modName + "': " + ex.Message);
				}
			}
		}
		catch (Exception ex2)
		{
			MelonLogger.Warning("[POGConfig] Prefs skipped for '" + modName + "': " + ex2.Message);
		}
		_mods.Add(new ModRecord
		{
			Name = modName,
			Entries = entries,
			Info = info
		});
		_registryVersion++;
		MelonLogger.Msg($"[POGConfig] Registered: {modName} ({entries.Count} entries)");
	}

	[IteratorStateMachine(typeof(<GetAll>d__10))]
	internal static IEnumerable<(string Name, List<ConfigEntry> Entries)> GetAll()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <GetAll>d__10(-2);
	}

	internal static IReadOnlyList<ModRecord> GetAllRecords()
	{
		return _mods;
	}
}
[HarmonyPatch(typeof(NetworkMenu), "TogglePauseMenu")]
internal class PatchTogglePauseMenu
{
	private static bool Prefix()
	{
		if (!ConfigBehaviour.PanelOpen)
		{
			return true;
		}
		ConfigBehaviour.RequestClose();
		return false;
	}
}
public class PogConfigMelon : MelonMod
{
	public override void OnInitializeMelon()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			((MelonBase)this).HarmonyInstance.PatchAll();
		}
		catch (Exception ex)
		{
			MelonLogger.Warning("[POGConfig] Harmony patch failed: " + ex.Message);
		}
		ClassInjector.RegisterTypeInIl2Cpp<ConfigBehaviour>();
		GameObject val = new GameObject("POGConfigRunner");
		Object.DontDestroyOnLoad((Object)val);
		((Object)val).hideFlags = (HideFlags)61;
		val.AddComponent<ConfigBehaviour>();
		MelonLogger.Msg("POG Config 1.0.7 loaded.");
	}
}
public class ConfigBehaviour : MonoBehaviour
{
	internal static bool PanelOpen;

	private static ConfigBehaviour _instance;

	private const float PANEL_W = 980f;

	private const float PANEL_H = 600f;

	private const float TOP_H = 68f;

	private const float BOT_H = 24f;

	private const float SB_W = 14f;

	private const float SIDEBAR_W = 220f;

	private const float SIDEBAR_PAD = 8f;

	private const float SEARCH_H = 32f;

	private const float MOD_HDR_H = 56f;

	private const float VIEWPORT_H = 452f;

	private const float SIDEBAR_LIST_H = 460f;

	private const float SCROLL_SPD = 40f;

	private bool _isPause;

	private bool _isMainMenu;

	private bool _panelOpen;

	private bool _updateErrLogged;

	private RectTransform _modsBtnRt;

	private RectTransform _doneBtnRt;

	private GameObject _overlay;

	private Image _modsBtnImg;

	private GameObject _mainMenuModsBtn;

	private NetworkMenuButton _mainMenuModsNmb;

	private bool _modsHovered;

	private Transform _scrollContent;

	private RectTransform _scrollContentRt;

	private RectTransform _scrollTrackRt;

	private RectTransform _scrollThumbRt;

	private GameObject _scrollbarGo;

	private float _totalContentH;

	private float _scrollOffset;

	private bool _uiReady;

	private bool _contentBuilt;

	private int _builtRegistryVersion = -1;

	private TMP_FontAsset _font;

	private Transform _sidebarList;

	private RectTransform _sidebarListRt;

	private RectTransform _sidebarTrackRt;

	private RectTransform _sidebarThumbRt;

	private GameObject _sidebarScrollbarGo;

	private float _sidebarTotalH;

	private float _sidebarOffset;

	private RectTransform _searchBgRt;

	private Image _searchBgImg;

	private TextMeshProUGUI _searchText;

	private string _searchQuery = "";

	private bool _editingSearch;

	private RectTransform _contentHeaderRt;

	private TextMeshProUGUI _modTitleTmp;

	private TextMeshProUGUI _modSubTmp;

	private int _selectedMod;

	private readonly Dictionary<int, RectTransform> _sidebarItemRects = new Dictionary<int, RectTransform>();

	private readonly Dictionary<int, Image> _sidebarItemBgs = new Dictionary<int, Image>();

	private bool _scrollDragging;

	private float _scrollDragGrab;

	private bool _sidebarDragging;

	private float _sidebarDragGrab;

	private GameObject _savedSelected;

	public ConfigBehaviour(IntPtr ptr)
		: base(ptr)
	{
	}

	internal static void RequestClose()
	{
		_instance?.DoClose();
	}

	private void Awake()
	{
		_instance = this;
	}

	private void Start()
	{
		BuildStaticUI();
	}

	internal static bool HitTest(RectTransform rt, Vector2 screenPoint)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: 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_0077: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)rt == (Object)null)
		{
			return false;
		}
		try
		{
			return RectTransformUtility.RectangleContainsScreenPoint(rt, screenPoint, (Camera)null);
		}
		catch
		{
			try
			{
				Il2CppStructArray<Vector3> corners = GetCorners(rt);
				float num = screenPoint.x - (float)Screen.width * 0.5f;
				float num2 = screenPoint.y - (float)Screen.height * 0.5f;
				return num >= ((Il2CppArrayBase<Vector3>)(object)corners)[0].x && num <= ((Il2CppArrayBase<Vector3>)(object)corners)[2].x && num2 >= ((Il2CppArrayBase<Vector3>)(object)corners)[0].y && num2 <= ((Il2CppArrayBase<Vector3>)(object)corners)[2].y;
			}
			catch
			{
				return false;
			}
		}
	}

	private void Update()
	{
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		if (!_uiReady)
		{
			BuildStaticUI();
		}
		try
		{
			NetworkMenu instance = NetworkMenu.Instance;
			string text = (((Object)(object)instance != (Object)null && (Object)(object)instance.CurrentState != (Object)null) ? ((MemberInfo)((Object)instance.CurrentState).GetIl2CppType()).Name : "");
			_isPause = text == "NetworkMenuPauseState";
			_isMainMenu = text == "NetworkMenuMainState";
			bool flag = _isPause && !_panelOpen;
			if ((Object)(object)_modsBtnRt != (Object)null)
			{
				((Component)_modsBtnRt).gameObject.SetActive(flag);
				if (flag)
				{
					PositionModsButton();
					UpdateModsButtonHover();
				}
				else if ((Object)(object)_modsBtnImg != (Object)null)
				{
					((Graphic)_modsBtnImg).color = new Color(0f, 0f, 0f, 0f);
				}
			}
			if (_isMainMenu && !_panelOpen)
			{
				EnsureMainMenuModsBtn();
				UpdateModsHoverSelection();
			}
			if (_isMainMenu && Input.GetKey((KeyCode)304) && Input.GetKeyDown((KeyCode)109))
			{
				DiagnoseAtCursor();
			}
			if (!_isPause && !_isMainMenu && _panelOpen)
			{
				DoClose();
			}
			HandleClicks();
			if (_panelOpen)
			{
				EventSystem current = EventSystem.current;
				if ((Object)(object)current != (Object)null && (Object)(object)current.currentSelectedGameObject != (Object)null)
				{
					current.SetSelectedGameObject((GameObject)null);
				}
				UpdateThumbDrag();
				HandleScroll();
				HandleSearchInput();
				foreach (var item in POGConfig.GetAll())
				{
					foreach (ConfigEntry item2 in item.Entries)
					{
						item2.OnUpdate();
					}
				}
				if (!_editingSearch && !KeyEntry.AnyWaiting && Input.GetKeyDown((KeyCode)27))
				{
					DoClose();
				}
			}
			else if (_scrollDragging || _sidebarDragging)
			{
				_scrollDragging = false;
				_sidebarDragging = false;
			}
		}
		catch (Exception value)
		{
			if (!_updateErrLogged)
			{
				_updateErrLogged = true;
				MelonLogger.Warning($"[POGConfig] Update error: {value}");
			}
		}
	}

	private void HandleScroll()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00bc: 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)
		float y = Input.mouseScrollDelta.y;
		Vector2 screenPoint = Vector2.op_Implicit(Input.mousePosition);
		float num = Mathf.Max(0f, _totalContentH - 452f);
		float num2 = Mathf.Max(0f, _sidebarTotalH - 460f);
		RectTransform val = (((Object)(object)_sidebarListRt != (Object)null && (Object)(object)((Transform)_sidebarListRt).parent != (Object)null) ? ((Component)((Transform)_sidebarListRt).parent).GetComponent<RectTransform>() : null);
		RectTransform val2 = (((Object)(object)_scrollContentRt != (Object)null && (Object)(object)((Transform)_scrollContentRt).parent != (Object)null) ? ((Component)((Transform)_scrollContentRt).parent).GetComponent<RectTransform>() : null);
		bool flag = (Object)(object)val != (Object)null && HitTest(val, screenPoint);
		bool flag2 = (Object)(object)val2 != (Object)null && HitTest(val2, screenPoint);
		if (Mathf.Abs(y) > 0.001f)
		{
			if (flag && num2 > 0f)
			{
				_sidebarOffset = Mathf.Clamp(_sidebarOffset - y * 40f, 0f, num2);
				ApplySidebarScroll(num2);
			}
			else if (flag2 && num > 0f)
			{
				_scrollOffset = Mathf.Clamp(_scrollOffset - y * 40f, 0f, num);
				ApplyScroll(num);
			}
		}
		else
		{
			if (num > 0f)
			{
				UpdateScrollThumb(num);
			}
			if (num2 > 0f)
			{
				UpdateSidebarThumb(num2);
			}
		}
	}

	private void ApplySidebarScroll(float maxScroll)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		_sidebarOffset = Mathf.Clamp(_sidebarOffset, 0f, maxScroll);
		if ((Object)(object)_sidebarListRt != (Object)null)
		{
			_sidebarListRt.anchoredPosition = new Vector2(0f, _sidebarOffset);
		}
		UpdateSidebarThumb(maxScroll);
	}

	private void UpdateSidebarThumb(float maxScroll)
	{
		//IL_0060: 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)
		if (!((Object)(object)_sidebarThumbRt == (Object)null) && !(_sidebarTotalH <= 0f))
		{
			float num = ((maxScroll > 0f) ? (_sidebarOffset / maxScroll) : 0f);
			float num2 = Mathf.Max(20f, 211600f / _sidebarTotalH);
			float num3 = (0f - num) * (460f - num2);
			_sidebarThumbRt.sizeDelta = new Vector2(0f, num2);
			_sidebarThumbRt.anchoredPosition = new Vector2(0f, num3);
		}
	}

	private void ApplyScroll(float maxScroll)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		_scrollOffset = Mathf.Clamp(_scrollOffset, 0f, maxScroll);
		if ((Object)(object)_scrollContentRt != (Object)null)
		{
			_scrollContentRt.anchoredPosition = new Vector2(0f, _scrollOffset);
		}
		UpdateScrollThumb(maxScroll);
	}

	private void UpdateScrollThumb(float maxScroll)
	{
		//IL_0060: 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)
		if (!((Object)(object)_scrollThumbRt == (Object)null) && !(_totalContentH <= 0f))
		{
			float num = ((maxScroll > 0f) ? (_scrollOffset / maxScroll) : 0f);
			float num2 = Mathf.Max(30f, 204304f / _totalContentH);
			float num3 = (0f - num) * (452f - num2);
			_scrollThumbRt.sizeDelta = new Vector2(0f, num2);
			_scrollThumbRt.anchoredPosition = new Vector2(0f, num3);
		}
	}

	private void HandleClicks()
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		if (!Input.GetMouseButtonDown(0))
		{
			return;
		}
		Vector2 val = Vector2.op_Implicit(Input.mousePosition);
		if (!_panelOpen && (Object)(object)_modsBtnRt != (Object)null && ((Component)_modsBtnRt).gameObject.activeSelf && HitTest(_modsBtnRt, val))
		{
			OpenPanel();
		}
		else
		{
			if (!_panelOpen)
			{
				return;
			}
			if ((Object)(object)_scrollThumbRt != (Object)null && (Object)(object)_scrollbarGo != (Object)null && _scrollbarGo.activeInHierarchy && HitTest(_scrollThumbRt, val))
			{
				StartScrollThumbDrag(val);
				return;
			}
			if ((Object)(object)_sidebarThumbRt != (Object)null && (Object)(object)_sidebarScrollbarGo != (Object)null && _sidebarScrollbarGo.activeInHierarchy && HitTest(_sidebarThumbRt, val))
			{
				StartSidebarThumbDrag(val);
				return;
			}
			bool flag = (Object)(object)_searchBgRt != (Object)null && HitTest(_searchBgRt, val);
			if (_editingSearch && !flag)
			{
				CommitSearchEdit();
			}
			if (flag)
			{
				if (!_editingSearch)
				{
					_editingSearch = true;
					SliderEntry.AnyInputActive = true;
					if ((Object)(object)_searchBgImg != (Object)null)
					{
						((Graphic)_searchBgImg).color = new Color(0.28f, 0.22f, 0.08f);
					}
					UpdateSearchTextDisplay();
				}
				return;
			}
			if ((Object)(object)_scrollTrackRt != (Object)null && (Object)(object)_scrollbarGo != (Object)null && _scrollbarGo.activeInHierarchy && HitTest(_scrollTrackRt, val))
			{
				JumpScrollToCursor(val);
				StartScrollThumbDrag(val);
				return;
			}
			if (!((Object)(object)_sidebarTrackRt != (Object)null) || !((Object)(object)_sidebarScrollbarGo != (Object)null) || !_sidebarScrollbarGo.activeInHierarchy || !HitTest(_sidebarTrackRt, val))
			{
				foreach (var (val3, action2) in Clicks.Map)
				{
					if (!((Object)(object)val3 == (Object)null) && HitTest(val3, val))
					{
						action2?.Invoke();
						break;
					}
				}
				return;
			}
			JumpSidebarToCursor(val);
			StartSidebarThumbDrag(val);
		}
	}

	private void StartScrollThumbDrag(Vector2 mp)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_scrollThumbRt == (Object)null))
		{
			float y = ((Il2CppArrayBase<Vector3>)(object)GetCorners(_scrollThumbRt))[1].y;
			_scrollDragGrab = mp.y - y;
			_scrollDragging = true;
		}
	}

	private void StartSidebarThumbDrag(Vector2 mp)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_sidebarThumbRt == (Object)null))
		{
			float y = ((Il2CppArrayBase<Vector3>)(object)GetCorners(_sidebarThumbRt))[1].y;
			_sidebarDragGrab = mp.y - y;
			_sidebarDragging = true;
		}
	}

	private static Il2CppStructArray<Vector3> GetCorners(RectTransform rt)
	{
		Il2CppStructArray<Vector3> val = new Il2CppStructArray<Vector3>(4L);
		rt.GetWorldCorners(val);
		return val;
	}

	private static float ScreenPointHeight(RectTransform rt)
	{
		//IL_0009: 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)
		Il2CppStructArray<Vector3> corners = GetCorners(rt);
		return ((Il2CppArrayBase<Vector3>)(object)corners)[1].y - ((Il2CppArrayBase<Vector3>)(object)corners)[0].y;
	}

	private void JumpScrollToCursor(Vector2 mp)
	{
		//IL_004a: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_scrollTrackRt == (Object)null || (Object)(object)_scrollThumbRt == (Object)null)
		{
			return;
		}
		float num = Mathf.Max(0f, _totalContentH - 452f);
		if (!(num <= 0f))
		{
			Il2CppStructArray<Vector3> corners = GetCorners(_scrollTrackRt);
			float y = ((Il2CppArrayBase<Vector3>)(object)corners)[1].y;
			float y2 = ((Il2CppArrayBase<Vector3>)(object)corners)[0].y;
			float num2 = y - y2;
			float num3 = ScreenPointHeight(_scrollThumbRt);
			float num4 = num2 - num3;
			if (!(num4 <= 0f))
			{
				float num5 = mp.y + num3 * 0.5f;
				float num6 = Mathf.Clamp01((y - num5) / num4);
				_scrollOffset = num6 * num;
				ApplyScroll(num);
			}
		}
	}

	private void JumpSidebarToCursor(Vector2 mp)
	{
		//IL_004a: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_sidebarTrackRt == (Object)null || (Object)(object)_sidebarThumbRt == (Object)null)
		{
			return;
		}
		float num = Mathf.Max(0f, _sidebarTotalH - 460f);
		if (!(num <= 0f))
		{
			Il2CppStructArray<Vector3> corners = GetCorners(_sidebarTrackRt);
			float y = ((Il2CppArrayBase<Vector3>)(object)corners)[1].y;
			float y2 = ((Il2CppArrayBase<Vector3>)(object)corners)[0].y;
			float num2 = y - y2;
			float num3 = ScreenPointHeight(_sidebarThumbRt);
			float num4 = num2 - num3;
			if (!(num4 <= 0f))
			{
				float num5 = mp.y + num3 * 0.5f;
				float num6 = Mathf.Clamp01((y - num5) / num4);
				_sidebarOffset = num6 * num;
				ApplySidebarScroll(num);
			}
		}
	}

	private void UpdateThumbDrag()
	{
		if (Input.GetMouseButtonUp(0))
		{
			_scrollDragging = false;
			_sidebarDragging = false;
			return;
		}
		if (_scrollDragging)
		{
			DragScrollThumb();
		}
		if (_sidebarDragging)
		{
			DragSidebarThumb();
		}
	}

	private void DragScrollThumb()
	{
		//IL_0051: 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_0085: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_scrollTrackRt == (Object)null || (Object)(object)_scrollThumbRt == (Object)null)
		{
			_scrollDragging = false;
			return;
		}
		float num = Mathf.Max(0f, _totalContentH - 452f);
		if (!(num <= 0f))
		{
			Il2CppStructArray<Vector3> corners = GetCorners(_scrollTrackRt);
			float y = ((Il2CppArrayBase<Vector3>)(object)corners)[1].y;
			float y2 = ((Il2CppArrayBase<Vector3>)(object)corners)[0].y;
			float num2 = y - y2;
			float num3 = ScreenPointHeight(_scrollThumbRt);
			float num4 = num2 - num3;
			if (!(num4 <= 0f))
			{
				float num5 = Input.mousePosition.y - _scrollDragGrab;
				float num6 = Mathf.Clamp01((y - num5) / num4);
				_scrollOffset = num6 * num;
				ApplyScroll(num);
			}
		}
	}

	private void DragSidebarThumb()
	{
		//IL_0051: 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_0085: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_sidebarTrackRt == (Object)null || (Object)(object)_sidebarThumbRt == (Object)null)
		{
			_sidebarDragging = false;
			return;
		}
		float num = Mathf.Max(0f, _sidebarTotalH - 460f);
		if (!(num <= 0f))
		{
			Il2CppStructArray<Vector3> corners = GetCorners(_sidebarTrackRt);
			float y = ((Il2CppArrayBase<Vector3>)(object)corners)[1].y;
			float y2 = ((Il2CppArrayBase<Vector3>)(object)corners)[0].y;
			float num2 = y - y2;
			float num3 = ScreenPointHeight(_sidebarThumbRt);
			float num4 = num2 - num3;
			if (!(num4 <= 0f))
			{
				float num5 = Input.mousePosition.y - _sidebarDragGrab;
				float num6 = Mathf.Clamp01((y - num5) / num4);
				_sidebarOffset = num6 * num;
				ApplySidebarScroll(num);
			}
		}
	}

	private void CommitSearchEdit()
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		if (_editingSearch)
		{
			_editingSearch = false;
			SliderEntry.AnyInputActive = false;
			if ((Object)(object)_searchBgImg != (Object)null)
			{
				((Graphic)_searchBgImg).color = new Color(0.16f, 0.16f, 0.18f, 0.95f);
			}
			UpdateSearchTextDisplay();
		}
	}

	private void HandleSearchInput()
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		if (!_editingSearch)
		{
			return;
		}
		if (Input.GetKeyDown((KeyCode)27))
		{
			_editingSearch = false;
			SliderEntry.AnyInputActive = false;
			_searchQuery = "";
			if ((Object)(object)_searchBgImg != (Object)null)
			{
				((Graphic)_searchBgImg).color = new Color(0.16f, 0.16f, 0.18f, 0.95f);
			}
			UpdateSearchTextDisplay();
			RebuildSidebar();
			return;
		}
		bool flag = false;
		string inputString = Input.inputString;
		for (int i = 0; i < inputString.Length; i++)
		{
			char c = inputString[i];
			if (c == '\b')
			{
				if (_searchQuery.Length > 0)
				{
					_searchQuery = _searchQuery.Substring(0, _searchQuery.Length - 1);
					flag = true;
				}
			}
			else if (c != '\n' && c != '\r' && c >= ' ')
			{
				_searchQuery += c;
				flag = true;
			}
		}
		if (flag)
		{
			UpdateSearchTextDisplay();
			RebuildSidebar();
		}
	}

	private void UpdateSearchTextDisplay()
	{
		if (!((Object)(object)_searchText == (Object)null))
		{
			if (_editingSearch)
			{
				((TMP_Text)_searchText).text = _searchQuery + "|";
			}
			else if (string.IsNullOrEmpty(_searchQuery))
			{
				((TMP_Text)_searchText).text = "Search…";
			}
			else
			{
				((TMP_Text)_searchText).text = _searchQuery;
			}
		}
	}

	private void UpdateModsButtonHover()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_modsBtnImg == (Object)null) && !((Object)(object)_modsBtnRt == (Object)null))
		{
			bool flag = HitTest(_modsBtnRt, Vector2.op_Implicit(Input.mousePosition));
			((Graphic)_modsBtnImg).color = (flag ? new Color(1f, 1f, 1f, 0.14f) : new Color(0f, 0f, 0f, 0f));
		}
	}

	private void PositionModsButton()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		RectTransform modsBtnRt = _modsBtnRt;
		RectTransform modsBtnRt2 = _modsBtnRt;
		Vector2 val = default(Vector2);
		((Vector2)(ref val))..ctor(0.5f, 0.685f);
		modsBtnRt2.anchorMax = val;
		modsBtnRt.anchorMin = val;
		_modsBtnRt.sizeDelta = new Vector2(260f, 34f);
		_modsBtnRt.anchoredPosition = Vector2.zero;
	}

	private void EnsureMainMenuModsBtn()
	{
		if ((Object)(object)_mainMenuModsBtn != (Object)null)
		{
			return;
		}
		NetworkMenuButton val = FindStartButton();
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		try
		{
			GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject);
			((Object)val2).name = "POGModsButton";
			val2.transform.SetParent(((Component)val).transform.parent, false);
			NetworkMenuButton component = val2.GetComponent<NetworkMenuButton>();
			if ((Object)(object)component == (Object)null)
			{
				Object.Destroy((Object)(object)val2);
				return;
			}
			if ((Object)(object)component.m_buttonText != (Object)null)
			{
				component.m_buttonText.text = "MODS";
			}
			Button button = component.m_button;
			if ((Object)(object)button != (Object)null)
			{
				((UnityEventBase)button.onClick).RemoveAllListeners();
				int persistentEventCount = ((UnityEventBase)button.onClick).GetPersistentEventCount();
				for (int i = 0; i < persistentEventCount; i++)
				{
					((UnityEventBase)button.onClick).SetPersistentListenerState(i, (UnityEventCallState)0);
				}
				Action action = delegate
				{
					try
					{
						if (_panelOpen)
						{
							DoClose();
						}
						else
						{
							OpenPanel();
						}
					}
					catch (Exception ex2)
					{
						MelonLogger.Warning("[POGConfig] MODS click: " + ex2.Message);
					}
				};
				((UnityEvent)button.onClick).AddListener(UnityAction.op_Implicit(action));
				((Behaviour)button).enabled = true;
				((Selectable)button).interactable = true;
				Navigation navigation = ((Selectable)button).navigation;
				navigation.mode = (Mode)3;
				((Selectable)button).navigation = navigation;
			}
			val2.transform.SetSiblingIndex(1);
			foreach (Image componentsInChild in val2.GetComponentsInChildren<Image>(true))
			{
				((Graphic)componentsInChild).raycastTarget = true;
			}
			val2.SetActive(true);
			_mainMenuModsBtn = val2;
			_mainMenuModsNmb = component;
			_modsHovered = false;
			Transform parent = ((Component)val).transform.parent;
			RectTransform val3 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
			if ((Object)(object)val3 != (Object)null)
			{
				LayoutRebuilder.ForceRebuildLayoutImmediate(val3);
			}
			Canvas.ForceUpdateCanvases();
			MelonLogger.Msg("[POGConfig] MODS button injected into main menu.");
		}
		catch (Exception ex)
		{
			MelonLogger.Warning("[POGConfig] EnsureMainMenuModsBtn: " + ex.Message);
		}
	}

	private void UpdateModsHoverSelection()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_mainMenuModsBtn == (Object)null || (Object)(object)_mainMenuModsNmb == (Object)null)
		{
			return;
		}
		Transform transform = _mainMenuModsBtn.transform;
		RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		bool flag = RectTransformUtility.RectangleContainsScreenPoint(val, Vector2.op_Implicit(Input.mousePosition), (Camera)null);
		if (flag != _modsHovered)
		{
			_modsHovered = flag;
			if ((Object)(object)_mainMenuModsNmb.m_selectionImage != (Object)null)
			{
				((Behaviour)_mainMenuModsNmb.m_selectionImage).enabled = flag;
			}
			if ((Object)(object)_mainMenuModsNmb.m_pointerImage != (Object)null)
			{
				((Behaviour)_mainMenuModsNmb.m_pointerImage).enabled = flag;
			}
			EventSystem current = EventSystem.current;
			if ((Object)(object)current != (Object)null && flag && (Object)(object)current.currentSelectedGameObject != (Object)(object)_mainMenuModsBtn)
			{
				current.SetSelectedGameObject(_mainMenuModsBtn);
			}
		}
	}

	private static NetworkMenuButton FindStartButton()
	{
		foreach (NetworkMenuButton item in Resources.FindObjectsOfTypeAll<NetworkMenuButton>())
		{
			if ((Object)(object)item == (Object)null || !((Component)item).gameObject.activeInHierarchy)
			{
				continue;
			}
			TMP_Text buttonText = item.m_buttonText;
			if (!((Object)(object)buttonText == (Object)null))
			{
				string text = buttonText.text;
				if (!string.IsNullOrEmpty(text) && text.Equals("START", StringComparison.OrdinalIgnoreCase))
				{
					return item;
				}
			}
		}
		return null;
	}

	private static void DiagnoseAtCursor()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: 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)
		try
		{
			Vector2 val = Vector2.op_Implicit(Input.mousePosition);
			MelonLogger.Msg($"[POGConfig] === DIAG @ mouse={val} ===");
			EventSystem current = EventSystem.current;
			if ((Object)(object)current != (Object)null)
			{
				GameObject currentSelectedGameObject = current.currentSelectedGameObject;
				MelonLogger.Msg("[POGConfig]   EventSystem.selected = " + (((Object)(object)currentSelectedGameObject != (Object)null) ? ((Object)currentSelectedGameObject).name : "<null>"));
			}
			foreach (NetworkMenuButton item in Resources.FindObjectsOfTypeAll<NetworkMenuButton>())
			{
				if ((Object)(object)item == (Object)null || !((Component)item).gameObject.activeInHierarchy)
				{
					continue;
				}
				Transform transform = ((Component)item).transform;
				RectTransform val2 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
				if (!((Object)(object)val2 == (Object)null))
				{
					bool num = RectTransformUtility.RectangleContainsScreenPoint(val2, val, (Camera)null);
					string value = (((Object)(object)item.m_buttonText != (Object)null) ? item.m_buttonText.text : "?");
					if (num)
					{
						DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(44, 4);
						defaultInterpolatedStringHandler.AppendLiteral("[POGConfig]   HIT '");
						defaultInterpolatedStringHandler.AppendFormatted(((Object)((Component)item).gameObject).name);
						defaultInterpolatedStringHandler.AppendLiteral("' label='");
						defaultInterpolatedStringHandler.AppendFormatted(value);
						defaultInterpolatedStringHandler.AppendLiteral("' pos=");
						defaultInterpolatedStringHandler.AppendFormatted<Vector2>(val2.anchoredPosition);
						defaultInterpolatedStringHandler.AppendLiteral(" parent='");
						Transform parent = ((Transform)val2).parent;
						defaultInterpolatedStringHandler.AppendFormatted((parent != null) ? ((Object)parent).name : null);
						defaultInterpolatedStringHandler.AppendLiteral("'");
						MelonLogger.Msg(defaultInterpolatedStringHandler.ToStringAndClear());
					}
				}
			}
		}
		catch (Exception ex)
		{
			MelonLogger.Warning("[POGConfig] DiagnoseAtCursor: " + ex.Message);
		}
	}

	private void OpenPanel()
	{
		if (_builtRegistryVersion != POGConfig.RegistryVersion)
		{
			_contentBuilt = false;
		}
		EnsureContent();
		_overlay.SetActive(true);
		_panelOpen = true;
		PanelOpen = true;
		POGConfig.PanelOpen = true;
		EventSystem current = EventSystem.current;
		if ((Object)(object)current != (Object)null)
		{
			_savedSelected = current.currentSelectedGameObject;
			current.SetSelectedGameObject((GameObject)null);
		}
	}

	internal void DoClose()
	{
		if ((Object)(object)_overlay != (Object)null)
		{
			_overlay.SetActive(false);
		}
		_panelOpen = false;
		PanelOpen = false;
		POGConfig.PanelOpen = false;
		KeyEntry.AnyWaiting = false;
		_scrollDragging = false;
		_sidebarDragging = false;
		EventSystem current = EventSystem.current;
		if ((Object)(object)current != (Object)null && (Object)(object)_savedSelected != (Object)null)
		{
			current.SetSelectedGameObject(_savedSelected);
		}
		_savedSelected = null;
	}

	private void BuildStaticUI()
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Expected O, but got Unknown
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		if (_uiReady)
		{
			return;
		}
		_uiReady = true;
		try
		{
			try
			{
				Il2CppArrayBase<TMP_FontAsset> val = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
				if (val != null && val.Count > 0)
				{
					_font = val[0];
				}
			}
			catch
			{
			}
			try
			{
				if ((Object)(object)_font == (Object)null)
				{
					_font = TMP_Settings.defaultFontAsset;
				}
			}
			catch
			{
			}
			GameObject val2 = new GameObject("POGCanvas");
			Object.DontDestroyOnLoad((Object)(object)val2);
			Canvas obj3 = val2.AddComponent<Canvas>();
			obj3.renderMode = (RenderMode)0;
			obj3.sortingOrder = 9999;
			CanvasScaler obj4 = val2.AddComponent<CanvasScaler>();
			obj4.uiScaleMode = (ScaleMode)1;
			obj4.referenceResolution = new Vector2(1920f, 1080f);
			obj4.matchWidthOrHeight = 0.5f;
			val2.AddComponent<GraphicRaycaster>();
			if ((Object)(object)Object.FindObjectOfType<EventSystem>() == (Object)null)
			{
				GameObject val3 = new GameObject("POG_EventSystem");
				Object.DontDestroyOnLoad((Object)val3);
				val3.AddComponent<EventSystem>();
				val3.AddComponent<StandaloneInputModule>();
			}
			GameObject val4 = BuildModsButton(val2.transform);
			_modsBtnRt = UI.Rt(val4);
			val4.SetActive(false);
			_overlay = BuildOverlay(val2.transform);
			_overlay.SetActive(false);
			MelonLogger.Msg("[POGConfig] Canvas created.");
		}
		catch (Exception ex)
		{
			_uiReady = false;
			MelonLogger.Warning("[POGConfig] BuildStaticUI failed: " + ex.Message);
		}
	}

	private GameObject BuildModsButton(Transform parent)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = UI.Make("ModsButton", parent);
		_modsBtnImg = UI.AddImage(val, new Color(0f, 0f, 0f, 0f));
		GameObject go = UI.Make("Text", val.transform);
		UI.Stretch(UI.Rt(go));
		((TMP_Text)UI.AddText(go, "MODS", _font, 20, Color.white, (TextAlignmentOptions)514)).fontStyle = (FontStyles)1;
		return val;
	}

	private GameObject BuildOverlay(Transform parent)
	{
		//IL_0040: 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_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: 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)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = UI.Make("Overlay", parent);
		UI.Stretch(UI.Rt(val));
		UI.AddImage(val, new Color(0f, 0f, 0f, 0.82f));
		GameObject val2 = UI.Make("Panel", val.transform);
		RectTransform obj = UI.Rt(val2);
		Vector2 val3 = default(Vector2);
		((Vector2)(ref val3))..ctor(0.5f, 0.5f);
		obj.anchorMax = val3;
		obj.anchorMin = val3;
		obj.sizeDelta = new Vector2(980f, 600f);
		Color color = default(Color);
		((Color)(ref color))..ctor(0.055f, 0.055f, 0.07f, 0.99f);
		UI.AddImage(val2, color);
		GameObject go = UI.Make("Title", val2.transform);
		UI.PlaceFromTop(UI.Rt(go), 14f, 40f, 24f, 24f);
		((TMP_Text)UI.AddText(go, "MOD SETTINGS", _font, 22, Color.white, (TextAlignmentOptions)4097)).fontStyle = (FontStyles)1;
		GameObject go2 = UI.Make("Sep", val2.transform);
		UI.PlaceFromTop(UI.Rt(go2), 62f, 1f, 24f, 24f);
		UI.AddImage(go2, new Color(1f, 1f, 1f, 0.12f), raycast: false);
		BuildSidebar(val2.transform);
		GameObject go3 = UI.Make("VSep", val2.transform);
		RectTransform obj2 = UI.Rt(go3);
		obj2.anchorMin = new Vector2(0f, 0f);
		obj2.anchorMax = new Vector2(0f, 1f);
		obj2.pivot = new Vector2(0f, 0.5f);
		obj2.sizeDelta = new Vector2(1f, -92f);
		obj2.anchoredPosition = new Vector2(236f, 0f);
		UI.AddImage(go3, new Color(1f, 1f, 1f, 0.1f), raycast: false);
		BuildContentHeader(val2.transform);
		BuildViewport(val2.transform);
		BuildScrollbar(val2.transform);
		GameObject val4 = UI.Make("DoneBtn", val2.transform);
		_doneBtnRt = UI.Rt(val4);
		_doneBtnRt.anchorMin = new Vector2(1f, 1f);
		_doneBtnRt.anchorMax = new Vector2(1f, 1f);
		_doneBtnRt.pivot = new Vector2(1f, 1f);
		_doneBtnRt.sizeDelta = new Vector2(120f, 36f);
		_doneBtnRt.anchoredPosition = new Vector2(-20f, -16f);
		UI.AddImage(val4, new Color(0.85f, 0.65f, 0.1f));
		GameObject go4 = UI.Make("Text", val4.transform);
		UI.Stretch(UI.Rt(go4));
		((TMP_Text)UI.AddText(go4, "DONE", _font, 15, new Color(0.08f, 0.04f, 0f), (TextAlignmentOptions)514)).fontStyle = (FontStyles)1;
		return val;
	}

	private void BuildSidebar(Transform panelTr)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: 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_01f0: 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_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: 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_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0305: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0339: Unknown result type (might be due to invalid IL or missing references)
		//IL_0353: 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_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0400: Unknown result type (might be due to invalid IL or missing references)
		//IL_041a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0435: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = UI.Make("Sidebar", panelTr);
		RectTransform obj = UI.Rt(val);
		obj.anchorMin = new Vector2(0f, 0f);
		obj.anchorMax = new Vector2(0f, 1f);
		obj.pivot = new Vector2(0f, 0.5f);
		obj.sizeDelta = new Vector2(220f, -92f);
		obj.anchoredPosition = new Vector2(16f, 0f);
		GameObject val2 = UI.Make("Search", val.transform);
		_searchBgRt = UI.Rt(val2);
		_searchBgRt.anchorMin = new Vector2(0f, 1f);
		_searchBgRt.anchorMax = new Vector2(1f, 1f);
		_searchBgRt.pivot = new Vector2(0.5f, 1f);
		_searchBgRt.sizeDelta = new Vector2(0f, 32f);
		_searchBgRt.anchoredPosition = new Vector2(0f, 0f);
		_searchBgImg = UI.AddImage(val2, new Color(0.16f, 0.16f, 0.18f, 0.95f));
		GameObject go = UI.Make("Text", val2.transform);
		UI.Stretch(UI.Rt(go), 8f, 8f);
		_searchText = UI.AddText(go, "Search…", _font, 13, new Color(0.55f, 0.55f, 0.6f), (TextAlignmentOptions)4097);
		((TMP_Text)_searchText).enableWordWrapping = false;
		((TMP_Text)_searchText).overflowMode = (TextOverflowModes)1;
		GameObject val3 = UI.Make("ListVP", val.transform);
		RectTransform obj2 = UI.Rt(val3);
		obj2.anchorMin = new Vector2(0f, 0f);
		obj2.anchorMax = new Vector2(1f, 1f);
		obj2.offsetMin = new Vector2(0f, 0f);
		obj2.offsetMax = new Vector2(0f, -40f);
		val3.AddComponent<RectMask2D>();
		GameObject val4 = UI.Make("List", val3.transform);
		_sidebarListRt = UI.Rt(val4);
		_sidebarListRt.anchorMin = new Vector2(0f, 1f);
		_sidebarListRt.anchorMax = new Vector2(1f, 1f);
		_sidebarListRt.pivot = new Vector2(0.5f, 1f);
		_sidebarListRt.sizeDelta = new Vector2(0f, 0f);
		_sidebarListRt.anchoredPosition = Vector2.zero;
		_sidebarList = val4.transform;
		_sidebarScrollbarGo = UI.Make("SBScroll", val.transform);
		_sidebarTrackRt = UI.Rt(_sidebarScrollbarGo);
		_sidebarTrackRt.anchorMin = new Vector2(1f, 0f);
		_sidebarTrackRt.anchorMax = new Vector2(1f, 1f);
		_sidebarTrackRt.pivot = new Vector2(1f, 0.5f);
		_sidebarTrackRt.sizeDelta = new Vector2(8.400001f, -40f);
		_sidebarTrackRt.anchoredPosition = new Vector2(0f, -20f);
		UI.AddImage(_sidebarScrollbarGo, new Color(0.1f, 0.1f, 0.12f));
		GameObject go2 = UI.Make("Thumb", _sidebarScrollbarGo.transform);
		_sidebarThumbRt = UI.Rt(go2);
		_sidebarThumbRt.anchorMin = new Vector2(0f, 1f);
		_sidebarThumbRt.anchorMax = new Vector2(1f, 1f);
		_sidebarThumbRt.pivot = new Vector2(0.5f, 1f);
		_sidebarThumbRt.sizeDelta = new Vector2(0f, 30f);
		UI.AddImage(go2, new Color(0.4f, 0.4f, 0.45f));
		_sidebarScrollbarGo.SetActive(false);
	}

	private void BuildContentHeader(Transform panelTr)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = UI.Make("ContentHeader", panelTr);
		_contentHeaderRt = UI.Rt(val);
		float num = 253f;
		_contentHeaderRt.anchorMin = new Vector2(0f, 1f);
		_contentHeaderRt.anchorMax = new Vector2(1f, 1f);
		_contentHeaderRt.pivot = new Vector2(0f, 1f);
		_contentHeaderRt.offsetMin = new Vector2(num, -124f);
		_contentHeaderRt.offsetMax = new Vector2(-16f, -68f);
		GameObject go = UI.Make("ModTitle", val.transform);
		RectTransform obj = UI.Rt(go);
		obj.anchorMin = new Vector2(0f, 1f);
		obj.anchorMax = new Vector2(1f, 1f);
		obj.pivot = new Vector2(0f, 1f);
		obj.sizeDelta = new Vector2(0f, 28f);
		obj.anchoredPosition = new Vector2(0f, -2f);
		_modTitleTmp = UI.AddText(go, "", _font, 18, new Color(1f, 0.82f, 0.3f), (TextAlignmentOptions)257);
		((TMP_Text)_modTitleTmp).fontStyle = (FontStyles)1;
		GameObject go2 = UI.Make("ModSub", val.transform);
		RectTransform obj2 = UI.Rt(go2);
		obj2.anchorMin = new Vector2(0f, 1f);
		obj2.anchorMax = new Vector2(1f, 1f);
		obj2.pivot = new Vector2(0f, 1f);
		obj2.sizeDelta = new Vector2(0f, 22f);
		obj2.anchoredPosition = new Vector2(0f, -28f);
		_modSubTmp = UI.AddText(go2, "", _font, 12, new Color(0.7f, 0.7f, 0.72f), (TextAlignmentOptions)257);
		((TMP_Text)_modSubTmp).enableWordWrapping = false;
		((TMP_Text)_modSubTmp).overflowMode = (TextOverflowModes)1;
	}

	private void BuildViewport(Transform panelTr)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: 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_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = UI.Make("Viewport", panelTr);
		RectTransform obj = UI.Rt(val);
		float num = 253f;
		obj.anchorMin = Vector2.zero;
		obj.anchorMax = Vector2.one;
		obj.offsetMin = new Vector2(num, 24f);
		obj.offsetMax = new Vector2(-36f, -124f);
		val.AddComponent<RectMask2D>();
		GameObject val2 = UI.Make("ScrollContent", val.transform);
		_scrollContentRt = UI.Rt(val2);
		_scrollContentRt.anchorMin = new Vector2(0f, 1f);
		_scrollContentRt.anchorMax = new Vector2(1f, 1f);
		_scrollContentRt.pivot = new Vector2(0.5f, 1f);
		_scrollContentRt.sizeDelta = new Vector2(0f, 0f);
		_scrollContentRt.anchoredPosition = Vector2.zero;
		_scrollContent = val2.transform;
	}

	private void BuildScrollbar(Transform panelTr)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		_scrollbarGo = UI.Make("ScrollTrack", panelTr);
		_scrollTrackRt = UI.Rt(_scrollbarGo);
		_scrollTrackRt.anchorMin = new Vector2(1f, 0f);
		_scrollTrackRt.anchorMax = new Vector2(1f, 1f);
		_scrollTrackRt.pivot = new Vector2(1f, 0.5f);
		_scrollTrackRt.offsetMin = new Vector2(-22f, 24f);
		_scrollTrackRt.offsetMax = new Vector2(-8f, -124f);
		UI.AddImage(_scrollbarGo, new Color(0.12f, 0.12f, 0.14f));
		GameObject go = UI.Make("Thumb", _scrollbarGo.transform);
		_scrollThumbRt = UI.Rt(go);
		_scrollThumbRt.anchorMin = new Vector2(0f, 1f);
		_scrollThumbRt.anchorMax = new Vector2(1f, 1f);
		_scrollThumbRt.pivot = new Vector2(0.5f, 1f);
		_scrollThumbRt.offsetMin = new Vector2(2f, 0f);
		_scrollThumbRt.offsetMax = new Vector2(-2f, 0f);
		_scrollThumbRt.sizeDelta = new Vector2(-4f, 40f);
		_scrollThumbRt.anchoredPosition = Vector2.zero;
		UI.AddImage(go, new Color(0.45f, 0.45f, 0.5f));
		_scrollbarGo.SetActive(false);
	}

	private void EnsureContent()
	{
		if (!_contentBuilt && !((Object)(object)_scrollContent == (Object)null))
		{
			_contentBuilt = true;
			_builtRegistryVersion = POGConfig.RegistryVersion;
			RebuildAll();
		}
	}

	private void RebuildAll()
	{
		Clicks.Clear();
		if ((Object)(object)_doneBtnRt != (Object)null)
		{
			Clicks.Register(_doneBtnRt, DoClose);
		}
		IReadOnlyList<ModRecord> allRecords = POGConfig.GetAllRecords();
		if (allRecords.Count == 0)
		{
			_selectedMod = 0;
		}
		else if (_selectedMod >= allRecords.Count)
		{
			_selectedMod = allRecords.Count - 1;
		}
		else if (_selectedMod < 0)
		{
			_selectedMod = 0;
		}
		RebuildSidebar();
		RebuildContent();
	}

	private void RebuildSidebar()
	{
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or m