Decompiled source of REPOSettings v1.0.2

Zichen-REPOSettings-1.0.2.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using MenuLib.Structs;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("Zichen-REPOSettings-1.0.2")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+32c11006eb1c1cd412ae63df2b933665e2f66441")]
[assembly: AssemblyProduct("Zichen-REPOSettings-1.0.2")]
[assembly: AssemblyTitle("Zichen-REPOSettings-1.0.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace REPOSettings
{
	[BepInPlugin("zichen.reposettings", "REPOSettings", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class Plugin : BaseUnityPlugin
	{
		private sealed class CompatibilityReport
		{
			private readonly List<string> _disabledFeatures = new List<string>();

			private readonly List<string> _details = new List<string>();

			public bool HasIssues => _disabledFeatures.Count > 0;

			public static CompatibilityReport CreateHealthy()
			{
				return new CompatibilityReport();
			}

			public static CompatibilityReport Build()
			{
				CompatibilityReport compatibilityReport = new CompatibilityReport();
				RequireType(typeof(MenuPageMain), "主菜单入口", compatibilityReport, "主菜单入口");
				RequireType(typeof(MenuPageEsc), "ESC 菜单入口", compatibilityReport, "ESC 菜单入口");
				RequireType(typeof(MenuManager), "菜单管理器", compatibilityReport, "菜单页开关与弹窗");
				RequireType(typeof(MenuPage), "菜单页面", compatibilityReport, "菜单页开关与弹窗");
				RequireType(typeof(MenuButton), "菜单按钮", compatibilityReport, "菜单按钮行为");
				RequireType(typeof(MapToolController), "地图工具", compatibilityReport, "地图开合动画");
				RequireType(typeof(SemiUI), "半屏 UI", compatibilityReport, "准备界面与提示 UI");
				RequireType(typeof(WorldSpaceUIParent), "世界空间 UI", compatibilityReport, "世界空间 UI 动画");
				RequireField(typeof(GameManager), "connectRandom", compatibilityReport, "公开房/私人房确认跳过");
				RequireField(typeof(MenuManager), "currentMenuPageIndex", compatibilityReport, "大厅与联机提示识别");
				RequireField(typeof(MenuManager), "currentMenuPage", compatibilityReport, "菜单关闭动画");
				RequireField(typeof(MenuPage), "originalPosition", compatibilityReport, "菜单打开动画");
				RequireField(typeof(MenuPage), "popUpAnimation", compatibilityReport, "菜单开关动画");
				RequireField(typeof(MenuPage), "rectTransform", compatibilityReport, "菜单开关动画");
				RequireField(typeof(MenuElementServer), "introDone", compatibilityReport, "房间列表入场动画");
				RequireField(typeof(MenuElementRegion), "introLerp", compatibilityReport, "地区列表入场动画");
				RequireMethod(typeof(MenuManager), "PagePopUpTwoOptions", new Type[11]
				{
					typeof(MenuButtonPopUp),
					typeof(string),
					typeof(LocalizedAsset),
					typeof(Color),
					typeof(string),
					typeof(LocalizedAsset),
					typeof(string),
					typeof(LocalizedAsset),
					typeof(string),
					typeof(LocalizedAsset),
					typeof(bool)
				}, compatibilityReport, "公开房/私人房确认跳过");
				RequireMethod(typeof(MenuPageMain), "Start", Type.EmptyTypes, compatibilityReport, "主菜单入口");
				RequireMethod(typeof(MenuPageEsc), "Start", Type.EmptyTypes, compatibilityReport, "ESC 菜单入口");
				RequireMethod(typeof(MenuPage), "StateOpening", Type.EmptyTypes, compatibilityReport, "菜单打开动画");
				RequireMethod(typeof(MenuPage), "StateClosing", Type.EmptyTypes, compatibilityReport, "菜单关闭动画");
				RequireMethod(typeof(MenuButton), "OnHovering", Type.EmptyTypes, compatibilityReport, "菜单按钮位移动画");
				RequireMethod(typeof(MapToolController), "Update", Type.EmptyTypes, compatibilityReport, "地图开合动画");
				DetectLoadedCompanions(compatibilityReport);
				return compatibilityReport;
			}

			public void AddPatchFailure(string featureName, string patchName, string reason)
			{
				AddDisabledFeature(featureName);
				_details.Add("Patch failed: " + patchName + " -> " + reason);
			}

			public string BuildLogMessage()
			{
				if (!HasIssues)
				{
					return "Compatibility self-check passed.";
				}
				string text = ((_disabledFeatures.Count == 0) ? "暂无明确功能降级" : string.Join(";", _disabledFeatures.Distinct().ToArray()));
				return "Compatibility self-check found possible game API changes. Affected features: " + text;
			}

			public string BuildPopupMessage(bool english)
			{
				if (!HasIssues)
				{
					return null;
				}
				if (english)
				{
					string text = "REPOSettings detected possible game API changes and entered compatibility mode.\nPotentially affected features:";
					foreach (string item in _disabledFeatures.Distinct().Take(6))
					{
						text = text + "\n- " + item;
					}
					if (_disabledFeatures.Count == 0)
					{
						text += "\n- Some menu or effect features may be limited";
					}
					return text + "\n\nPlease wait for an updated version if something does not work as expected.";
				}
				string text2 = "检测到游戏接口可能已变化,REPOSettings 已进入兼容模式。\n以下功能可能受影响:";
				foreach (string item2 in _disabledFeatures.Distinct().Take(6))
				{
					text2 = text2 + "\n- " + item2;
				}
				if (_disabledFeatures.Count == 0)
				{
					text2 += "\n- 部分菜单或特效功能可能受限";
				}
				return text2 + "\n\n如遇异常,请等待新版本适配。";
			}

			public IEnumerable<string> GetDetailMessages()
			{
				return _details.Distinct().ToArray();
			}

			private static void RequireType(Type type, string apiName, CompatibilityReport report, string affectedFeature)
			{
				if (!(type != null))
				{
					report.AddDisabledFeature(affectedFeature);
					report._details.Add("Missing type: " + apiName);
				}
			}

			private static void RequireField(Type type, string fieldName, CompatibilityReport report, string affectedFeature)
			{
				if (!(AccessTools.Field(type, fieldName) != null))
				{
					report.AddDisabledFeature(affectedFeature);
					report._details.Add("Missing field: " + type.FullName + "." + fieldName);
				}
			}

			private static void RequireMethod(Type type, string methodName, Type[] parameterTypes, CompatibilityReport report, string affectedFeature)
			{
				if (!(type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, parameterTypes ?? Type.EmptyTypes, null) != null))
				{
					report.AddDisabledFeature(affectedFeature);
					string text = ((parameterTypes == null || parameterTypes.Length == 0) ? "()" : ("(" + string.Join(", ", parameterTypes.Select((Type parameterType) => parameterType.Name).ToArray()) + ")"));
					report._details.Add("Missing method: " + type.FullName + "." + methodName + text);
				}
			}

			private static void DetectLoadedCompanions(CompatibilityReport report)
			{
				try
				{
					if (Chainloader.PluginInfos.ContainsKey("nickklmao.repoconfig"))
					{
						report._details.Add("Detected REPOConfig: menu entry will coexist with Mods.");
					}
					if (Chainloader.PluginInfos.ContainsKey("zichen.moreui"))
					{
						report._details.Add("Detected MoreUI: some local UI/effect toggles may overlap.");
					}
				}
				catch (Exception ex)
				{
					report._details.Add("Failed to scan loaded plugins: " + ex.Message);
				}
			}

			private void AddDisabledFeature(string feature)
			{
				if (!_disabledFeatures.Contains(feature))
				{
					_disabledFeatures.Add(feature);
				}
			}
		}

		[HarmonyPatch(typeof(MenuManager), "Start")]
		private static class MenuManagerStartPatch
		{
			private static bool _done;

			private static void Postfix()
			{
				if (!_done)
				{
					_done = true;
					TryShowCompatibilityPopup();
				}
			}
		}

		internal sealed class CfgI18N
		{
			public string SectionCN;

			public string SectionEN;

			public string KeyCN;

			public string KeyEN;

			public string DisplayEN;

			public string DescCN;

			public string DescEN;

			public ConfigurationManagerAttributes Attrs;

			public string ValueEN;

			public string ValueCN;

			public ConfigEntry<string> ReadOnlyEntry;

			public ConfigEntryBase Entry;

			public bool ChineseOnly;
		}

		internal sealed class LiveLabel
		{
			public WeakReference<TextMeshProUGUI> Tmp;

			public WeakReference<object> UIElement;

			public CfgI18N I18N;

			public bool IsSection;
		}

		internal sealed class LiveValue
		{
			public WeakReference<Object> InputField;

			public CfgI18N I18N;
		}

		internal sealed class LiveSliderOptions
		{
			public WeakReference<Object> Slider;

			public CfgI18N I18N;

			public string[] OptionsCN;

			public string[] OptionsEN;
		}

		internal sealed class LiveToggleButtons
		{
			public WeakReference<TextMeshProUGUI> LeftTmp;

			public WeakReference<TextMeshProUGUI> RightTmp;

			public bool IsLanguage;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static EventHandler <>9__27_0;

			public static BuilderDelegate <>9__27_1;

			public static Func<Transform, bool> <>9__30_0;

			public static Func<Transform, bool> <>9__31_0;

			public static Func<Transform, float> <>9__31_1;

			public static ShouldCloseMenuDelegate <>9__36_0;

			public static Func<ConfigEntry<bool>, string> <>9__43_0;

			public static Func<ConfigEntry<bool>, string> <>9__43_3;

			public static Func<KeyValuePair<ConfigDefinition, ConfigEntryBase>, ConfigEntryBase> <>9__44_0;

			public static Func<ConfigEntry<bool>, bool> <>9__44_1;

			public static Func<ConfigEntry<bool>, bool> <>9__44_2;

			public static Func<TextMeshProUGUI, bool> <>9__53_0;

			public static Func<Type, bool> <>9__62_0;

			public static Converter<Component, string> <>9__253_0;

			internal void <Awake>b__27_0(object sender, EventArgs args)
			{
				RefreshAllI18N();
			}

			internal void <Awake>b__27_1(Transform parent)
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				REPOButton button = (_escapeMenuButton = MenuAPI.CreateREPOButton(GetLocalizedText("更多设置", "More Settings"), (Action)OpenQuickSettingsPage, parent, new Vector2(0f, 0f)));
				((MonoBehaviour)_instance).StartCoroutine(AdjustEscapeButtonPosition(parent, button));
			}

			internal bool <AdjustEscapeButtonPosition>b__30_0(Transform child)
			{
				if (!((Object)child).name.Contains("Menu Button"))
				{
					return false;
				}
				TextMeshProUGUI componentInChildren = ((Component)child).GetComponentInChildren<TextMeshProUGUI>(true);
				return string.Equals((componentInChildren == null) ? null : ((TMP_Text)componentInChildren).text?.Trim(), "设置", StringComparison.Ordinal);
			}

			internal bool <CreateMainMenuButton>b__31_0(Transform transform)
			{
				return ((Object)transform).name.Contains("Menu Button");
			}

			internal float <CreateMainMenuButton>b__31_1(Transform transform)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return transform.localPosition.y;
			}

			internal bool <OpenSectionPage>b__36_0()
			{
				return true;
			}

			internal string <GetFpsPlusBoolSectionEntries>b__43_0(ConfigEntry<bool> entry)
			{
				return ((ConfigEntryBase)entry).Definition.Section;
			}

			internal string <GetFpsPlusBoolSectionEntries>b__43_3(ConfigEntry<bool> entry)
			{
				return ((ConfigEntryBase)entry).Definition.Section;
			}

			internal ConfigEntryBase <GetDisplayedFpsPlusBoolEntries>b__44_0(KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry)
			{
				return configEntry.Value;
			}

			internal bool <GetDisplayedFpsPlusBoolEntries>b__44_1(ConfigEntry<bool> entry)
			{
				if (((ConfigEntryBase)entry).Definition.Section != "A.Mod Info")
				{
					return ((ConfigEntryBase)entry).Definition.Section != "A.REPOSettings Info";
				}
				return false;
			}

			internal bool <GetDisplayedFpsPlusBoolEntries>b__44_2(ConfigEntry<bool> entry)
			{
				return ((ConfigEntryBase)entry).Definition.Section != "K.Performance";
			}

			internal bool <FindTitleTMP>b__53_0(TextMeshProUGUI t)
			{
				if (!((Object)((Component)t).gameObject).name.Contains("Title") && !((Object)((Component)t).gameObject).name.Contains("Header"))
				{
					return ((Object)((TMP_Text)t).transform.parent).name.Contains("Title");
				}
				return true;
			}

			internal bool <GetLoadableTypes>b__62_0(Type type)
			{
				return type != null;
			}

			internal string <LogPopupEvent>b__253_0(Component component)
			{
				if (!((Object)(object)component == (Object)null))
				{
					return ((object)component).GetType().Name;
				}
				return "null";
			}
		}

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

			private object <>2__current;

			public Transform parent;

			public REPOButton button;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					if ((Object)(object)parent == (Object)null || (Object)(object)button == (Object)null)
					{
						return false;
					}
					Transform val = ResolveButtonParent(parent);
					if ((Object)(object)val == (Object)null)
					{
						return false;
					}
					Transform val2 = ((IEnumerable)val).Cast<Transform>().FirstOrDefault((Func<Transform, bool>)delegate(Transform child)
					{
						if (!((Object)child).name.Contains("Menu Button"))
						{
							return false;
						}
						TextMeshProUGUI componentInChildren = ((Component)child).GetComponentInChildren<TextMeshProUGUI>(true);
						return string.Equals((componentInChildren == null) ? null : ((TMP_Text)componentInChildren).text?.Trim(), "设置", StringComparison.Ordinal);
					});
					if ((Object)(object)val2 == (Object)null)
					{
						Plugin instance = _instance;
						if (instance != null)
						{
							((BaseUnityPlugin)instance).Logger.LogWarning((object)"REPOSettings: ESC settings button not found, keeping default position");
						}
						return false;
					}
					Vector3 localPosition = val2.localPosition;
					((Component)button).transform.localPosition = new Vector3(localPosition.x + 96f, localPosition.y, localPosition.z);
					Plugin instance2 = _instance;
					if (instance2 != null)
					{
						((BaseUnityPlugin)instance2).Logger.LogInfo((object)$"REPOSettings: adjusted escape button next to settings at pos={((Component)button).transform.localPosition}");
					}
					return false;
				}
				}
			}

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

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

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

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 2;
					return true;
				case 2:
				{
					<>1__state = -1;
					_isInitializingCustomUI = false;
					_isRenderingOurCustomSettings = false;
					Plugin instance = _instance;
					if (instance != null)
					{
						((BaseUnityPlugin)instance).Logger.LogInfo((object)"[REPOSettings Debug] Custom UI initialization completed, protection flag disabled.");
					}
					return false;
				}
				}
			}

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

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

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

			private object <>2__current;

			public string compatibilityMessage;

			private float <deadline>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<deadline>5__2 = Time.unscaledTime + 15f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!_compatibilityPopupShown && Time.unscaledTime < <deadline>5__2)
				{
					MenuManager instance = MenuManager.instance;
					if ((Object)(object)instance != (Object)null && !IsPopupSlotBusy(instance))
					{
						_compatibilityPopupShown = true;
						_compatibilityPopupWaiting = false;
						instance.PagePopUp(GetLocalizedText("兼容模式提示", "Compatibility Notice"), Color.yellow, compatibilityMessage, "OK", false);
						return false;
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				_compatibilityPopupWaiting = false;
				return false;
			}

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

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

		public const string PluginGuid = "zichen.reposettings";

		public const string PluginName = "REPOSettings";

		public const string PluginVersion = "1.0.2";

		private const string SettingsButtonText = "更多设置";

		private const string SettingsButtonTextEnglish = "More Settings";

		private const float MainMenuRowStepY = 30f;

		private static readonly Vector2 QuickSettingsBackButtonPosition = new Vector2(66f, 18f);

		private static readonly Vector2 QuickSettingsResetButtonPosition = new Vector2(138f, 265f);

		private const string VersionInfoSection = "A.Mod Info";

		private const string LanguageKey = "REPOSettingsLanguage";

		private static readonly Dictionary<string, string> SectionEnglishNames = new Dictionary<string, string>
		{
			["A.Mod Info"] = "A.Mod Info\u200b",
			["B.Global"] = "B.Global",
			["C.StartupTransitions"] = "C.Startup & Transitions",
			["D.LobbyOnline"] = "D.Lobby & Online",
			["E.GunfireEffects"] = "E.Gunfire Effects",
			["E.MeleeEffects"] = "E.Melee Effects\u200b",
			["F.ScreenCamera"] = "F.Screen & Camera",
			["G.WeaponsArms"] = "G.Weapons & Arms",
			["H.TumbleMotion"] = "H.Tumble & Motion",
			["I.DeathStatus"] = "I.Death & Status",
			["J.ValuableEffects"] = "J.Valuable Effects",
			["K.Performance"] = "K.Performance",
			["L.WorldSpaceUI"] = "L.World Space UI",
			["M.UpgradeStand"] = "M.Upgrade Stand",
			["N.CosmeticMachine"] = "N.Cosmetic Machine",
			["O.ResultScreen"] = "O.Result Screen",
			["P.UIPrompts"] = "P.UI & Prompts",
			["Q.PotionUpgrade"] = "Q.Potion Upgrade"
		};

		private static readonly Dictionary<string, string> InfoEnglishNames = new Dictionary<string, string>
		{
			["REPOSettingsModName"] = "Mod Name",
			["REPOSettingsModVersion"] = "Mod Version",
			["模组名称"] = "Mod Name",
			["模组版本号"] = "Mod Version"
		};

		private static readonly Dictionary<string, string> KeyEnglishNames = new Dictionary<string, string>
		{
			["启用"] = "Enable Config",
			["关闭开枪间隔(主机)"] = "Disable Gunfire Cooldown (Host)\u200b",
			["关闭武器震动"] = "Disable Melee Shake",
			["关闭武器造伤间隔(主机)"] = "Disable Melee Hit Freeze (Host)\u200b",
			["显示FPS数值"] = "Show FPS Counter",
			["界面语言"] = "UI Language",
			["关闭启动画面"] = "Disable Splash Screen",
			["关闭开场手臂动画"] = "Disable Arm Intro",
			["关闭加载与切场动画"] = "Disable Loading & Transition",
			["关闭大厅页面切换动画"] = "Disable Lobby Page Animation",
			["关闭按钮弹窗动画"] = "Disable Popup Animation",
			["关闭房间列表入场动画"] = "Disable Server List Intro",
			["关闭地区列表入场动画"] = "Disable Region List Intro",
			["关闭菜单加载图标动画"] = "Disable Menu Loading Icon",
			["关闭主菜单按钮位移动画"] = "Disable Main Menu Motion",
			["关闭加入玩家提示淡入"] = "Disable Join Prompt Fade",
			["关闭左侧准备界面淡入动画"] = "Disable Prep UI Fade",
			["关闭结算页淡入淡出"] = "Disable Result Fade",
			["关闭月相变化界面"] = "Disable Moon Phase UI",
			["关闭主菜单卡车动画"] = "Disable Truck Menu Animation",
			["跳过公开游戏加入确认"] = "Skip Public Join Confirm",
			["跳过私人游戏默认确认"] = "Skip Private Host Confirm",
			["跳过公开/私人游戏区服前提示"] = "Skip Region Entry Prompt",
			["关闭屏幕噪点遮罩"] = "Disable Screen Overlay",
			["关闭镜头噪声"] = "Disable Camera Noise",
			["关闭第一人称镜头动画"] = "Disable Camera Motion",
			["关闭镜头震动"] = "Disable Camera Shake",
			["关闭屏幕故障闪屏"] = "Disable Camera Glitch",
			["关闭影怪血管屏幕特效"] = "Disable Shadow Vein Effect",
			["关闭临时后处理特效"] = "Disable Post Processing",
			["关闭低血量红框"] = "Disable Hurt Vignette",
			["关闭打开地图动画"] = "Disable Map Open Animation",
			["关闭第一人称手臂动作"] = "Disable Arm Animation",
			["关闭摔倒特效"] = "Disable Tumble Effects",
			["关闭开枪扳机动画"] = "Disable Trigger Animation",
			["关闭开枪震动"] = "Disable Gunfire Shake",
			["关闭开枪后坐力(主机)"] = "Disable Recoil (Host)\u200b",
			["关闭开枪枪口特效"] = "Disable Muzzle Effects",
			["关闭开枪黑烟特效"] = "Disable Gun Smoke",
			["关闭死亡与复活特效"] = "Disable Death & Revive Effects",
			["关闭蜘蛛贴脸屏幕效果"] = "Disable Spider Screen Effect",
			["关闭地图贵重物标记"] = "Disable Valuable Map Markers",
			["关闭贵重物发现提示"] = "Disable Valuable Discover Prompt",
			["关闭贵重物动态灯光与粒子"] = "Disable Valuable Effects",
			["关闭世界空间UI动画"] = "Disable World Space UI Motion",
			["关闭重构装备镜头震动"] = "Disable Reroll Equipment Shake",
			["关闭重构装备运转特效与表现"] = "Disable Reroll Equipment Animations",
			["关闭重构装备损坏起火特效"] = "Disable Reroll Equipment Broken Fire",
			["关闭吃药水升级粒子特效"] = "Disable Potion Upgrade Particles",
			["关闭吃药水升级屏幕故障特效"] = "Disable Potion Upgrade Screen Glitch",
			["关闭吃药水升级镜头震动"] = "Disable Potion Upgrade Camera Shake",
			["关闭外观机抓取光束与粒子"] = "Disable Cosmetic Grab Beam",
			["关闭外观机镜头震动"] = "Disable Cosmetic Machine Shake",
			["关闭外观机转盘与屏幕表现"] = "Disable Cosmetic Screen Motion",
			["关闭外观机循环灯光与音效"] = "Disable Cosmetic Loop Effects",
			["关闭结算页抖动"] = "Disable Result Shake",
			["关闭结算页代币粒子"] = "Disable Result Token Particles",
			["快速跳过结算表现"] = "Quick Skip Result Screen",
			["关闭电池UI弹跳与闪烁"] = "Disable Battery UI Motion",
			["关闭手电开关动画"] = "Disable Flashlight Animation",
			["关闭手电闪烁表现"] = "Disable Flashlight Flicker",
			["关闭大厅聊天跳动动画"] = "Disable Lobby Chat Motion",
			["关闭指引箭头"] = "Disable Guide Arrow",
			["关闭大字提示"] = "Disable Big Messages",
			["关闭载具速度粒子"] = "Disable Vehicle Speed Particles",
			["关闭铀伤害屏幕特效"] = "Disable Uranium Effect",
			["关闭翻滚翅膀UI"] = "Disable Tumble Wings UI",
			["关闭教程提示"] = "Disable Tutorial Tips",
			["关闭竞技场大字提示"] = "Disable Arena Messages",
			["关闭竞技场警示灯"] = "Disable Arena Warning Lights",
			["关闭竞速计时器动画"] = "Disable Race Timer Motion",
			["关闭卡车屏幕加载条动画"] = "Disable Truck Loading Bar",
			["关闭卡车聊天框动画"] = "Disable Truck Chat Motion",
			["关闭电池条浮动特效"] = "Disable Battery Bar Effect",
			["关闭价值屏幕跳字特效"] = "Disable Value Screen Effect",
			["关闭教程UI动画"] = "Disable Tutorial UI Motion"
		};

		private static Plugin _instance;

		private static REPOPopupPage _currentSettingsPage;

		private static REPOPopupPage _currentSectionPage;

		private static string _currentSectionName;

		private static Hook _mainMenuStartHook;

		private static REPOButton _escapeMenuButton;

		private static REPOButton _mainMenuButton;

		private static bool _isInitializingCustomUI;

		private static bool _isRenderingOurCustomSettings;

		internal static bool IsInPlayerUpgradeSequence;

		private static TextMeshProUGUI _quickSettingsTitleTMP;

		private static REPOButton _quickSettingsBackButton;

		private static REPOButton _quickSettingsResetButton;

		private static TextMeshProUGUI _sectionTitleTMP;

		private static CompatibilityReport _compatibilityReport = CompatibilityReport.CreateHealthy();

		private static bool _compatibilityPopupShown;

		private static bool _compatibilityPopupWaiting;

		private static readonly FieldRef<MenuManager, bool> PagePopUpScheduledRef = AccessTools.FieldRefAccess<MenuManager, bool>("pagePopUpScheduled");

		private static readonly FieldRef<MenuManager, MenuPageIndex> CurrentMenuPageIndexRef = AccessTools.FieldRefAccess<MenuManager, MenuPageIndex>("currentMenuPageIndex");

		private const string ModuleDisplayName = "更多设置选项";

		private static Harmony _harmony;

		private static ConfigEntry<bool> _cfgShowFpsCounter;

		private static ConfigEntry<bool> _cfgModEnabled;

		private static ConfigEntry<DisplayLanguage> displayLanguage;

		private static ConfigEntry<bool> _cfgDisableSplashScreen;

		private static ConfigEntry<bool> _cfgDisableArmIntroAnimation;

		private static ConfigEntry<bool> _cfgDisableLoadingAnimation;

		private static ConfigEntry<bool> _cfgDisableVideoOverlay;

		private static ConfigEntry<bool> _cfgDisableCameraNoise;

		private static ConfigEntry<bool> _cfgDisableCameraAnimation;

		private static ConfigEntry<bool> _cfgDisableCameraShake;

		private static ConfigEntry<bool> _cfgDisableCameraGlitch;

		private static ConfigEntry<bool> _cfgDisableEnemyShadowVeinScreenEffect;

		private static ConfigEntry<bool> _cfgDisablePostProcessingOverrides;

		private static ConfigEntry<bool> _cfgDisableHurtVignette;

		private static ConfigEntry<bool> _cfgDisableMapOpenAnimation;

		private static ConfigEntry<bool> _cfgDisableFirstPersonArmAnimations;

		private static ConfigEntry<bool> _cfgDisableGunfireCooldown;

		private static ConfigEntry<bool> _cfgDisableMeleeShake;

		private static ConfigEntry<bool> _cfgDisableMeleeCooldown;

		internal static bool IsInItemMeleeSwingHit;

		private static ConfigEntry<bool> _cfgDisableGunTriggerAnimation;

		private static ConfigEntry<bool> _cfgDisableGunFireShake;

		private static ConfigEntry<bool> _cfgDisableGunRecoil;

		private static ConfigEntry<bool> _cfgDisableGunMuzzleEffects;

		private static ConfigEntry<bool> _cfgDisableGunSmokeEffects;

		private static ConfigEntry<bool> _cfgDisableDeathAndReviveEffects;

		private static ConfigEntry<bool> _cfgDisableSpiderScreenEffects;

		private static ConfigEntry<bool> _cfgDisableTumbleVisualEffects;

		private static ConfigEntry<bool> _cfgDisablePhysImpactVisualEffects;

		private static ConfigEntry<bool> _cfgThrottleValuableExtractionTracking;

		private static ConfigEntry<bool> _cfgThrottleEnemyInvestigate;

		private static ConfigEntry<bool> _cfgSkipPublicGameJoinConfirm;

		private static ConfigEntry<bool> _cfgSkipPrivateGameConfirm;

		private static ConfigEntry<bool> _cfgDisableLobbyPageAnimations;

		private static ConfigEntry<bool> _cfgDisablePopupAnimations;

		private static ConfigEntry<bool> _cfgDisableServerListEntryAnimations;

		private static ConfigEntry<bool> _cfgDisableRegionListEntryAnimations;

		private static ConfigEntry<bool> _cfgDisableMenuLoadingGraphicsAnimations;

		private static ConfigEntry<bool> _cfgDisableMenuButtonMotion;

		private static ConfigEntry<bool> _cfgEnableValuableMapMarkers;

		private static ConfigEntry<bool> _cfgEnableValuableDiscoverPrompts;

		private static ConfigEntry<bool> _cfgEnableValuableDynamicEffects;

		private static ConfigEntry<bool> _cfgDisableWorldSpaceUiAnimations;

		private static ConfigEntry<bool> _cfgDisableUpgradeStandCameraShake;

		private static ConfigEntry<bool> _cfgDisableUpgradeStandAnimations;

		private static ConfigEntry<bool> _cfgDisableUpgradeStandBrokenFire;

		private static ConfigEntry<bool> _cfgDisableUpgradePotionParticles;

		private static ConfigEntry<bool> _cfgDisableUpgradeScreenGlitch;

		private static ConfigEntry<bool> _cfgDisableUpgradeCameraShake;

		private static ConfigEntry<bool> _cfgDisableCosmeticMachineGrabBeamEffects;

		private static ConfigEntry<bool> _cfgDisableCosmeticMachineCameraShake;

		private static ConfigEntry<bool> _cfgDisableCosmeticMachineScreenAnimations;

		private static ConfigEntry<bool> _cfgDisableCosmeticMachineLoopEffects;

		private static ConfigEntry<bool> _cfgDisableResultScreenFade;

		private static ConfigEntry<bool> _cfgDisableResultScreenShake;

		private static ConfigEntry<bool> _cfgDisableResultScreenTokenParticles;

		private static ConfigEntry<bool> _cfgQuickSkipResultScreen;

		private static ConfigEntry<bool> _cfgDisableBatteryUiAnimations;

		private static ConfigEntry<bool> _cfgDisableFlashlightAnimations;

		private static ConfigEntry<bool> _cfgDisableFlashlightFlicker;

		private static ConfigEntry<bool> _cfgDisableLobbyChatAnimations;

		private static ConfigEntry<bool> _cfgDisableLobbyJoiningPromptFade;

		private static ConfigEntry<bool> _cfgDisableLeftPrepUiFade;

		private static ConfigEntry<bool> _cfgDisableMoonPhaseUi;

		private static ConfigEntry<bool> _cfgDisableMainMenuTruckAnimation;

		private static ConfigEntry<bool> _cfgDisableGuideArrowUi;

		private static ConfigEntry<bool> _cfgDisableBigMessageUi;

		private static ConfigEntry<bool> _cfgDisableVehicleSpeedParticles;

		private static ConfigEntry<bool> _cfgDisableUraniumScreenEffects;

		private static ConfigEntry<bool> _cfgDisableTumbleWingsUi;

		private static ConfigEntry<bool> _cfgDisableTutorialTips;

		private static ConfigEntry<bool> _cfgDisableArenaMessages;

		private static ConfigEntry<bool> _cfgDisableArenaWarningLights;

		private static ConfigEntry<bool> _cfgDisableArenaRaceTimerAnimations;

		private static ConfigEntry<bool> _cfgDisableTruckScreenLoadingBarAnimation;

		private static ConfigEntry<bool> _cfgDisableTruckScreenChatAnimations;

		private static ConfigEntry<bool> _cfgDisableBatteryBarEffects;

		private static ConfigEntry<bool> _cfgDisableValueScreenEffects;

		private static ConfigEntry<bool> _cfgDisableTutorialUiAnimations;

		private static readonly Dictionary<int, float> ValuableTrackingNextRunTimes = new Dictionary<int, float>();

		private static readonly Dictionary<int, float> ImpactInvestigateNextRunTimes = new Dictionary<int, float>();

		private static float _nextGlobalInvestigateTime;

		private static GUIStyle _fpsLabelStyle;

		private static float _fpsAccumulatedTime;

		private static int _fpsAccumulatedFrames;

		private static float _fpsDisplayValue;

		private float _lastLabelRefreshTime;

		private float _lastNetSyncTime;

		internal static readonly Dictionary<string, CfgI18N> _cfgByEnSection = new Dictionary<string, CfgI18N>(StringComparer.Ordinal);

		internal static readonly Dictionary<string, CfgI18N> _cfgByCnSection = new Dictionary<string, CfgI18N>(StringComparer.Ordinal);

		internal static readonly Dictionary<string, CfgI18N> _cfgByEnKey = new Dictionary<string, CfgI18N>(StringComparer.Ordinal);

		internal static readonly Dictionary<string, List<CfgI18N>> _cfgByKeyOnly = new Dictionary<string, List<CfgI18N>>(StringComparer.Ordinal);

		internal static readonly Dictionary<string, List<CfgI18N>> _cfgByKeyCnOnly = new Dictionary<string, List<CfgI18N>>(StringComparer.Ordinal);

		private static readonly List<CfgI18N> _cfgI18Ns = new List<CfgI18N>(64);

		private static readonly string[] _chineseModKeywords = new string[6] { "chinese", "简体", "繁體", "繁体", "汉化", "中文" };

		private static readonly string[] _chineseEnvironmentPluginGuids = new string[1] { "gravydevsupreme.xunity.autotranslator" };

		private static readonly List<LiveLabel> _liveLabels = new List<LiveLabel>(64);

		private static LiveLabel _pendingSectionLabel;

		private static readonly List<LiveValue> _liveValues = new List<LiveValue>(8);

		private static readonly List<LiveSliderOptions> _liveSliderOptions = new List<LiveSliderOptions>(4);

		private static readonly List<LiveToggleButtons> _liveToggleButtons = new List<LiveToggleButtons>(16);

		private static readonly Dictionary<Type, FieldInfo> _labelTmpFieldCache = new Dictionary<Type, FieldInfo>(8);

		private static readonly Dictionary<Type, PropertyInfo> _sliderStringOptionsPropCache = new Dictionary<Type, PropertyInfo>(4);

		private static readonly Dictionary<Type, FieldInfo> _toggleLeftTmpCache = new Dictionary<Type, FieldInfo>(4);

		private static readonly Dictionary<Type, FieldInfo> _toggleRightTmpCache = new Dictionary<Type, FieldInfo>(4);

		private static readonly Dictionary<string, int> _pendingKeyMatchIndex = new Dictionary<string, int>(StringComparer.Ordinal);

		internal static string _currentRenderingConfigFilePath;

		internal static bool _createModEntriesPatchInstalled;

		private static readonly Dictionary<Type, FieldInfo> _inputStringSystemFieldCache = new Dictionary<Type, FieldInfo>(4);

		private static readonly Dictionary<Type, MethodInfo> _inputStringSystemSetValueCache = new Dictionary<Type, MethodInfo>(4);

		private static readonly Dictionary<string, string> _enumNameCNtoEN = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["中文"] = "Chinese",
			["文字显示"] = "Text Mode",
			["原生UI显示"] = "Native UI"
		};

		private static readonly Dictionary<string, string> _enumNameENtoCN = new Dictionary<string, string>(StringComparer.Ordinal)
		{
			["English"] = "英语",
			["Chinese"] = "中文"
		};

		public static Plugin Instance => _instance;

		private void Awake()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			_instance = this;
			InitializeIntegratedFeatures();
			TryHookREPOConfig(_harmony);
			if (displayLanguage != null)
			{
				displayLanguage.SettingChanged += delegate
				{
					RefreshAllI18N();
				};
			}
			_mainMenuStartHook = new Hook((MethodBase)AccessTools.Method(typeof(MenuPageMain), "Start", (Type[])null, (Type[])null), typeof(Plugin).GetMethod("MenuPageMainStartHook", BindingFlags.Static | BindingFlags.NonPublic));
			object obj = <>c.<>9__27_1;
			if (obj == null)
			{
				BuilderDelegate val = delegate(Transform parent)
				{
					//IL_0035: Unknown result type (might be due to invalid IL or missing references)
					REPOButton button = (_escapeMenuButton = MenuAPI.CreateREPOButton(GetLocalizedText("更多设置", "More Settings"), (Action)OpenQuickSettingsPage, parent, new Vector2(0f, 0f)));
					((MonoBehaviour)_instance).StartCoroutine(AdjustEscapeButtonPosition(parent, button));
				};
				<>c.<>9__27_1 = val;
				obj = (object)val;
			}
			MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"REPOSettings: side-button mode active");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"REPOSettings v1.0.2 loaded.");
		}

		private void OnDestroy()
		{
			Hook mainMenuStartHook = _mainMenuStartHook;
			if (mainMenuStartHook != null)
			{
				mainMenuStartHook.Dispose();
			}
		}

		private static void MenuPageMainStartHook(Action<MenuPageMain> orig, MenuPageMain self)
		{
			orig(self);
			CreateMainMenuButton(((Component)self).transform);
			TryShowCompatibilityPopup();
		}

		[IteratorStateMachine(typeof(<AdjustEscapeButtonPosition>d__30))]
		private static IEnumerator AdjustEscapeButtonPosition(Transform parent, REPOButton button)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AdjustEscapeButtonPosition>d__30(0)
			{
				parent = parent,
				button = button
			};
		}

		private static void CreateMainMenuButton(Transform parent)
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)parent == (Object)null)
			{
				Plugin instance = _instance;
				if (instance != null)
				{
					((BaseUnityPlugin)instance).Logger.LogWarning((object)"REPOSettings: main parent missing");
				}
				return;
			}
			Transform val = ResolveButtonParent(parent);
			if ((Object)(object)val == (Object)null)
			{
				Plugin instance2 = _instance;
				if (instance2 != null)
				{
					((BaseUnityPlugin)instance2).Logger.LogWarning((object)("REPOSettings: main button parent missing, root=" + ((Object)parent).name));
				}
				return;
			}
			if ((Object)(object)((Component)val).GetComponent<VerticalLayoutGroup>() == (Object)null)
			{
				VerticalLayoutGroup obj = ((Component)val).gameObject.AddComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = false;
				((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false;
			}
			Transform val2 = FindOrCleanupManagedButton(val);
			if ((Object)(object)val2 != (Object)null)
			{
				TextMeshProUGUI componentInChildren = ((Component)val2).GetComponentInChildren<TextMeshProUGUI>(true);
				if ((Object)(object)componentInChildren != (Object)null)
				{
					((TMP_Text)componentInChildren).text = GetLocalizedText("更多设置", "More Settings");
				}
				_mainMenuButton = ((Component)val2).GetComponent<REPOButton>();
				Plugin instance3 = _instance;
				if (instance3 != null)
				{
					((BaseUnityPlugin)instance3).Logger.LogInfo((object)$"REPOSettings: main button already exists at pos={val2.localPosition}");
				}
				return;
			}
			REPOButton val3 = (_mainMenuButton = MenuAPI.CreateREPOButton(GetLocalizedText("更多设置", "More Settings"), (Action)OpenQuickSettingsPage, val, new Vector2(0f, 0f)));
			List<Transform> list = (from Transform transform in (IEnumerable)val
				where ((Object)transform).name.Contains("Menu Button")
				orderby transform.localPosition.y descending
				select transform).ToList();
			int index = Math.Max(list.Count - 2, 0);
			list.Insert(index, ((Component)val3).transform);
			Transform val4 = list[list.Count - 1];
			((Component)val3).transform.SetSiblingIndex(val4.GetSiblingIndex());
			float num = 230f;
			foreach (Transform item in list)
			{
				item.localPosition = new Vector3(item.localPosition.x, num, item.localPosition.z);
				num -= 30f;
			}
			Plugin instance4 = _instance;
			if (instance4 != null)
			{
				((BaseUnityPlugin)instance4).Logger.LogInfo((object)$"REPOSettings: inserted main default button at pos={((Component)val3).transform.localPosition}");
			}
		}

		private static Transform ResolveButtonParent(Transform root)
		{
			if ((Object)(object)root == (Object)null)
			{
				return null;
			}
			Transform val = root.Find("Buttons");
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			return root;
		}

		private static Transform FindOrCleanupManagedButton(Transform parent)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			List<Transform> list = new List<Transform>();
			foreach (Transform item in parent)
			{
				Transform val = item;
				if (((Object)val).name.Contains("Menu Button"))
				{
					TextMeshProUGUI componentInChildren = ((Component)val).GetComponentInChildren<TextMeshProUGUI>(true);
					string a = ((!((Object)(object)componentInChildren != (Object)null)) ? string.Empty : ((TMP_Text)componentInChildren).text?.Trim());
					if (string.Equals(a, "更多设置", StringComparison.Ordinal) || string.Equals(a, "More Settings", StringComparison.Ordinal))
					{
						list.Add(val);
					}
				}
			}
			if (list.Count <= 1)
			{
				return list.FirstOrDefault();
			}
			Transform result = list[0];
			for (int i = 1; i < list.Count; i++)
			{
				Object.Destroy((Object)(object)((Component)list[i]).gameObject);
			}
			Plugin instance = _instance;
			if (instance != null)
			{
				((BaseUnityPlugin)instance).Logger.LogWarning((object)$"REPOSettings: cleaned duplicate settings buttons, removed={list.Count - 1}");
			}
			return result;
		}

		private static void OpenQuickSettingsPage()
		{
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			_isRenderingOurCustomSettings = true;
			_isInitializingCustomUI = true;
			if ((Object)(object)_instance != (Object)null)
			{
				((BaseUnityPlugin)_instance).Logger.LogInfo((object)string.Format("[REPOSettings Debug] displayLanguage={0}, IsEnglishUiEnabled={1}, UseChinese={2}", displayLanguage?.Value.ToString() ?? "null", IsEnglishUiEnabled(), UseChinese()));
			}
			Plugin instance = _instance;
			if (instance != null)
			{
				((BaseUnityPlugin)instance).Logger.LogInfo((object)"REPOSettings: OpenQuickSettingsPage invoked");
			}
			string localizedText = GetLocalizedText("更多设置", "More Settings");
			REPOPopupPage page = MenuAPI.CreateREPOPopupPage(localizedText, (PresetSide)0, false, true, 0f);
			_currentSettingsPage = page;
			_quickSettingsTitleTMP = FindTitleTMP(page);
			if ((Object)(object)_quickSettingsTitleTMP != (Object)null)
			{
				((TMP_Text)_quickSettingsTitleTMP).fontStyle = (FontStyles)0;
			}
			page.scrollView.scrollSpeed = 3f;
			REPOPopupPage obj = page;
			Padding maskPadding = page.maskPadding;
			maskPadding.top = 35f;
			obj.maskPadding = maskPadding;
			page.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				_quickSettingsBackButton = MenuAPI.CreateREPOButton(GetLocalizedText("返回", "Back"), (Action)delegate
				{
					page.ClosePage(true);
				}, parent, QuickSettingsBackButtonPosition);
				_quickSettingsResetButton = MenuAPI.CreateREPOButton(GetLocalizedText("重置全部设置", "Reset All Settings"), (Action)ConfirmResetAllManagedEntries, parent, QuickSettingsResetButtonPosition);
				((TMP_Text)_quickSettingsResetButton.labelTMP).fontStyle = (FontStyles)0;
			});
			string modInfoSection = "A.Mod Info";
			page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				REPOButton obj3 = MenuAPI.CreateREPOButton(GetDisplaySectionName(modInfoSection), (Action)delegate
				{
					OpenSectionPage(modInfoSection);
				}, scrollView, default(Vector2));
				((TMP_Text)obj3.labelTMP).fontStyle = (FontStyles)0;
				return ((REPOElement)obj3).rectTransform;
			}, 0f, 0f);
			foreach (IGrouping<string, ConfigEntry<bool>> fpsPlusBoolSectionEntry in GetFpsPlusBoolSectionEntries())
			{
				string sectionName = fpsPlusBoolSectionEntry.Key;
				page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
				{
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0033: Unknown result type (might be due to invalid IL or missing references)
					REPOButton obj2 = MenuAPI.CreateREPOButton(GetDisplaySectionName(sectionName), (Action)delegate
					{
						OpenSectionPage(sectionName);
					}, scrollView, default(Vector2));
					((TMP_Text)obj2.labelTMP).fontStyle = (FontStyles)0;
					return ((REPOElement)obj2).rectTransform;
				}, 0f, 0f);
			}
			page.OpenPage(false);
			if ((Object)(object)_instance != (Object)null)
			{
				((MonoBehaviour)_instance).StartCoroutine(ResetInitializingFlagCoroutine());
			}
			else
			{
				_isInitializingCustomUI = false;
				_isRenderingOurCustomSettings = false;
			}
			Plugin instance2 = _instance;
			if (instance2 != null)
			{
				((BaseUnityPlugin)instance2).Logger.LogInfo((object)"REPOSettings: popup opened");
			}
		}

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

		private static void OpenSectionPage(string sectionName)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			_isRenderingOurCustomSettings = true;
			_isInitializingCustomUI = true;
			MenuAPI.CloseAllPagesAddedOnTop();
			REPOPopupPage val = (_currentSectionPage = MenuAPI.CreateREPOPopupPage(GetDisplaySectionName(sectionName), (PresetSide)1, false, false, 8f));
			_currentSectionName = sectionName;
			_sectionTitleTMP = FindTitleTMP(val);
			if ((Object)(object)_sectionTitleTMP != (Object)null)
			{
				((TMP_Text)_sectionTitleTMP).fontStyle = (FontStyles)0;
			}
			val.scrollView.scrollSpeed = 3f;
			object obj = <>c.<>9__36_0;
			if (obj == null)
			{
				ShouldCloseMenuDelegate val2 = () => true;
				<>c.<>9__36_0 = val2;
				obj = (object)val2;
			}
			val.onEscapePressed = (ShouldCloseMenuDelegate)obj;
			if (sectionName == "A.Mod Info")
			{
				if (displayLanguage != null)
				{
					AddLanguageToggle(val, displayLanguage);
				}
				AddInfoField(val, GetDisplayInfoName("REPOSettingsModName"), GetInfoEntryValue("REPOSettingsModName"));
				AddInfoField(val, GetDisplayInfoName("REPOSettingsModVersion"), GetInfoEntryValue("REPOSettingsModVersion"));
			}
			foreach (ConfigEntry<bool> item in from entry in GetDisplayedFpsPlusBoolEntries()
				where ((ConfigEntryBase)entry).Definition.Section == sectionName
				select entry)
			{
				AddBoolToggle(val, item);
			}
			val.OpenPage(true);
			if ((Object)(object)_instance != (Object)null)
			{
				((MonoBehaviour)_instance).StartCoroutine(ResetInitializingFlagCoroutine());
			}
			else
			{
				_isInitializingCustomUI = false;
				_isRenderingOurCustomSettings = false;
			}
			Plugin instance = _instance;
			if (instance != null)
			{
				((BaseUnityPlugin)instance).Logger.LogInfo((object)("REPOSettings: section page opened -> " + sectionName));
			}
		}

		private static void ConfirmResetAllManagedEntries()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			MenuAPI.OpenPopup(GetLocalizedText("重置全部配置", "Reset All Settings"), Color.red, GetLocalizedText("确定将这页里的所有配置恢复为默认值吗?", "Reset all settings on this page to their defaults?"), (Action)ResetAllManagedEntries, (Action)null);
		}

		private static void ResetAllManagedEntries()
		{
			foreach (ConfigEntry<bool> displayedFpsPlusBoolEntry in GetDisplayedFpsPlusBoolEntries())
			{
				((ConfigEntryBase)displayedFpsPlusBoolEntry).BoxedValue = ((ConfigEntryBase)displayedFpsPlusBoolEntry).DefaultValue;
			}
			Plugin instance = _instance;
			if (instance != null)
			{
				ConfigFile config = ((BaseUnityPlugin)instance).Config;
				if (config != null)
				{
					config.Save();
				}
			}
			if ((Object)(object)_currentSectionPage != (Object)null && !string.IsNullOrWhiteSpace(_currentSectionName))
			{
				_currentSectionPage.ClosePage(true);
				_currentSectionPage = null;
				OpenSectionPage(_currentSectionName);
				return;
			}
			REPOPopupPage currentSettingsPage = _currentSettingsPage;
			if (currentSettingsPage != null)
			{
				currentSettingsPage.ClosePage(true);
			}
			_currentSettingsPage = null;
			OpenQuickSettingsPage();
		}

		private static void AddBoolToggle(REPOPopupPage page, ConfigEntry<bool> entry)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
			{
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				string localizedText = GetLocalizedText("开", "On");
				string localizedText2 = GetLocalizedText("关", "Off");
				bool value2 = entry.Value;
				string displayKeyName = GetDisplayKeyName(((ConfigEntryBase)entry).Definition.Key);
				Action<bool> obj = delegate(bool value)
				{
					if (!_isInitializingCustomUI)
					{
						entry.Value = value;
						SavePluginConfig("zichen.reposettings");
					}
				};
				bool flag = value2;
				string text = localizedText;
				string text2 = localizedText2;
				REPOToggle obj2 = MenuAPI.CreateREPOToggle(displayKeyName, obj, scrollView, default(Vector2), text, text2, flag);
				((TMP_Text)obj2.labelTMP).fontSize = 24f;
				((TMP_Text)obj2.labelTMP).fontStyle = (FontStyles)0;
				return ((REPOElement)obj2).rectTransform;
			}, 0f, 0f);
		}

		private static void AddLanguageToggle(REPOPopupPage page, ConfigEntry<DisplayLanguage> entry)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			if ((Object)(object)_instance != (Object)null)
			{
				((BaseUnityPlugin)_instance).Logger.LogInfo((object)string.Format("[REPOSettings Debug] AddLanguageToggle entry.Value={0}, IsEnglishUiEnabled={1}, GetLocalizedText={2}", entry.Value, IsEnglishUiEnabled(), GetLocalizedText("语言", "Language")));
			}
			page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
			{
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				string text = "中文";
				string text2 = "English";
				bool flag = entry.Value == DisplayLanguage.中文;
				string displayKeyName = GetDisplayKeyName("REPOSettingsLanguage");
				Action<bool> obj = delegate(bool value)
				{
					if (!_isInitializingCustomUI)
					{
						DisplayLanguage displayLanguage = ((!value) ? DisplayLanguage.English : DisplayLanguage.中文);
						if (entry.Value != displayLanguage)
						{
							entry.Value = displayLanguage;
							SavePluginConfig("zichen.reposettings");
						}
					}
				};
				bool flag2 = flag;
				string text3 = text;
				string text4 = text2;
				REPOToggle obj2 = MenuAPI.CreateREPOToggle(displayKeyName, obj, scrollView, default(Vector2), text3, text4, flag2);
				((TMP_Text)obj2.labelTMP).fontSize = 24f;
				((TMP_Text)obj2.labelTMP).fontStyle = (FontStyles)0;
				return ((REPOElement)obj2).rectTransform;
			}, 0f, 0f);
		}

		private static void AddInfoField(REPOPopupPage page, string labelText, string valueText)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				string stableValue = valueText ?? string.Empty;
				REPOInputField inputField = null;
				inputField = MenuAPI.CreateREPOInputField(labelText, (Action<string>)delegate(string value)
				{
					if ((Object)(object)inputField != (Object)null)
					{
						string text = stableValue;
						if (labelText.Contains("Name") || labelText.Contains("名称"))
						{
							text = GetLocalizedText("更多设置选项", "REPOSettings Options ");
						}
						else if (labelText.Contains("Version") || labelText.Contains("版本"))
						{
							text = "1.0.2";
						}
						if (value != text)
						{
							inputField.inputStringSystem.SetValue(text, false);
						}
					}
				}, scrollView, Vector2.zero, false, string.Empty, stableValue);
				((TMP_Text)inputField.labelTMP).fontStyle = (FontStyles)0;
				inputField.inputStringSystem.inputTMP.fontStyle = (FontStyles)0;
				inputField.inputStringSystem.SetValue(stableValue, false);
				return ((REPOElement)inputField).rectTransform;
			}, 0f, 0f);
		}

		private static void RefreshSettingsPages()
		{
		}

		private static IEnumerable<IGrouping<string, ConfigEntry<bool>>> GetFpsPlusBoolSectionEntries()
		{
			List<ConfigEntry<bool>> entries = GetDisplayedFpsPlusBoolEntries().ToList();
			return from section in entries.Select((ConfigEntry<bool> entry) => ((ConfigEntryBase)entry).Definition.Section).Distinct().ToList()
				select (from entry in entries
					where ((ConfigEntryBase)entry).Definition.Section == section
					group entry by ((ConfigEntryBase)entry).Definition.Section).First();
		}

		private static IEnumerable<ConfigEntry<bool>> GetDisplayedFpsPlusBoolEntries()
		{
			Plugin instance = _instance;
			if (((instance != null) ? ((BaseUnityPlugin)instance).Config : null) == null)
			{
				return Enumerable.Empty<ConfigEntry<bool>>();
			}
			return from entry in ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)((BaseUnityPlugin)_instance).Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) => configEntry.Value).OfType<ConfigEntry<bool>>()
				where ((ConfigEntryBase)entry).Definition.Section != "A.Mod Info" && ((ConfigEntryBase)entry).Definition.Section != "A.REPOSettings Info"
				where ((ConfigEntryBase)entry).Definition.Section != "K.Performance"
				select entry;
		}

		private static string GetInfoEntryValue(string keyEN)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			Plugin instance = _instance;
			if (((instance != null) ? ((BaseUnityPlugin)instance).Config : null) == null)
			{
				return string.Empty;
			}
			ConfigEntry<string> val = default(ConfigEntry<string>);
			if (((BaseUnityPlugin)_instance).Config.TryGetEntry<string>(new ConfigDefinition("A.Mod Info", keyEN), ref val) && val != null)
			{
				return val.Value;
			}
			return string.Empty;
		}

		private static string GetDisplaySectionName(string rawSectionName)
		{
			switch (rawSectionName)
			{
			case "A.Mod Info":
			case "A.REPOSettings Info":
			case "A.模组信息":
			{
				string text = (IsEnglishUiEnabled() ? "A.Mod Info\u200b" : "A.模组信息");
				if ((Object)(object)_instance != (Object)null)
				{
					((BaseUnityPlugin)_instance).Logger.LogInfo((object)$"[REPOSettings Debug] GetDisplaySectionName raw={rawSectionName} result={text} IsEnglishUiEnabled={IsEnglishUiEnabled()}");
				}
				return text;
			}
			default:
			{
				if (_cfgByEnSection.TryGetValue(rawSectionName, out var value))
				{
					if (IsEnglishUiEnabled())
					{
						if (!SectionEnglishNames.TryGetValue(rawSectionName, out var value2))
						{
							return value.SectionEN;
						}
						return value2;
					}
					return value.SectionCN;
				}
				return GetLocalizedMappedText(rawSectionName, SectionEnglishNames);
			}
			}
		}

		private static string GetDisplayKeyName(string rawKeyName)
		{
			if (rawKeyName == "REPOSettingsLanguage")
			{
				return GetLocalizedText("语言", "Language ");
			}
			if (_cfgByKeyOnly.TryGetValue(rawKeyName, out var value) && value != null && value.Count > 0)
			{
				CfgI18N cfgI18N = value[0];
				if (IsEnglishUiEnabled())
				{
					if (cfgI18N.DisplayEN != null)
					{
						return GetUIVariant(cfgI18N.DisplayEN);
					}
					if (KeyEnglishNames.TryGetValue(cfgI18N.KeyCN, out var value2))
					{
						return GetUIVariant(value2);
					}
					return GetUIVariant(cfgI18N.KeyEN);
				}
				return cfgI18N.KeyCN;
			}
			return GetUIVariant(GetLocalizedMappedText(rawKeyName, KeyEnglishNames));
		}

		private static string GetDisplayInfoName(string rawKeyName)
		{
			if (rawKeyName == "REPOSettingsModName")
			{
				return GetLocalizedText("模组名称", "Mod Name");
			}
			if (rawKeyName == "REPOSettingsModVersion")
			{
				return GetLocalizedText("模组版本号", "Mod Version");
			}
			return GetLocalizedMappedText(rawKeyName, InfoEnglishNames);
		}

		private static string GetLocalizedMappedText(string chineseText, Dictionary<string, string> englishMap)
		{
			if (!IsEnglishUiEnabled())
			{
				return chineseText;
			}
			if (!englishMap.TryGetValue(chineseText, out var value))
			{
				return chineseText;
			}
			return value;
		}

		private static string GetLocalizedText(string chineseText, string englishText)
		{
			if (!IsEnglishUiEnabled())
			{
				return chineseText;
			}
			return englishText;
		}

		private static void SavePluginConfig(string pluginGuid)
		{
			if (Chainloader.PluginInfos.TryGetValue(pluginGuid, out var value))
			{
				object obj;
				if (value == null)
				{
					obj = null;
				}
				else
				{
					BaseUnityPlugin instance = value.Instance;
					obj = ((instance != null) ? instance.Config : null);
				}
				if (obj != null)
				{
					value.Instance.Config.Save();
				}
			}
		}

		internal static string GetUIVariant(string text)
		{
			if (string.IsNullOrEmpty(text))
			{
				return text;
			}
			switch (text)
			{
			case "A.Mod Info":
			case "A.REPOSettings Info":
			case "A.REPO Settings Info":
				return "A.Mod Info\u200b";
			case "Language":
				return "Language\u200b";
			case "Mod Name":
				return "Mod Name\u200b";
			case "Mod Version":
				return "Mod Version\u200b";
			case "REPOSettings Options":
				return "REPOSettings Options\u200b";
			default:
				return text;
			}
		}

		private static TextMeshProUGUI FindTitleTMP(REPOPopupPage page)
		{
			if ((Object)(object)page == (Object)null)
			{
				return null;
			}
			return ((IEnumerable<TextMeshProUGUI>)((Component)page).gameObject.GetComponentsInChildren<TextMeshProUGUI>(true)).FirstOrDefault((Func<TextMeshProUGUI, bool>)((TextMeshProUGUI t) => ((Object)((Component)t).gameObject).name.Contains("Title") || ((Object)((Component)t).gameObject).name.Contains("Header") || ((Object)((TMP_Text)t).transform.parent).name.Contains("Title")));
		}

		private static void PatchHarmonySafely()
		{
			foreach (Type loadableType in GetLoadableTypes(typeof(Plugin).Assembly))
			{
				if (loadableType == null || !loadableType.GetCustomAttributes(typeof(HarmonyPatch), inherit: true).Any())
				{
					continue;
				}
				try
				{
					_harmony.CreateClassProcessor(loadableType).Patch();
				}
				catch (Exception ex)
				{
					string patchFeatureName = GetPatchFeatureName(loadableType);
					_compatibilityReport.AddPatchFailure(patchFeatureName, loadableType.Name, ex.Message);
					Plugin instance = _instance;
					if (instance != null)
					{
						((BaseUnityPlugin)instance).Logger.LogWarning((object)("Skipped Harmony patch " + loadableType.FullName + ": " + ex.Message));
					}
				}
			}
		}

		private static string GetPatchFeatureName(Type patchType)
		{
			string text = patchType?.Name ?? "未知功能";
			if (text.IndexOf("Menu", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return "菜单与界面";
			}
			if (text.IndexOf("Camera", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("PostProcessing", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Vignette", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("MapTool", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return "屏幕与镜头效果";
			}
			if (text.IndexOf("Gun", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Arm", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return "武器与手臂表现";
			}
			if (text.IndexOf("Valuable", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Phys", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return "贵重物与表现优化";
			}
			if (text.IndexOf("WorldSpace", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Tutorial", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Message", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("UI", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return "UI 与提示";
			}
			return text;
		}

		private static IEnumerable<Type> GetLoadableTypes(Assembly assembly)
		{
			try
			{
				return assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				return ex.Types.Where((Type type) => type != null);
			}
		}

		private static void TryShowCompatibilityPopup()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (_compatibilityPopupShown || !_compatibilityReport.HasIssues || (Object)(object)MenuManager.instance == (Object)null)
			{
				return;
			}
			string text = _compatibilityReport.BuildPopupMessage(IsEnglishUiEnabled());
			if (!string.IsNullOrWhiteSpace(text))
			{
				if (IsPopupSlotBusy(MenuManager.instance))
				{
					StartCompatibilityPopupWait(text);
					return;
				}
				_compatibilityPopupShown = true;
				MenuManager.instance.PagePopUpScheduled(GetLocalizedText("兼容模式提示", "Compatibility Notice"), Color.yellow, text, "OK", false);
			}
		}

		private static bool IsPopupSlotBusy(MenuManager menuManager)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			if ((Object)(object)menuManager == (Object)null)
			{
				return true;
			}
			if (PagePopUpScheduledRef.Invoke(menuManager))
			{
				return true;
			}
			MenuPageIndex val = CurrentMenuPageIndexRef.Invoke(menuManager);
			if ((int)val != 9)
			{
				return (int)val == 7;
			}
			return true;
		}

		private static void StartCompatibilityPopupWait(string compatibilityMessage)
		{
			if (!_compatibilityPopupWaiting && !((Object)(object)_instance == (Object)null))
			{
				_compatibilityPopupWaiting = true;
				((MonoBehaviour)_instance).StartCoroutine(WaitAndShowCompatibilityPopup(compatibilityMessage));
			}
		}

		[IteratorStateMachine(typeof(<WaitAndShowCompatibilityPopup>d__66))]
		private static IEnumerator WaitAndShowCompatibilityPopup(string compatibilityMessage)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitAndShowCompatibilityPopup>d__66(0)
			{
				compatibilityMessage = compatibilityMessage
			};
		}

		public static bool IsStaticModEnabled()
		{
			if (_cfgModEnabled != null)
			{
				return _cfgModEnabled.Value;
			}
			return false;
		}

		public static bool IsEnglishUiEnabled()
		{
			if (displayLanguage != null)
			{
				return displayLanguage.Value == DisplayLanguage.English;
			}
			return false;
		}

		private void InitializeIntegratedFeatures()
		{
			DetachFromManager();
			ResetConfigIfVersionChanged();
			BindConfig();
			CleanupLegacyConfigFile();
			_compatibilityReport = CompatibilityReport.Build();
			ApplyPatches();
			if (_compatibilityReport.HasIssues)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)_compatibilityReport.BuildLogMessage());
				foreach (string detailMessage in _compatibilityReport.GetDetailMessages())
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Compatibility detail: " + detailMessage));
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"更多设置选项 integrated into REPOSettings v1.0.2.");
		}

		private void Update()
		{
			if (Time.unscaledTime - _lastLabelRefreshTime > 0.2f)
			{
				_lastLabelRefreshTime = Time.unscaledTime;
				RefreshLiveLabels();
			}
			UpdateFpsCounter();
			if (IsStaticModEnabled())
			{
				if (DisableCameraAnimationEnabled() && (Object)(object)GameplayManager.instance != (Object)null)
				{
					GameplayManager.instance.OverrideCameraAnimation(0f, 0.2f);
				}
				if (DisableCameraNoiseEnabled() && (Object)(object)GameplayManager.instance != (Object)null)
				{
					GameplayManager.instance.OverrideCameraNoise(0f, 0.2f);
				}
				if (Time.unscaledTime - _lastNetSyncTime > 1f)
				{
					_lastNetSyncTime = Time.unscaledTime;
					SyncConfigToRoomProperties();
				}
			}
		}

		private void SyncConfigToRoomProperties()
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			if (!PhotonNetwork.InRoom || !SemiFunc.IsMasterClient())
			{
				return;
			}
			Room currentRoom = PhotonNetwork.CurrentRoom;
			if (currentRoom == null)
			{
				return;
			}
			bool flag = IsFeatureEnabled(_cfgDisableGunfireCooldown);
			bool flag2 = IsFeatureEnabled(_cfgDisableMeleeCooldown);
			bool flag3 = IsFeatureEnabled(_cfgDisableGunRecoil);
			bool flag4 = false;
			if (((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableGunfireCooldown", out object value))
			{
				if (!(value is bool flag5) || flag5 != flag)
				{
					flag4 = true;
				}
			}
			else
			{
				flag4 = true;
			}
			if (((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableMeleeCooldown", out object value2))
			{
				if (!(value2 is bool flag6) || flag6 != flag2)
				{
					flag4 = true;
				}
			}
			else
			{
				flag4 = true;
			}
			if (((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableGunRecoil", out object value3))
			{
				if (!(value3 is bool flag7) || flag7 != flag3)
				{
					flag4 = true;
				}
			}
			else
			{
				flag4 = true;
			}
			if (flag4)
			{
				Hashtable val = new Hashtable();
				val[(object)"Zichen_DisableGunfireCooldown"] = flag;
				val[(object)"Zichen_DisableMeleeCooldown"] = flag2;
				val[(object)"Zichen_DisableGunRecoil"] = flag3;
				currentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null);
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"[REPOSettings Sync] Host synced custom properties: Gunfire={flag}, Melee={flag2}, Recoil={flag3}");
			}
		}

		internal static bool IsHostDisableGunfireCooldownEnabled()
		{
			if (PhotonNetwork.InRoom)
			{
				Room currentRoom = PhotonNetwork.CurrentRoom;
				if (currentRoom != null && ((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableGunfireCooldown", out object value) && value is bool)
				{
					return (bool)value;
				}
			}
			return false;
		}

		internal static bool IsHostDisableMeleeCooldownEnabled()
		{
			if (PhotonNetwork.InRoom)
			{
				Room currentRoom = PhotonNetwork.CurrentRoom;
				if (currentRoom != null && ((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableMeleeCooldown", out object value) && value is bool)
				{
					return (bool)value;
				}
			}
			return false;
		}

		internal static bool IsHostDisableGunRecoilEnabled()
		{
			if (PhotonNetwork.InRoom)
			{
				Room currentRoom = PhotonNetwork.CurrentRoom;
				if (currentRoom != null && ((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableGunRecoil", out object value) && value is bool)
				{
					return (bool)value;
				}
			}
			return false;
		}

		private void OnGUI()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (IsStaticModEnabled() && _cfgShowFpsCounter != null && _cfgShowFpsCounter.Value)
			{
				EnsureFpsLabelStyle();
				GUI.Label(new Rect(12f, 12f, 160f, 28f), $"FPS: {Mathf.RoundToInt(_fpsDisplayValue)}", _fpsLabelStyle);
			}
		}

		private void BindConfig()
		{
			DisplayLanguage defaultVal = DetectDefaultLanguage();
			displayLanguage = BindI18N("A.Mod Info", "A.模组信息", "REPOSettingsLanguage", "语言", "Switch display language.", "切换显示语言。", defaultVal, null, 1000, null, "Language");
			BindReadOnlyI18N("A.Mod Info", "A.模组信息", "REPOSettingsModName", "模组名称", "REPOSettings Options", "更多设置选项", 990, null, "Mod Name");
			BindReadOnlyI18N("A.Mod Info", "A.模组信息", "REPOSettingsModVersion", "模组版本号", "1.0.2", "1.0.2", 980, null, "Mod Version");
			_cfgModEnabled = BindI18N("B.Global", "B.全局设置", "REPOSettingsEnabled", "启用", "Disable to turn off all features.", "总开关", defaultVal: true, null, 990, null, "Enable Config");
			_cfgShowFpsCounter = BindI18N("B.Global", "B.全局设置", "REPOSettingsShowFps", "显示FPS数值", "Show FPS counter in the top-left corner.", "左上角实时显示FPS", defaultVal: true, null, 980, null, "Show FPS Counter");
			_cfgDisableSplashScreen = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableSplashScreen", "关闭启动画面", "Disable splash screen.", "关闭启动画面", defaultVal: true);
			_cfgDisableArmIntroAnimation = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableArmIntroAnimation", "关闭开场手臂动画", "Disable arm intro animation.", "关闭开场手臂", defaultVal: false);
			_cfgDisableLoadingAnimation = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableLoadingAnimation", "关闭加载与切场动画", "Disable loading & transition animations.", "关闭加载切场", defaultVal: false);
			_cfgDisableLobbyPageAnimations = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableLobbyPageAnimations", "关闭大厅页面切换动画", "Disable lobby page transition animations.", "关闭大厅页面切换动画", defaultVal: false);
			_cfgDisablePopupAnimations = BindI18N("C.StartupTransitions", "C.启动与切场", "DisablePopupAnimations", "关闭按钮弹窗动画", "Disable popup animations.", "关闭按钮弹窗动画", defaultVal: false);
			_cfgDisableServerListEntryAnimations = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableServerListEntryAnimations", "关闭房间列表入场动画", "Disable server list entry animations.", "关闭房间列表入场动画", defaultVal: false);
			_cfgDisableRegionListEntryAnimations = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableRegionListEntryAnimations", "关闭地区列表入场动画", "Disable region list entry animations.", "关闭地区列表入场动画", defaultVal: false);
			_cfgDisableMenuLoadingGraphicsAnimations = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableMenuLoadingGraphicsAnimations", "关闭菜单加载图标动画", "Disable menu loading graphic animations.", "关闭菜单加载图标动画", defaultVal: false);
			_cfgDisableMenuButtonMotion = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableMenuButtonMotion", "关闭主菜单按钮位移动画", "Disable main menu button motion.", "关闭主菜单按钮位移动画", defaultVal: false);
			_cfgDisableLobbyJoiningPromptFade = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableLobbyJoiningPromptFade", "关闭加入玩家提示淡入", "Disable joining prompt fade.", "关闭加入玩家提示淡入", defaultVal: false);
			_cfgDisableLeftPrepUiFade = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableLeftPrepUiFade", "关闭左侧准备界面淡入动画", "Disable left prep UI fade.", "关闭左侧准备界面淡入动画", defaultVal: false);
			_cfgDisableResultScreenFade = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableResultScreenFade", "关闭结算页淡入淡出", "Disable result screen fade.", "关闭结算页淡入淡出", defaultVal: false);
			_cfgDisableMoonPhaseUi = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableMoonPhaseUi", "关闭月相变化界面", "Disable moon phase UI.", "关闭月相变化界面", defaultVal: false);
			_cfgDisableMainMenuTruckAnimation = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableMainMenuTruckAnimation", "关闭主菜单卡车动画", "Disable main menu truck animation.", "关闭主菜单卡车动画", defaultVal: false);
			_cfgSkipPublicGameJoinConfirm = BindI18N("D.LobbyOnline", "D.大厅与联机", "SkipPublicGameJoinConfirm", "跳过公开游戏加入确认", "Skip public game join confirmation.", "跳过公开房加入提示", defaultVal: true);
			_cfgSkipPrivateGameConfirm = BindI18N("D.LobbyOnline", "D.大厅与联机", "SkipPrivateGameConfirm", "跳过私人游戏默认确认", "Skip private game default confirmation.", "跳过私人房默认提示", defaultVal: true);
			_cfgDisableGunfireCooldown = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunfireCooldown", "关闭开枪间隔(主机)", "Disable gunfire cooldown. (Host)\u200b", "关闭开枪重新装填和射击间隔 (主机)", defaultVal: true);
			_cfgDisableGunTriggerAnimation = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunTriggerAnimation", "关闭开枪扳机动画", "Disable gun trigger animation.", "关闭扳机动画", defaultVal: true);
			_cfgDisableGunFireShake = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunFireShake", "关闭开枪震动", "Disable gunfire shake.", "关闭开枪震动", defaultVal: true);
			_cfgDisableGunRecoil = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunRecoil", "关闭开枪后坐力(主机)", "Disable gun recoil. (Host)\u200b", "关闭开枪后坐力 (主机)", defaultVal: true);
			_cfgDisableGunMuzzleEffects = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunMuzzleEffects", "关闭开枪枪口特效", "Disable muzzle effects.", "关闭枪口火焰火花", defaultVal: true);
			_cfgDisableGunSmokeEffects = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunSmokeEffects", "关闭开枪黑烟特效", "Disable gun smoke effects.", "关闭枪口和落点黑烟", defaultVal: true);
			_cfgDisableMeleeShake = BindI18N("E.MeleeEffects", "E.近战表现", "DisableMeleeShake", "关闭武器震动", "Disable melee shake.", "关闭近战击中震动", defaultVal: true);
			_cfgDisableMeleeCooldown = BindI18N("E.MeleeEffects", "E.近战表现", "DisableMeleeCooldown", "关闭武器造伤间隔(主机)", "Disable melee hit freeze. (Host)\u200b", "关闭近战受击卡顿 (主机)", defaultVal: true);
			_cfgDisableVideoOverlay = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableVideoOverlay", "关闭屏幕噪点遮罩", "Disable screen noise overlay.", "关闭噪点遮罩", defaultVal: false);
			_cfgDisableCameraNoise = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableCameraNoise", "关闭镜头噪声", "Disable camera noise.", "关闭镜头噪声", defaultVal: false);
			_cfgDisableCameraAnimation = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableCameraAnimation", "关闭第一人称镜头动画", "Disable first-person camera motion.", "关闭走路跳跃镜头动画", defaultVal: false);
			_cfgDisableCameraShake = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableCameraShake", "关闭镜头震动", "Disable camera shake.", "关闭镜头震动", defaultVal: false);
			_cfgDisableCameraGlitch = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableCameraGlitch", "关闭屏幕故障闪屏", "Disable screen glitch effect.", "关闭故障闪屏", defaultVal: false);
			_cfgDisableEnemyShadowVeinScreenEffect = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableEnemyShadowVeinScreenEffect", "关闭影怪血管屏幕特效", "Disable shadow enemy vein screen effect.", "关闭影怪血管屏幕特效", defaultVal: false);
			_cfgDisablePostProcessingOverrides = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisablePostProcessingOverrides", "关闭临时后处理特效", "Disable temporary post-processing overrides.", "关闭临时后处理", defaultVal: false);
			_cfgDisableHurtVignette = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableHurtVignette", "关闭低血量红框", "Disable hurt vignette.", "关闭低血量红框", defaultVal: false);
			_cfgDisableMapOpenAnimation = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableMapOpenAnimation", "关闭打开地图动画", "Disable map open animation.", "关闭地图开合动画", defaultVal: false);
			_cfgDisableFirstPersonArmAnimations = BindI18N("G.WeaponsArms", "G.武器与手臂表现", "DisableFirstPersonArmAnimations", "关闭第一人称手臂动作", "Disable first-person arm animations.", "关闭手臂摆动", defaultVal: false);
			_cfgDisableTumbleVisualEffects = BindI18N("H.TumbleMotion", "H.摔倒与动作表现", "DisableTumbleVisualEffects", "关闭摔倒特效", "Disable tumble visual effects.", "关闭摔倒粒子", defaultVal: false);
			_cfgDisableDeathAndReviveEffects = BindI18N("I.DeathStatus", "I.死亡与状态表现", "DisableDeathAndReviveEffects", "关闭死亡与复活特效", "Disable death and revive effects.", "关闭死亡复活特效", defaultVal: false);
			_cfgDisableSpiderScreenEffects = BindI18N("I.DeathStatus", "I.死亡与状态表现", "DisableSpiderScreenEffects", "关闭蜘蛛贴脸屏幕效果", "Disable spider screen effects.", "关闭蜘蛛贴脸效果", defaultVal: false);
			_cfgEnableValuableMapMarkers = BindI18N("J.ValuableEffects", "J.贵重物表现", "DisableValuableMapMarkers", "关闭地图贵重物标记", "Disable valuable map markers.", "关闭地图贵重物标记", defaultVal: false);
			_cfgEnableValuableDiscoverPrompts = BindI18N("J.ValuableEffects", "J.贵重物表现", "DisableValuableDiscoverPrompts", "关闭贵重物发现提示", "Disable valuable discover prompts.", "关闭贵重物发现提示", defaultVal: false);
			_cfgEnableValuableDynamicEffects = BindI18N("J.ValuableEffects", "J.贵重物表现", "DisableValuableDynamicEffects", "关闭贵重物动态灯光与粒子", "Disable valuable dynamic effects.", "关闭贵重物灯光粒子", defaultVal: false);
			_cfgDisablePhysImpactVisualEffects = BindI18N("K.Performance", "K.性能优化", "DisablePhysImpactVisualEffects", "关闭物体碰撞粒子与灯光", "Disable physics impact visual effects.", "关闭碰撞粒子灯光", defaultVal: false);
			_cfgThrottleValuableExtractionTracking = BindI18N("K.Performance", "K.性能优化", "ThrottleValuableExtractionTracking", "贵重物距离跟踪降频", "Throttle valuable extraction tracking.", "降低距离跟踪频率", defaultVal: false);
			_cfgThrottleEnemyInvestigate = BindI18N("K.Performance", "K.性能优化", "ThrottleEnemyInvestigate", "敌人调查触发节流", "Throttle enemy investigate triggers.", "限制高频调查触发", defaultVal: false);
			_cfgDisableWorldSpaceUiAnimations = BindI18N("L.WorldSpaceUI", "L.世界空间UI", "DisableWorldSpaceUiAnimations", "关闭世界空间UI动画", "Disable world space UI animations.", "关闭名字弹字和TTS动画", defaultVal: false);
			_cfgDisableUpgradeStandCameraShake = BindI18N("M.UpgradeStand", "M.升级台表现", "DisableUpgradeStandCameraShake", "关闭重构装备镜头震动", "Disable Reroll Equipment Shake", "关闭重构装备时的镜头晃动表现", defaultVal: false);
			_cfgDisableUpgradeStandAnimations = BindI18N("M.UpgradeStand", "M.升级台表现", "DisableUpgradeStandAnimations", "关闭重构装备运转特效与表现", "Disable Reroll Equipment Animations", "关闭重构(洗装备)运转时的声光特效与表现", defaultVal: false);
			_cfgDisableUpgradeStandBrokenFire = BindI18N("M.UpgradeStand", "M.升级台表现", "DisableUpgradeStandBrokenFire", "关闭重构装备损坏起火特效", "Disable Reroll Equipment Broken Fire", "关闭重构台用尽损坏起火时的粒子与爆裂音效", defaultVal: false);
			_cfgDisableCosmeticMachineGrabBeamEffects = BindI18N("N.CosmeticMachine", "N.外观机表现", "DisableCosmeticMachineGrabBeamEffects", "关闭外观机抓取光束与粒子", "Disable cosmetic machine grab beam effects.", "关闭外观机抓取光束粒子", defaultVal: false);
			_cfgDisableCosmeticMachineCameraShake = BindI18N("N.CosmeticMachine", "N.外观机表现", "DisableCosmeticMachineCameraShake", "关闭外观机镜头震动", "Disable cosmetic machine camera shake.", "关闭外观机镜头震动", defaultVal: false);
			_cfgDisableCosmeticMachineScreenAnimations = BindI18N("N.CosmeticMachine", "N.外观机表现", "DisableCosmeticMachineScreenAnimations", "关闭外观机转盘与屏幕表现", "Disable cosmetic machine screen animations.", "关闭外观机转盘屏幕表现", defaultVal: false);
			_cfgDisableCosmeticMachineLoopEffects = BindI18N("N.CosmeticMachine", "N.外观机表现", "DisableCosmeticMachineLoopEffects", "关闭外观机循环灯光与音效", "Disable cosmetic machine loop effects.", "关闭外观机循环灯光音效", defaultVal: false);
			_cfgDisableResultScreenShake = BindI18N("O.ResultScreen", "O.结算表现", "DisableResultScreenShake", "关闭结算页抖动", "Disable result screen shake.", "关闭结算页抖动", defaultVal: false);
			_cfgDisableResultScreenTokenParticles = BindI18N("O.ResultScreen", "O.结算表现", "DisableResultScreenTokenParticles", "关闭结算页代币粒子", "Disable result screen token particles.", "关闭结算页代币粒子", defaultVal: false);
			_cfgQuickSkipResultScreen = BindI18N("O.ResultScreen", "O.结算表现", "QuickSkipResultScreen", "快速跳过结算表现", "Quickly skip the result screen.", "快速跳过结算表现", defaultVal: false);
			_cfgDisableUpgradePotionParticles = BindI18N("Q.PotionUpgrade", "Q.使用药水表现", "DisableUpgradePotionParticles", "关闭吃药水升级粒子特效", "Disable Potion Upgrade Particles", "关闭玩家购买升级(吃属性药水)瞬间生成的黄色粒子", defaultVal: true);
			_cfgDisableUpgradeScreenGlitch = BindI18N("Q.PotionUpgrade", "Q.使用药水表现", "DisableUpgradeScreenGlitch", "关闭吃药水升级屏幕故障特效", "Disable Potion Upgrade Screen Glitch", "关闭吃药水升级时产生的屏幕波纹故障闪屏与对应声效", defaultVal: true);
			_cfgDisableUpgradeCameraShake = BindI18N("Q.PotionUpgrade", "Q.使用药水表现", "DisableUpgradeCameraShake", "关闭吃药水升级镜头震动", "Disable Potion Upgrade Camera Shake", "关闭吃药水升级瞬间玩家本地以及队友传来的镜头震动", defaultVal: true);
			_cfgDisableBatteryUiAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableBatteryUiAnimations", "关闭电池UI弹跳与闪烁", "Disable battery UI animations.", "关闭电池UI弹跳闪烁", defaultVal: false);
			_cfgDisableFlashlightAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableFlashlightAnimations", "关闭手电开关动画", "Disable flashlight animations.", "关闭手电开关动画", defaultVal: false);
			_cfgDisableFlashlightFlicker = BindI18N("P.UIPrompts", "P.UI与提示", "DisableFlashlightFlicker", "关闭手电闪烁表现", "Disable flashlight flicker.", "关闭手电闪烁表现", defaultVal: false);
			_cfgDisableLobbyChatAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableLobbyChatAnimations", "关闭大厅聊天跳动动画", "Disable lobby chat animations.", "关闭大厅聊天跳动动画", defaultVal: false);
			_cfgDisableGuideArrowUi = BindI18N("P.UIPrompts", "P.UI与提示", "DisableGuideArrowUi", "关闭指引箭头", "Disable guide arrow UI.", "关闭指引箭头", defaultVal: false);
			_cfgDisableBigMessageUi = BindI18N("P.UIPrompts", "P.UI与提示", "DisableBigMessageUi", "关闭大字提示", "Disable big message UI.", "关闭大字提示", defaultVal: false);
			_cfgDisableVehicleSpeedParticles = BindI18N("P.UIPrompts", "P.UI与提示", "DisableVehicleSpeedParticles", "关闭载具速度粒子", "Disable vehicle speed particles.", "关闭载具速度粒子", defaultVal: false);
			_cfgDisableUraniumScreenEffects = BindI18N("P.UIPrompts", "P.UI与提示", "DisableUraniumScreenEffects", "关闭铀伤害屏幕特效", "Disable uranium screen effects.", "关闭铀伤害屏幕特效", defaultVal: false);
			_cfgDisableTumbleWingsUi = BindI18N("P.UIPrompts", "P.UI与提示", "DisableTumbleWingsUi", "关闭翻滚翅膀UI", "Disable tumble wings UI.", "关闭翻滚翅膀UI", defaultVal: false);
			_cfgDisableTutorialTips = BindI18N("P.UIPrompts", "P.UI与提示", "DisableTutorialTips", "关闭教程提示", "Disable tutorial tips.", "关闭教程提示", defaultVal: false);
			_cfgDisableArenaMessages = BindI18N("P.UIPrompts", "P.UI与提示", "DisableArenaMessages", "关闭竞技场大字提示", "Disable arena messages.", "关闭竞技场大字提示", defaultVal: false);
			_cfgDisableArenaWarningLights = BindI18N("P.UIPrompts", "P.UI与提示", "DisableArenaWarningLights", "关闭竞技场警示灯", "Disable arena warning lights.", "关闭竞技场警示灯", defaultVal: false);
			_cfgDisableArenaRaceTimerAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableArenaRaceTimerAnimations", "关闭竞速计时器动画", "Disable arena race timer animations.", "关闭竞速计时器动画", defaultVal: false);
			_cfgDisableTruckScreenLoadingBarAnimation = BindI18N("P.UIPrompts", "P.UI与提示", "DisableTruckScreenLoadingBarAnimation", "关闭卡车屏幕加载条动画", "Disable truck screen loading bar animation.", "关闭卡车屏幕加载条动画", defaultVal: false);
			_cfgDisableTruckScreenChatAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableTruckScreenChatAnimations", "关闭卡车聊天框动画", "Disable truck chat animations.", "关闭卡车聊天框动画", defaultVal: false);
			_cfgDisableBatteryBarEffects = BindI18N("P.UIPrompts", "P.UI与提示", "DisableBatteryBarEffects", "关闭电池条浮动特效", "Disable battery bar effects.", "关闭电池条浮动特效", defaultVal: false);
			_cfgDisableValueScreenEffects = BindI18N("P.UIPrompts", "P.UI与提示", "DisableValueScreenEffects", "关闭价值屏幕跳字特效", "Disable value screen effects.", "关闭价值屏幕跳字特效", defaultVal: false);
			_cfgDisableTutorialUiAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableTutorialUiAnimations", "关闭教程UI动画", "Disable tutorial UI animations.", "关闭教程UI动画", defaultVal: false);
			RefreshAllI18N();
		}

		private void ResetConfigIfVersionChanged()
		{
			try
			{
				string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath;
				string text = ReadConfigPluginVersion(configFilePath);
				if (!string.IsNullOrWhiteSpace(text) && !(text == "1.0.2"))
				{
					((BaseUnityPlugin)this).Config.Clear();
					if (File.Exists(configFilePath))
					{
						File.Delete(configFilePath);
					}
					((BaseUnityPlugin)this).Config.Reload();
					((BaseUnityPlugin)this).Logger.LogWarning((object)"Config version changed. Old config was reset to defaults.");
				}
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to reset config by version: " + ex.Message));
			}
		}

		private static string ReadConfigPluginVersion(string configPath)
		{
			if (!File.Exists(configPath))
			{
				return null;
			}
			string input = File.ReadAllText(configPath);
			Match match = Regex.Match(input, "(?m)^REPOSettingsModVersion\\s*=\\s*(.+?)\\s*$");
			if (!match.Success)
			{
				match = Regex.Match(input, "(?m)^模组版本号\\s*=\\s*(.+?)\\s*$");
			}
			if (!match.Success)
			{
				match = Regex.Match(input, "(?m)^Mod Version\\s*=\\s*(.+?)\\s*$");
			}
			if (!match.Success)
			{
				return null;
			}
			return match.Groups[1].Value.Trim();
		}

		private void CleanupLegacyConfigFile()
		{
			try
			{
				string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath;
				if (File.Exists(configFilePath))
				{
					string text = File.ReadAllText(configFilePath);
					if (text.Contains("[基础配置]") || text.Contains("[版本信息]") || text.Contains("[全局设置]") || text.Contains("[显示]") || text.Contains("[模组信息]") || text.Contains("[增加UI]") || text.Contains("[A.启动与切场]") || text.Contains("[B.屏幕与镜头效果]") || text.Contains("[C.武器与手臂表现]") || text.Contains("[D.摔倒与动作表现]") || text.Contains("[E.开枪表现]") || text.Contains("[F.死亡与状态表现]") || text.Contains("[G.贵重物表现]") || text.Contains("[H.性能优化]") || text.Contains("[I.大厅与联机]") || text.Contains("[J.大厅与菜单动画]") || text.Contains("[K.世界空间UI]") || text.Contains("[L.升级台演出]") || text.Contains("[M.外观机演出]") || text.Contains("[N.结算演出]") || text.Contains("[O.UI与提示]") || Regex.IsMatch(text, "(?m)^模组启用\\s*=") || Regex.IsMatch(text, "(?m)^界面语言\\s*=") || text.Contains("[B.启动与切场]") || text.Contains("[C.屏幕与镜头效果]") || text.Contains("[D.武器与手臂表现]") || text.Contains("[E.摔倒与动作表现]") || text.Contains("[F.开枪表现]") || text.Contains("[G.死亡与状态表现]") || text.Contains("[H.贵重物表现]") || text.Contains("[J.世界空间UI]") || text.Contains("[K.升级台演出]") || text.Contains("[L.外观机演出]") || text.Contains("[M.结算演出]") || text.Contains("[N.UI与提示]") || text.Contains("[B.全局设置]") || text.Contains("[C.启动与切场]") || text.Contains("[D.大厅与联机]") || text.Contains("[E.屏幕与镜头效果]") || text.Contains("[F.武器与手臂表现]") || text.Contains("[G.摔倒与动作表现]") || text.Contains("[H.开枪表现]") || text.Contains("[I.死亡与状态表现]") || text.Contains("[J.贵重物表现]") || text.Contains("[K.性能优化]") || text.Contains("[L.世界空间UI]") || text.Contains("[M.升级台演出]") || text.Contains("[N.外观机演出]") || text.Contains("[O.结算演出]") || text.Contains("[P.UI与提示]"))
					{
						File.Delete(configFilePath);
						((BaseUnityPlugin)this).Config.Save();
						((BaseUnityPlugin)this).Logger.LogWarning((object)"Legacy config layout detected and rebuilt to current structure.");
					}
				}
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to cleanup legacy config: " + ex.Message));
			}
		}

		private void DetachFromManager()
		{
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		}

		private static void ApplyPatches()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (_harmony == null)
			{
				_harmony = new Harmony("zichen.reposettings");
				PatchHarmonySafely();
			}
		}

		private static bool IsFeatureEnabled(ConfigEntry<bool> configEntry)
		{
			if (IsStaticModEnabled() && configEntry != null)
			{
				return configEntry.Value;
			}
			return false;
		}

		private static void EnsureFpsLabelStyle()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (_fpsLabelStyle == null)
			{
				_fpsLabelStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 18
				};
				_fpsLabelStyle.normal.textColor = Color.white;
			}
		}

		private static void UpdateFpsCounter()
		{
			_fpsAccumulatedTime += Time.unscaledDeltaTime;
			_fpsAccumulatedFrames++;
			if (!(_fpsAccumulatedTime < 1f))
			{
				_fpsDisplayValue = (float)_fpsAccumulatedFrames / _fpsAccumulatedTime;
				_fpsAccumulatedTime = 0f;
				_fpsAccumulatedFrames = 0;
			}
		}

		internal static bool DisableSplashScreenEnabled()
		{
			return IsFeatureEnabled(_cfgDisableSplashScreen);
		}

		internal static bool DisableArmIntroAnimationEnabled()
		{
			return IsFeatureEnabled(_cfgDisableArmIntroAnimation);
		}

		internal static bool DisableLoadingAnimationEnabled()
		{
			return IsFeatureEnabled(_cfgDisableLoadingAnimation);
		}

		internal static bool DisableVideoOverlayEnabled()
		{
			return IsFeatureEnabled(_cfgDisableVideoOverlay);
		}

		internal static bool DisableCameraNoiseEnabled()
		{
			return IsFeatureEnabled(_cfgDisableCameraNoise);
		}

		internal static bool DisableCameraAnimationEnabled()
		{
			return IsFeatureEnabled(_cfgDisableCameraAnimation);
		}

		internal static bool DisableCameraShakeEnabled()
		{
			return IsFeatureEnabled(_cfgDisableCameraShake);
		}

		internal static bool DisableCameraGlitchEnabled()
		{
			return IsFeatureEnabled(_cfgDisableCameraGlitch);
		}

		internal static bool DisableEnemyShadowVeinScreenEffectEnabled()
		{
			return IsFeatureEnabled(_cfgDisableEnemyShadowVeinScreenEffect);
		}

		internal static bool DisablePostProcessingOverridesEnabled()
		{
			return IsFeatureEnabled(_cfgDisablePostProcessingOverrides);
		}

		internal static bool DisableHurtVignetteEnabled()
		{
			return IsFeatureEnabled(_cfgDisableHurtVignette);
		}

		internal static bool DisableMapOpenAnimationEnabled()
		{
			return IsFeatureEnabled(_cfgDisableMapOpenAnimation);
		}

		internal static bool DisableFirstPersonArmAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableFirstPersonArmAnimations);
		}

		internal static bool DisableGunfireCooldownEnabled()
		{
			if (!IsFeatureEnabled(_cfgDisableGunfireCooldown))
			{
				return IsHostDisableGunfireCooldownEnabled();
			}
			return true;
		}

		internal static bool DisableMeleeShakeEnabled()
		{
			return IsFeatureEnabled(_cfgDisableMeleeShake);
		}

		internal static bool DisableMeleeCooldownEnabled()
		{
			if (!IsFeatureEnabled(_cfgDisableMeleeCooldown))
			{
				return IsHostDisableMeleeCooldownEnabled();
			}
			return true;
		}

		internal static bool DisableGunTriggerAnimationEnabled()
		{
			return IsFeatureEnabled(_cfgDisableGunTriggerAnimation);
		}

		internal static bool DisableGunFireShakeEnabled()
		{
			return IsFeatureEnabled(_cfgDisableGunFireShake);
		}

		internal static bool DisableGunRecoilEnabled()
		{
			if (!IsFeatureEnabled(_cfgDisableGunRecoil))
			{
				return IsHostDisableGunRecoilEnabled();
			}
			return true;
		}

		internal static bool DisableGunMuzzleEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableGunMuzzleEffects);
		}

		internal static bool DisableGunSmokeEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableGunSmokeEffects);
		}

		internal static bool DisableDeathAndReviveEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableDeathAndReviveEffects);
		}

		internal static bool DisableSpiderScreenEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableSpiderScreenEffects);
		}

		internal static bool DisableTumbleVisualEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableTumbleVisualEffects);
		}

		internal static bool DisablePhysImpactVisualEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisablePhysImpactVisualEffects);
		}

		internal static bool ThrottleValuableExtractionTrackingEnabled()
		{
			return IsFeatureEnabled(_cfgThrottleValuableExtractionTracking);
		}

		internal static bool ThrottleEnemyInvestigateEnabled()
		{
			return IsFeatureEnabled(_cfgThrottleEnemyInvestigate);
		}

		internal static bool SkipPublicGameJoinConfirmEnabled()
		{
			return IsFeatureEnabled(_cfgSkipPublicGameJoinConfirm);
		}

		internal static bool SkipPrivateGameConfirmEnabled()
		{
			return IsFeatureEnabled(_cfgSkipPrivateGameConfirm);
		}

		internal static bool DisableLobbyPageAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableLobbyPageAnimations);
		}

		internal static bool DisablePopupAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisablePopupAnimations);
		}

		internal static bool DisableServerListEntryAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableServerListEntryAnimations);
		}

		internal static bool DisableRegionListEntryAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableRegionListEntryAnimations);
		}

		internal static bool DisableMenuLoadingGraphicsAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableMenuLoadingGraphicsAnimations);
		}

		internal static bool DisableMenuButtonMotionEnabled()
		{
			return IsFeatureEnabled(_cfgDisableMenuButtonMotion);
		}

		internal static bool EnableValuableMapMarkersEnabled()
		{
			return !IsFeatureEnabled(_cfgEnableValuableMapMarkers);
		}

		internal static bool EnableValuableDiscoverPromptsEnabled()
		{
			return !IsFeatureEnabled(_cfgEnableValuableDiscoverPrompts);
		}

		internal static bool EnableValuableDynamicEffectsEnabled()
		{
			return !IsFeatureEnabled(_cfgEnableValuableDynamicEffects);
		}

		internal static bool DisableWorldSpaceUiAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableWorldSpaceUiAnimations);
		}

		internal static bool DisableUpgradeStandCameraShakeEnabled()
		{
			return IsFeatureEnabled(_cfgDisableUpgradeStandCameraShake);
		}

		internal static bool DisableUpgradeStandAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableUpgradeStandAnimations);
		}

		internal static bool DisableUpgradeStandBrokenFireEnabled()
		{
			return IsFeatureEnabled(_cfgDisableUpgradeStandBrokenFire);
		}

		internal static bool DisableUpgradePotionParticlesEnabled()
		{
			return IsFeatureEnabled(_cfgDisableUpgradePotionParticles);
		}

		internal static bool DisableUpgradeScreenGlitchEnabled()
		{
			return IsFeatureEnabled(_cfgDisableUpgradeScreenGlitch);
		}

		internal static bool DisableUpgradeCameraShakeEnabled()
		{
			return IsFeatureEnabled(_cfgDisableUpgradeCameraShake);
		}

		internal static bool DisableCosmeticMachineGrabBeamEffectsEnabled()
		{
			return IsFeatureEnabled(_cf