Decompiled source of RRModConfigManager v1.0.0

BepInEx/plugins/ModConfigManager.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using IceBoxModLib.Config;
using IceBoxModLib.Localization;
using IceBoxModLib.Runtime;
using IceBoxModLib.Utilities;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using ModConfigManager.Api;
using ModConfigManager.Configuration;
using ModConfigManager.Localization;
using ModConfigManager.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ModConfigManager")]
[assembly: AssemblyDescription("Mod Config Manager mod for Roadside Research by Ice Box Studio")]
[assembly: AssemblyCompany("Ice Box Studio")]
[assembly: AssemblyProduct("ModConfigManager")]
[assembly: AssemblyCopyright("Copyright © 2026 Ice Box Studio All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bef278ca-3862-4551-be34-16cb6c2963a8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ModConfigManager
{
	[BepInPlugin("IceBoxStudio.RoadsideResearch.ModConfigManager", "ModConfigManager", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ModConfigManager : BasePlugin
	{
		private static bool _uiControllerTypeRegistered;

		public static ModConfigManager Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal ConfigEntry<KeyCode> ToggleManagerKey => ConfigManager.Instance?.ToggleManagerKey;

		public override void Load()
		{
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			Instance = this;
			Logger = ((BasePlugin)this).Log;
			bool flag = default(bool);
			try
			{
				((BasePlugin)this).Log.LogInfo((object)"=============================================");
				ManualLogSource log = ((BasePlugin)this).Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(1, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ModConfigManager");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LocalizationManager.Instance.GetLocalizedText("plugin.initializing"));
				}
				log.LogInfo(val);
				ManualLogSource log2 = ((BasePlugin)this).Log;
				val = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LocalizationManager.Instance.GetLocalizedText("plugin.author_prefix"));
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Ice Box Studio(https://steamcommunity.com/id/ibox666/)");
				}
				log2.LogInfo(val);
				ConfigManager.Initialize(((BasePlugin)this).Config);
				RegisterSelfToApi();
				ModConfigManagerUI.Initialize();
				EnsureUiControllerLoaded();
				ManualLogSource log3 = ((BasePlugin)this).Log;
				val = new BepInExInfoLogInterpolatedStringHandler(1, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ModConfigManager");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LocalizationManager.Instance.GetLocalizedText("plugin.initialized"));
				}
				log3.LogInfo(val);
				((BasePlugin)this).Log.LogInfo((object)"=============================================");
			}
			catch (Exception ex)
			{
				ManualLogSource log4 = ((BasePlugin)this).Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(9, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("ModConfigManager");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" 初始化错误: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("\n");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.StackTrace);
				}
				log4.LogError(val2);
			}
		}

		private void RegisterSelfToApi()
		{
			ModConfigManagerAPI.RegisterPluginInfo("IceBoxStudio.RoadsideResearch.ModConfigManager", LocalizationManager.Instance.GetLocalizedText("ui.title"), "1.0.0", "Ice Box Studio", LocalizationManager.Instance.GetLocalizedText("plugin.description"));
		}

		private static void EnsureUiControllerLoaded()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			if (!_uiControllerTypeRegistered)
			{
				Il2CppTypeRegistry.RegisterType<ModConfigManagerUIController>();
				_uiControllerTypeRegistered = true;
			}
			GameObject val = GameObject.Find("ModConfigManager_UI");
			if ((Object)(object)val == (Object)null)
			{
				val = new GameObject("ModConfigManager_UI");
			}
			Object.DontDestroyOnLoad((Object)(object)val);
			((Object)val).hideFlags = (HideFlags)61;
			if ((Object)(object)val.GetComponent<ModConfigManagerUIController>() == (Object)null)
			{
				val.AddComponent<ModConfigManagerUIController>();
			}
		}
	}
	public class ModConfigManagerUIController : MonoBehaviour
	{
		private GameObject _blockerCanvasGO;

		public ModConfigManagerUIController(IntPtr pointer)
			: base(pointer)
		{
		}

		private void Awake()
		{
			((Object)this).hideFlags = (HideFlags)61;
			if ((Object)(object)_blockerCanvasGO == (Object)null)
			{
				CreateBlockerCanvas();
			}
		}

		private void CreateBlockerCanvas()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0070: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			_blockerCanvasGO = new GameObject("ModConfigManager_UIBlockerCanvas");
			Object.DontDestroyOnLoad((Object)(object)_blockerCanvasGO);
			((Object)_blockerCanvasGO).hideFlags = (HideFlags)61;
			Canvas obj = _blockerCanvasGO.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 32767;
			_blockerCanvasGO.AddComponent<GraphicRaycaster>();
			Image obj2 = _blockerCanvasGO.AddComponent<Image>();
			((Graphic)obj2).color = new Color(0f, 0f, 0f, 0f);
			((Graphic)obj2).raycastTarget = true;
			RectTransform rectTransform = ((Graphic)obj2).rectTransform;
			rectTransform.anchorMin = Vector2.zero;
			rectTransform.anchorMax = Vector2.one;
			rectTransform.offsetMin = Vector2.zero;
			rectTransform.offsetMax = Vector2.zero;
			_blockerCanvasGO.SetActive(false);
		}

		private void Update()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			MainMenuButtonInjector.Update();
			ModConfigManager instance = ModConfigManager.Instance;
			if (KeyboardInputHelper.WasKeyPressed((KeyCode)((instance == null || instance.ToggleManagerKey == null) ? 282 : ((int)instance.ToggleManagerKey.Value))))
			{
				ModConfigManagerUI.Toggle();
			}
			if ((Object)(object)_blockerCanvasGO != (Object)null && _blockerCanvasGO.activeSelf != ModConfigManagerUI.IsWindowVisible)
			{
				_blockerCanvasGO.SetActive(ModConfigManagerUI.IsWindowVisible);
			}
		}

		private void OnGUI()
		{
			ModConfigManagerUI.OnGUI();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "IceBoxStudio.RoadsideResearch.ModConfigManager";

		public const string PLUGIN_NAME = "ModConfigManager";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ModConfigManager.UI
{
	internal static class MainMenuButtonInjector
	{
		private const string MenuButtonsPath = "MenuCanvas/Main/MainMenuButtons";

		private const string OptionsButtonName = "Button_Base_Menu_Main_Left_Options";

		private const string OptionsButtonPath = "MenuCanvas/Main/MainMenuButtons/Button_Base_Menu_Main_Left_Options";

		private const string InjectedButtonName = "Button_Base_Menu_Main_Left_ModConfigManager";

		private static GameObject _injectedButton;

		private static float _nextScanTime;

		public static void Update()
		{
			if ((Object)(object)_injectedButton != (Object)null)
			{
				SyncLabel();
			}
			else if (!(Time.unscaledTime < _nextScanTime))
			{
				_nextScanTime = Time.unscaledTime + 1f;
				TryInject();
			}
		}

		private static void TryInject()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			try
			{
				GameObject val = FindExistingButton();
				if ((Object)(object)val != (Object)null)
				{
					_injectedButton = val;
					return;
				}
				Button val2 = FindOptionsButton();
				if (!((Object)(object)val2 == (Object)null))
				{
					CreateButton(val2);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource logger = ModConfigManager.Logger;
				if (logger != null)
				{
					bool flag = default(bool);
					BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(18, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Main menu button: ");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
					}
					logger.LogWarning(val3);
				}
			}
		}

		private static GameObject FindExistingButton()
		{
			GameObject[] array = Il2CppArrayBase<GameObject>.op_Implicit(Resources.FindObjectsOfTypeAll<GameObject>());
			foreach (GameObject val in array)
			{
				if ((Object)(object)val != (Object)null && ((Object)val).name == "Button_Base_Menu_Main_Left_ModConfigManager" && IsLoadedSceneObject(val))
				{
					return val;
				}
			}
			return null;
		}

		private static Button FindOptionsButton()
		{
			GameObject val = GameObject.Find("MenuCanvas/Main/MainMenuButtons/Button_Base_Menu_Main_Left_Options");
			if ((Object)(object)val != (Object)null && IsLoadedSceneObject(val))
			{
				Button component = val.GetComponent<Button>();
				if ((Object)(object)component != (Object)null)
				{
					return component;
				}
			}
			GameObject[] array = Il2CppArrayBase<GameObject>.op_Implicit(Resources.FindObjectsOfTypeAll<GameObject>());
			foreach (GameObject val2 in array)
			{
				if (!((Object)(object)val2 == (Object)null) && !(((Object)val2).name != "Button_Base_Menu_Main_Left_Options") && IsLoadedSceneObject(val2) && string.Equals(GetTransformPath(val2.transform), "MenuCanvas/Main/MainMenuButtons/Button_Base_Menu_Main_Left_Options", StringComparison.Ordinal))
				{
					Button component2 = val2.GetComponent<Button>();
					if ((Object)(object)component2 != (Object)null)
					{
						return component2;
					}
				}
			}
			return null;
		}

		private static void CreateButton(Button templateButton)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			Transform parent = ((Component)templateButton).transform.parent;
			if ((Object)(object)parent == (Object)null)
			{
				return;
			}
			GameObject val = Object.Instantiate<GameObject>(((Component)templateButton).gameObject, parent, false);
			((Object)val).name = "Button_Base_Menu_Main_Left_ModConfigManager";
			val.SetActive(false);
			Button component = val.GetComponent<Button>();
			if ((Object)(object)component == (Object)null)
			{
				Object.Destroy((Object)(object)val);
				return;
			}
			StripCopiedScripts(val, component);
			SetButtonText(val, GetLabel());
			PlaceButton(templateButton, val);
			component.onClick = new ButtonClickedEvent();
			((UnityEvent)component.onClick).AddListener(UnityAction.op_Implicit((Action)OpenManager));
			((Selectable)component).interactable = true;
			val.SetActive(((Component)templateButton).gameObject.activeSelf);
			_injectedButton = val;
			ManualLogSource logger = ModConfigManager.Logger;
			if (logger != null)
			{
				logger.LogInfo((object)"Main menu button added");
			}
		}

		private static void SyncLabel()
		{
			if (!((Object)(object)_injectedButton == (Object)null))
			{
				SetButtonText(_injectedButton, GetLabel());
			}
		}

		private static void StripCopiedScripts(GameObject clonedObject, Button clonedButton)
		{
			Component[] array = Il2CppArrayBase<Component>.op_Implicit(clonedObject.GetComponentsInChildren<Component>(true));
			foreach (Component val in array)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)clonedButton) && ShouldDisable(val))
				{
					Behaviour val2 = ((Il2CppObjectBase)val).TryCast<Behaviour>();
					if ((Object)(object)val2 != (Object)null)
					{
						val2.enabled = false;
					}
				}
			}
		}

		private static bool ShouldDisable(Component component)
		{
			if ((Object)(object)((Il2CppObjectBase)component).TryCast<Behaviour>() == (Object)null)
			{
				return false;
			}
			Type type = ((object)component).GetType();
			string text = type.FullName ?? type.Name;
			if (text.StartsWith("UnityEngine.", StringComparison.Ordinal) || text.StartsWith("TMPro.", StringComparison.Ordinal))
			{
				return false;
			}
			switch (type.Name)
			{
			case "ButtonJuicer":
			case "TextJuicer":
			case "SelectionVisuals":
			case "SetSelectedOnHover":
			case "EnableOnSelect":
			case "EnableOnGamepad":
			case "RefreshSelectionOnGamepad":
			case "RefreshNavigation":
				return false;
			default:
				return true;
			}
		}

		private static void PlaceButton(Button templateButton, GameObject clonedObject)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			Transform parent = ((Component)templateButton).transform.parent;
			int siblingIndex = ((Component)templateButton).transform.GetSiblingIndex();
			clonedObject.transform.SetSiblingIndex(siblingIndex + 1);
			if (!((Object)(object)((Component)parent).GetComponent<LayoutGroup>() != (Object)null))
			{
				RectTransform val = ((Il2CppObjectBase)((Component)templateButton).transform).TryCast<RectTransform>();
				RectTransform val2 = ((Il2CppObjectBase)clonedObject.transform).TryCast<RectTransform>();
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null))
				{
					float spacing = GetSpacing(parent, val);
					val2.anchorMin = val.anchorMin;
					val2.anchorMax = val.anchorMax;
					val2.pivot = val.pivot;
					val2.sizeDelta = val.sizeDelta;
					val2.anchoredPosition = new Vector2(val.anchoredPosition.x, val.anchoredPosition.y - spacing);
					MoveLowerItems(parent, val, val2, spacing);
				}
			}
		}

		private static float GetSpacing(Transform parent, RectTransform templateRect)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			float y = templateRect.anchoredPosition.y;
			float num = float.MaxValue;
			for (int i = 0; i < parent.childCount; i++)
			{
				RectTransform val = ((Il2CppObjectBase)parent.GetChild(i)).TryCast<RectTransform>();
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)templateRect) && !(((Object)val).name == "Button_Base_Menu_Main_Left_ModConfigManager"))
				{
					float num2 = y - val.anchoredPosition.y;
					if (num2 > 1f && num2 < num)
					{
						num = num2;
					}
				}
			}
			if (num < float.MaxValue)
			{
				return num;
			}
			Rect rect = templateRect.rect;
			return Mathf.Max(46f, ((Rect)(ref rect)).height + 20f);
		}

		private static void MoveLowerItems(Transform parent, RectTransform templateRect, RectTransform clonedRect, float spacing)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			float y = templateRect.anchoredPosition.y;
			float num = Mathf.Max(8f, spacing * 0.25f);
			int siblingIndex = ((Transform)clonedRect).GetSiblingIndex();
			for (int i = 0; i < parent.childCount; i++)
			{
				RectTransform val = ((Il2CppObjectBase)parent.GetChild(i)).TryCast<RectTransform>();
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)templateRect) && !((Object)(object)val == (Object)(object)clonedRect) && ((Transform)val).GetSiblingIndex() > siblingIndex && val.anchoredPosition.y < y - num)
				{
					val.anchoredPosition = new Vector2(val.anchoredPosition.x, val.anchoredPosition.y - spacing);
				}
			}
		}

		private static void SetButtonText(GameObject buttonObject, string label)
		{
			TMP_Text[] array = Il2CppArrayBase<TMP_Text>.op_Implicit(buttonObject.GetComponentsInChildren<TMP_Text>(true));
			foreach (TMP_Text val in array)
			{
				if (!((Object)(object)val == (Object)null))
				{
					val.text = label;
					val.SetText(label);
				}
			}
		}

		private static string GetLabel()
		{
			return LocalizationManager.Instance.GetLocalizedText("ui.main_menu_button");
		}

		private static bool IsLoadedSceneObject(GameObject gameObject)
		{
			//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)
			Scene scene = gameObject.scene;
			if (((Scene)(ref scene)).IsValid())
			{
				return ((Scene)(ref scene)).isLoaded;
			}
			return false;
		}

		private static string GetTransformPath(Transform transform)
		{
			if ((Object)(object)transform == (Object)null)
			{
				return string.Empty;
			}
			Stack<string> stack = new Stack<string>();
			Transform val = transform;
			while ((Object)(object)val != (Object)null)
			{
				stack.Push(((Object)val).name);
				val = val.parent;
			}
			return string.Join("/", stack);
		}

		private static void OpenManager()
		{
			ModConfigManagerUI.Show();
		}
	}
	public static class ModConfigManagerUI
	{
		private class ManagedPluginEntry
		{
			public PluginInfo Info;

			public string ListText;

			public string TitleText;

			public string MetaText;

			public string Description;
		}

		private sealed class ConfigDisplayRow
		{
			public ConfigSection Section;

			public ConfigItem Item;

			public bool IsSectionHeader;
		}

		private const int WindowId = 486213;

		private static readonly List<ManagedPluginEntry> Plugins = new List<ManagedPluginEntry>();

		private static readonly Dictionary<string, string> EditorBuffer = new Dictionary<string, string>();

		private static Rect _windowRect;

		private static int _pluginPage;

		private static int _configPage;

		private static bool _isWindowVisible;

		private static int _selectedPluginIndex = -1;

		private static ConfigFileModel _selectedModel;

		private static string _selectedConfigPath;

		private static bool _isInitialized;

		private static GUIStyle _windowStyle;

		private static GUIStyle _pluginBtnStyle;

		private static GUIStyle _selectedPluginBtnStyle;

		private static GUIStyle _headerStyle;

		private static GUIStyle _pluginTitleStyle;

		private static GUIStyle _pluginMetaStyle;

		private static GUIStyle _pluginDescriptionStyle;

		private static GUIStyle _labelStyle;

		private static GUIStyle _descStyle;

		private static GUIStyle _configKeyStyle;

		private static GUIStyle _conflictConfigKeyStyle;

		private static GUIStyle _conflictWarningStyle;

		private static GUIStyle _revertBtnStyle;

		private static GUIStyle _actionBtnStyle;

		private static GUIStyle _closeBtnStyle;

		private static GUIStyle _textFieldStyle;

		private static GUIStyle _conflictTextFieldStyle;

		private static GUIStyle _checkboxNormalStyle;

		private static GUIStyle _checkboxActiveStyle;

		private static GUIStyle _sectionHeaderStyle;

		private static GUIStyle _dropdownButtonStyle;

		private static GUIStyle _conflictDropdownButtonStyle;

		private static GUIStyle _dropdownTextStyle;

		private static GUIStyle _dropdownItemStyle;

		private static GUIStyle _dropdownSelectedItemStyle;

		private static GUIStyle _dropdownArrowStyle;

		private static GUIStyle _dropdownPanelStyle;

		private static GUIStyle _dropdownScrollButtonStyle;

		private static GUIStyle _dropdownScrollTrackStyle;

		private static GUIStyle _dropdownScrollThumbStyle;

		private static GUIStyle _scrollViewBackgroundStyle;

		private static GUIStyle _verticalScrollbarStyle;

		private static GUIStyle _verticalScrollbarThumbStyle;

		private static GUIStyle _verticalScrollbarUpButtonStyle;

		private static GUIStyle _verticalScrollbarDownButtonStyle;

		private static GUIStyle _horizontalScrollbarStyle;

		private static GUIStyle _horizontalScrollbarThumbStyle;

		private static GUIStyle _horizontalScrollbarLeftButtonStyle;

		private static GUIStyle _horizontalScrollbarRightButtonStyle;

		private static Texture2D _darkBackground;

		private static Texture2D _lightBackground;

		private static Texture2D _redBackground;

		private static Texture2D _dangerBackground;

		private static Texture2D _conflictOutlineTexture;

		private static readonly List<Texture2D> _generatedTextures = new List<Texture2D>();

		private static bool _stylesInitialized;

		private static Dictionary<string, bool> _collapsedSections = new Dictionary<string, bool>();

		private static Dictionary<string, bool> _dropdownStates = new Dictionary<string, bool>();

		private static Dictionary<string, int> _dropdownStartIndexes = new Dictionary<string, int>();

		private static string _draggingDropdownKey;

		private static float _dropdownDragOffsetY;

		private static Dictionary<string, List<HotkeyConflictSource>> _hotkeyConflicts = new Dictionary<string, List<HotkeyConflictSource>>(StringComparer.OrdinalIgnoreCase);

		public static bool IsWindowVisible
		{
			get
			{
				return _isWindowVisible;
			}
			set
			{
				_isWindowVisible = value;
			}
		}

		public static void Initialize()
		{
			if (!_isInitialized)
			{
				_isInitialized = true;
				RefreshPlugins();
				RefreshHotkeyConflicts();
			}
		}

		public static void Toggle()
		{
			_isWindowVisible = !_isWindowVisible;
			if (_isWindowVisible)
			{
				RefreshPlugins();
				RefreshHotkeyConflicts();
			}
		}

		public static void Show()
		{
			if (!_isWindowVisible)
			{
				_isWindowVisible = true;
				RefreshPlugins();
				RefreshHotkeyConflicts();
			}
		}

		private static void PersistItemValue(ConfigItem item, string value)
		{
			if (_selectedModel != null)
			{
				_selectedModel.SetValue(item.Section, item.Key, value);
				_selectedModel.Save();
				if (ConflictDetector.IsHotkeyItem(item))
				{
					RefreshHotkeyConflicts();
				}
			}
		}

		private static void RefreshPlugins()
		{
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Expected O, but got Unknown
			Plugins.Clear();
			try
			{
				foreach (PluginInfo item in (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance)?.Plugins != null) ? ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Values.OrderBy((PluginInfo p) => p.Metadata.Name).ToList() : new List<PluginInfo>())
				{
					string gUID = item.Metadata.GUID;
					string name = item.Metadata.Name;
					string name2 = item.Metadata.Name;
					string text = string.Empty;
					string text2 = string.Empty;
					string description = "";
					if (ModConfigManagerAPI.RegisteredPlugins.TryGetValue(gUID, out var value))
					{
						if (!string.IsNullOrWhiteSpace(value.Name))
						{
							name = value.Name;
							name2 = value.Name;
						}
						if (!string.IsNullOrWhiteSpace(value.Version))
						{
							text = value.Version;
						}
						if (!string.IsNullOrWhiteSpace(value.Author))
						{
							text2 = value.Author;
						}
						description = value.Description ?? "";
					}
					string text3 = string.Empty;
					if (!string.IsNullOrWhiteSpace(text))
					{
						text3 = text ?? "";
					}
					if (!string.IsNullOrWhiteSpace(text2))
					{
						text3 = (string.IsNullOrWhiteSpace(text3) ? text2 : (text3 + "  ·  " + text2));
					}
					Plugins.Add(new ManagedPluginEntry
					{
						Info = item,
						ListText = name,
						TitleText = name2,
						MetaText = text3,
						Description = description
					});
				}
			}
			catch (Exception ex)
			{
				ManualLogSource logger = ModConfigManager.Logger;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(10, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("刷新插件列表失败: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				logger.LogError(val);
			}
		}

		private static void SelectPlugin(int index)
		{
			if (index < 0 || index >= Plugins.Count)
			{
				return;
			}
			_selectedPluginIndex = index;
			_configPage = 0;
			_selectedConfigPath = GetConfigPathForPlugin(Plugins[index].Info);
			_selectedModel = ConfigParser.Parse(_selectedConfigPath);
			EditorBuffer.Clear();
			foreach (ConfigSection section in _selectedModel.Sections)
			{
				foreach (ConfigItem item in section.Items)
				{
					EditorBuffer[item.Section + "||" + item.Key] = item.Value ?? string.Empty;
				}
			}
			RefreshHotkeyConflicts();
		}

		private static void RefreshHotkeyConflicts()
		{
			_hotkeyConflicts = ConflictDetector.GetConflictingValues();
		}

		private static string GetConfigPathForPlugin(PluginInfo info)
		{
			string gUID = info.Metadata.GUID;
			string text = Path.Combine(Paths.ConfigPath, gUID + ".cfg");
			if (File.Exists(text))
			{
				return text;
			}
			string text2 = Path.Combine(Paths.ConfigPath, info.Metadata.Name + ".cfg");
			if (File.Exists(text2))
			{
				return text2;
			}
			return text;
		}

		private static void DrawPluginsPanel()
		{
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(350f) });
			GUILayout.Label(LocalizationManager.Instance.GetLocalizedText("ui.mod_list"), _headerStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
			float num = (float)Screen.height - 250f;
			int num2 = Mathf.Max(1, Mathf.FloorToInt((num - 36f) / 55f));
			int totalPages = Mathf.Max(1, (Plugins.Count + num2 - 1) / num2);
			ClampPage(ref _pluginPage, totalPages);
			int num3 = _pluginPage * num2;
			int num4 = Mathf.Min(Plugins.Count, num3 + num2);
			for (int i = num3; i < num4; i++)
			{
				ManagedPluginEntry managedPluginEntry = Plugins[i];
				GUIStyle val = ((i == _selectedPluginIndex) ? _selectedPluginBtnStyle : _pluginBtnStyle);
				if (GUILayout.Button(managedPluginEntry.ListText, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(50f) }))
				{
					SelectPlugin(i);
				}
				GUILayout.Space(5f);
			}
			GUILayout.FlexibleSpace();
			DrawPager(ref _pluginPage, totalPages, 350f);
			GUILayout.EndVertical();
		}

		private static void DrawConfigPanel()
		{
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical((Il2CppReferenceArray<GUILayoutOption>)null);
			if (_selectedPluginIndex < 0 || _selectedPluginIndex >= Plugins.Count)
			{
				GUILayout.Label(LocalizationManager.Instance.GetLocalizedText("ui.select_mod_first"), _labelStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.EndVertical();
				return;
			}
			ManagedPluginEntry managedPluginEntry = Plugins[_selectedPluginIndex];
			float num = Mathf.Max(420f, (float)Screen.width - 500f);
			float width = Mathf.Max(220f, num - 190f);
			float num2 = CalculateTextHeight(_pluginTitleStyle, managedPluginEntry.TitleText, width);
			float num3 = CalculateTextHeight(_pluginMetaStyle, managedPluginEntry.MetaText, width);
			float num4 = CalculateTextHeight(_pluginDescriptionStyle, managedPluginEntry.Description, num);
			float num5 = num2 + num3 + num4 + 18f;
			float num6 = Mathf.Max(92f, num5);
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num6) });
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.BeginVertical((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label(managedPluginEntry.TitleText, _pluginTitleStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
			if (!string.IsNullOrWhiteSpace(managedPluginEntry.MetaText))
			{
				GUILayout.Label(managedPluginEntry.MetaText, _pluginMetaStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			GUILayout.EndVertical();
			GUILayout.FlexibleSpace();
			if (GUILayout.Button(LocalizationManager.Instance.GetLocalizedText("ui.reset_button"), _actionBtnStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(40f),
				GUILayout.Width(150f)
			}) && _selectedModel != null)
			{
				ConfigParser.ResetToDefaults(_selectedModel);
				SelectPlugin(_selectedPluginIndex);
			}
			GUILayout.EndHorizontal();
			if (!string.IsNullOrEmpty(managedPluginEntry.Description))
			{
				GUILayout.Label(managedPluginEntry.Description, _pluginDescriptionStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndVertical();
			GUILayout.Space(10f);
			float num7 = Mathf.Max(180f, (float)Screen.height - 250f - num6);
			if (_selectedModel == null || _selectedModel.Sections.Count == 0)
			{
				GUILayout.Label(LocalizationManager.Instance.GetLocalizedText("ui.no_config_file"), _labelStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.EndVertical();
				return;
			}
			List<ConfigDisplayRow> list = BuildConfigRows(managedPluginEntry);
			if (list != null)
			{
				if (list.Count == 0)
				{
					GUILayout.Label(LocalizationManager.Instance.GetLocalizedText("ui.no_config_file"), _labelStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
					GUILayout.EndVertical();
					return;
				}
				int num8 = Mathf.Max(1, Mathf.FloorToInt((num7 - 42f) / 96f));
				int totalPages = Mathf.Max(1, (list.Count + num8 - 1) / num8);
				ClampPage(ref _configPage, totalPages);
				int num9 = _configPage * num8;
				int num10 = Mathf.Min(list.Count, num9 + num8);
				GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num7) });
				for (int i = num9; i < num10; i++)
				{
					ConfigDisplayRow configDisplayRow = list[i];
					if (configDisplayRow.IsSectionHeader)
					{
						GUILayout.Space(10f);
						string key = managedPluginEntry.Info.Metadata.GUID + "_" + configDisplayRow.Section.Name;
						bool flag = _collapsedSections.ContainsKey(key) && _collapsedSections[key];
						if (GUILayout.Button((flag ? "> " : "v ") + configDisplayRow.Section.Name.ToUpper(), _sectionHeaderStyle, Array.Empty<GUILayoutOption>()))
						{
							_collapsedSections[key] = !flag;
							_configPage = 0;
						}
						GUI.color = new Color(0.5f, 0.5f, 0.5f, 0.5f);
						GUILayout.Box("", (GUILayoutOption[])(object)new GUILayoutOption[2]
						{
							GUILayout.Height(2f),
							GUILayout.ExpandWidth(true)
						});
						GUI.color = Color.white;
					}
					else
					{
						GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
						GUILayout.Space(14f);
						GUILayout.BeginVertical((Il2CppReferenceArray<GUILayoutOption>)null);
						DrawConfigItem(configDisplayRow.Item);
						GUILayout.EndVertical();
						GUILayout.EndHorizontal();
					}
				}
				GUILayout.FlexibleSpace();
				DrawPager(ref _configPage, totalPages, 260f);
				GUILayout.EndVertical();
				GUILayout.EndVertical();
				return;
			}
			foreach (ConfigSection item in _selectedModel.Sections.Where((ConfigSection s) => s.Items.Count > 0))
			{
				GUILayout.Space(10f);
				string key2 = managedPluginEntry.Info.Metadata.GUID + "_" + item.Name;
				bool flag2 = _collapsedSections.ContainsKey(key2) && _collapsedSections[key2];
				if (GUILayout.Button((flag2 ? "▶ " : "▼ ") + item.Name.ToUpper(), _sectionHeaderStyle, Array.Empty<GUILayoutOption>()))
				{
					_collapsedSections[key2] = !flag2;
				}
				GUI.color = new Color(0.5f, 0.5f, 0.5f, 0.5f);
				GUILayout.Box("", (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Height(2f),
					GUILayout.ExpandWidth(true)
				});
				GUI.color = Color.white;
				if (!flag2)
				{
					GUILayout.Space(6f);
					GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
					GUILayout.Space(14f);
					GUILayout.BeginVertical((Il2CppReferenceArray<GUILayoutOption>)null);
					foreach (ConfigItem item2 in item.Items)
					{
						DrawConfigItem(item2);
					}
					GUILayout.EndVertical();
					GUILayout.EndHorizontal();
					GUILayout.Space(10f);
				}
				else
				{
					GUILayout.Space(5f);
				}
			}
			GUILayout.EndVertical();
		}

		private static List<ConfigDisplayRow> BuildConfigRows(ManagedPluginEntry selected)
		{
			List<ConfigDisplayRow> list = new List<ConfigDisplayRow>();
			foreach (ConfigSection section in _selectedModel.Sections)
			{
				if (section.Items.Count == 0)
				{
					continue;
				}
				list.Add(new ConfigDisplayRow
				{
					Section = section,
					IsSectionHeader = true
				});
				string key = selected.Info.Metadata.GUID + "_" + section.Name;
				if (_collapsedSections.ContainsKey(key) && _collapsedSections[key])
				{
					continue;
				}
				foreach (ConfigItem item in section.Items)
				{
					list.Add(new ConfigDisplayRow
					{
						Section = section,
						Item = item
					});
				}
			}
			return list;
		}

		private static void DrawPager(ref int page, int totalPages, float width)
		{
			if (totalPages <= 1)
			{
				GUILayout.Space(30f);
				return;
			}
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(width),
				GUILayout.Height(32f)
			});
			GUI.enabled = page > 0;
			if (GUILayout.Button("<", _actionBtnStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(40f),
				GUILayout.Height(30f)
			}))
			{
				page--;
			}
			GUI.enabled = true;
			GUILayout.FlexibleSpace();
			GUILayout.Label(page + 1 + " / " + totalPages, _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) });
			GUILayout.FlexibleSpace();
			GUI.enabled = page < totalPages - 1;
			if (GUILayout.Button(">", _actionBtnStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(40f),
				GUILayout.Height(30f)
			}))
			{
				page++;
			}
			GUI.enabled = true;
			GUILayout.EndHorizontal();
		}

		private static void ClampPage(ref int page, int totalPages)
		{
			if (page < 0)
			{
				page = 0;
			}
			else if (page >= totalPages)
			{
				page = Mathf.Max(0, totalPages - 1);
			}
		}

		private static void DrawConfigItem(ConfigItem item)
		{
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0676: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e46: Unknown result type (might be due to invalid IL or missing references)
			//IL_0753: Unknown result type (might be due to invalid IL or missing references)
			//IL_0759: Invalid comparison between Unknown and I4
			//IL_075f: Unknown result type (might be due to invalid IL or missing references)
			//IL_076f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0815: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b45: Unknown result type (might be due to invalid IL or missing references)
			//IL_099f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a83: Invalid comparison between Unknown and I4
			//IL_09b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae9: Invalid comparison between Unknown and I4
			//IL_0a87: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b03: Invalid comparison between Unknown and I4
			//IL_0a12: Unknown result type (might be due to invalid IL or missing references)
			string text = item.Section + "||" + item.Key;
			string text2 = item.Section + "_" + text;
			bool flag = item.AcceptableValues != null && item.AcceptableValues.Count > 0;
			bool flag2 = flag && _dropdownStates.ContainsKey(text2) && _dropdownStates[text2];
			bool flag3 = false;
			string text3 = string.Empty;
			if (_selectedPluginIndex >= 0 && _selectedPluginIndex < Plugins.Count && ConflictDetector.IsHotkeyItem(item))
			{
				string text4 = ConflictDetector.NormalizeValue(item.Value);
				if (!string.IsNullOrEmpty(text4) && _hotkeyConflicts.TryGetValue(text4, out var value))
				{
					string currentPluginGuid = Plugins[_selectedPluginIndex].Info.Metadata.GUID;
					List<string> list = (from source in value
						where !string.Equals(source.PluginGuid, currentPluginGuid, StringComparison.OrdinalIgnoreCase)
						select source.DisplayName into name
						where !string.IsNullOrWhiteSpace(name)
						select name).Distinct<string>(StringComparer.OrdinalIgnoreCase).ToList();
					if (list.Count > 0)
					{
						flag3 = true;
						text3 = LocalizationManager.Instance.GetLocalizedText("ui.hotkey_conflict", string.Join("、", list));
					}
				}
			}
			GUILayout.BeginVertical((Il2CppReferenceArray<GUILayoutOption>)null);
			if (!string.IsNullOrWhiteSpace(item.Description))
			{
				string text5 = item.Description;
				if (item.HasRange)
				{
					text5 += $"\n({LocalizationManager.Instance.GetLocalizedText("ui.range_hint")}: {item.RangeMin} - {item.RangeMax})";
				}
				GUILayout.Label(text5, _descStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Space(1f);
			}
			else if (item.HasRange)
			{
				GUILayout.Label($"({LocalizationManager.Instance.GetLocalizedText("ui.range_hint")}: {item.RangeMin} - {item.RangeMax})", _descStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Space(1f);
			}
			Rect rect = GUILayoutUtility.GetRect(10f, 30f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			float num = Mathf.Clamp(((Rect)(ref rect)).width * 0.36f, 220f, 360f);
			float num2 = ((Rect)(ref rect)).width - num - 100f - 24f - 20f;
			float num3 = Mathf.Clamp(num2, 320f, 520f);
			if (num2 < 320f)
			{
				num3 = Mathf.Max(220f, num2);
				num = Mathf.Max(140f, ((Rect)(ref rect)).width - num3 - 100f - 24f - 20f);
			}
			float num4 = ((Rect)(ref rect)).xMax - 100f - 20f;
			float num5 = num4 - 12f - num3;
			Rect val = new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, Mathf.Max(140f, num5 - ((Rect)(ref rect)).x - 12f), 30f);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(num5, ((Rect)(ref rect)).y, num3, 30f);
			Rect val3 = default(Rect);
			((Rect)(ref val3))..ctor(num4, ((Rect)(ref rect)).y, 100f, 30f);
			float num6 = ((Rect)(ref val3)).xMax - ((Rect)(ref val2)).x;
			float num7 = (flag3 ? CalculateTextHeight(_conflictWarningStyle, text3, num6) : 0f);
			int num8 = (flag ? Mathf.Min(item.AcceptableValues.Count, Mathf.Max(1, Mathf.FloorToInt(5.5f))) : 0);
			float num9 = (flag ? ((float)num8 * 32f) : 0f);
			float num10 = ((flag && flag2) ? (num9 + 6f) : 0f);
			float num11 = 30f + (flag3 ? (4f + num7) : 0f);
			Rect val4 = default(Rect);
			((Rect)(ref val4))..ctor(((Rect)(ref val2)).x, ((Rect)(ref val2)).yMax + 4f, num6, num7);
			GUI.Label(val, item.Key.ToUpper(), flag3 ? _conflictConfigKeyStyle : _configKeyStyle);
			if (item.ValueType == ConfigValueType.Bool)
			{
				bool flag4 = string.Equals(item.Value, "true", StringComparison.OrdinalIgnoreCase);
				GUIStyle val5 = (flag4 ? _checkboxActiveStyle : _checkboxNormalStyle);
				if (GUI.Button(new Rect(((Rect)(ref val2)).xMax - 30f, ((Rect)(ref val2)).y, 30f, 30f), flag4 ? "✓" : "", val5))
				{
					string value2 = (item.Value = ((!flag4) ? "true" : "false"));
					EditorBuffer[text] = value2;
					PersistItemValue(item, value2);
				}
			}
			else if (flag)
			{
				GUIStyle val6 = (flag3 ? _conflictDropdownButtonStyle : _dropdownButtonStyle);
				string text6 = item.Value ?? string.Empty;
				if (!item.AcceptableValues.Contains(text6))
				{
					text6 = item.AcceptableValues.FirstOrDefault() ?? string.Empty;
				}
				if (GUI.Button(val2, GUIContent.none, val6))
				{
					flag2 = !flag2;
					_dropdownStates[text2] = flag2;
					if (!flag2 && string.Equals(_draggingDropdownKey, text2, StringComparison.Ordinal))
					{
						_draggingDropdownKey = null;
						_dropdownDragOffsetY = 0f;
					}
					if (flag2)
					{
						int num12 = item.AcceptableValues.IndexOf(item.Value);
						_dropdownStartIndexes[text2] = Mathf.Max(0, num12);
					}
				}
				GUI.Label(new Rect(((Rect)(ref val2)).x + 12f, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width - 42f, ((Rect)(ref val2)).height), text6, _dropdownTextStyle);
				GUI.Label(new Rect(((Rect)(ref val2)).xMax - 28f, ((Rect)(ref val2)).y, 20f, ((Rect)(ref val2)).height), flag2 ? "^" : "v", _dropdownArrowStyle);
				if (flag2)
				{
					Rect val7 = default(Rect);
					((Rect)(ref val7))..ctor(((Rect)(ref val2)).x, ((Rect)(ref rect)).y + num11 + 4f, ((Rect)(ref val2)).width, num10);
					int num13 = num8;
					int num14 = item.AcceptableValues.IndexOf(item.Value);
					int num15 = Mathf.Max(0, item.AcceptableValues.Count - num13);
					if (!_dropdownStartIndexes.TryGetValue(text2, out var value3))
					{
						value3 = ((num14 >= 0) ? num14 : 0);
					}
					value3 = Mathf.Clamp(value3, 0, num15);
					Event current = Event.current;
					if (current != null && (int)current.type == 6 && ((Rect)(ref val7)).Contains(current.mousePosition))
					{
						value3 += ((current.delta.y > 0f) ? 1 : (-1));
						value3 = Mathf.Clamp(value3, 0, num15);
						_dropdownStartIndexes[text2] = value3;
						current.Use();
					}
					bool num16 = item.AcceptableValues.Count > num13;
					float num17 = (num16 ? 26f : 0f);
					float num18 = (num16 ? 4f : 0f);
					Rect val8 = default(Rect);
					((Rect)(ref val8))..ctor(((Rect)(ref val7)).x + 3f, ((Rect)(ref val7)).y + 3f, ((Rect)(ref val7)).width - 6f - num17 - num18, (float)num13 * 32f);
					GUI.Box(val7, GUIContent.none, _dropdownPanelStyle);
					if (num16)
					{
						Rect val9 = default(Rect);
						((Rect)(ref val9))..ctor(((Rect)(ref val7)).xMax - 3f - 26f, ((Rect)(ref val7)).y + 3f, 26f, ((Rect)(ref val7)).height - 6f);
						Rect val10 = default(Rect);
						((Rect)(ref val10))..ctor(((Rect)(ref val9)).x, ((Rect)(ref val9)).y, ((Rect)(ref val9)).width, 28f);
						Rect val11 = default(Rect);
						((Rect)(ref val11))..ctor(((Rect)(ref val9)).x, ((Rect)(ref val9)).yMax - 28f, ((Rect)(ref val9)).width, 28f);
						Rect val12 = default(Rect);
						((Rect)(ref val12))..ctor(((Rect)(ref val9)).x, ((Rect)(ref val10)).yMax + 2f, ((Rect)(ref val9)).width, Mathf.Max(8f, ((Rect)(ref val11)).y - ((Rect)(ref val10)).yMax - 4f));
						GUI.Box(val9, GUIContent.none, _dropdownScrollTrackStyle);
						if (num15 > 0 && ((Rect)(ref val12)).height > 0f)
						{
							float num19 = Mathf.Max(18f, ((Rect)(ref val12)).height * (float)num13 / (float)item.AcceptableValues.Count);
							float num20 = Mathf.Max(0f, ((Rect)(ref val12)).height - num19);
							float num21 = ((Rect)(ref val12)).y + num20 * (float)value3 / (float)num15;
							Rect val13 = default(Rect);
							((Rect)(ref val13))..ctor(((Rect)(ref val12)).x + 5f, num21, ((Rect)(ref val12)).width - 10f, num19);
							if (current != null && num20 > 0f)
							{
								if ((int)current.type == 0 && current.button == 0)
								{
									if (((Rect)(ref val13)).Contains(current.mousePosition))
									{
										_draggingDropdownKey = text2;
										_dropdownDragOffsetY = current.mousePosition.y - ((Rect)(ref val13)).y;
										current.Use();
									}
									else if (((Rect)(ref val12)).Contains(current.mousePosition))
									{
										_draggingDropdownKey = text2;
										_dropdownDragOffsetY = num19 * 0.5f;
										value3 = Mathf.Clamp(Mathf.RoundToInt((Mathf.Clamp(current.mousePosition.y - _dropdownDragOffsetY, ((Rect)(ref val12)).y, ((Rect)(ref val12)).y + num20) - ((Rect)(ref val12)).y) / num20 * (float)num15), 0, num15);
										_dropdownStartIndexes[text2] = value3;
										current.Use();
									}
								}
								if (string.Equals(_draggingDropdownKey, text2, StringComparison.Ordinal))
								{
									if ((int)current.type == 3)
									{
										value3 = Mathf.Clamp(Mathf.RoundToInt((Mathf.Clamp(current.mousePosition.y - _dropdownDragOffsetY, ((Rect)(ref val12)).y, ((Rect)(ref val12)).y + num20) - ((Rect)(ref val12)).y) / num20 * (float)num15), 0, num15);
										_dropdownStartIndexes[text2] = value3;
										current.Use();
									}
									else if ((int)current.rawType == 1)
									{
										_draggingDropdownKey = null;
										_dropdownDragOffsetY = 0f;
										if ((int)current.type == 1)
										{
											current.Use();
										}
									}
								}
							}
							num21 = ((Rect)(ref val12)).y + num20 * (float)value3 / (float)num15;
							((Rect)(ref val13))..ctor(((Rect)(ref val12)).x + 5f, num21, ((Rect)(ref val12)).width - 10f, num19);
							GUI.Box(val13, GUIContent.none, _dropdownScrollThumbStyle);
						}
						bool enabled = GUI.enabled;
						GUI.enabled = enabled && value3 > 0;
						if (GUI.Button(val10, "^", _dropdownScrollButtonStyle))
						{
							value3 = Mathf.Max(0, value3 - 1);
						}
						GUI.enabled = enabled && value3 < num15;
						if (GUI.Button(val11, "v", _dropdownScrollButtonStyle))
						{
							value3 = Mathf.Min(num15, value3 + 1);
						}
						GUI.enabled = enabled;
						_dropdownStartIndexes[text2] = value3;
					}
					else if (string.Equals(_draggingDropdownKey, text2, StringComparison.Ordinal))
					{
						_draggingDropdownKey = null;
						_dropdownDragOffsetY = 0f;
					}
					for (int i = 0; i < num13; i++)
					{
						int index = value3 + i;
						string text7 = item.AcceptableValues[index];
						Rect val14 = new Rect(((Rect)(ref val8)).x, ((Rect)(ref val8)).y + (float)i * 32f, ((Rect)(ref val8)).width, 31f);
						GUIStyle val15 = (string.Equals(text7, item.Value, StringComparison.Ordinal) ? _dropdownSelectedItemStyle : _dropdownItemStyle);
						if (GUI.Button(val14, text7, val15))
						{
							item.Value = text7;
							EditorBuffer[text] = text7;
							PersistItemValue(item, text7);
							_dropdownStates[text2] = false;
							_draggingDropdownKey = null;
							_dropdownDragOffsetY = 0f;
						}
					}
				}
			}
			else
			{
				GUIStyle val16 = (flag3 ? _conflictTextFieldStyle : _textFieldStyle);
				if (!EditorBuffer.TryGetValue(text, out var value4))
				{
					value4 = item.Value ?? string.Empty;
					EditorBuffer[text] = value4;
				}
				string text8 = GUI.TextField(val2, value4, val16);
				if (!string.Equals(text8, value4, StringComparison.Ordinal))
				{
					if (item.HasRange && !string.IsNullOrEmpty(text8))
					{
						float result2;
						if (item.ValueType == ConfigValueType.Int && int.TryParse(text8, out var result))
						{
							int num22 = (int)Math.Floor(item.RangeMin);
							int num23 = (int)Math.Ceiling(item.RangeMax);
							if (result < num22)
							{
								result = num22;
							}
							if (result > num23)
							{
								result = num23;
							}
							text8 = result.ToString();
						}
						else if (item.ValueType == ConfigValueType.Float && float.TryParse(text8, out result2))
						{
							float num24 = (float)item.RangeMin;
							float num25 = (float)item.RangeMax;
							if (result2 < num24)
							{
								result2 = num24;
							}
							if (result2 > num25)
							{
								result2 = num25;
							}
							text8 = result2.ToString();
						}
					}
					EditorBuffer[text] = text8;
					item.Value = text8;
					PersistItemValue(item, text8);
				}
			}
			GUI.enabled = !string.IsNullOrEmpty(item.DefaultValue) && item.Value != item.DefaultValue;
			if (GUI.Button(val3, LocalizationManager.Instance.GetLocalizedText("ui.revert_button"), _revertBtnStyle))
			{
				item.Value = item.DefaultValue;
				EditorBuffer[text] = item.DefaultValue;
				PersistItemValue(item, item.DefaultValue);
			}
			GUI.enabled = true;
			if (flag3)
			{
				GUI.Label(val4, text3, _conflictWarningStyle);
			}
			GUILayout.Space((flag3 ? (4f + num7) : 0f) + ((flag && flag2) ? (4f + num10) : 0f) + 8f);
			GUILayout.EndVertical();
		}

		public static void OnGUI()
		{
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			//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_00ca: Unknown result type (might be due to invalid IL or missing references)
			if (!_isWindowVisible)
			{
				return;
			}
			EnsureStyles();
			if (((Rect)(ref _windowRect)).width != (float)Screen.width || ((Rect)(ref _windowRect)).height != (float)Screen.height)
			{
				_windowRect = new Rect(0f, 0f, (float)Screen.width, (float)Screen.height);
			}
			try
			{
				GUISkin skin = GUI.skin;
				GUIStyle verticalScrollbarThumb = skin.verticalScrollbarThumb;
				GUIStyle verticalScrollbarUpButton = skin.verticalScrollbarUpButton;
				GUIStyle verticalScrollbarDownButton = skin.verticalScrollbarDownButton;
				GUIStyle horizontalScrollbarThumb = skin.horizontalScrollbarThumb;
				GUIStyle horizontalScrollbarLeftButton = skin.horizontalScrollbarLeftButton;
				GUIStyle horizontalScrollbarRightButton = skin.horizontalScrollbarRightButton;
				skin.verticalScrollbarThumb = _verticalScrollbarThumbStyle;
				skin.verticalScrollbarUpButton = _verticalScrollbarUpButtonStyle;
				skin.verticalScrollbarDownButton = _verticalScrollbarDownButtonStyle;
				skin.horizontalScrollbarThumb = _horizontalScrollbarThumbStyle;
				skin.horizontalScrollbarLeftButton = _horizontalScrollbarLeftButtonStyle;
				skin.horizontalScrollbarRightButton = _horizontalScrollbarRightButtonStyle;
				bool flag = false;
				try
				{
					GUILayout.BeginArea(_windowRect, GUIContent.none, _windowStyle);
					flag = true;
					DrawWindow(486213);
				}
				finally
				{
					if (flag)
					{
						GUILayout.EndArea();
					}
					skin.verticalScrollbarThumb = verticalScrollbarThumb;
					skin.verticalScrollbarUpButton = verticalScrollbarUpButton;
					skin.verticalScrollbarDownButton = verticalScrollbarDownButton;
					skin.horizontalScrollbarThumb = horizontalScrollbarThumb;
					skin.horizontalScrollbarLeftButton = horizontalScrollbarLeftButton;
					skin.horizontalScrollbarRightButton = horizontalScrollbarRightButton;
				}
			}
			catch (Exception ex)
			{
				_isWindowVisible = false;
				ManualLogSource logger = ModConfigManager.Logger;
				bool flag2 = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(9, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("UI 绘制错误: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				logger.LogError(val);
			}
		}

		private static void DrawWindow(int windowId)
		{
			GUILayout.Space(20f);
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.FlexibleSpace();
			GUILayout.Label(LocalizationManager.Instance.GetLocalizedText("ui.title"), _headerStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.FlexibleSpace();
			GUILayout.Label(LocalizationManager.Instance.GetLocalizedText("ui.restart_hint"), _descStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(20f);
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Space(40f);
			DrawPluginsPanel();
			GUILayout.Space(40f);
			DrawConfigPanel();
			GUILayout.Space(40f);
			GUILayout.EndHorizontal();
			GUILayout.FlexibleSpace();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Space(40f);
			if (GUILayout.Button(LocalizationManager.Instance.GetLocalizedText("ui.close"), _closeBtnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(50f) }))
			{
				Toggle();
			}
			GUILayout.Space(40f);
			GUILayout.EndHorizontal();
			GUILayout.Space(20f);
		}

		private static void EnsureStyles()
		{
			if (!_stylesInitialized || !AreStyleResourcesAlive())
			{
				ReleaseGeneratedTextures();
				_stylesInitialized = false;
				InitStyles();
			}
		}

		private static void InitStyles()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: 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_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Expected O, but got Unknown
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Expected O, but got Unknown
			//IL_02c5: 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_02e3: Expected O, but got Unknown
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Expected O, but got Unknown
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Expected O, but got Unknown
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Expected O, but got Unknown
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Expected O, but got Unknown
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Expected O, but got Unknown
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Expected O, but got Unknown
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Expected O, but got Unknown
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Expected O, but got Unknown
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Expected O, but got Unknown
			//IL_0498: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Expected O, but got Unknown
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Expected O, but got Unknown
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Expected O, but got Unknown
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Expected O, but got Unknown
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Expected O, but got Unknown
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: 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)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Expected O, but got Unknown
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Expected O, but got Unknown
			//IL_063f: Unknown result type (might be due to invalid IL or missing references)
			//IL_064f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a5: Expected O, but got Unknown
			//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0735: Expected O, but got Unknown
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0748: Expected O, but got Unknown
			//IL_074d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0760: Unknown result type (might be due to invalid IL or missing references)
			//IL_076a: Expected O, but got Unknown
			//IL_076f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0779: Expected O, but got Unknown
			//IL_078d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0797: Expected O, but got Unknown
			//IL_079c: Unknown result type (might be due to invalid IL or missing references)
			//IL_07af: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b9: Expected O, but got Unknown
			//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cc: Expected O, but got Unknown
			//IL_07d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e0: Expected O, but got Unknown
			//IL_0801: Unknown result type (might be due to invalid IL or missing references)
			//IL_0826: Unknown result type (might be due to invalid IL or missing references)
			//IL_0848: Unknown result type (might be due to invalid IL or missing references)
			//IL_086a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0874: Expected O, but got Unknown
			//IL_088a: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0911: Unknown result type (might be due to invalid IL or missing references)
			//IL_091b: Expected O, but got Unknown
			//IL_0924: Unknown result type (might be due to invalid IL or missing references)
			//IL_092e: Expected O, but got Unknown
			//IL_093e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0948: Expected O, but got Unknown
			//IL_099a: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a4: Expected O, but got Unknown
			//IL_09d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a01: Expected O, but got Unknown
			//IL_0a06: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a10: Expected O, but got Unknown
			//IL_0a2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a54: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a69: Expected O, but got Unknown
			//IL_0a8a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab9: Expected O, but got Unknown
			//IL_0abe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac8: Expected O, but got Unknown
			//IL_0ad3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0add: Expected O, but got Unknown
			//IL_0ae6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af0: Expected O, but got Unknown
			//IL_0b1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b24: Expected O, but got Unknown
			//IL_0b5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b69: Expected O, but got Unknown
			//IL_0b7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd1: Expected O, but got Unknown
			//IL_0bda: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be4: Expected O, but got Unknown
			//IL_0be9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf3: Expected O, but got Unknown
			//IL_0c0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c14: Expected O, but got Unknown
			//IL_0c1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c27: Expected O, but got Unknown
			//IL_0c42: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4c: Expected O, but got Unknown
			//IL_0c6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c80: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca5: Expected O, but got Unknown
			//IL_0cc5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cdb: Expected O, but got Unknown
			//IL_0cf5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cff: Expected O, but got Unknown
			//IL_0d08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d12: Expected O, but got Unknown
			//IL_0d17: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d21: Expected O, but got Unknown
			//IL_0d5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d80: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dbb: Expected O, but got Unknown
			//IL_0dc4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dce: Expected O, but got Unknown
			//IL_0dd3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddd: Expected O, but got Unknown
			//IL_0df7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e01: Expected O, but got Unknown
			//IL_0e0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e14: Expected O, but got Unknown
			//IL_0e19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e23: Expected O, but got Unknown
			//IL_0e5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e69: Expected O, but got Unknown
			//IL_0e72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e7c: Expected O, but got Unknown
			//IL_0e81: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e8b: Expected O, but got Unknown
			//IL_0e94: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9e: Expected O, but got Unknown
			//IL_0ea7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eb1: Expected O, but got Unknown
			//IL_0ebb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec5: Expected O, but got Unknown
			//IL_0f01: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f0b: Expected O, but got Unknown
			//IL_0f14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f1e: Expected O, but got Unknown
			//IL_0f36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f40: Expected O, but got Unknown
			//IL_0f4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f54: Expected O, but got Unknown
			//IL_0f90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f9a: Expected O, but got Unknown
			//IL_0fa3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fad: Expected O, but got Unknown
			//IL_0fc5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fcf: Expected O, but got Unknown
			//IL_0fd9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe3: Expected O, but got Unknown
			//IL_102e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1038: Expected O, but got Unknown
			//IL_1041: Unknown result type (might be due to invalid IL or missing references)
			//IL_104b: Expected O, but got Unknown
			//IL_1054: Unknown result type (might be due to invalid IL or missing references)
			//IL_105e: Expected O, but got Unknown
			//IL_1068: Unknown result type (might be due to invalid IL or missing references)
			//IL_1072: Expected O, but got Unknown
			//IL_10bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_10c7: Expected O, but got Unknown
			//IL_10d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_10da: Expected O, but got Unknown
			//IL_10e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_10ed: Expected O, but got Unknown
			//IL_10f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1101: Expected O, but got Unknown
			//IL_113d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1147: Expected O, but got Unknown
			//IL_1150: Unknown result type (might be due to invalid IL or missing references)
			//IL_115a: Expected O, but got Unknown
			//IL_1172: Unknown result type (might be due to invalid IL or missing references)
			//IL_117c: Expected O, but got Unknown
			//IL_1186: Unknown result type (might be due to invalid IL or missing references)
			//IL_1190: Expected O, but got Unknown
			//IL_11cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_11d6: Expected O, but got Unknown
			//IL_11df: Unknown result type (might be due to invalid IL or missing references)
			//IL_11e9: Expected O, but got Unknown
			//IL_1201: Unknown result type (might be due to invalid IL or missing references)
			//IL_120b: Expected O, but got Unknown
			//IL_1215: Unknown result type (might be due to invalid IL or missing references)
			//IL_121f: Expected O, but got Unknown
			//IL_126a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1274: Expected O, but got Unknown
			//IL_127d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1287: Expected O, but got Unknown
			//IL_1290: Unknown result type (might be due to invalid IL or missing references)
			//IL_129a: Expected O, but got Unknown
			//IL_12a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ae: Expected O, but got Unknown
			//IL_12f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1303: Expected O, but got Unknown
			//IL_130c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1316: Expected O, but got Unknown
			//IL_131f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1329: Expected O, but got Unknown
			Color color = default(Color);
			((Color)(ref color))..ctor(0.01f, 0.04f, 0.035f, 0.94f);
			Color color2 = default(Color);
			((Color)(ref color2))..ctor(0.055f, 0.18f, 0.15f, 0.98f);
			Color color3 = new Color(0.095f, 0.3f, 0.24f, 1f);
			Color color4 = default(Color);
			((Color)(ref color4))..ctor(0.015f, 0.09f, 0.085f, 0.98f);
			Color color5 = new Color(0.035f, 0.17f, 0.14f, 1f);
			Color textColor = default(Color);
			((Color)(ref textColor))..ctor(0.01f, 0.07f, 0.05f, 1f);
			Color textColor2 = default(Color);
			((Color)(ref textColor2))..ctor(0.76f, 1f, 0.7f, 1f);
			Color textColor3 = default(Color);
			((Color)(ref textColor3))..ctor(0.7f, 1f, 0.62f, 1f);
			Color textColor4 = default(Color);
			((Color)(ref textColor4))..ctor(0.54f, 0.82f, 0.72f, 1f);
			Color textColor5 = default(Color);
			((Color)(ref textColor5))..ctor(0.58f, 1f, 0.74f, 1f);
			Color color6 = default(Color);
			((Color)(ref color6))..ctor(0.16f, 0.86f, 0.42f, 1f);
			Color val = default(Color);
			((Color)(ref val))..ctor(0.3f, 1f, 0.56f, 1f);
			Color color7 = new Color(0.74f, 0.18f, 0.16f, 1f);
			Color color8 = default(Color);
			((Color)(ref color8))..ctor(0.92f, 0.28f, 0.22f, 1f);
			Color color9 = default(Color);
			((Color)(ref color9))..ctor(0.01f, 0.07f, 0.065f, 0.98f);
			Color color10 = default(Color);
			((Color)(ref color10))..ctor(0.22f, 0.92f, 0.52f, 1f);
			Color color11 = default(Color);
			((Color)(ref color11))..ctor(0.43f, 1f, 0.65f, 1f);
			Color color12 = default(Color);
			((Color)(ref color12))..ctor(0.035f, 0.2f, 0.16f, 1f);
			_darkBackground = CreateColorTexture(color);
			_lightBackground = CreateColorTexture(color2);
			_redBackground = CreateColorTexture(color6);
			_dangerBackground = CreateColorTexture(color7);
			_conflictOutlineTexture = CreateColorTexture(new Color(0.92f, 0.3f, 0.26f, 0.82f));
			Texture2D background = CreateColorTexture(color4);
			Texture2D background2 = CreateColorTexture(color5);
			Texture2D background3 = CreateColorTexture(color3);
			Texture2D background4 = CreateColorTexture(color8);
			Texture2D background5 = CreateColorTexture(color9);
			Texture2D background6 = CreateColorTexture(color10);
			Texture2D background7 = CreateColorTexture(color11);
			Texture2D background8 = CreateColorTexture(color12);
			_windowStyle = new GUIStyle();
			_windowStyle.normal.background = _darkBackground;
			_headerStyle = new GUIStyle(GUI.skin.label);
			_headerStyle.fontSize = 24;
			_headerStyle.fontStyle = (FontStyle)1;
			_headerStyle.normal.textColor = textColor3;
			_headerStyle.margin = new RectOffset(10, 10, 20, 10);
			_pluginTitleStyle = new GUIStyle(GUI.skin.label);
			_pluginTitleStyle.fontSize = 22;
			_pluginTitleStyle.fontStyle = (FontStyle)1;
			_pluginTitleStyle.normal.textColor = textColor3;
			_pluginTitleStyle.alignment = (TextAnchor)3;
			_pluginTitleStyle.wordWrap = true;
			_pluginTitleStyle.margin = new RectOffset(0, 0, 0, 2);
			_pluginMetaStyle = new GUIStyle(GUI.skin.label);
			_pluginMetaStyle.fontSize = 15;
			_pluginMetaStyle.normal.textColor = textColor4;
			_pluginMetaStyle.alignment = (TextAnchor)3;
			_pluginMetaStyle.wordWrap = true;
			_pluginMetaStyle.margin = new RectOffset(0, 0, 0, 4);
			_pluginDescriptionStyle = new GUIStyle(GUI.skin.label);
			_pluginDescriptionStyle.fontSize = 19;
			_pluginDescriptionStyle.normal.textColor = textColor2;
			_pluginDescriptionStyle.alignment = (TextAnchor)3;
			_pluginDescriptionStyle.wordWrap = true;
			_pluginDescriptionStyle.margin = new RectOffset(0, 0, 2, 10);
			_labelStyle = new GUIStyle(GUI.skin.label);
			_labelStyle.fontSize = 16;
			_labelStyle.normal.textColor = textColor2;
			_labelStyle.alignment = (TextAnchor)3;
			_descStyle = new GUIStyle(GUI.skin.label);
			_descStyle.fontSize = 18;
			_descStyle.normal.textColor = textColor4;
			_descStyle.wordWrap = true;
			_descStyle.alignment = (TextAnchor)3;
			_descStyle.margin = new RectOffset(0, 0, 0, 1);
			_configKeyStyle = new GUIStyle(_labelStyle);
			_configKeyStyle.fontSize = 12;
			_configKeyStyle.normal.textColor = textColor5;
			_conflictConfigKeyStyle = new GUIStyle(_configKeyStyle);
			_conflictConfigKeyStyle.normal.textColor = new Color(1f, 0.44f, 0.36f, 1f);
			_conflictWarningStyle = new GUIStyle(GUI.skin.label);
			_conflictWarningStyle.fontSize = 13;
			_conflictWarningStyle.normal.textColor = new Color(1f, 0.5f, 0.42f, 1f);
			_conflictWarningStyle.wordWrap = true;
			_conflictWarningStyle.alignment = (TextAnchor)3;
			_conflictWarningStyle.margin = new RectOffset(0, 0, 0, 2);
			_pluginBtnStyle = new GUIStyle(GUI.skin.button);
			_pluginBtnStyle.fontSize = 16;
			_pluginBtnStyle.normal.textColor = textColor2;
			_pluginBtnStyle.normal.background = _lightBackground;
			_pluginBtnStyle.hover.textColor = textColor3;
			_pluginBtnStyle.hover.background = background3;
			_pluginBtnStyle.active.textColor = textColor3;
			_pluginBtnStyle.active.background = background3;
			_pluginBtnStyle.alignment = (TextAnchor)3;
			_pluginBtnStyle.padding = new RectOffset(15, 10, 10, 10);
			_selectedPluginBtnStyle = new GUIStyle(_pluginBtnStyle);
			_selectedPluginBtnStyle.normal.background = _redBackground;
			_selectedPluginBtnStyle.normal.textColor = textColor;
			_selectedPluginBtnStyle.hover.background = CreateColorTexture(val);
			_selectedPluginBtnStyle.hover.textColor = textColor;
			_selectedPluginBtnStyle.active.background = CreateColorTexture(val);
			_selectedPluginBtnStyle.active.textColor = textColor;
			_revertBtnStyle = new GUIStyle(GUI.skin.button);
			_revertBtnStyle.fontSize = 14;
			_revertBtnStyle.normal.textColor = textColor2;
			_revertBtnStyle.normal.background = background;
			_revertBtnStyle.hover.textColor = textColor2;
			_revertBtnStyle.hover.background = background2;
			_revertBtnStyle.active.textColor = textColor2;
			_revertBtnStyle.active.background = background2;
			_revertBtnStyle.alignment = (TextAnchor)4;
			_revertBtnStyle.padding = new RectOffset(0, 0, 0, 0);
			_revertBtnStyle.margin = new RectOffset(0, 0, 0, 0);
			_revertBtnStyle.contentOffset = Vector2.zero;
			_revertBtnStyle.overflow = new RectOffset(0, 0, 0, 0);
			_actionBtnStyle = new GUIStyle(_pluginBtnStyle);
			_actionBtnStyle.alignment = (TextAnchor)4;
			_actionBtnStyle.padding = new RectOffset(0, 0, 0, 0);
			_actionBtnStyle.contentOffset = Vector2.zero;
			_actionBtnStyle.margin = new RectOffset(0, 0, 0, 0);
			_actionBtnStyle.overflow = new RectOffset(0, 0, 0, 0);
			_closeBtnStyle = new GUIStyle(GUI.skin.button);
			_closeBtnStyle.fontSize = 20;
			_closeBtnStyle.fontStyle = (FontStyle)1;
			_closeBtnStyle.normal.textColor = textColor2;
			_closeBtnStyle.normal.background = _dangerBackground;
			_closeBtnStyle.hover.textColor = textColor2;
			_closeBtnStyle.hover.background = background4;
			_closeBtnStyle.active.textColor = textColor2;
			_closeBtnStyle.active.background = background4;
			_textFieldStyle = new GUIStyle(GUI.skin.textField);
			_textFieldStyle.fontSize = 15;
			_textFieldStyle.normal.textColor = textColor2;
			_textFieldStyle.normal.background = background;
			_textFieldStyle.hover.textColor = textColor2;
			_textFieldStyle.hover.background = background2;
			_textFieldStyle.focused.textColor = textColor2;
			_textFieldStyle.focused.background = background;
			_textFieldStyle.active.textColor = textColor2;
			_textFieldStyle.active.background = background;
			_textFieldStyle.padding = new RectOffset(8, 8, 8, 8);
			_textFieldStyle.margin = new RectOffset(0, 0, 0, 0);
			_textFieldStyle.alignment = (TextAnchor)3;
			_conflictTextFieldStyle = new GUIStyle(_textFieldStyle);
			_conflictTextFieldStyle.normal.background = _dangerBackground;
			_conflictTextFieldStyle.hover.background = background4;
			_conflictTextFieldStyle.focused.background = _dangerBackground;
			_conflictTextFieldStyle.active.background = _dangerBackground;
			_checkboxNormalStyle = new GUIStyle(GUIStyle.none);
			_checkboxNormalStyle.normal.background = background;
			_checkboxNormalStyle.hover.background = background2;
			_checkboxNormalStyle.normal.textColor = textColor2;
			_checkboxNormalStyle.alignment = (TextAnchor)4;
			_checkboxNormalStyle.fontSize = 16;
			_checkboxNormalStyle.margin = new RectOffset(0, 0, 0, 0);
			_checkboxActiveStyle = new GUIStyle(_checkboxNormalStyle);
			_checkboxActiveStyle.normal.background = _redBackground;
			_checkboxActiveStyle.hover.background = CreateColorTexture(val);
			_checkboxActiveStyle.normal.textColor = textColor;
			_checkboxActiveStyle.hover.textColor = textColor;
			_sectionHeaderStyle = new GUIStyle(GUIStyle.none);
			_sectionHeaderStyle.fontSize = 24;
			_sectionHeaderStyle.fontStyle = (FontStyle)1;
			_sectionHeaderStyle.normal.textColor = textColor3;
			_sectionHeaderStyle.hover.textColor = val;
			_sectionHeaderStyle.margin = new RectOffset(10, 10, 20, 10);
			_dropdownButtonStyle = new GUIStyle(_textFieldStyle);
			_dropdownButtonStyle.padding = new RectOffset(12, 34, 6, 6);
			_dropdownButtonStyle.margin = new RectOffset(0, 0, 0, 0);
			_dropdownButtonStyle.alignment = (TextAnchor)3;
			_dropdownButtonStyle.clipping = (TextClipping)1;
			_dropdownButtonStyle.fixedHeight = 0f;
			_conflictDropdownButtonStyle = new GUIStyle(_dropdownButtonStyle);
			_conflictDropdownButtonStyle.normal.background = _dangerBackground;
			_conflictDropdownButtonStyle.hover.background = background4;
			_conflictDropdownButtonStyle.active.background = background4;
			_dropdownTextStyle = new GUIStyle(_labelStyle);
			_dropdownTextStyle.fontSize = 15;
			_dropdownTextStyle.normal.textColor = textColor2;
			_dropdownTextStyle.hover.textColor = textColor2;
			_dropdownTextStyle.active.textColor = textColor2;
			_dropdownTextStyle.alignment = (TextAnchor)3;
			_dropdownTextStyle.clipping = (TextClipping)1;
			_dropdownTextStyle.padding = new RectOffset(0, 0, 0, 0);
			_dropdownTextStyle.margin = new RectOffset(0, 0, 0, 0);
			_dropdownItemStyle = new GUIStyle(_textFieldStyle);
			_dropdownItemStyle.fontSize = 15;
			_dropdownItemStyle.padding = new RectOffset(12, 10, 6, 6);
			_dropdownItemStyle.margin = new RectOffset(0, 0, 0, 0);
			_dropdownItemStyle.alignment = (TextAnchor)3;
			_dropdownItemStyle.clipping = (TextClipping)1;
			_dropdownSelectedItemStyle = new GUIStyle(_dropdownItemStyle);
			_dropdownSelectedItemStyle.normal.background = _redBackground;
			_dropdownSelectedItemStyle.hover.background = CreateColorTexture(val);
			_dropdownSelectedItemStyle.normal.textColor = textColor;
			_dropdownSelectedItemStyle.hover.textColor = textColor;
			_dropdownArrowStyle = new GUIStyle(_labelStyle);
			_dropdownArrowStyle.alignment = (TextAnchor)4;
			_dropdownArrowStyle.fontStyle = (FontStyle)1;
			_dropdownArrowStyle.normal.textColor = textColor2;
			_dropdownPanelStyle = new GUIStyle(GUIStyle.none);
			_dropdownPanelStyle.normal.background = background;
			_dropdownPanelStyle.padding = new RectOffset(0, 0, 0, 0);
			_dropdownPanelStyle.margin = new RectOffset(0, 0, 0, 0);
			_dropdownScrollButtonStyle = new GUIStyle(GUIStyle.none);
			_dropdownScrollButtonStyle.normal.background = background8;
			_dropdownScrollButtonStyle.hover.background = background2;
			_dropdownScrollButtonStyle.active.background = background3;
			_dropdownScrollButtonStyle.normal.textColor = textColor2;
			_dropdownScrollButtonStyle.hover.textColor = textColor2;
			_dropdownScrollButtonStyle.active.textColor = textColor;
			_dropdownScrollButtonStyle.alignment = (TextAnchor)4;
			_dropdownScrollButtonStyle.fontSize = 15;
			_dropdownScrollButtonStyle.fontStyle = (FontStyle)1;
			_dropdownScrollButtonStyle.padding = new RectOffset(0, 0, 0, 0);
			_dropdownScrollButtonStyle.margin = new RectOffset(0, 0, 0, 0);
			_dropdownScrollTrackStyle = new GUIStyle(GUIStyle.none);
			_dropdownScrollTrackStyle.normal.background = background5;
			_dropdownScrollTrackStyle.padding = new RectOffset(0, 0, 0, 0);
			_dropdownScrollTrackStyle.margin = new RectOffset(0, 0, 0, 0);
			_dropdownScrollThumbStyle = new GUIStyle(GUIStyle.none);
			_dropdownScrollThumbStyle.normal.background = background6;
			_dropdownScrollThumbStyle.hover.background = background7;
			_dropdownScrollThumbStyle.active.background = background3;
			_dropdownScrollThumbStyle.padding = new RectOffset(0, 0, 0, 0);
			_dropdownScrollThumbStyle.margin = new RectOffset(0, 0, 0, 0);
			_scrollViewBackgroundStyle = new GUIStyle(GUIStyle.none);
			_scrollViewBackgroundStyle.margin = new RectOffset(0, 0, 0, 0);
			_scrollViewBackgroundStyle.padding = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarStyle = new GUIStyle(GUI.skin.verticalScrollbar);
			_verticalScrollbarStyle.normal.background = background5;
			_verticalScrollbarStyle.hover.background = background5;
			_verticalScrollbarStyle.active.background = background5;
			_verticalScrollbarStyle.border = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarStyle.padding = new RectOffset(2, 2, 2, 2);
			_verticalScrollbarStyle.fixedWidth = 12f;
			_verticalScrollbarStyle.margin = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarThumbStyle = new GUIStyle(GUI.skin.verticalScrollbarThumb);
			_verticalScrollbarThumbStyle.normal.background = background6;
			_verticalScrollbarThumbStyle.hover.background = background7;
			_verticalScrollbarThumbStyle.active.background = background3;
			_verticalScrollbarThumbStyle.border = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarThumbStyle.padding = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarThumbStyle.fixedWidth = 8f;
			_verticalScrollbarThumbStyle.margin = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarUpButtonStyle = new GUIStyle(GUI.skin.verticalScrollbarUpButton);
			_verticalScrollbarUpButtonStyle.normal.background = background5;
			_verticalScrollbarUpButtonStyle.hover.background = background5;
			_verticalScrollbarUpButtonStyle.active.background = background5;
			_verticalScrollbarUpButtonStyle.fixedHeight = 0f;
			_verticalScrollbarUpButtonStyle.border = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarUpButtonStyle.padding = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarUpButtonStyle.margin = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarDownButtonStyle = new GUIStyle(GUI.skin.verticalScrollbarDownButton);
			_verticalScrollbarDownButtonStyle.normal.background = background5;
			_verticalScrollbarDownButtonStyle.hover.background = background5;
			_verticalScrollbarDownButtonStyle.active.background = background5;
			_verticalScrollbarDownButtonStyle.fixedHeight = 0f;
			_verticalScrollbarDownButtonStyle.border = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarDownButtonStyle.padding = new RectOffset(0, 0, 0, 0);
			_verticalScrollbarDownButtonStyle.margin = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarStyle = new GUIStyle(GUI.skin.horizontalScrollbar);
			_horizontalScrollbarStyle.normal.background = background5;
			_horizontalScrollbarStyle.hover.background = background5;
			_horizontalScrollbarStyle.active.background = background5;
			_horizontalScrollbarStyle.border = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarStyle.padding = new RectOffset(2, 2, 2, 2);
			_horizontalScrollbarStyle.fixedHeight = 12f;
			_horizontalScrollbarStyle.margin = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarThumbStyle = new GUIStyle(GUI.skin.horizontalScrollbarThumb);
			_horizontalScrollbarThumbStyle.normal.background = background6;
			_horizontalScrollbarThumbStyle.hover.background = background7;
			_horizontalScrollbarThumbStyle.active.background = background3;
			_horizontalScrollbarThumbStyle.border = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarThumbStyle.padding = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarThumbStyle.fixedHeight = 8f;
			_horizontalScrollbarThumbStyle.margin = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarLeftButtonStyle = new GUIStyle(GUI.skin.horizontalScrollbarLeftButton);
			_horizontalScrollbarLeftButtonStyle.normal.background = background5;
			_horizontalScrollbarLeftButtonStyle.hover.background = background5;
			_horizontalScrollbarLeftButtonStyle.active.background = background5;
			_horizontalScrollbarLeftButtonStyle.fixedWidth = 0f;
			_horizontalScrollbarLeftButtonStyle.border = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarLeftButtonStyle.padding = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarLeftButtonStyle.margin = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarRightButtonStyle = new GUIStyle(GUI.skin.horizontalScrollbarRightButton);
			_horizontalScrollbarRightButtonStyle.normal.background = background5;
			_horizontalScrollbarRightButtonStyle.hover.background = background5;
			_horizontalScrollbarRightButtonStyle.active.background = background5;
			_horizontalScrollbarRightButtonStyle.fixedWidth = 0f;
			_horizontalScrollbarRightButtonStyle.border = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarRightButtonStyle.padding = new RectOffset(0, 0, 0, 0);
			_horizontalScrollbarRightButtonStyle.margin = new RectOffset(0, 0, 0, 0);
			_stylesInitialized = true;
		}

		private static bool AreStyleResourcesAlive()
		{
			if ((Object)(object)_darkBackground != (Object)null && (Object)(object)_lightBackground != (Object)null && (Object)(object)_redBackground != (Object)null && (Object)(object)_dangerBackground != (Object)null && (Object)(object)_conflictOutlineTexture != (Object)null && _windowStyle != null && (Object)(object)_windowStyle.normal.background != (Object)null && _pluginBtnStyle != null && (Object)(object)_pluginBtnStyle.normal.background != (Object)null && _selectedPluginBtnStyle != null && (Object)(object)_selectedPluginBtnStyle.normal.background != (Object)null && _textFieldStyle != null && (Object)(object)_textFieldStyle.normal.background != (Object)null && _conflictTextFieldStyle != null && (Object)(object)_conflictTextFieldStyle.normal.background != (Object)null && _conflictDropdownButtonStyle != null && (Object)(object)_conflictDropdownButtonStyle.normal.background != (Object)null && _dropdownPanelStyle != null && (Object)(object)_dropdownPanelStyle.normal.background != (Object)null && _dropdownScrollButtonStyle != null && (Object)(object)_dropdownScrollButtonStyle.normal.background != (Object)null && _dropdownScrollTrackStyle != null && (Object)(object)_dropdownScrollTrackStyle.normal.background != (Object)null && _dropdownScrollThumbStyle != null && (Object)(object)_dropdownScrollThumbStyle.normal.background != (Object)null && _closeBtnStyle != null)
			{
				return (Object)(object)_closeBtnStyle.normal.background != (Object)null;
			}
			return false;
		}

		private static void ReleaseGeneratedTextures()
		{
			for (int i = 0; i < _generatedTextures.Count; i++)
			{
				Texture2D val = _generatedTextures[i];
				if ((Object)(object)val != (Object)null)
				{
					Object.Destroy((Object)(object)val);
				}
			}
			_generatedTextures.Clear();
			_darkBackground = null;
			_lightBackground = null;
			_redBackground = null;
			_dangerBackground = null;
			_conflictOutlineTexture = null;
		}

		private static Texture2D CreateColorTexture(Color color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, color);
			val.Apply();
			((Object)val).hideFlags = (HideFlags)61;
			_generatedTextures.Add(val);
			return val;
		}

		private static float CalculateTextHeight(GUIStyle style, string text, float width)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if (style == null || string.IsNullOrWhiteSpace(text))
			{
				return 0f;
			}
			return style.CalcHeight(new GUIContent(text), Mathf.Max(1f, width));
		}
	}
}
namespace ModConfigManager.Localization
{
	public static class LocalizationHelper
	{
		public static Dictionary<string, string> GetDefaultTranslations(string language)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			switch (language)
			{
			case "简体中文":
				dictionary.Add("plugin.initializing", "开始初始化...");
				dictionary.Add("plugin.author_prefix", "作者:");
				dictionary.Add("plugin.initialized", "初始化成功!");
				dictionary.Add("plugin.patches_skipped", "补丁已应用,跳过...");
				dictionary.Add("ui.title", "模组配置管理器");
				dictionary.Add("ui.main_menu_button", "模组配置管理");
				dictionary.Add("plugin.description", "统一管理和编辑已安装模组配置,并支持显示第三方模组自定义信息。");
				dictionary.Add("config.toggle_manager_key", "打开配置管理器的快捷键");
				dictionary.Add("ui.restart_hint", "修改配置后重启游戏才可以生效");
				dictionary.Add("ui.close", "关闭");
				dictionary.Add("ui.mod_list", "模组列表");
				dictionary.Add("ui.select_mod_first", "请先从左侧选择一个模组");
				dictionary.Add("ui.reset_button", "恢复默认");
				dictionary.Add("ui.revert_button", "恢复");
				dictionary.Add("ui.range_hint", "范围");
				dictionary.Add("ui.hotkey_conflict", "快捷键冲突(与 {0} 冲突)");
				dictionary.Add("ui.no_config_file", "未找到配置文件,或该模组没有可编辑配置。");
				break;
			case "繁體中文":
				dictionary.Add("plugin.initializing", "開始初始化...");
				dictionary.Add("plugin.author_prefix", "作者:");
				dictionary.Add("plugin.initialized", "初始化成功!");
				dictionary.Add("plugin.patches_skipped", "補丁已套用,跳過...");
				dictionary.Add("ui.title", "模組配置管理器");
				dictionary.Add("ui.main_menu_button", "模組配置管理");
				dictionary.Add("plugin.description", "統一管理和編輯已安裝模組配置,並支援顯示第三方模組自訂資訊。");
				dictionary.Add("config.toggle_manager_key", "開啟配置管理器的快捷鍵");
				dictionary.Add("ui.restart_hint", "修改配置後需重新啟動遊戲才會生效");
				dictionary.Add("ui.close", "關閉");
				dictionary.Add("ui.mod_list", "模組列表");
				dictionary.Add("ui.select_mod_first", "請先從左側選擇一個模組");
				dictionary.Add("ui.reset_button", "恢復預設");
				dictionary.Add("ui.revert_button", "恢復");
				dictionary.Add("ui.range_hint", "範圍");
				dictionary.Add("ui.hotkey_conflict", "快捷鍵衝突(與 {0} 衝突)");
				dictionary.Add("ui.no_config_file", "找不到配置檔,或該模組沒有可編輯配置。");
				break;
			case "English":
				dictionary.Add("plugin.initializing", "Initializing...");
				dictionary.Add("plugin.author_prefix", "Author: ");
				dictionary.Add("plugin.initialized", "Initialized successfully!");
				dictionary.Add("plugin.patches_skipped", "Patches already applied, skipping...");
				dictionary.Add("ui.title", "Mod Config Manager");
				dictionary.Add("ui.main_menu_button", "Mod Config Manager");
				dictionary.Add("plugin.description", "Unified management and editing of mod configurations, with support for custom third-party mod information.");
				dictionary.Add("config.toggle_manager_key", "Hotkey to open config manager");
				dictionary.Add("ui.restart_hint", "Configuration changed. Restart the game to apply.");
				dictionary.Add("ui.close", "Close");
				dictionary.Add("ui.mod_list", "Mods");
				dictionary.Add("ui.select_mod_first", "Select a mod from the left panel.");
				dictionary.Add("ui.reset_button", "Reset to Defaults");
				dictionary.Add("ui.revert_button", "Revert");
				dictionary.Add("ui.range_hint", "Range");
				dictionary.Add("ui.hotkey_conflict", "Hotkey conflict (conflicts with {0})");
				dictionary.Add("ui.no_config_file", "Config file not found or has no editable entries.");
				break;
			case "日本語":
				dictionary.Add("plugin.initializing", "初期化中...");
				dictionary.Add("plugin.author_prefix", "作者: ");
				dictionary.Add("plugin.initialized", "初期化に成功しました!");
				dictionary.Add("plugin.patches_skipped", "パッチはすでに適用済みです。スキップします...");
				dictionary.Add("ui.title", "Mod Config Manager");
				dictionary.Add("ui.main_menu_button", "Mod設定管理");
				dictionary.Add("plugin.description", "インストール済みMODの設定を一元管理・編集し、サードパーティMODのカスタム情報表示にも対応します。");
				dictionary.Add("config.toggle_manager_key", "設定マネージャーを開くホットキー");
				dictionary.Add("ui.restart_hint", "設定変更はゲーム再起動後に有効になります");
				dictionary.Add("ui.close", "閉じる");
				dictionary.Add("ui.mod_list", "MOD一覧");
				dictionary.Add("ui.select_mod_first", "左側からMODを選択してください。");
				dictionary.Add("ui.reset_button", "デフォルトに戻す");
				dictionary.Add("ui.revert_button", "戻す");
				dictionary.Add("ui.range_hint", "範囲");
				dictionary.Add("ui.hotkey_conflict", "ホットキー競合({0} と競合)");
				dictionary.Add("ui.no_config_file", "設定ファイルが見つからないか、編集可能な設定がありません。");
				break;
			}
			return dictionary;
		}
	}
	public class LocalizationManager
	{
		private static LocalizationManager _instance;

		private readonly ModLocalizationService _service;

		public static readonly string[] SupportedLanguages = new string[4] { "简体中文", "繁體中文", "English", "日本語" };

		public static LocalizationManager Instance => _instance ?? (_instance = new LocalizationManager());

		private LocalizationManager()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			_service = new ModLocalizationService((IEnumerable<string>)SupportedLanguages, "English");
			Initialize();
		}

		public void Initialize()
		{
			string[] supportedLanguages = SupportedLanguages;
			foreach (string text in supportedLanguages)
			{
				Dictionary<string, string> defaultTranslations = LocalizationHelper.GetDefaultTranslations(text);
				if (defaultTranslations != null && defaultTranslations.Count > 0)
				{
					_service.AddTranslations(text, defaultTranslations);
				}
			}
		}

		public string GetLocalizedText(string key, params object[] args)
		{
			return _service.GetText(key, args);
		}
	}
}
namespace ModConfigManager.Configuration
{
	internal sealed class ConfigManager : ModConfigBase
	{
		private static ConfigManager _instance;

