Decompiled source of Ui Tweaks v0.2.1

Ui_Tweaks.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SpaceCraft;
using TMPro;
using Ui_Tweaks.Modules;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("UnloadedHangar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds billboards to several moons")]
[assembly: AssemblyFileVersion("1.3.6.0")]
[assembly: AssemblyInformationalVersion("1.0.7+75e95b7d38c16d78266d6b3452ddfb59cc4fbbc1")]
[assembly: AssemblyProduct("OutsideStructures")]
[assembly: AssemblyTitle("OutsideStructures")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.6.0")]
[module: UnverifiableCode]
[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 Ui_Tweaks
{
	internal class ConfigManager
	{
		public ExtendedConfigEntry<bool> EnableConfiguration;

		public ExtendedConfigEntry<bool> DebugLogging;

		public ExtendedConfigEntry<float> OxygenLowWarningValue;

		public ExtendedConfigEntry<float> OxygenCriticalWarningValue;

		public ExtendedConfigEntry<float> HungerLowWarningValue;

		public ExtendedConfigEntry<float> HungerCriticalWarningValue;

		public ExtendedConfigEntry<float> ThirstLowWarningValue;

		public ExtendedConfigEntry<float> ThirstCriticalWarningValue;

		public ExtendedConfigEntry<float> ToxicHighWarningValue;

		public ExtendedConfigEntry<float> ToxicCriticalWarningValue;

		public ConfigManager()
		{
			BindConfigs();
			ClearUnusedEntries();
		}

		private void BindConfigs()
		{
			EnableConfiguration = new ExtendedConfigEntry<bool>("General Settings", "EnableConfiguration", defaultValue: false, "Enable if you want to use custom set config setting values. If disabled, the default config setting values will be used.");
			DebugLogging = new ExtendedConfigEntry<bool>("General Settings", "DebugLogging", defaultValue: false, "Enable if you want Debug logging to function.", useEnableConfiguration: true);
			OxygenLowWarningValue = new ExtendedConfigEntry<float>("General Settings", "OxygenLowWarningValue", 30f, "When does Oxygen Low warning go off. Value must be bigger than OxygenCriticalWarningValue.", useEnableConfiguration: true);
			OxygenCriticalWarningValue = new ExtendedConfigEntry<float>("General Settings", "OxygenCriticalWarningValue", 16f, "When does Oxygen Critical warning go off. Value must be smaller than OxygenLowWarningValue.", useEnableConfiguration: true);
			HungerLowWarningValue = new ExtendedConfigEntry<float>("General Settings", "HungerLowWarningValue", 25f, "When does Food Low warning go off. Value must be bigger than HungerCriticalWarningValue.", useEnableConfiguration: true);
			HungerCriticalWarningValue = new ExtendedConfigEntry<float>("General Settings", "HungerCriticalWarningValue", 10f, "When does Food Critical warning go off. Value must be smaller than HungerLowWarningValue.", useEnableConfiguration: true);
			ThirstLowWarningValue = new ExtendedConfigEntry<float>("General Settings", "ThirstLowWarningValue", 25f, "When does Water Low warning go off. Value must be bigger than ThirstCriticalWarningValue.", useEnableConfiguration: true);
			ThirstCriticalWarningValue = new ExtendedConfigEntry<float>("General Settings", "ThirstCriticalWarningValue", 10f, "When does Water Critical warning go off. Value must be smaller than ThirstLowWarningValue.", useEnableConfiguration: true);
			ToxicHighWarningValue = new ExtendedConfigEntry<float>("General Settings", "ToxicHighWarningValue", 35f, "When does Toxicity High warning go off. Value must be smaller than ToxicCriticalWarningValue.", useEnableConfiguration: true);
			ToxicCriticalWarningValue = new ExtendedConfigEntry<float>("General Settings", "ToxicCriticalWarningValue", 40f, "When does Toxicity Critical warning go off. Value must be bigger than ToxicHighWarningValue.", useEnableConfiguration: true);
		}

		private void ClearUnusedEntries()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null);
			dictionary.Clear();
			config.Save();
		}
	}
	public class ExtendedConfigEntry<T>
	{
		public ConfigEntry<T> ConfigEntry;

		public Func<T> GetValue;

		public Action<T> SetValue;

		public bool UseEnableConfiguration = false;

		public T DefaultValue => (T)((ConfigEntryBase)ConfigEntry).DefaultValue;

		public T Value
		{
			get
			{
				return GetValue();
			}
			set
			{
				SetValue(value);
			}
		}

		public ExtendedConfigEntry(string section, string key, T defaultValue, string description, bool useEnableConfiguration = false)
		{
			ConfigEntry = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<T>(section, key, defaultValue, description);
			UseEnableConfiguration = useEnableConfiguration;
			Initialize();
		}

		public ExtendedConfigEntry(string section, string key, T defaultValue, ConfigDescription configDescription = null, bool useEnableConfiguration = false)
		{
			ConfigEntry = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<T>(section, key, defaultValue, configDescription);
			UseEnableConfiguration = useEnableConfiguration;
			Initialize();
		}

		private void Initialize()
		{
			if (GetValue == null)
			{
				GetValue = () => (UseEnableConfiguration && !Plugin.ConfigManager.EnableConfiguration.Value) ? DefaultValue : ConfigEntry.Value;
			}
			if (SetValue == null)
			{
				SetValue = delegate(T value)
				{
					ConfigEntry.Value = value;
				};
			}
		}

		public void ResetToDefault()
		{
			ConfigEntry.Value = (T)((ConfigEntryBase)ConfigEntry).DefaultValue;
		}
	}
	[BepInProcess("Planet Crafter.exe")]
	[BepInPlugin("Ui_Tweaks-UnloadedHangar", "Ui_Tweaks", "0.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		public static class PluginInfo
		{
			public const string Guid = "Ui_Tweaks-UnloadedHangar";

			public const string Name = "Ui_Tweaks";

			public const string Ver = "0.2.1";
		}

		internal static Plugin Instance;

		internal static ManualLogSource logger;

		internal static ConfigManager ConfigManager;

		internal Harmony _harmony;

		private void Awake()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("Ui_Tweaks");
			logger.LogInfo((object)"Ui_Tweaks has awoken!");
			ConfigManager = new ConfigManager();
			_harmony = new Harmony("Ui_Tweaks-UnloadedHangar");
			_harmony.PatchAll(typeof(OxygenGaugePatch));
			_harmony.PatchAll(typeof(HealthGaugePatch));
			_harmony.PatchAll(typeof(ThirstGaugePatch));
			_harmony.PatchAll(typeof(ToxicGaugePatch));
		}
	}
}
namespace Ui_Tweaks.Modules
{
	[HarmonyPatch(typeof(PlayerGaugeOxygen))]
	internal class OxygenGaugePatch
	{
		private static Image thisImage;

