Decompiled source of MonitorEnhance v2024.3.2101

MonitorEnhance.dll

Decompiled 8 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using GeneralImprovements;
using LethalCompanyInputUtils.Api;
using LethalExpansionCore;
using Microsoft.CodeAnalysis;
using MonitorEnhance.Lang;
using MonitorEnhance.Utils;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.DualShock;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MonitorEnhance")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MonitorEnhance")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d0b089b6-9241-47f0-adee-410959241c45")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MonitorEnhance
{
	public class MonitorEnhanceInputClass : LcInputActions
	{
		public static readonly MonitorEnhanceInputClass Instance = new MonitorEnhanceInputClass();

		[InputAction("<Mouse>/leftButton", ActionId = "MonitorEnhance:Primary", Name = "Primary")]
		public InputAction PRIMARY
		{
			get
			{
				return InputUtil.INPUT_PRIMARY;
			}
			set
			{
				InputUtil.INPUT_PRIMARY = value;
			}
		}

		[InputAction("<Mouse>/rightButton", ActionId = "MonitorEnhance:Secondary", Name = "Secondary")]
		public InputAction SECONDARY
		{
			get
			{
				return InputUtil.INPUT_SECONDARY;
			}
			set
			{
				InputUtil.INPUT_SECONDARY = value;
			}
		}

		[InputAction("<Keyboard>/e", ActionId = "MonitorEnhance:QuickSwitch", Name = "QuickSwitch")]
		public InputAction QUICK_SWITCH
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH = value;
			}
		}

		[InputAction("<Keyboard>/q", ActionId = "MonitorEnhance:AltQuickSwitch", Name = "Alt QuickSwitch")]
		public InputAction ALT_QUICK_SWITCH
		{
			get
			{
				return InputUtil.INPUT_ALT_QUICKSWITCH;
			}
			set
			{
				InputUtil.INPUT_ALT_QUICKSWITCH = value;
			}
		}

		[InputAction("<Keyboard>/leftShift", ActionId = "MonitorEnhance:DoorSwitch", Name = "DoorSwitch")]
		public InputAction DOOR_SWITCH
		{
			get
			{
				return InputUtil.INPUT_DOOR_SWITCH;
			}
			set
			{
				InputUtil.INPUT_DOOR_SWITCH = value;
			}
		}

		[InputAction("<Keyboard>/r", ActionId = "MonitorEnhance:SelectTarget", Name = "SelectTarget")]
		public InputAction SELECT_TARGET
		{
			get
			{
				return InputUtil.INPUT_SELECT_TARGET;
			}
			set
			{
				InputUtil.INPUT_SELECT_TARGET = value;
			}
		}

		[InputAction("<Keyboard>/1", ActionId = "MonitorEnhance:QuickSwitch1", Name = "QuickSwitch Player1")]
		public InputAction QUICK_SWITCH_1
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH_1;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH_1 = value;
			}
		}

		[InputAction("<Keyboard>/2", ActionId = "MonitorEnhance:QuickSwitch2", Name = "QuickSwitch Player2")]
		public InputAction QUICK_SWITCH_2
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH_2;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH_2 = value;
			}
		}

		[InputAction("<Keyboard>/3", ActionId = "MonitorEnhance:QuickSwitch3", Name = "QuickSwitch Player3")]
		public InputAction QUICK_SWITCH_3
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH_3;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH_3 = value;
			}
		}

		[InputAction("<Keyboard>/4", ActionId = "MonitorEnhance:QuickSwitch4", Name = "QuickSwitch Player4")]
		public InputAction QUICK_SWITCH_4
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH_4;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH_4 = value;
			}
		}

		[InputAction("<Keyboard>/5", ActionId = "MonitorEnhance:QuickSwitch5", Name = "QuickSwitch Player5")]
		public InputAction QUICK_SWITCH_5
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH_5;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH_5 = value;
			}
		}

		[InputAction("<Keyboard>/6", ActionId = "MonitorEnhance:QuickSwitch6", Name = "QuickSwitch Player6")]
		public InputAction QUICK_SWITCH_6
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH_6;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH_6 = value;
			}
		}

		[InputAction("<Keyboard>/7", ActionId = "MonitorEnhance:QuickSwitch7", Name = "QuickSwitch Player7")]
		public InputAction QUICK_SWITCH_7
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH_7;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH_7 = value;
			}
		}

		[InputAction("<Keyboard>/8", ActionId = "MonitorEnhance:QuickSwitch8", Name = "QuickSwitch Player8")]
		public InputAction QUICK_SWITCH_8
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH_8;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH_8 = value;
			}
		}

		[InputAction("<Keyboard>/9", ActionId = "MonitorEnhance:QuickSwitch9", Name = "QuickSwitch Player9")]
		public InputAction QUICK_SWITCH_9
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH_9;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH_9 = value;
			}
		}

		[InputAction("<Keyboard>/0", ActionId = "MonitorEnhance:QuickSwitch0", Name = "QuickSwitch Player0")]
		public InputAction QUICK_SWITCH_0
		{
			get
			{
				return InputUtil.INPUT_QUICKSWITCH_0;
			}
			set
			{
				InputUtil.INPUT_QUICKSWITCH_0 = value;
			}
		}
	}
	internal static class MapCameraExtension
	{
		private static PlayerControllerB LOCAL_PLAYER => GameNetworkManager.Instance?.localPlayerController;

		public static TransformAndName GetCurrentRadarTarget(this ManualCameraRenderer renderer)
		{
			int targetTransformIndex = renderer.targetTransformIndex;
			if (targetTransformIndex < 0)
			{
				return null;
			}
			return renderer.radarTargets[targetTransformIndex];
		}

		public static int GetNextPlayerIdx(this ManualCameraRenderer renderer)
		{
			for (int i = ((!renderer.GetCurrentRadarTarget().isNonPlayer) ? ((renderer.targetTransformIndex < renderer.radarTargets.Count - 1) ? (renderer.targetTransformIndex + 1) : 0) : 0); i <= renderer.radarTargets.Count; i++)
			{
				if (i == renderer.radarTargets.Count)
				{
					i = 0;
				}
				TransformAndName val = renderer.radarTargets[i];
				if (val != null && ((Component)val.transform).gameObject.activeSelf && val != null && !val.isNonPlayer)
				{
					return i;
				}
			}
			return renderer.targetTransformIndex;
		}

		public static int GetNextRadarIdx(this ManualCameraRenderer renderer)
		{
			for (int i = (renderer.GetCurrentRadarTarget().isNonPlayer ? ((renderer.targetTransformIndex < renderer.radarTargets.Count - 1) ? (renderer.targetTransformIndex + 1) : 0) : 0); i < renderer.radarTargets.Count; i++)
			{
				TransformAndName val = renderer.radarTargets[i];
				if (val != null && ((Component)val.transform).gameObject.activeSelf && val != null && val.isNonPlayer)
				{
					return i;
				}
			}
			return renderer.targetTransformIndex;
		}

		public static void SwitchMonitorPlayer(this ManualCameraRenderer renderer)
		{
			renderer.SwitchRadarTargetAndSync(renderer.GetNextPlayerIdx());
		}

		public static void SwitchMonitorRadar(this ManualCameraRenderer renderer)
		{
			renderer.SwitchRadarTargetAndSync(renderer.GetNextRadarIdx());
		}

		public static void SwitchRadarTargetByNum(this ManualCameraRenderer renderer, int target)
		{
			int i = 0;
			int num = 0;
			if (target == 0)
			{
				for (; i < renderer.radarTargets.Count; i++)
				{
					if (((object)((Component)renderer.radarTargets[i].transform).GetComponent<PlayerControllerB>()).Equals((object?)LOCAL_PLAYER))
					{
						renderer.SwitchRadarTargetAndSync(i);
						break;
					}
				}
				return;
			}
			for (; i < renderer.radarTargets.Count; i++)
			{
				TransformAndName val = renderer.radarTargets[i];
				PlayerControllerB component = ((Component)val.transform).GetComponent<PlayerControllerB>();
				if (val != null && ((Component)val.transform).gameObject.activeSelf && val != null && !val.isNonPlayer && !((object)component).Equals((object?)LOCAL_PLAYER))
				{
					if (++num == target)
					{
						renderer.SwitchRadarTargetAndSync(i);
						break;
					}
					if (num > target)
					{
						break;
					}
				}
			}
		}
	}
	[BepInProcess("Lethal Company.exe")]
	[BepInPlugin("Paimon-Kawaii_MonitorEnhance", "MonitorEnhance", "2024.03.13")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal delegate R Func<R, T>(T value);

		internal delegate R Supplier<R>();

		internal static ManualLogSource LOGGER;

		internal static Func<Bounds, GameObject> CREATE_BOUNDS;

		private static bool _override = true;

		private static bool _onPlanet = false;

		public static bool IsActive
		{
			get
			{
				if (_onPlanet)
				{
					if (!_override)
					{
						return ConfigUtil.IGNORE_OVERRIDE;
					}
					return true;
				}
				return false;
			}
			set
			{
				if (_override != value)
				{
					_override = value;
					MethodBase method = new StackTrace().GetFrame(1).GetMethod();
					LOGGER.LogInfo((object)string.Format("MonitorEnhance was {0} by {1}.{2}.{3}", value ? "enabled" : "disabled", method.ReflectedType.Namespace, method.ReflectedType.Name, method.Name));
				}
			}
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			_onPlanet = false;
			if (PlanetUtil.IsPlanet(scene))
			{
				StartOfRound instance = StartOfRound.Instance;
				object obj;
				if (instance == null)
				{
					obj = null;
				}
				else
				{
					ManualCameraRenderer mapScreen = instance.mapScreen;
					obj = ((mapScreen != null) ? ((Component)mapScreen.mesh).gameObject : null);
				}
				GameObject val = (GameObject)obj;
				if ((Object)(object)val != (Object)null && (Object)(object)val.GetComponent<ScreenScript>() == (Object)null)
				{
					val.AddComponent<ScreenScript>();
				}
				_onPlanet = true;
			}
		}

		private void OnSceneUnloaded(Scene scene)
		{
			_onPlanet = false;
		}

		private void Awake()
		{
			LOGGER = ((BaseUnityPlugin)this).Logger;
			string pluginFolder = Path.Combine(Paths.PluginPath, "MonitorEnhance");
			SceneManager.sceneLoaded += OnSceneLoaded;
			SceneManager.sceneUnloaded += OnSceneUnloaded;
			ConfigUtil.Setup(((BaseUnityPlugin)this).Config, pluginFolder);
			InputUtil.Setup();
			PlanetUtil.CheckPlugins();
			if (Chainloader.PluginInfos.TryGetValue("ShaosilGaming.GeneralImprovements", out var value) && _gi())
			{
				CREATE_BOUNDS = (GameObject x) => new Bounds(new Vector3(x.transform.position.x + -0.2f, x.transform.position.y + -0.05f, x.transform.position.z + 0.03f), new Vector3(0f, 1.05f, 1.36f));
				LOGGER.LogInfo((object)$"> Hooked into GeneralImprovements {value.Metadata.Version}");
			}
			else
			{
				CREATE_BOUNDS = (GameObject x) => new Bounds(new Vector3(x.transform.position.x + 0.06f, x.transform.position.y + -0.05f, x.transform.position.z + 0.84f), new Vector3(0f, 1.05f, 1.36f));
			}
			LOGGER.LogInfo((object)"Enabled MonitorEnhance");
			LOGGER.LogInfo((object)"Special Thanks to TheDeadSnake's TouchScreen");
			static bool _gi()
			{
				return Plugin.UseBetterMonitors.Value;
			}
		}
	}
	public class ScreenScript : MonoBehaviour
	{
		private TransformAndName _selectedTarget;

		private const float _isCloseMax = 2f;

		private bool _isLookingAtMonitor;

		private bool _isTargetSelected;

		private float _tpCoolDown;

		private static PlayerControllerB LOCAL_PLAYER => GameNetworkManager.Instance?.localPlayerController;

		private static ManualCameraRenderer MAP_RENDERER => StartOfRound.Instance?.mapScreen;

		private static TransformAndName RADAR_TARGET => MAP_RENDERER.GetCurrentRadarTarget();

		private Bounds GetMonitorScreenBounds()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			return Plugin.CREATE_BOUNDS(((Component)this).gameObject);
		}

		private bool GetMonitorCameraRay(out Ray camRay)
		{
			//IL_007b: 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)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB lOCAL_PLAYER = LOCAL_PLAYER;
			if (lOCAL_PLAYER != null && lOCAL_PLAYER.isInHangarShipRoom)
			{
				Ray val = default(Ray);
				((Ray)(ref val))..ctor(((Component)lOCAL_PLAYER.gameplayCamera).transform.position, ((Component)lOCAL_PLAYER.gameplayCamera).transform.forward);
				Bounds monitorScreenBounds = GetMonitorScreenBounds();
				float num = default(float);
				if (((Bounds)(ref monitorScreenBounds)).IntersectRay(val, ref num) && num <= lOCAL_PLAYER.grabDistance)
				{
					camRay = MAP_RENDERER.cam.ViewportPointToRay(GetMonitorCoordinates(monitorScreenBounds, ((Ray)(ref val)).GetPoint(num)));
					return true;
				}
			}
			camRay = default(Ray);
			return false;
		}

		private bool IsLookingAtMonitor()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB lOCAL_PLAYER = LOCAL_PLAYER;
			if (lOCAL_PLAYER != null && lOCAL_PLAYER.isInHangarShipRoom)
			{
				Ray val = default(Ray);
				((Ray)(ref val))..ctor(((Component)lOCAL_PLAYER.gameplayCamera).transform.position, ((Component)lOCAL_PLAYER.gameplayCamera).transform.forward);
				Bounds monitorScreenBounds = GetMonitorScreenBounds();
				float num = default(float);
				if (((Bounds)(ref monitorScreenBounds)).IntersectRay(val, ref num) && num <= lOCAL_PLAYER.grabDistance * 1.5f)
				{
					return true;
				}
			}
			return false;
		}

		private Vector3 GetMonitorCoordinates(Bounds bounds, Vector3 point)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(1f - 1f / Math.Abs(((Bounds)(ref bounds)).max.z - ((Bounds)(ref bounds)).min.z) * (point.z - ((Bounds)(ref bounds)).min.z), 1f / Math.Abs(((Bounds)(ref bounds)).max.y - ((Bounds)(ref bounds)).min.y) * (point.y - ((Bounds)(ref bounds)).min.y), 0f);
		}

		internal void OnSelectTarget()
		{
			if (Plugin.IsActive && _isLookingAtMonitor)
			{
				TransformAndName rADAR_TARGET = RADAR_TARGET;
				if (rADAR_TARGET != null)
				{
					_selectedTarget = rADAR_TARGET;
					_isTargetSelected = true;
				}
			}
		}

		internal void OnPlayerInteraction(bool isSecondary)
		{
			if (!Plugin.IsActive || !_isLookingAtMonitor || LOCAL_PLAYER == null)
			{
				return;
			}
			if (_isTargetSelected)
			{
				TransformAndName selectedTarget = _selectedTarget;
				if (selectedTarget.isNonPlayer)
				{
					TriggerRadar(((Component)selectedTarget.transform).GetComponent<RadarBoosterItem>(), isSecondary);
				}
				else if (!isSecondary)
				{
					Teleport();
				}
				else
				{
					TriggerTrap();
				}
			}
			else if (isSecondary)
			{
				TriggerTrap();
			}
		}

		private void TriggerRadar(RadarBoosterItem rItem, bool isSecondary)
		{
			if (rItem != null)
			{
				if (isSecondary)
				{
					rItem.FlashAndSync();
				}
				else
				{
					rItem.PlayPingAudioAndSync();
				}
			}
		}

		private void Teleport(bool isInverse = false)
		{
			ShipTeleporter val = (from x in Object.FindObjectsOfType<ShipTeleporter>()
				where x.isInverseTeleporter == isInverse
				select x).FirstOrDefault();
			if (val != null)
			{
				TransformAndName selectedTarget = _selectedTarget;
				Plugin.LOGGER.LogInfo((object)("> 传送: " + selectedTarget.name));
				if (selectedTarget != null && !((float)typeof(ShipTeleporter).GetField("cooldownTime", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val) > 5f))
				{
					val.PressTeleportButtonOnLocalClient();
				}
			}
		}

		private void TriggerTrap()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.IsActive || !_isLookingAtMonitor || !GetMonitorCameraRay(out var camRay))
			{
				return;
			}
			Collider[] array = Physics.OverlapCapsule(((Ray)(ref camRay)).GetPoint(0f), ((Ray)(ref camRay)).GetPoint(10f), 2f);
			for (int i = 0; i < array.Length; i++)
			{
				TerminalAccessibleObject component = ((Component)array[i]).GetComponent<TerminalAccessibleObject>();
				if (component != null)
				{
					component.CallFunctionFromTerminal();
				}
			}
			TransformAndName selectedTarget = _selectedTarget;
			if (selectedTarget == null)
			{
				return;
			}
			PlayerControllerB component2 = ((Component)selectedTarget.transform).GetComponent<PlayerControllerB>();
			if (component2 == null)
			{
				return;
			}
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(selectedTarget.transform.position.x, selectedTarget.transform.position.y);
			TerminalAccessibleObject[] array2 = Object.FindObjectsOfType<TerminalAccessibleObject>();
			Vector2 val3 = default(Vector2);
			foreach (TerminalAccessibleObject val2 in array2)
			{
				if (!val2.isBigDoor)
				{
					((Vector2)(ref val3))..ctor(((Component)val2).transform.position.x, ((Component)val2).transform.position.y);
					Vector2 val4 = val - val3;
					float magnitude = ((Vector2)(ref val4)).magnitude;
					Plugin.LOGGER.LogInfo((object)$"> [{val2.objectCode}] 与 {((Object)component2).name} 距离: {magnitude}");
					if (magnitude <= component2.grabDistance * 4f)
					{
						val2.CallFunctionFromTerminal();
					}
				}
			}
		}

		internal void ShipDoor()
		{
			if (Plugin.IsActive && _isLookingAtMonitor)
			{
				GameObject gameObject = ((Component)Object.FindObjectOfType<HangarShipDoor>()).gameObject;
				string animation = "CloseDoor";
				if (StartOfRound.Instance.hangarDoorsClosed)
				{
					animation = "OpenDoor";
				}
				AnimatedObjectTrigger obj = gameObject.GetComponentsInChildren<AnimatedObjectTrigger>().First((AnimatedObjectTrigger trigger) => trigger.animationString == animation);
				if (obj != null)
				{
					((UnityEvent<PlayerControllerB>)(object)((Component)obj).GetComponentInParent<InteractTrigger>().onInteract).Invoke(GameNetworkManager.Instance?.localPlayerController);
				}
			}
		}

		internal void OnMonitorQuickSwitch(bool isPlayer)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.IsActive || !_isLookingAtMonitor)
			{
				return;
			}
			PlayerControllerB lOCAL_PLAYER = LOCAL_PLAYER;
			Vector3 val = ((Component)this).gameObject.transform.position - ((Component)lOCAL_PLAYER).transform.position;
			if (Math.Abs(val.x) + Math.Abs(val.y) + Math.Abs(val.z) < 10f)
			{
				if (isPlayer)
				{
					MAP_RENDERER.SwitchMonitorPlayer();
				}
				else
				{
					MAP_RENDERER.SwitchMonitorRadar();
				}
			}
		}

		internal void OnPlayerQuickSwitchByNum()
		{
			if (Plugin.IsActive && _isLookingAtMonitor)
			{
				if (InputUtil.INPUT_QUICKSWITCH_1.IsPressed())
				{
					MAP_RENDERER.SwitchRadarTargetByNum(1);
				}
				else if (InputUtil.INPUT_QUICKSWITCH_2.IsPressed())
				{
					MAP_RENDERER.SwitchRadarTargetByNum(2);
				}
				else if (InputUtil.INPUT_QUICKSWITCH_3.IsPressed())
				{
					MAP_RENDERER.SwitchRadarTargetByNum(3);
				}
				else if (InputUtil.INPUT_QUICKSWITCH_4.IsPressed())
				{
					MAP_RENDERER.SwitchRadarTargetByNum(4);
				}
				else if (InputUtil.INPUT_QUICKSWITCH_5.IsPressed())
				{
					MAP_RENDERER.SwitchRadarTargetByNum(5);
				}
				else if (InputUtil.INPUT_QUICKSWITCH_6.IsPressed())
				{
					MAP_RENDERER.SwitchRadarTargetByNum(6);
				}
				else if (InputUtil.INPUT_QUICKSWITCH_7.IsPressed())
				{
					MAP_RENDERER.SwitchRadarTargetByNum(7);
				}
				else if (InputUtil.INPUT_QUICKSWITCH_8.IsPressed())
				{
					MAP_RENDERER.SwitchRadarTargetByNum(8);
				}
				else if (InputUtil.INPUT_QUICKSWITCH_9.IsPressed())
				{
					MAP_RENDERER.SwitchRadarTargetByNum(9);
				}
				else if (InputUtil.INPUT_QUICKSWITCH_0.IsPressed())
				{
					MAP_RENDERER.SwitchRadarTargetByNum(0);
				}
			}
		}

		private void OnEnable()
		{
			InputUtil.SCREEN_SCRIPT = this;
			if (LOCAL_PLAYER == null)
			{
				Plugin.LOGGER.LogWarning((object)"Unable to activate monitor touchscreen. Reason: Failed to get local player.");
			}
		}

		private void OnDisable()
		{
			InputUtil.SCREEN_SCRIPT = null;
		}

		private void Update()
		{
			_tpCoolDown -= Time.deltaTime;
			if (_tpCoolDown < 0f)
			{
				_tpCoolDown = 0f;
			}
			PlayerControllerB lOCAL_PLAYER = LOCAL_PLAYER;
			lOCAL_PLAYER.isGrabbingObjectAnimation = false;
			if (!Plugin.IsActive)
			{
				return;
			}
			_isLookingAtMonitor = IsLookingAtMonitor();
			if (!_isLookingAtMonitor)
			{
				return;
			}
			lOCAL_PLAYER.isGrabbingObjectAnimation = true;
			((Behaviour)lOCAL_PLAYER.cursorIcon).enabled = true;
			lOCAL_PLAYER.cursorIcon.sprite = ConfigUtil.HOVER_ICON;
			if (_isTargetSelected && RADAR_TARGET != _selectedTarget)
			{
				_isTargetSelected = false;
			}
			if (!ConfigUtil.SELECT_REQUIRE)
			{
				_selectedTarget = RADAR_TARGET;
				_isTargetSelected = true;
			}
			if (ConfigUtil.CONFIG_SHOW_TOOLTIP.Value)
			{
				TransformAndName val = _selectedTarget;
				if (!_isTargetSelected)
				{
					val = RADAR_TARGET;
				}
				((TMP_Text)lOCAL_PLAYER.cursorTip).text = string.Empty;
				TextMeshProUGUI cursorTip = lOCAL_PLAYER.cursorTip;
				((TMP_Text)cursorTip).text = ((TMP_Text)cursorTip).text + "[ " + InputUtil.GetButtonDescription(InputUtil.INPUT_DOOR_SWITCH) + " ] " + (StartOfRound.Instance.hangarDoorsClosed ? LocalizationManager.GetString("Open") : LocalizationManager.GetString("Close")) + LocalizationManager.GetString("ShipDoor") + "\n";
				TextMeshProUGUI cursorTip2 = lOCAL_PLAYER.cursorTip;
				((TMP_Text)cursorTip2).text = ((TMP_Text)cursorTip2).text + (_isTargetSelected ? ("[ " + InputUtil.GetButtonDescription(InputUtil.INPUT_PRIMARY) + " ] " + (val.isNonPlayer ? LocalizationManager.GetString("PingRadar") : LocalizationManager.GetString("TPPlayer")) + "\n[ " + InputUtil.GetButtonDescription(InputUtil.INPUT_SECONDARY) + " ] " + (val.isNonPlayer ? LocalizationManager.GetString("FlashRadar") : LocalizationManager.GetString("TriggerTrap")) + "\n") : ("[ " + InputUtil.GetButtonDescription(InputUtil.INPUT_SELECT_TARGET) + " ] " + LocalizationManager.GetString("SelectTarget") + "\n[ " + InputUtil.GetButtonDescription(InputUtil.INPUT_SECONDARY) + " ] " + LocalizationManager.GetString("TriggerTrap") + "\n"));
				cursorTip = lOCAL_PLAYER.cursorTip;
				((TMP_Text)cursorTip).text = ((TMP_Text)cursorTip).text + "[ " + InputUtil.GetButtonDescription(InputUtil.INPUT_QUICKSWITCH) + " & 0-9 ] " + LocalizationManager.GetString("SwitchPlayer") + "\n";
				cursorTip = lOCAL_PLAYER.cursorTip;
				((TMP_Text)cursorTip).text = ((TMP_Text)cursorTip).text + "[ " + InputUtil.GetButtonDescription(InputUtil.INPUT_ALT_QUICKSWITCH) + " ] " + LocalizationManager.GetString("SwitchRadar") + "\n";
			}
		}
	}
	public static class ConfigUtil
	{
		public static Sprite HOVER_ICON { get; private set; }

		public static ConfigEntry<string> CONFIG_PRIMARY { get; private set; }

		public static ConfigEntry<string> CONFIG_SECONDARY { get; private set; }

		public static ConfigEntry<string> CONFIG_QUICK_SWITCH { get; private set; }

		public static ConfigEntry<string> CONFIG_DOOR_SWITCH { get; private set; }

		public static ConfigEntry<string> CONFIG_SELECT_TARGET { get; private set; }

		public static ConfigEntry<string> CONFIG_ALT_QUICK_SWITCH { get; private set; }

		public static ConfigEntry<bool> CONFIG_SELECT_REQUIRE { get; private set; }

		public static ConfigEntry<bool> CONFIG_SHOW_TOOLTIP { get; private set; }

		public static ConfigEntry<string> CONFIG_LANGUAGE { get; private set; }

		public static bool IGNORE_OVERRIDE { get; private set; } = false;


		public static bool SELECT_REQUIRE { get; private set; } = true;


		internal static void Setup(ConfigFile config, string pluginFolder)
		{
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Expected O, but got Unknown
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			CONFIG_LANGUAGE = config.Bind<string>("Config", "Languge", "en_US", "Mod languge");
			CONFIG_PRIMARY = config.Bind<string>("Layout", "Primary", "<Mouse>/leftButton", "Name of the key mapping for the primary (switch, ping, trigger) actions\r\nAllowed value format: \"<Keyboard>/KEY\", \"<Mouse>/BUTTON\", \"<Gamepad>/BUTTON\"\r\nExamples: \"<Keyboard>/f\" \"<Mouse>/leftButton\" \"<Gamepad>/buttonNorth\"\r\nFor in depth instructions see: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.InputSystem.InputControlPath.html");
			CONFIG_SECONDARY = config.Bind<string>("Layout", "Secondary", "<Mouse>/rightButton", "Name of the key mapping for the secondary (Flash) action\r\nAllowed value format: \"<Keyboard>/KEY\", \"<Mouse>/BUTTON\", \"<Gamepad>/BUTTON\"\r\nExamples: \"<Keyboard>/g\" \"<Mouse>/rightButton\" \"<Gamepad>/buttonWest\"\r\nFor in depth instructions see: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.InputSystem.InputControlPath.html");
			CONFIG_QUICK_SWITCH = config.Bind<string>("Layout", "Switch", "<Keyboard>/e", "Name of the key mapping for the quick switch action\r\nAllowed value format: \"<Keyboard>/KEY\", \"<Mouse>/BUTTON\", \"<Gamepad>/BUTTON\"\r\nExamples: \"<Keyboard>/g\" \"<Mouse>/rightButton\" \"<Gamepad>/buttonWest\"\r\nFor in depth instructions see: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.InputSystem.InputControlPath.html");
			CONFIG_DOOR_SWITCH = config.Bind<string>("Layout", "DoorSwitch", "<Keyboard>/leftShift", "Name of the key mapping for the quick door switch action\r\nAllowed value format: \"<Keyboard>/KEY\", \"<Mouse>/BUTTON\", \"<Gamepad>/BUTTON\"\r\nExamples: \"<Keyboard>/g\" \"<Mouse>/rightButton\" \"<Gamepad>/buttonWest\"\r\nFor in depth instructions see: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.InputSystem.InputControlPath.html");
			CONFIG_SELECT_TARGET = config.Bind<string>("Layout", "SelectTarget", "<Keyboard>/r", "Name of the key mapping for the trap trigger action\r\nAllowed value format: \"<Keyboard>/KEY\", \"<Mouse>/BUTTON\", \"<Gamepad>/BUTTON\"\r\nExamples: \"<Keyboard>/g\" \"<Mouse>/rightButton\" \"<Gamepad>/buttonWest\"\r\nFor in depth instructions see: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.InputSystem.InputControlPath.html");
			CONFIG_ALT_QUICK_SWITCH = config.Bind<string>("Layout", "SwitchAlternative", "<Keyboard>/q", "Name of the key mapping for the alternative quick switch action\r\nThe behaviour of the key is dependent on the \"ReverseSwitch\" option\r\nAllowed value format: \"<Keyboard>/KEY\", \"<Mouse>/BUTTON\", \"<Gamepad>/BUTTON\"\r\nExamples: \"<Keyboard>/g\" \"<Mouse>/rightButton\" \"<Gamepad>/buttonWest\"\r\nFor in depth instructions see: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.InputSystem.InputControlPath.html");
			CONFIG_SELECT_REQUIRE = config.Bind<bool>("Features", "SelectRequire", true, "Set if select required.\r\n > \"true\": Functions need select target to call\r\n > \"false\": Functions noneed select target to call");
			SELECT_REQUIRE = CONFIG_SELECT_REQUIRE.Value;
			IGNORE_OVERRIDE = config.Bind<bool>("Features", "IgnoreOverride", false, "Set if other plugins can disable / enable the MonitorEnhance feature.\r\n > \"true\": Other plugins can no longer toggle it\r\n > \"false\": Other plugins may disable / enable it").Value;
			CONFIG_SHOW_TOOLTIP = config.Bind<bool>("UI", "ShowTooltip", true, string.Format("Enable / Disable the keybind tooltip when hovering over the monitor", pluginFolder));
			bool num = Utility.IsNullOrWhiteSpace(CONFIG_LANGUAGE.Value);
			Plugin.LOGGER.LogInfo((object)("> 语言: " + CONFIG_LANGUAGE.Value));
			LocalizationManager.SetLanguage(num ? CultureInfo.InstalledUICulture.Name : CONFIG_LANGUAGE.Value);
			Plugin.LOGGER.LogWarning((object)" > =======图片测试开始======== ");
			Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MonitorEnhance.Resources.HoverIcon.png");
			if (manifestResourceStream != null)
			{
				Plugin.LOGGER.LogWarning((object)$" > 长度 {manifestResourceStream.Length} ");
				Texture2D val = new Texture2D(0, 0);
				ImageConversion.LoadImage(val, StreamToBytes(manifestResourceStream));
				HOVER_ICON = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
				manifestResourceStream.Dispose();
				manifestResourceStream.Close();
			}
			Plugin.LOGGER.LogWarning((object)" > =======图片结束开始======== ");
		}

		private static byte[] StreamToBytes(Stream stream)
		{
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			stream.Seek(0L, SeekOrigin.Begin);
			return array;
		}
	}
	public static class InputUtil
	{
		private delegate void Execute();

		private static ScreenScript _screen_script = null;

		internal static InputAction INPUT_PRIMARY;

		internal static InputAction INPUT_SECONDARY;

		internal static InputAction INPUT_SELECT_TARGET;

		internal static InputAction INPUT_QUICKSWITCH;

		internal static InputAction INPUT_DOOR_SWITCH;

		internal static InputAction INPUT_ALT_QUICKSWITCH;

		internal static InputAction INPUT_QUICKSWITCH_1;

		internal static InputAction INPUT_QUICKSWITCH_2;

		internal static InputAction INPUT_QUICKSWITCH_3;

		internal static InputAction INPUT_QUICKSWITCH_4;

		internal static InputAction INPUT_QUICKSWITCH_5;

		internal static InputAction INPUT_QUICKSWITCH_6;

		internal static InputAction INPUT_QUICKSWITCH_7;

		internal static InputAction INPUT_QUICKSWITCH_8;

		internal static InputAction INPUT_QUICKSWITCH_9;

		internal static InputAction INPUT_QUICKSWITCH_0;

		private static Execute _primaryExecute = delegate
		{
		};

		private static Execute _secondaryExecute = delegate
		{
		};

		private static Execute _doorSwitchExecute = delegate
		{
		};

		private static Execute _selectTargetExecute = delegate
		{
		};

		private static Execute _playerSwitchExecute = delegate
		{
		};

		private static Execute _raderSwitchExecute = delegate
		{
		};

		private static Execute _playerQuickSwitchExecute = delegate
		{
		};

		public static ScreenScript SCREEN_SCRIPT
		{
			get
			{
				return _screen_script;
			}
			internal set
			{
				if (Object.op_Implicit((Object)(object)value))
				{
					SetupActions(value);
				}
				else
				{
					ClearActions();
				}
				_screen_script = value;
			}
		}

		public static string GetButtonDescription(InputAction action)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			bool flag = Object.op_Implicit((Object)(object)StartOfRound.Instance) && StartOfRound.Instance.localPlayerUsingController;
			bool flag2 = flag && (Gamepad.current is DualShockGamepad || Gamepad.current is DualShock3GamepadHID || Gamepad.current is DualShock4GamepadHID);
			InputBinding? val = null;
			Enumerator<InputBinding> enumerator = action.bindings.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					InputBinding current = enumerator.Current;
					if (flag && ((InputBinding)(ref current)).effectivePath.StartsWith("<Gamepad>"))
					{
						val = current;
						break;
					}
					if (!flag && (((InputBinding)(ref current)).effectivePath.StartsWith("<Keyboard>") || ((InputBinding)(ref current)).effectivePath.StartsWith("<Mouse>")))
					{
						val = current;
						break;
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			object obj;
			if (!val.HasValue)
			{
				obj = "";
			}
			else
			{
				InputBinding value = val.Value;
				obj = ((InputBinding)(ref value)).effectivePath;
			}
			string text = (string)obj;
			string[] array = text.Split(new char[1] { '/' });
			return ((array.Length > 1) ? text : "") switch
			{
				"<Mouse>/leftButton" => LocalizationManager.GetString("LeftButton"), 
				"<Mouse>/rightButton" => LocalizationManager.GetString("RightButton"), 
				"<Keyboard>/escape" => "ESC", 
				"<Keyboard>/leftShift" => LocalizationManager.GetString("LeftShift"), 
				"<Keyboard>/leftAlt" => LocalizationManager.GetString("LeftAlt"), 
				"<Gamepad>/buttonNorth" => flag2 ? "△" : "Y", 
				"<Gamepad>/buttonEast" => flag2 ? "◯" : "B", 
				"<Gamepad>/buttonSouth" => flag2 ? "X" : "A", 
				"<Gamepad>/buttonWest" => flag2 ? "□" : "X", 
				"<Gamepad>/leftStickPress" => "L-Stick", 
				"<Gamepad>/rightStickPress" => "R-Stick", 
				"<Gamepad>/leftShoulder" => flag2 ? "L1" : "L-Shoulder", 
				"<Gamepad>/leftTrigger" => flag2 ? "L2" : "L-Trigger", 
				"<Gamepad>/rightShoulder" => flag2 ? "R1" : "R-Shoulder", 
				"<Gamepad>/rightTrigger" => flag2 ? "R2" : "R-Trigger", 
				_ => (array.Length > 1) ? array[1].ToUpper() : "?", 
			};
		}

		private static InputAction CreateKeybind(string key, string binding, Action<CallbackContext> action)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			InputAction val = new InputAction(key, (InputActionType)1, binding, (string)null, (string)null, (string)null);
			val.performed += action;
			val.Enable();
			Plugin.LOGGER.LogInfo((object)("Set " + key + " button to: " + GetButtonDescription(val)));
			return val;
		}

		private static void SetupActions(ScreenScript script)
		{
			Plugin.LOGGER.LogInfo((object)" > Setup actions");
			_doorSwitchExecute = (Execute)Delegate.Combine(_doorSwitchExecute, new Execute(script.ShipDoor));
			_selectTargetExecute = (Execute)Delegate.Combine(_selectTargetExecute, new Execute(script.OnSelectTarget));
			_primaryExecute = (Execute)Delegate.Combine(_primaryExecute, (Execute)delegate
			{
				script.OnPlayerInteraction(isSecondary: false);
			});
			_secondaryExecute = (Execute)Delegate.Combine(_secondaryExecute, (Execute)delegate
			{
				script.OnPlayerInteraction(isSecondary: true);
			});
			_playerSwitchExecute = (Execute)Delegate.Combine(_playerSwitchExecute, (Execute)delegate
			{
				script.OnMonitorQuickSwitch(isPlayer: false);
			});
			_raderSwitchExecute = (Execute)Delegate.Combine(_raderSwitchExecute, (Execute)delegate
			{
				script.OnMonitorQuickSwitch(isPlayer: true);
			});
			_playerQuickSwitchExecute = (Execute)Delegate.Combine(_playerQuickSwitchExecute, new Execute(script.OnPlayerQuickSwitchByNum));
		}

		private static void ClearActions()
		{
			Plugin.LOGGER.LogInfo((object)" > Clear actions");
			_primaryExecute = delegate
			{
			};
			_secondaryExecute = delegate
			{
			};
			_doorSwitchExecute = delegate
			{
			};
			_selectTargetExecute = delegate
			{
			};
			_playerSwitchExecute = delegate
			{
			};
			_raderSwitchExecute = delegate
			{
			};
			_playerQuickSwitchExecute = delegate
			{
			};
		}

		internal static void Setup()
		{
			if (Chainloader.PluginInfos.TryGetValue("com.rune580.LethalCompanyInputUtils", out var value) && _iu_create())
			{
				INPUT_PRIMARY.performed += delegate
				{
					_primaryExecute();
				};
				INPUT_SECONDARY.performed += delegate
				{
					_secondaryExecute();
				};
				INPUT_SELECT_TARGET.performed += delegate
				{
					_selectTargetExecute();
				};
				INPUT_DOOR_SWITCH.performed += delegate
				{
					_doorSwitchExecute();
				};
				INPUT_QUICKSWITCH.performed += delegate
				{
					_raderSwitchExecute();
				};
				INPUT_ALT_QUICKSWITCH.performed += delegate
				{
					_playerSwitchExecute();
				};
				INPUT_QUICKSWITCH_1.performed += delegate
				{
					_playerQuickSwitchExecute();
				};
				INPUT_QUICKSWITCH_2.performed += delegate
				{
					_playerQuickSwitchExecute();
				};
				INPUT_QUICKSWITCH_3.performed += delegate
				{
					_playerQuickSwitchExecute();
				};
				INPUT_QUICKSWITCH_4.performed += delegate
				{
					_playerQuickSwitchExecute();
				};
				INPUT_QUICKSWITCH_5.performed += delegate
				{
					_playerQuickSwitchExecute();
				};
				INPUT_QUICKSWITCH_6.performed += delegate
				{
					_playerQuickSwitchExecute();
				};
				INPUT_QUICKSWITCH_7.performed += delegate
				{
					_playerQuickSwitchExecute();
				};
				INPUT_QUICKSWITCH_8.performed += delegate
				{
					_playerQuickSwitchExecute();
				};
				INPUT_QUICKSWITCH_9.performed += delegate
				{
					_playerQuickSwitchExecute();
				};
				INPUT_QUICKSWITCH_0.performed += delegate
				{
					_playerQuickSwitchExecute();
				};
				Plugin.LOGGER.LogInfo((object)$" > Hooked into InputUtils {value.Metadata.Version}");
			}
			else
			{
				INPUT_PRIMARY = CreateKeybind("MonitorEnhance:Primary", ConfigUtil.CONFIG_PRIMARY.Value, delegate
				{
					_primaryExecute();
				});
				INPUT_SECONDARY = CreateKeybind("MonitorEnhance:Secondary", ConfigUtil.CONFIG_SECONDARY.Value, delegate
				{
					_secondaryExecute();
				});
				INPUT_QUICKSWITCH = CreateKeybind("MonitorEnhance:QuickSwitch", ConfigUtil.CONFIG_QUICK_SWITCH.Value, delegate
				{
					_playerSwitchExecute();
				});
				INPUT_DOOR_SWITCH = CreateKeybind("MonitorEnhance:DoorSwitch", ConfigUtil.CONFIG_DOOR_SWITCH.Value, delegate
				{
					_doorSwitchExecute();
				});
				INPUT_SELECT_TARGET = CreateKeybind("MonitorEnhance:SelectTarget", ConfigUtil.CONFIG_SELECT_TARGET.Value, delegate
				{
					_selectTargetExecute();
				});
				INPUT_ALT_QUICKSWITCH = CreateKeybind("MonitorEnhance:AltQuickSwitch", ConfigUtil.CONFIG_ALT_QUICK_SWITCH.Value, delegate
				{
					_raderSwitchExecute();
				});
			}
			static bool _iu_create()
			{
				return MonitorEnhanceInputClass.Instance != null;
			}
		}
	}
	public static class PlanetUtil
	{
		private static Plugin.Func<bool, string> _onPlanetCheck = (string _) => false;

		public static bool IsPlanet(Scene scene)
		{
			if (Object.op_Implicit((Object)(object)StartOfRound.Instance))
			{
				if (_onPlanetCheck(((Scene)(ref scene)).name))
				{
					return true;
				}
				SelectableLevel[] levels = StartOfRound.Instance.levels;
				foreach (SelectableLevel val in levels)
				{
					if (((Scene)(ref scene)).name.Equals(val.sceneName))
					{
						return true;
					}
				}
			}
			return false;
		}

		public static void CheckPlugins()
		{
			PluginInfo value2;
			if (Chainloader.PluginInfos.TryGetValue("com.github.lethalmods.lethalexpansioncore", out var value) && _lec())
			{
				_onPlanetCheck = (string x) => x.Equals("InitSceneLaunchOptions") && LethalExpansion.isInGame;
				Plugin.LOGGER.LogInfo((object)$" > Hooked into LethalExpansionCore {value.Metadata.Version}");
			}
			else if (Chainloader.PluginInfos.TryGetValue("LethalExpansion", out value2))
			{
				_onPlanetCheck = (string x) => x.Equals("InitSceneLaunchOptions") && LethalExpansion.isInGame;
				Plugin.LOGGER.LogInfo((object)$" > Hooked into LethalExpansion {value2.Metadata.Version}");
			}
			static bool _lec()
			{
				return !Settings.UseOriginalLethalExpansion.Value;
			}
		}
	}
}
namespace MonitorEnhance.Utils
{
	public class LocalizationManager
	{
		private static ResourceManager resourceManager;

