Decompiled source of REPOSettings v1.0.1

Zichen-REPOSettings-1.0.1.dll

Decompiled 4 days 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 HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using MenuLib.Structs;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using Photon.Pun;
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.1")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d762a9c70329ce4b425fe1bbc7d98036ebaf2167")]
[assembly: AssemblyProduct("Zichen-REPOSettings-1.0.1")]
[assembly: AssemblyTitle("Zichen-REPOSettings-1.0.1")]
[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.1")]
	[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();
				}
			}
		}

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

			public static BuilderDelegate <>9__18_0;

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

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

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

			public static ShouldCloseMenuDelegate <>9__26_0;

			public static ScrollViewBuilderDelegate <>9__26_1;

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

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

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

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

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

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

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

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

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

			internal bool <AdjustEscapeButtonPosition>b__21_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__22_0(Transform transform)
			{
				return ((Object)transform).name.Contains("Menu Button");
			}

			internal float <CreateMainMenuButton>b__22_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__26_0()
			{
				return true;
			}

			internal RectTransform <OpenSectionPage>b__26_1(Transform scrollView)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(0f, 18f);
				return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val)).rectTransform;
			}

			internal bool <OpenSectionPage>b__26_2(ConfigEntry<bool> entry)
			{
				if (((ConfigEntryBase)entry).Definition.Section == "版本信息")
				{
					return ((ConfigEntryBase)entry).Definition.Key == "语言/Language";
				}
				return false;
			}

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

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

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

			internal bool <GetDisplayedFpsPlusBoolEntries>b__33_1(ConfigEntry<bool> entry)
			{
				return ((ConfigEntryBase)entry).Definition.Section != "基础配置";
			}

			internal bool <GetDisplayedFpsPlusBoolEntries>b__33_2(ConfigEntry<bool> entry)
			{
				return ((ConfigEntryBase)entry).Definition.Section != "I.性能优化";
			}

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

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

		[CompilerGenerated]
		private sealed class <AdjustEscapeButtonPosition>d__21 : 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__21(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 <WaitAndShowCompatibilityPopup>d__53 : 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__53(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.1";

		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 = "版本信息";

		private const string LanguageKey = "语言/Language";

		private static readonly Dictionary<string, string> SectionEnglishNames = new Dictionary<string, string>
		{
			["版本信息"] = "Version Info",
			["A.启动与切场"] = "A.Startup & Transitions",
			["B.大厅与联机"] = "B.Lobby & Online",
			["C.屏幕与镜头效果"] = "C.Screen & Camera",
			["D.武器与手臂表现"] = "D.Weapons & Arms",
			["E.摔倒与动作表现"] = "E.Tumble & Motion",
			["F.开枪表现"] = "F.Gunfire Effects",
			["G.死亡与状态表现"] = "G.Death & Status",
			["H.贵重物表现"] = "H.Valuable Effects",
			["J.世界空间UI"] = "J.World Space UI",
			["K.升级台演出"] = "K.Upgrade Stand",
			["L.外观机演出"] = "L.Cosmetic Machine",
			["M.结算演出"] = "M.Result Screen",
			["N.UI与提示"] = "N.UI & Prompts"
		};

		private static readonly Dictionary<string, string> InfoEnglishNames = new Dictionary<string, string>
		{
			["模组名称"] = "Mod Name",
			["模组版本号"] = "Mod Version",
			["REPO交流QQ群"] = "QQ Group"
		};

		private static readonly Dictionary<string, string> KeyEnglishNames = new Dictionary<string, string>
		{
			["配置生效"] = "Enable Config",
			["显示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",
			["关闭开枪枪口特效"] = "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 Upgrade Stand Shake",
			["关闭升级台粒子与灯光"] = "Disable Upgrade Stand Effects",
			["关闭升级台滚动与舱门动画"] = "Disable Upgrade Stand Animations",
			["关闭升级台损坏起火特效"] = "Disable Upgrade Stand Fire",
			["关闭外观机抓取光束与粒子"] = "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 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<bool> _cfgUseEnglishUi;

		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> _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> _cfgDisableUpgradeStandEffects;

		private static ConfigEntry<bool> _cfgDisableUpgradeStandAnimations;

		private static ConfigEntry<bool> _cfgDisableUpgradeStandBrokenFireEffects;

		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> _cfgSkipRegionEntryPrompt;

		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;

		public static Plugin Instance => _instance;

		private void Awake()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			_instance = this;
			InitializeIntegratedFeatures();
			_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__18_0;
			if (obj == null)
			{
				BuilderDelegate val = delegate(Transform parent)
				{
					//IL_0035: Unknown result type (might be due to invalid IL or missing references)
					REPOButton button = MenuAPI.CreateREPOButton(GetLocalizedText("更多设置", "More Settings"), (Action)OpenQuickSettingsPage, parent, new Vector2(0f, 0f));
					((MonoBehaviour)_instance).StartCoroutine(AdjustEscapeButtonPosition(parent, button));
				};
				<>c.<>9__18_0 = 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.1 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__21))]
		private static IEnumerator AdjustEscapeButtonPosition(Transform parent, REPOButton button)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AdjustEscapeButtonPosition>d__21(0)
			{
				parent = parent,
				button = button
			};
		}

		private static void CreateMainMenuButton(Transform parent)
		{
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: 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");
				}
				Plugin instance3 = _instance;
				if (instance3 != null)
				{
					((BaseUnityPlugin)instance3).Logger.LogInfo((object)$"REPOSettings: main button already exists at pos={val2.localPosition}");
				}
				return;
			}
			REPOButton val3 = 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_00a4: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			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;
			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_0065: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton(GetLocalizedText("返回", "Back"), (Action)delegate
				{
					page.ClosePage(true);
				}, parent, QuickSettingsBackButtonPosition);
				((TMP_Text)MenuAPI.CreateREPOButton(GetLocalizedText("重置全部设置", "Reset All Settings"), (Action)ConfirmResetAllManagedEntries, parent, QuickSettingsResetButtonPosition).labelTMP).fontStyle = (FontStyles)0;
			});
			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);
			Plugin instance2 = _instance;
			if (instance2 != null)
			{
				((BaseUnityPlugin)instance2).Logger.LogInfo((object)"REPOSettings: popup opened");
			}
		}

		private static void OpenSectionPage(string sectionName)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			MenuAPI.CloseAllPagesAddedOnTop();
			REPOPopupPage val = (_currentSectionPage = MenuAPI.CreateREPOPopupPage(GetDisplaySectionName(sectionName), (PresetSide)1, false, false, 8f));
			_currentSectionName = sectionName;
			val.scrollView.scrollSpeed = 3f;
			object obj = <>c.<>9__26_0;
			if (obj == null)
			{
				ShouldCloseMenuDelegate val2 = () => true;
				<>c.<>9__26_0 = val2;
				obj = (object)val2;
			}
			val.onEscapePressed = (ShouldCloseMenuDelegate)obj;
			if (sectionName == "版本信息")
			{
				AddInfoField(val, "模组名称", GetInfoEntryValue("模组名称"));
				AddInfoField(val, "模组版本号", GetInfoEntryValue("模组版本号"));
				AddInfoField(val, "REPO交流QQ群", GetInfoEntryValue("REPO交流QQ群"));
				object obj2 = <>c.<>9__26_1;
				if (obj2 == null)
				{
					ScrollViewBuilderDelegate val3 = delegate(Transform scrollView)
					{
						//IL_0014: Unknown result type (might be due to invalid IL or missing references)
						//IL_001a: Unknown result type (might be due to invalid IL or missing references)
						//IL_001b: Unknown result type (might be due to invalid IL or missing references)
						Vector2 val5 = default(Vector2);
						((Vector2)(ref val5))..ctor(0f, 18f);
						return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val5)).rectTransform;
					};
					<>c.<>9__26_1 = val3;
					obj2 = (object)val3;
				}
				val.AddElementToScrollView((ScrollViewBuilderDelegate)obj2, 0f, 0f);
				ConfigEntry<bool> val4 = GetDisplayedFpsPlusBoolEntries().FirstOrDefault((Func<ConfigEntry<bool>, bool>)((ConfigEntry<bool> entry) => ((ConfigEntryBase)entry).Definition.Section == "版本信息" && ((ConfigEntryBase)entry).Definition.Key == "语言/Language"));
				if (val4 != null)
				{
					AddBoolToggle(val, val4);
				}
			}
			foreach (ConfigEntry<bool> item in from entry in GetDisplayedFpsPlusBoolEntries()
				where ((ConfigEntryBase)entry).Definition.Section == sectionName
				select entry)
			{
				if (!(sectionName == "版本信息") || !(((ConfigEntryBase)item).Definition.Key == "语言/Language"))
				{
					AddBoolToggle(val, item);
				}
			}
			val.OpenPage(true);
			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_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				bool isLanguageEntry = ((ConfigEntryBase)entry).Definition.Key == "语言/Language";
				string text = (isLanguageEntry ? "中文" : GetLocalizedText("开", "On"));
				string text2 = (isLanguageEntry ? "English" : GetLocalizedText("关", "Off"));
				bool flag = (isLanguageEntry ? (!entry.Value) : entry.Value);
				string displayKeyName = GetDisplayKeyName(((ConfigEntryBase)entry).Definition.Key);
				Action<bool> obj = delegate(bool value)
				{
					entry.Value = (isLanguageEntry ? (!value) : value);
					SavePluginConfig("zichen.reposettings");
					if (isLanguageEntry)
					{
						RefreshSettingsPages();
					}
				};
				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;
				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_0036: 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 && value != stableValue)
					{
						inputField.inputStringSystem.SetValue(stableValue, false);
					}
				}, scrollView, Vector2.zero, false, string.Empty, stableValue);
				((TMP_Text)inputField.labelTMP).text = GetDisplayInfoName(labelText);
				((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()
		{
			string currentSectionName = _currentSectionName;
			bool num = (Object)(object)_currentSectionPage != (Object)null && !string.IsNullOrWhiteSpace(currentSectionName);
			REPOPopupPage currentSectionPage = _currentSectionPage;
			if (currentSectionPage != null)
			{
				currentSectionPage.ClosePage(true);
			}
			_currentSectionPage = null;
			REPOPopupPage currentSettingsPage = _currentSettingsPage;
			if (currentSettingsPage != null)
			{
				currentSettingsPage.ClosePage(true);
			}
			_currentSettingsPage = null;
			OpenQuickSettingsPage();
			if (num)
			{
				OpenSectionPage(currentSectionName);
			}
		}

		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 != "基础配置"
				where ((ConfigEntryBase)entry).Definition.Section != "I.性能优化"
				select entry;
		}

		private static string GetInfoEntryValue(string key)
		{
			//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("基础配置", key), ref val) && val != null)
			{
				return val.Value;
			}
			return string.Empty;
		}

		private static string GetDisplaySectionName(string rawSectionName)
		{
			return GetLocalizedMappedText(rawSectionName, SectionEnglishNames);
		}

		private static string GetDisplayKeyName(string rawKeyName)
		{
			if (rawKeyName == "语言/Language")
			{
				return "语言 / Language";
			}
			return GetLocalizedMappedText(rawKeyName, KeyEnglishNames);
		}

		private static string GetDisplayInfoName(string rawKeyName)
		{
			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();
				}
			}
		}

		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__53))]
		private static IEnumerator WaitAndShowCompatibilityPopup(string compatibilityMessage)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitAndShowCompatibilityPopup>d__53(0)
			{
				compatibilityMessage = compatibilityMessage
			};
		}

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

		public static bool IsEnglishUiEnabled()
		{
			if (_cfgUseEnglishUi != null)
			{
				return _cfgUseEnglishUi.Value;
			}
			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.1.");
		}

		private void Update()
		{
			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);
				}
			}
		}

		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()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			((BaseUnityPlugin)this).Config.Bind<string>("基础配置", "模组名称", "更多设置选项", new ConfigDescription("", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 1000,
					ReadOnly = true
				}
			}));
			((BaseUnityPlugin)this).Config.Bind<string>("基础配置", "模组版本号", "1.0.1", new ConfigDescription("", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 990,
					ReadOnly = true
				}
			}));
			((BaseUnityPlugin)this).Config.Bind<string>("基础配置", "REPO交流QQ群", "824639225", new ConfigDescription("", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 980,
					ReadOnly = true
				}
			}));
			_cfgModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("版本信息", "配置生效", true, "总开关");
			_cfgShowFpsCounter = ((BaseUnityPlugin)this).Config.Bind<bool>("版本信息", "显示FPS数值", true, "左上角实时显示FPS");
			_cfgUseEnglishUi = ((BaseUnityPlugin)this).Config.Bind<bool>("版本信息", "语言/Language", false, "选择游戏内显示文本的语言。默认中文,English 会把更多设置里的分类名和开关名切换为英文。");
			_cfgDisableSplashScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭启动画面", true, "关闭启动画面");
			_cfgDisableArmIntroAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭开场手臂动画", false, "关闭开场手臂");
			_cfgDisableLoadingAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭加载与切场动画", false, "关闭加载切场");
			_cfgDisableLobbyPageAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭大厅页面切换动画", false, "关闭大厅页面切换动画");
			_cfgDisablePopupAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭按钮弹窗动画", false, "关闭按钮弹窗动画");
			_cfgDisableServerListEntryAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭房间列表入场动画", false, "关闭房间列表入场动画");
			_cfgDisableRegionListEntryAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭地区列表入场动画", false, "关闭地区列表入场动画");
			_cfgDisableMenuLoadingGraphicsAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭菜单加载图标动画", false, "关闭菜单加载图标动画");
			_cfgDisableMenuButtonMotion = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭主菜单按钮位移动画", false, "关闭主菜单按钮位移动画");
			_cfgDisableLobbyJoiningPromptFade = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭加入玩家提示淡入", false, "关闭加入玩家提示淡入");
			_cfgDisableLeftPrepUiFade = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭左侧准备界面淡入动画", false, "关闭左侧准备界面淡入动画");
			_cfgDisableResultScreenFade = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭结算页淡入淡出", false, "关闭结算页淡入淡出");
			_cfgDisableMoonPhaseUi = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭月相变化界面", false, "关闭月相变化界面");
			_cfgDisableMainMenuTruckAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("A.启动与切场", "关闭主菜单卡车动画", false, "关闭主菜单卡车动画");
			_cfgSkipPublicGameJoinConfirm = ((BaseUnityPlugin)this).Config.Bind<bool>("B.大厅与联机", "跳过公开游戏加入确认", true, "跳过公开房加入提示");
			_cfgSkipPrivateGameConfirm = ((BaseUnityPlugin)this).Config.Bind<bool>("B.大厅与联机", "跳过私人游戏默认确认", true, "跳过私人房默认提示");
			_cfgSkipRegionEntryPrompt = ((BaseUnityPlugin)this).Config.Bind<bool>("B.大厅与联机", "跳过公开/私人游戏区服前提示", false, "跳过区服前提示");
			_cfgDisableVideoOverlay = ((BaseUnityPlugin)this).Config.Bind<bool>("C.屏幕与镜头效果", "关闭屏幕噪点遮罩", false, "关闭噪点遮罩");
			_cfgDisableCameraNoise = ((BaseUnityPlugin)this).Config.Bind<bool>("C.屏幕与镜头效果", "关闭镜头噪声", false, "关闭镜头噪声");
			_cfgDisableCameraAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("C.屏幕与镜头效果", "关闭第一人称镜头动画", false, "关闭走路跳跃镜头动画");
			_cfgDisableCameraShake = ((BaseUnityPlugin)this).Config.Bind<bool>("C.屏幕与镜头效果", "关闭镜头震动", false, "关闭镜头震动");
			_cfgDisableCameraGlitch = ((BaseUnityPlugin)this).Config.Bind<bool>("C.屏幕与镜头效果", "关闭屏幕故障闪屏", false, "关闭故障闪屏");
			_cfgDisableEnemyShadowVeinScreenEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("C.屏幕与镜头效果", "关闭影怪血管屏幕特效", false, "关闭影怪血管屏幕特效");
			_cfgDisablePostProcessingOverrides = ((BaseUnityPlugin)this).Config.Bind<bool>("C.屏幕与镜头效果", "关闭临时后处理特效", false, "关闭临时后处理");
			_cfgDisableHurtVignette = ((BaseUnityPlugin)this).Config.Bind<bool>("C.屏幕与镜头效果", "关闭低血量红框", false, "关闭低血量红框");
			_cfgDisableMapOpenAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("C.屏幕与镜头效果", "关闭打开地图动画", false, "关闭地图开合动画");
			_cfgDisableFirstPersonArmAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("D.武器与手臂表现", "关闭第一人称手臂动作", false, "关闭手臂摆动");
			_cfgDisableTumbleVisualEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("E.摔倒与动作表现", "关闭摔倒特效", false, "关闭摔倒粒子");
			_cfgDisableGunTriggerAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("F.开枪表现", "关闭开枪扳机动画", false, "关闭扳机动画");
			_cfgDisableGunFireShake = ((BaseUnityPlugin)this).Config.Bind<bool>("F.开枪表现", "关闭开枪震动", false, "关闭开枪震动");
			_cfgDisableGunRecoil = ((BaseUnityPlugin)this).Config.Bind<bool>("F.开枪表现", "关闭开枪后坐力", false, "关闭开枪后坐力");
			_cfgDisableGunMuzzleEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("F.开枪表现", "关闭开枪枪口特效", false, "关闭枪口火焰火花");
			_cfgDisableGunSmokeEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("F.开枪表现", "关闭开枪黑烟特效", false, "关闭枪口和落点黑烟");
			_cfgDisableDeathAndReviveEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("G.死亡与状态表现", "关闭死亡与复活特效", false, "关闭死亡复活特效");
			_cfgDisableSpiderScreenEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("G.死亡与状态表现", "关闭蜘蛛贴脸屏幕效果", false, "关闭蜘蛛贴脸效果");
			_cfgEnableValuableMapMarkers = ((BaseUnityPlugin)this).Config.Bind<bool>("H.贵重物表现", "关闭地图贵重物标记", false, "关闭地图贵重物标记");
			_cfgEnableValuableDiscoverPrompts = ((BaseUnityPlugin)this).Config.Bind<bool>("H.贵重物表现", "关闭贵重物发现提示", false, "关闭贵重物发现提示");
			_cfgEnableValuableDynamicEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("H.贵重物表现", "关闭贵重物动态灯光与粒子", false, "关闭贵重物灯光粒子");
			_cfgDisablePhysImpactVisualEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("I.性能优化", "关闭物体碰撞粒子与灯光", false, "关闭碰撞粒子灯光");
			_cfgThrottleValuableExtractionTracking = ((BaseUnityPlugin)this).Config.Bind<bool>("I.性能优化", "贵重物距离跟踪降频", false, "降低距离跟踪频率");
			_cfgThrottleEnemyInvestigate = ((BaseUnityPlugin)this).Config.Bind<bool>("I.性能优化", "敌人调查触发节流", false, "限制高频调查触发");
			_cfgDisableWorldSpaceUiAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("J.世界空间UI", "关闭世界空间UI动画", false, "关闭名字弹字和TTS动画");
			_cfgDisableUpgradeStandCameraShake = ((BaseUnityPlugin)this).Config.Bind<bool>("K.升级台演出", "关闭升级台镜头震动", false, "关闭升级台镜头震动");
			_cfgDisableUpgradeStandEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("K.升级台演出", "关闭升级台粒子与灯光", false, "关闭升级台粒子灯光");
			_cfgDisableUpgradeStandAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("K.升级台演出", "关闭升级台滚动与舱门动画", false, "关闭升级台滚动舱门动画");
			_cfgDisableUpgradeStandBrokenFireEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("K.升级台演出", "关闭升级台损坏起火特效", false, "关闭升级台起火特效");
			_cfgDisableCosmeticMachineGrabBeamEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("L.外观机演出", "关闭外观机抓取光束与粒子", false, "关闭外观机抓取光束粒子");
			_cfgDisableCosmeticMachineCameraShake = ((BaseUnityPlugin)this).Config.Bind<bool>("L.外观机演出", "关闭外观机镜头震动", false, "关闭外观机镜头震动");
			_cfgDisableCosmeticMachineScreenAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("L.外观机演出", "关闭外观机转盘与屏幕动画", false, "关闭外观机转盘屏幕动画");
			_cfgDisableCosmeticMachineLoopEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("L.外观机演出", "关闭外观机循环灯光与音效", false, "关闭外观机循环灯光音效");
			_cfgDisableResultScreenShake = ((BaseUnityPlugin)this).Config.Bind<bool>("M.结算演出", "关闭结算页抖动", false, "关闭结算页抖动");
			_cfgDisableResultScreenTokenParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("M.结算演出", "关闭结算页代币粒子", false, "关闭结算页代币粒子");
			_cfgQuickSkipResultScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("M.结算演出", "快速跳过结算演出", false, "快速跳过结算演出");
			_cfgDisableBatteryUiAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭电池UI弹跳与闪烁", false, "关闭电池UI弹跳闪烁");
			_cfgDisableFlashlightAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭手电开关动画", false, "关闭手电开关动画");
			_cfgDisableFlashlightFlicker = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭手电闪烁表现", false, "关闭手电闪烁表现");
			_cfgDisableLobbyChatAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭大厅聊天跳动动画", false, "关闭大厅聊天跳动动画");
			_cfgDisableGuideArrowUi = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭指引箭头", false, "关闭指引箭头");
			_cfgDisableBigMessageUi = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭大字提示", false, "关闭大字提示");
			_cfgDisableVehicleSpeedParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭载具速度粒子", false, "关闭载具速度粒子");
			_cfgDisableUraniumScreenEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭铀伤害屏幕特效", false, "关闭铀伤害屏幕特效");
			_cfgDisableTumbleWingsUi = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭翻滚翅膀UI", false, "关闭翻滚翅膀UI");
			_cfgDisableTutorialTips = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭教程提示", false, "关闭教程提示");
			_cfgDisableArenaMessages = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭竞技场大字提示", false, "关闭竞技场大字提示");
			_cfgDisableArenaWarningLights = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭竞技场警示灯", false, "关闭竞技场警示灯");
			_cfgDisableArenaRaceTimerAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭竞速计时器动画", false, "关闭竞速计时器动画");
			_cfgDisableTruckScreenLoadingBarAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭卡车屏幕加载条动画", false, "关闭卡车屏幕加载条动画");
			_cfgDisableTruckScreenChatAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭卡车聊天框动画", false, "关闭卡车聊天框动画");
			_cfgDisableBatteryBarEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭电池条浮动特效", false, "关闭电池条浮动特效");
			_cfgDisableValueScreenEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭价值屏幕跳字特效", false, "关闭价值屏幕跳字特效");
			_cfgDisableTutorialUiAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("N.UI与提示", "关闭教程UI动画", false, "关闭教程UI动画");
		}

		private void ResetConfigIfVersionChanged()
		{
			try
			{
				string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath;
				string text = ReadConfigPluginVersion(configFilePath);
				if (!string.IsNullOrWhiteSpace(text) && !(text == "1.0.1"))
				{
					((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;
			}
			Match match = Regex.Match(File.ReadAllText(configPath), "(?m)^模组版本号\\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("[增加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与提示]"))
					{
						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 DisableGunTriggerAnimationEnabled()
		{
			return IsFeatureEnabled(_cfgDisableGunTriggerAnimation);
		}

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

		internal static bool DisableGunRecoilEnabled()
		{
			return IsFeatureEnabled(_cfgDisableGunRecoil);
		}

		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 DisableUpgradeStandEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableUpgradeStandEffects);
		}

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

		internal static bool DisableUpgradeStandBrokenFireEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableUpgradeStandBrokenFireEffects);
		}

		internal static bool DisableCosmeticMachineGrabBeamEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableCosmeticMachineGrabBeamEffects);
		}

		internal static bool DisableCosmeticMachineCameraShakeEnabled()
		{
			return IsFeatureEnabled(_cfgDisableCosmeticMachineCameraShake);
		}

		internal static bool DisableCosmeticMachineScreenAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableCosmeticMachineScreenAnimations);
		}

		internal static bool DisableCosmeticMachineLoopEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableCosmeticMachineLoopEffects);
		}

		internal static bool DisableResultScreenFadeEnabled()
		{
			return IsFeatureEnabled(_cfgDisableResultScreenFade);
		}

		internal static bool DisableResultScreenShakeEnabled()
		{
			return IsFeatureEnabled(_cfgDisableResultScreenShake);
		}

		internal static bool DisableResultScreenTokenParticlesEnabled()
		{
			return IsFeatureEnabled(_cfgDisableResultScreenTokenParticles);
		}

		internal static bool QuickSkipResultScreenEnabled()
		{
			return IsFeatureEnabled(_cfgQuickSkipResultScreen);
		}

		internal static bool DisableBatteryUiAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableBatteryUiAnimations);
		}

		internal static bool DisableFlashlightAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableFlashlightAnimations);
		}

		internal static bool DisableFlashlightFlickerEnabled()
		{
			return IsFeatureEnabled(_cfgDisableFlashlightFlicker);
		}

		internal static bool DisableLobbyChatAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableLobbyChatAnimations);
		}

		internal static bool DisableLobbyJoiningPromptFadeEnabled()
		{
			return IsFeatureEnabled(_cfgDisableLobbyJoiningPromptFade);
		}

		internal static bool DisableLeftPrepUiFadeEnabled()
		{
			return IsFeatureEnabled(_cfgDisableLeftPrepUiFade);
		}

		internal static bool SkipRegionEntryPromptEnabled()
		{
			return IsFeatureEnabled(_cfgSkipRegionEntryPrompt);
		}

		internal static bool DisableMoonPhaseUiEnabled()
		{
			return IsFeatureEnabled(_cfgDisableMoonPhaseUi);
		}

		internal static bool DisableMainMenuTruckAnimationEnabled()
		{
			return IsFeatureEnabled(_cfgDisableMainMenuTruckAnimation);
		}

		internal static bool DisableGuideArrowUiEnabled()
		{
			return IsFeatureEnabled(_cfgDisableGuideArrowUi);
		}

		internal static bool DisableBigMessageUiEnabled()
		{
			return IsFeatureEnabled(_cfgDisableBigMessageUi);
		}

		internal static bool DisableVehicleSpeedParticlesEnabled()
		{
			return IsFeatureEnabled(_cfgDisableVehicleSpeedParticles);
		}

		internal static bool DisableUraniumScreenEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableUraniumScreenEffects);
		}

		internal static bool DisableTumbleWingsUiEnabled()
		{
			return IsFeatureEnabled(_cfgDisableTumbleWingsUi);
		}

		internal static bool DisableTutorialTipsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableTutorialTips);
		}

		internal static bool DisableArenaMessagesEnabled()
		{
			return IsFeatureEnabled(_cfgDisableArenaMessages);
		}

		internal static bool DisableArenaWarningLightsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableArenaWarningLights);
		}

		internal static bool DisableArenaRaceTimerAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableArenaRaceTimerAnimations);
		}

		internal static bool DisableTruckScreenLoadingBarAnimationEnabled()
		{
			return IsFeatureEnabled(_cfgDisableTruckScreenLoadingBarAnimation);
		}

		internal static bool DisableTruckScreenChatAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableTruckScreenChatAnimations);
		}

		internal static bool DisableBatteryBarEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableBatteryBarEffects);
		}

		internal static bool DisableValueScreenEffectsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableValueScreenEffects);
		}

		internal static bool DisableTutorialUiAnimationsEnabled()
		{
			return IsFeatureEnabled(_cfgDisableTutorialUiAnimations);
		}

		internal static void LogPopupEvent(string stage, MenuButtonPopUp menuButtonPopUp, string detail = null)
		{
			if (!((Object)(object)Instance == (Object)null) && !((Object)(object)menuButtonPopUp == (Object)null))
			{
				string text = "Unknown";
				if ((Object)(object)MenuManager.instance != (Object)null)
				{
					text = Traverse.Create((object)MenuManager.instance).Field("currentMenuPageIndex").GetValue()?.ToString() ?? "Unknown";
				}
				string transformPath = GetTransformPath(((Component)menuButtonPopUp).transform);
				string text2 = (string.IsNullOrWhiteSpace(menuButtonPopUp.headerText) ? "<empty>" : menuButtonPopUp.headerText);
				string text3 = (string.IsNullOrWhiteSpace(menuButtonPopUp.bodyText) ? "<empty>" : menuButtonPopUp.bodyText);
				string text4 = (string.IsNullOrWhiteSpace(menuButtonPopUp.option1Text) ? "<empty>" : menuButtonPopUp.option1Text);
				string text5 = (string.IsNullOrWhiteSpace(menuButtonPopUp.option2Text) ? "<empty>" : menuButtonPopUp.option2Text);
				string text6 = string.Join(",", Array.ConvertAll(((Component)menuButtonPopUp).GetComponents<Component>(), (Component component) => (!((Object)(object)component == (Object)null)) ? ((object)component).GetType().Name : "null"));
				((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[Popup:" + stage + "] page=" + text + " path=" + transformPath + " header=" + text2 + " body=" + text3 + " option1=" + text4 + " option2=" + text5 + " components=[" + text6 + "] detail=" + (detail ?? "<none>")));
			}
		}

		private static string GetTransformPath(Transform transform)
		{
			if ((Object)(object)transform == (Object)null)
			{
				return "<null>";
			}
			string text = ((Object)transform).name;
			Transform parent = transform.parent;
			while ((Object)(object)parent != (Object)null)
			{
				text = ((Object)parent).name + "/" + text;
				parent = parent.parent;
			}
			return text;
		}

		internal static bool IsLeftPrepSemiUi(SemiUI semiUi)
		{
			if (!(semiUi is LevelUI) && !(semiUi is GoalUI) && !(semiUi is HaulUI) && !(semiUi is StatsUI))
			{
				return semiUi is MissionUI;
			}
			return true;
		}

		internal static void SnapSemiUiVisible(SemiUI semiUi)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)semiUi == (Object)null))
			{
				Vector2 value = Traverse.Create((object)semiUi).Field("showPosition").GetValue<Vector2>();
				Traverse.Create((object)semiUi).Field("showTimer").SetValue((object)0f);
				Traverse.Create((object)semiUi).Field("hideTimer").SetValue((object)0f);
				Traverse.Create((object)semiUi).Field("hidePositionCurrent").SetValue((object)value);
				Traverse.Create((object)semiUi).Field("showAnimationEvaluation").SetValue((object)1f);
				Traverse.Create((object)semiUi).Field("hideAnimationEvaluation").SetValue((object)0f);
				Traverse.Create((object)semiUi).Field("animationEval").SetValue((object)1f);
				RectTransform value2 = Traverse.Create((object)semiUi).Field("textRectTransform").GetValue<RectTransform>();
				if ((Object)(object)value2 != (Object)null)
				{
					((Transform)value2).localPosition = Vector2.op_Implicit(value);
				}
				Component value3 = Traverse.Create((object)semiUi).Field("uiText").GetValue<Component>();
				if ((Object)(object)value3 != (Object)null)
				{
					Traverse.Create((object)value3).Property("enabled", (object[])null).SetValue((object)true);
				}
				Traverse.Create((object)semiUi).Field("isHidden").SetValue((object)false);
			}
		}

		internal static bool ShouldRunValuableTracking(ValuableObject valuableObject)
		{
			if (!ThrottleValuableExtractionTrackingEnabled() || (Object)(object)valuableObject == (Object)null)
			{
				return true;
			}
			int instanceID = ((Object)valuableObject).GetInstanceID();
			float unscaledTime = Time.unscaledTime;
			if (ValuableTrackingNextRunTimes.TryGetValue(instanceID, out var value) && unscaledTime < value)
			{
				return false;
			}
			ValuableTrackingNextRunTimes[instanceID] = unscaledTime + 0.75f;
			return true;
		}

		internal static bool ShouldRunImpactInvestigate(PhysGrabObjectImpactDetector impactDetector, float radius)
		{
			if (!ThrottleEnemyInvestigateEnabled() || (Object)(object)impactDetector == (Object)null)
			{
				return true;
			}
			float num = ((radius >= 10f) ? 0.2f : ((radius >= 3f) ? 0.35f : 0.5f));
			int instanceID = ((Object)impactDetector).GetInstanceID();
			float unscaledTime = Time.unscaledTime;
			if (ImpactInvestigateNextRunTimes.TryGetValue(instanceID, out var value) && unscaledTime < value)
			{
				return false;
			}
			ImpactInvestigateNextRunTimes[instanceID] = unscaledTime + num;
			return true;
		}

		internal static bool ShouldRunGlobalInvestigate(float radius, bool pathfindOnly)
		{
			if (!ThrottleEnemyInvestigateEnabled() || pathfindOnly || radius > 5f)
			{
				return true;
			}
			float unscaledTime = Time.unscaledTime;
			if (unscaledTime < _nextGlobalInvestigateTime)
			{
				return false;
			}
			_nextGlobalInvestigateTime = unscaledTime + 0.2f;
			return true;
		}

		internal static bool ShouldAllowCameraShakeAtPosition(Vector3 position)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (DisableCameraShakeEnabled())
			{
				return false;
			}
			if (DisableUpgradeStandCameraShakeEnabled())
			{
				UpgradeStand[] array = Object.FindObjectsOfType<UpgradeStand>();
				foreach (UpgradeStand val in array)
				{
					if ((Object)(object)val != (Object)null && Vector3.Distance(((Component)val).transform.position, position) <= 12f)
					{
						return false;
					}
				}
			}
			if (DisableCosmeticMachineCameraShakeEnabled())
			{
				CosmeticShopMachine[] array2 = Object.FindObjectsOfType<CosmeticShopMachine>();
				foreach (CosmeticShopMachine val2 in array2)
				{
					if ((Object)(object)val2 != (Object)null && Vector3.Distance(((Component)val2).transform.position, position) <= 10f)
					{
						return false;
					}
				}
			}
			return true;
		}

		internal static void CompleteSplashScreen()
		{
			SemiFunc.SplashScreenCompleted();
			if ((Object)(object)SplashScreenUI.instance != (Object)null)
			{
				((Component)SplashScreenUI.instance).gameObject.SetActive(false);
			}
			long num = 0L;
			if ((Object)(object)SteamManager.instance != (Object)null && Traverse.Create((object)SteamManager.instance).Field("lobbyIdToAutoJoin").GetValue() is long num2)
			{
				num = num2;
			}
			if ((Object)(object)SteamManager.instance != (Object)null && num != 0L)
			{
				SteamManager.instance.StartAutoJoiningLobby();
				return;
			}
			if ((Object)(object)RunManager.instance != (Object)null)
			{
				Traverse.Create((object)RunManager.instance).Field("skipLoadingUI").SetValue((object)true);
			}
			if ((Object)(object)GameDirector.instance != (Object)null)
			{
				GameDirector.instance.OutroStart();
			}
			if ((Object)(object)ResultScreenUI.instance != (Object)null)
			{
				ResultScreenUI.instance.Disable();
			}
			if ((Object)(object)NetworkManager.instance != (Object)null)
			{
				Traverse.Create((object)NetworkManager.instance).Field("leavePhotonRoom").SetValue((object)true);
			}
		}
	}
	[HarmonyPatch(typeof(SplashScreen), "StateWait")]
	internal static class SplashScreenStateWaitPatch
	{
		private static bool Prefix(SplashScreen __instance)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Invalid comparison between Unknown and I4
			if (!Plugin.DisableSplashScreenEnabled())
			{
				return true;
			}
			if ((Object)(object)VideoOverlay.Instance != (Object)null)
			{
				VideoOverlay.Instance.Override(0.01f, 0f, 30f);
			}
			if ((Object)(object)GameDirector.instance == (Object)null || (int)GameDirector.instance.currentState != 2)
			{
				return false;
			}
			Plugin.CompleteSplashScreen();
			Object.Destroy((Object)(object)((Component)__instance).gameObject);
			return false;
		}
	}
	[HarmonyPatch(typeof(ArmIntroController), "Start")]
	internal static class ArmIntroControllerStartPatch
	{
		private static void Postfix(ArmIntroController __instance)
		{
			if (Plugin.DisableArmIntroAnimationEnabled())
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
			}
		}
	}
	[HarmonyPatch(typeof(LoadingUI), "StartLoading")]
	internal static class LoadingUIStartLoadingPatch
	{
		private static bool Prefix(LoadingUI __instance)
		{
			if (!Plugin.DisableLoadingAnimationEnabled())
			{
				return true;
			}
			Traverse.Create((object)__instance).Field("levelAnimationStarted").SetValue((object)true);
			Traverse.Create((object)__instance).Field("levelAnimationCompleted").SetValue((object)true);
			if ((Object)(object)RunManager.instance != (Object)null)
			{
				Traverse.Create((object)RunManager.instance).Field("skipLoadingUI").SetValue((object)true);
			}
			((Component)__instance).gameObject.SetActive(false);
			return false;
		}
	}
	[HarmonyPatch(typeof(LoadingUI), "LevelAnimationStart")]
	internal static class LoadingUILevelAnimationStartPatch
	{
		private static bool Prefix(LoadingUI __instance)
		{
			if (!Plugin.DisableLoadingAnimationEnabled())
			{
				return true;
			}
			Traverse.Create((object)__instance).Field("levelAnimationStarted").SetValue((object)true);
			Traverse.Create((object)__instance).Field("levelAnimationCompleted").SetValue((object)true);
			((Component)__instance).gameObject.SetActive(false);
			if ((Object)(object)PlayerController.instance != (Object)null && (Object)(object)PlayerController.instance.playerAvatarScript != (Object)null)
			{
				PlayerController.instance.playerAvatarScript.LoadingLevelAnimationCompleted();
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(LoadingUI), "LateUpdate")]
	internal static class LoadingUILateUpdatePatch
	{
		private static bool Prefix(LoadingUI __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.DisableLoadingAnimationEnabled())
			{
				return true;
			}
			if ((Object)(object)__instance.fadeImage != (Object)null)
			{
				((Graphic)__instance.fadeImage).color = Color.clear;
			}
			if ((Object)(object)__instance.fadeBehindImage != (Object)null)
			{
				((Component)__instance.fadeBehindImage).gameObject.SetActive(false);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(VideoOverlay), "Update")]
	internal static class VideoOverlayUpdatePatch
	{
		private static bool Prefix(VideoOverlay __instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.DisableVideoOverlayEnabled())
			{
				return true;
			}
			if ((Object)(object)__instance.RawImage != (Object)null)
			{
				((Graphic)__instance.RawImage).color = new Color(1f, 1f, 1f, 0f);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(CameraShake), "Shake")]
	internal static class CameraShakeShakePatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisableCameraShakeEnabled();
		}
	}
	[HarmonyPatch(typeof(CameraShake), "ShakeDistance")]
	internal static class CameraShakeShakeDistancePatch
	{
		private static bool Prefix(Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return Plugin.ShouldAllowCameraShakeAtPosition(position);
		}
	}
	[HarmonyPatch(typeof(CameraBob), "Update")]
	internal static class CameraBobUpdatePatch
	{
		private static void Postfix(CameraBob __instance)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.DisableCameraAnimationEnabled())
			{
				((Component)__instance).transform.localPosition = Vector3.zero;
				((Component)__instance).transform.localRotation = Quaternion.identity;
			}
		}
	}
	[HarmonyPatch(typeof(CameraJump), "Update")]
	internal static class CameraJumpUpdatePatch
	{
		private static void Postfix(CameraJump __instance)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.DisableCameraAnimationEnabled())
			{
				((Component)__instance).transform.localPosition = Vector3.zero;
				((Component)__instance).transform.localRotation = Quaternion.identity;
			}
		}
	}
	[HarmonyPatch(typeof(CameraCrouchPosition), "Update")]
	internal static class CameraCrouchPositionUpdatePatch
	{
		private static void Postfix(CameraCrouchPosition __instance)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.DisableCameraAnimationEnabled())
			{
				((Component)__instance).transform.localPosition = Vector3.zero;
			}
		}
	}
	[HarmonyPatch(typeof(CameraCrawlPosition), "Update")]
	internal static class CameraCrawlPositionUpdatePatch
	{
		private static void Postfix(CameraCrawlPosition __instance)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.DisableCameraAnimationEnabled())
			{
				((Component)__instance).transform.localPosition = Vector3.zero;
			}
		}
	}
	[HarmonyPatch(typeof(CameraCrouchRotation), "Update")]
	internal static class CameraCrouchRotationUpdatePatch
	{
		private static void Postfix(CameraCrouchRotation __instance)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.DisableCameraAnimationEnabled())
			{
				((Component)__instance).transform.localRotation = Quaternion.identity;
			}
		}
	}
	[HarmonyPatch(typeof(CameraGlitch), "Update")]
	internal static class CameraGlitchUpdatePatch
	{
		private static bool Prefix(CameraGlitch __instance)
		{
			if (!Plugin.DisableCameraGlitchEnabled())
			{
				return true;
			}
			if ((Object)(object)__instance.ActiveParent != (Object)null)
			{
				__instance.ActiveParent.SetActive(false);
			}
			Sound doNotLookEffectSound = __instance.doNotLookEffectSound;
			if (doNotLookEffectSound != null)
			{
				doNotLookEffectSound.PlayLoop(false, 2f, 1f, 1f, 1f);
			}
			Traverse.Create((object)__instance).Field("doNotLookEffectTimer").SetValue((object)0f);
			Traverse.Create((object)__instance).Field("doNotLookEffectImpulseTimer").SetValue((object)0f);
			return false;
		}
	}
	[HarmonyPatch(typeof(CameraGlitch), "DoNotLookEffectSet")]
	internal static class CameraGlitchDoNotLookEffectSetPatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisableCameraGlitchEnabled();
		}
	}
	[HarmonyPatch(typeof(CameraGlitch), "PlayLong")]
	internal static class CameraGlitchPlayLongPatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisableCameraGlitchEnabled();
		}
	}
	[HarmonyPatch(typeof(CameraGlitch), "PlayShort")]
	internal static class CameraGlitchPlayShortPatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisableCameraGlitchEnabled();
		}
	}
	[HarmonyPatch(typeof(CameraGlitch), "PlayTiny")]
	internal static class CameraGlitchPlayTinyPatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisableCameraGlitchEnabled();
		}
	}
	[HarmonyPatch(typeof(CameraGlitch), "PlayLongHurt")]
	internal static class CameraGlitchPlayLongHurtPatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisableCameraGlitchEnabled();
		}
	}
	[HarmonyPatch(typeof(CameraGlitch), "PlayShortHurt")]
	internal static class CameraGlitchPlayShortHurtPatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisableCameraGlitchEnabled();
		}
	}
	[HarmonyPatch(typeof(CameraGlitch), "PlayLongHeal")]
	internal static class CameraGlitchPlayLongHealPatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisableCameraGlitchEnabled();
		}
	}
	[HarmonyPatch(typeof(CameraGlitch), "PlayShortHeal")]
	internal static class CameraGlitchPlayShortHealPatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisableCameraGlitchEnabled();
		}
	}
	[HarmonyPatch(typeof(CameraGlitch), "PlayUpgrade")]
	internal static class CameraGlitchPlayUpgradePatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisableCameraGlitchEnabled();
		}
	}
	[HarmonyPatch(typeof(PostProcessing), "LensDistortionOverride")]
	internal static class PostProcessingLensDistortionOverridePatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisablePostProcessingOverridesEnabled();
		}
	}
	[HarmonyPatch(typeof(PostProcessing), "VignetteOverride")]
	internal static class PostProcessingVignetteOverridePatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisablePostProcessingOverridesEnabled();
		}
	}
	[HarmonyPatch(typeof(PostProcessing), "BloomOverride")]
	internal static class PostProcessingBloomOverridePatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisablePostProcessingOverridesEnabled();
		}
	}
	[HarmonyPatch(typeof(PostProcessing), "SaturationOverride")]
	internal static class PostProcessingSaturationOverridePatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisablePostProcessingOverridesEnabled();
		}
	}
	[HarmonyPatch(typeof(PostProcessing), "ContrastOverride")]
	internal static class PostProcessingContrastOverridePatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisablePostProcessingOverridesEnabled();
		}
	}
	[HarmonyPatch(typeof(PostProcessing), "ResolutionOverride")]
	internal static class PostProcessingResolutionOverridePatch
	{
		private static bool Prefix()
		{
			return !Plugin.DisablePostProcessingOverridesEnabled();
		}
	}
	[HarmonyPatch(typeof(PostProcessing), "GrainIntensityOverride")]
	internal static class PostProcessingGrainIntensityOverridePatch
	{
		private stat