		[HarmonyPrefix]
		[HarmonyPatch("GaugeVerifications")]
		public static bool GaugeVerifications(PlayerGaugeOxygen __instance)
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			if (((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).isInited)
			{
				if ((Object)(object)thisImage == (Object)null)
				{
					thisImage = ((Component)((Component)((Component)((Component)__instance).transform.GetChild(0)).gameObject.GetComponent<Slider>().fillRect).gameObject.transform).gameObject.GetComponent<Image>();
				}
				if (((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).gaugeValue <= Utils.CheckForInvalidConfigurationValues(OxygenConfigType.OxygenLow) - 10f)
				{
					((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).playerAudio.SetIsPanting(true);
				}
				else
				{
					((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).playerAudio.SetIsPanting(false);
				}
				if (((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).gaugeValue > Utils.CheckForInvalidConfigurationValues(OxygenConfigType.OxygenLow))
				{
					__instance.hasAlertedLow = false;
					__instance.hasAlertedCritical = false;
					((Graphic)thisImage).color = Color.white;
					((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).StopBlinking();
				}
				else if (((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).gaugeValue <= Utils.CheckForInvalidConfigurationValues(OxygenConfigType.OxygenLow) && !__instance.hasAlertedLow)
				{
					Utils.DisplayInfoText(Object.FindFirstObjectByType<BaseHudHandler>(), "UI_WARN_OXYGEN_LOW", 3f, "", "");
					((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).globalAudioHandler.PlayAlertLow();
					((Graphic)thisImage).color = Color.yellow;
					__instance.hasAlertedLow = true;
				}
				else if (((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).gaugeValue <= Utils.CheckForInvalidConfigurationValues(OxygenConfigType.OxygenCritical) && !__instance.hasAlertedCritical)
				{
					Utils.DisplayInfoText(Object.FindFirstObjectByType<BaseHudHandler>(), "UI_WARN_OXYGEN_CRITICAL", 3f, "", "");
					((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).globalAudioHandler.PlayAlertCritical();
					__instance.hasAlertedCritical = true;
					((Graphic)thisImage).color = Color.red;
					((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).StartBlinking();
				}
				else if (((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).gaugeValue <= 0f)
				{
					((PlayerGauge<PlayerGaugeOxygen>)(object)__instance).playerAudio.PlayDie();
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerGaugeHealth))]
	internal class HealthGaugePatch
	{
		private static Image thisImage;

		[HarmonyPrefix]
		[HarmonyPatch("GaugeVerifications")]
		public static bool GaugeVerifications(PlayerGaugeHealth __instance)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			if (((PlayerGauge<PlayerGaugeHealth>)(object)__instance).isInited)
			{
				if ((Object)(object)thisImage == (Object)null)
				{
					thisImage = ((Component)((Component)((Component)((Component)__instance).transform.GetChild(0)).gameObject.GetComponent<Slider>().fillRect).gameObject.transform).gameObject.GetComponent<Image>();
				}
				if (((PlayerGauge<PlayerGaugeHealth>)(object)__instance).gaugeValue > Utils.CheckForInvalidConfigurationValues(HungerConfigType.FoodLow))
				{
					__instance.hasAlertedLow = false;
					__instance.hasAlertedCritical = false;
					((Graphic)thisImage).color = Color.white;
					((PlayerGauge<PlayerGaugeHealth>)(object)__instance).StopBlinking();
				}
				else if (((PlayerGauge<PlayerGaugeHealth>)(object)__instance).gaugeValue <= Utils.CheckForInvalidConfigurationValues(HungerConfigType.FoodLow) && !__instance.hasAlertedLow)
				{
					Utils.DisplayInfoText(Object.FindFirstObjectByType<BaseHudHandler>(), "UI_WARN_FOOD_LOW", 3f, "", "");
					((PlayerGauge<PlayerGaugeHealth>)(object)__instance).globalAudioHandler.PlayAlertLow();
					((Graphic)thisImage).color = Color.yellow;
					__instance.hasAlertedLow = true;
				}
				else if (((PlayerGauge<PlayerGaugeHealth>)(object)__instance).gaugeValue <= Utils.CheckForInvalidConfigurationValues(HungerConfigType.FoodCritical) && !__instance.hasAlertedCritical)
				{
					Utils.DisplayInfoText(Object.FindFirstObjectByType<BaseHudHandler>(), "UI_WARN_FOOD_CRITICAL", 3f, "", "");
					((PlayerGauge<PlayerGaugeHealth>)(object)__instance).globalAudioHandler.PlayAlertCritical();
					__instance.hasAlertedCritical = true;
					((Graphic)thisImage).color = Color.red;
					((PlayerGauge<PlayerGaugeHealth>)(object)__instance).StartBlinking();
				}
				else if (((PlayerGauge<PlayerGaugeHealth>)(object)__instance).gaugeValue <= 0f)
				{
					((PlayerGauge<PlayerGaugeHealth>)(object)__instance).playerAudio.PlayDie();
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerGaugeThirst))]
	internal class ThirstGaugePatch
	{
		private static Image thisImage;

		[HarmonyPrefix]
		[HarmonyPatch("GaugeVerifications")]
		public static bool GaugeVerifications(PlayerGaugeThirst __instance)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			if (((PlayerGauge<PlayerGaugeThirst>)(object)__instance).isInited)
			{
				if ((Object)(object)thisImage == (Object)null)
				{
					thisImage = ((Component)((Component)((Component)((Component)__instance).transform.GetChild(0)).gameObject.GetComponent<Slider>().fillRect).gameObject.transform).gameObject.GetComponent<Image>();
				}
				if (((PlayerGauge<PlayerGaugeThirst>)(object)__instance).gaugeValue > Utils.CheckForInvalidConfigurationValues(ThirstConfigType.WaterLow))
				{
					__instance.hasAlertedLow = false;
					__instance.hasAlertedCritical = false;
					((Graphic)thisImage).color = Color.white;
					((PlayerGauge<PlayerGaugeThirst>)(object)__instance).StopBlinking();
				}
				else if (((PlayerGauge<PlayerGaugeThirst>)(object)__instance).gaugeValue <= Utils.CheckForInvalidConfigurationValues(ThirstConfigType.WaterLow) && !__instance.hasAlertedLow)
				{
					Utils.DisplayInfoText(Object.FindFirstObjectByType<BaseHudHandler>(), "UI_WARN_THIRST_LOW", 3f, "", "");
					((PlayerGauge<PlayerGaugeThirst>)(object)__instance).globalAudioHandler.PlayAlertLow();
					((Graphic)thisImage).color = Color.yellow;
					__instance.hasAlertedLow = true;
				}
				else if (((PlayerGauge<PlayerGaugeThirst>)(object)__instance).gaugeValue <= Utils.CheckForInvalidConfigurationValues(ThirstConfigType.WaterCritical) && !__instance.hasAlertedCritical)
				{
					Utils.DisplayInfoText(Object.FindFirstObjectByType<BaseHudHandler>(), "UI_WARN_THIRST_CRITICAL", 3f, "", "");
					((PlayerGauge<PlayerGaugeThirst>)(object)__instance).globalAudioHandler.PlayAlertCritical();
					__instance.hasAlertedCritical = true;
					((Graphic)thisImage).color = Color.red;
					((PlayerGauge<PlayerGaugeThirst>)(object)__instance).StartBlinking();
				}
				else if (((PlayerGauge<PlayerGaugeThirst>)(object)__instance).gaugeValue <= 0f)
				{
					((PlayerGauge<PlayerGaugeThirst>)(object)__instance).playerAudio.PlayDie();
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerGaugeToxic))]
	internal class ToxicGaugePatch
	{
		private static Image thisImage;

		[HarmonyPrefix]
		[HarmonyPatch("GaugeVerifications")]
		public static bool GaugeVerifications(PlayerGaugeToxic __instance)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			if (!((PlayerGauge<PlayerGaugeToxic>)(object)__instance).isInited)
			{
				((Component)__instance).gameObject.SetActive(false);
				return false;
			}
			if ((Object)(object)thisImage == (Object)null)
			{
				thisImage = ((Component)((Component)((Component)((Component)__instance).transform.GetChild(0)).gameObject.GetComponent<Slider>().fillRect).gameObject.transform).gameObject.GetComponent<Image>();
			}
			__instance.SetVisible(((PlayerGauge<PlayerGaugeToxic>)(object)__instance).gaugeValue > 0f && !Managers.GetManager<WindowsHandler>().GetHasUiOpen());
			if (((PlayerGauge<PlayerGaugeToxic>)(object)__instance).gaugeValue < Utils.CheckForInvalidConfigurationValues(ToxicConfigType.ToxicWarning))
			{
				((Graphic)thisImage).color = Color.white;
			}
			else if (((PlayerGauge<PlayerGaugeToxic>)(object)__instance).gaugeValue >= Utils.CheckForInvalidConfigurationValues(ToxicConfigType.ToxicCritical))
			{
				((Graphic)thisImage).color = Color.red;
			}
			else if (((PlayerGauge<PlayerGaugeToxic>)(object)__instance).gaugeValue >= Utils.CheckForInvalidConfigurationValues(ToxicConfigType.ToxicWarning))
			{
				((Graphic)thisImage).color = Color.yellow;
			}
			((PlayerGauge<PlayerGaugeToxic>)(object)__instance).gaugeValue = ((PlayerGauge<PlayerGaugeToxic>)(object)__instance).maxValue - ((PlayerGauge<PlayerGaugeToxic>)(object)__instance).gaugeValue;
			return false;
		}
	}
	internal static class Utils
	{
		private static DoOnce doOnceOxygen;

		private static DoOnce doOnceHunger;

		private static DoOnce doOnceThirst;

		private static DoOnce doOnceToxicity;

		internal static float CheckForInvalidConfigurationValues(OxygenConfigType configType)
		{
			if (Plugin.ConfigManager.OxygenLowWarningValue.Value <= Plugin.ConfigManager.OxygenCriticalWarningValue.Value)
			{
				if (doOnceOxygen == null)
				{
					doOnceOxygen = new DoOnce(delegate
					{
						Plugin.logger.LogError((object)new InvalidOperationException("OxygenLowWarningValue can not be smaller than OxygenCriticalWarningValue! Using default values!"));
					});
				}
				switch (configType)
				{
				case OxygenConfigType.OxygenLow:
					return Plugin.ConfigManager.OxygenLowWarningValue.DefaultValue;
				case OxygenConfigType.OxygenCritical:
					return Plugin.ConfigManager.OxygenCriticalWarningValue.DefaultValue;
				}
			}
			else
			{
				switch (configType)
				{
				case OxygenConfigType.OxygenLow:
					return Plugin.ConfigManager.OxygenLowWarningValue.Value;
				case OxygenConfigType.OxygenCritical:
					return Plugin.ConfigManager.OxygenCriticalWarningValue.Value;
				}
			}
			return float.NaN;
		}

		internal static float CheckForInvalidConfigurationValues(HungerConfigType configType)
		{
			if (Plugin.ConfigManager.HungerLowWarningValue.Value <= Plugin.ConfigManager.HungerCriticalWarningValue.Value)
			{
				if (doOnceHunger == null)
				{
					doOnceHunger = new DoOnce(delegate
					{
						Plugin.logger.LogError((object)new InvalidOperationException("HungerLowWarningValue can not be smaller than HungerCriticalWarningValue! Using default values!"));
					});
				}
				switch (configType)
				{
				case HungerConfigType.FoodLow:
					return Plugin.ConfigManager.HungerLowWarningValue.DefaultValue;
				case HungerConfigType.FoodCritical:
					return Plugin.ConfigManager.HungerCriticalWarningValue.DefaultValue;
				}
			}
			else
			{
				switch (configType)
				{
				case HungerConfigType.FoodLow:
					return Plugin.ConfigManager.HungerLowWarningValue.Value;
				case HungerConfigType.FoodCritical:
					return Plugin.ConfigManager.HungerCriticalWarningValue.Value;
				}
			}
			return float.NaN;
		}

		internal static float CheckForInvalidConfigurationValues(ThirstConfigType configType)
		{
			if (Plugin.ConfigManager.ThirstLowWarningValue.Value <= Plugin.ConfigManager.ThirstCriticalWarningValue.Value)
			{
				if (doOnceThirst == null)
				{
					doOnceThirst = new DoOnce(delegate
					{
						Plugin.logger.LogError((object)new InvalidOperationException("ThirstLowWarningValue can not be smaller than ThirstCriticalWarningValue! Using default values!"));
					});
				}
				switch (configType)
				{
				case ThirstConfigType.WaterLow:
					return Plugin.ConfigManager.ThirstLowWarningValue.DefaultValue;
				case ThirstConfigType.WaterCritical:
					return Plugin.ConfigManager.ThirstCriticalWarningValue.DefaultValue;
				}
			}
			else
			{
				switch (configType)
				{
				case ThirstConfigType.WaterLow:
					return Plugin.ConfigManager.ThirstLowWarningValue.Value;
				case ThirstConfigType.WaterCritical:
					return Plugin.ConfigManager.ThirstCriticalWarningValue.Value;
				}
			}
			return float.NaN;
		}

		internal static float CheckForInvalidConfigurationValues(ToxicConfigType configType)
		{
			if (Plugin.ConfigManager.ToxicHighWarningValue.Value >= Plugin.ConfigManager.ToxicCriticalWarningValue.Value)
			{
				if (doOnceToxicity == null)
				{
					doOnceToxicity = new DoOnce(delegate
					{
						Plugin.logger.LogError((object)new InvalidOperationException("ToxicCriticalWarningValue can not be smaller than ToxicHighWarningValue! Using default values!"));
					});
				}
				switch (configType)
				{
				case ToxicConfigType.ToxicWarning:
					return Plugin.ConfigManager.ToxicHighWarningValue.DefaultValue;
				case ToxicConfigType.ToxicCritical:
					return Plugin.ConfigManager.ToxicCriticalWarningValue.DefaultValue;
				}
			}
			else
			{
				switch (configType)
				{
				case ToxicConfigType.ToxicWarning:
					return Plugin.ConfigManager.ToxicHighWarningValue.Value;
				case ToxicConfigType.ToxicCritical:
					return Plugin.ConfigManager.ToxicCriticalWarningValue.Value;
				}
			}
			return float.NaN;
		}

		internal static void DisplayInfoText(BaseHudHandler __instance, string localizationCode, float timeStayDisplayer, string postfix, string prefix)
		{
			if (!__instance._menuOpen)
			{
				string localizedString = Localization.GetLocalizedString(localizationCode);
				((Component)__instance.hoverText).gameObject.SetActive(true);
				((TMP_Text)__instance.hoverText).text = prefix + (string.IsNullOrEmpty(localizedString) ? localizationCode : localizedString) + " " + postfix;
				__instance._keepCurrentText = false;
				((MonoBehaviour)__instance).CancelInvoke();
				if (timeStayDisplayer > 0f)
				{
					__instance._keepCurrentText = true;
					((MonoBehaviour)__instance).Invoke("CleanCursorText", timeStayDisplayer);
				}
			}
		}
	}
	internal class DoOnce
	{
		private bool actionPerformed = false;

		internal DoOnce(Action action)
		{
			if (!actionPerformed)
			{
				action();
				actionPerformed = true;
			}
		}
	}
	internal enum OxygenConfigType
	{
		OxygenLow,
		OxygenCritical
	}
	internal enum HungerConfigType
	{
		FoodLow,
		FoodCritical
	}
	internal enum ThirstConfigType
	{
		WaterLow,
		WaterCritical
	}
	internal enum ToxicConfigType
	{
		ToxicWarning,
		ToxicCritical
	}
}