		public static ConfigManager Instance => _instance;

		public ConfigEntry<KeyCode> ToggleManagerKey { get; private set; }

		private ConfigManager(ConfigFile configFile)
			: base(configFile)
		{
			InitializeDefaultConfigs();
		}

		public static void Initialize(ConfigFile configFile)
		{
			if (_instance == null)
			{
				_instance = new ConfigManager(configFile);
			}
		}

		private void InitializeDefaultConfigs()
		{
			ToggleManagerKey = ((ModConfigBase)this).RegisterKeyCode("管理器设置 - Manager Settings", "ToggleManagerKey", LocalizationManager.Instance.GetLocalizedText("config.toggle_manager_key"), (KeyCode)282);
		}
	}
	public enum ConfigValueType
	{
		Bool,
		Int,
		Float,
		String
	}
	public class ConfigItem
	{
		public string Section;

		public string Key;

		public string Value;

		public string DefaultValue;

		public ConfigValueType ValueType;

		public int LineIndex;

		public string Description;

		public List<string> AcceptableValues = new List<string>();

		public bool HasRange;

		public double RangeMin;

		public double RangeMax;
	}
	public class ConfigSection
	{
		public string Name;

		public List<ConfigItem> Items = new List<ConfigItem>();
	}
	public class ConfigFileModel
	{
		public string Path;

		public List<string> Lines = new List<string>();

		public List<ConfigSection> Sections = new List<ConfigSection>();

		public void SetValue(string section, string key, string value)
		{
			ConfigItem configItem = null;
			foreach (ConfigSection section2 in Sections)
			{
				foreach (ConfigItem item in section2.Items)
				{
					if (item.Section == section && item.Key == key)
					{
						configItem = item;
						break;
					}
				}
				if (configItem != null)
				{
					break;
				}
			}
			if (configItem != null)
			{
				configItem.Value = value;
				string text = key + " = ";
				Lines[configItem.LineIndex] = text + value;
			}
		}

		public void Save()
		{
			string directoryName = System.IO.Path.GetDirectoryName(Path);
			if (!string.IsNullOrWhiteSpace(directoryName) && !Directory.Exists(directoryName))
			{
				Directory.CreateDirectory(directoryName);
			}
			File.WriteAllLines(Path, Lines);
		}
	}
	public static class ConfigParser
	{
		public static ConfigFileModel Parse(string path)
		{
			ConfigFileModel configFileModel = new ConfigFileModel
			{
				Path = path
			};
			if (!File.Ex