		public static Dictionary<string, Type> Languages { get; set; } = new Dictionary<string, Type>
		{
			{
				"en_us",
				typeof(en_US)
			},
			{
				"ko_kr",
				typeof(ko_KR)
			},
			{
				"zh_cn",
				typeof(zh_CN)
			}
		};


		public static void SetLanguage(string language)
		{
			if (Languages.ContainsKey(language.ToLower()))
			{
				resourceManager = new ResourceManager(Languages[language.ToLower()]);
			}
			else
			{
				resourceManager = new ResourceManager(typeof(en_US));
			}
		}

		public static string GetString(string key)
		{
			try
			{
				return resourceManager.GetString(key);
			}
			catch (Exception)
			{
				return "Missing translation for key: " + key;
			}
		}
	}
}
namespace MonitorEnhance.Lang
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class en_US
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("MonitorEnhance.Lang.en_US", typeof(en_US).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static string Close => ResourceManager.GetString("Close", resourceCulture);

		internal static string FlashRadar => ResourceManager.GetString("FlashRadar", resourceCulture);

		internal static string LeftAlt => ResourceManager.GetString("LeftAlt", resourceCulture);

		internal static string LeftButton => ResourceManager.GetString("LeftButton", resourceCulture);

		internal static string LeftShift => ResourceManager.GetString("LeftShift", resourceCulture);

		internal static string Open => ResourceManager.GetString("Open", resourceCulture);

		internal static string PingRadar => ResourceManager.GetString("PingRadar", resourceCulture);

		internal static string RightButton => ResourceManager.GetString("RightButton", resourceCulture);

		internal static string SelectTarget => ResourceManager.GetString("SelectTarget", resourceCulture);

		internal static string ShipDoor => ResourceManager.GetString("ShipDoor", resourceCulture);

		internal static string SwitchPlayer => ResourceManager.GetString("SwitchPlayer", resourceCulture);

		internal static string SwitchRadar => ResourceManager.GetString("SwitchRadar", resourceCulture);

		internal static string TPPlayer => ResourceManager.GetString("TPPlayer", resourceCulture);

		internal static string TriggerTrap => ResourceManager.GetString("TriggerTrap", resourceCulture);

		internal en_US()
		{
		}
	}
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class ko_KR
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("MonitorEnhance.Lang.ko_KR", typeof(ko_KR).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static string Close => ResourceManager.GetString("Close", resourceCulture);

		internal static string FlashRadar => ResourceManager.GetString("FlashRadar", resourceCulture);

		internal static string LeftAlt => ResourceManager.GetString("LeftAlt", resourceCulture);

		internal static string LeftButton => ResourceManager.GetString("LeftButton", resourceCulture);

		internal static string LeftShift => ResourceManager.GetString("LeftShift", resourceCulture);

		internal static string Open => ResourceManager.GetString("Open", resourceCulture);

		internal static string PingRadar => ResourceManager.GetString("PingRadar", resourceCulture);

		internal static string RightButton => ResourceManager.GetString("RightButton", resourceCulture);

		internal static string SelectTarget => ResourceManager.GetString("SelectTarget", resourceCulture);

		internal static string ShipDoor => ResourceManager.GetString("ShipDoor", resourceCulture);

		internal static string SwitchPlayer => ResourceManager.GetString("SwitchPlayer", resourceCulture);

		internal static string SwitchRadar => ResourceManager.GetString("SwitchRadar", resourceCulture);

		internal static string TPPlayer => ResourceManager.GetString("TPPlayer", resourceCulture);

		internal static string TriggerTrap => ResourceManager.GetString("TriggerTrap", resourceCulture);

		internal ko_KR()
		{
		}
	}
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class zh_CN
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("MonitorEnhance.Lang.zh_CN", typeof(zh_CN).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static string Close => ResourceManager.GetString("Close", resourceCulture);

		internal static string FlashRadar => ResourceManager.GetString("FlashRadar", resourceCulture);

		internal static string LeftAlt => ResourceManager.GetString("LeftAlt", resourceCulture);

		internal static string LeftButton => ResourceManager.GetString("LeftButton", resourceCulture);

		internal static string LeftShift => ResourceManager.GetString("LeftShift", resourceCulture);

		internal static string Open => ResourceManager.GetString("Open", resourceCulture);

		internal static string PingRadar => ResourceManager.GetString("PingRadar", resourceCulture);

		internal static string RightButton => ResourceManager.GetString("RightButton", resourceCulture);

		internal static string SelectTarget => ResourceManager.GetString("SelectTarget", resourceCulture);

		internal static string ShipDoor => ResourceManager.GetString("ShipDoor", resourceCulture);

		internal static string SwitchPlayer => ResourceManager.GetString("SwitchPlayer", resourceCulture);

		internal static string SwitchRadar => ResourceManager.GetString("SwitchRadar", resourceCulture);

		internal static string TPPlayer => ResourceManager.GetString("TPPlayer", resourceCulture);

		internal static string TriggerTrap => ResourceManager.GetString("TriggerTrap", resourceCulture);

		internal zh_CN()
		{
		}
	}
}