Decompiled source of ShowGladeInfo v1.0.0

ShowGladeInfo.dll

Decompiled 2 days ago
using System;
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 Eremite.Controller;
using Eremite.Glades.Controller;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("ShowGladeInfo")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Example Mod for Against The Storm")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d6ada77561ccfe85ca4c2c807fd24c8c3fc0d51c")]
[assembly: AssemblyProduct("ShowGladeInfo")]
[assembly: AssemblyTitle("ShowGladeInfo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 ShowGladeInfo
{
	[BepInPlugin("ShowGladeInfo", "ShowGladeInfo", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		private Harmony harmony;

		private static ConfigEntry<bool> ShowGladeInfo;

		private void Awake()
		{
			Instance = this;
			ShowGladeInfo = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowGladeInfo", true, "If true, all glades (normal + dangerous) show their info icons and tooltips.");
			ShowGladeInfo.SettingChanged += delegate
			{
				RefreshAllMarkers();
			};
			harmony = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ShowGladeInfo is loaded!");
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPostfix]
		private static void ForceGladeInfo(ref bool __result)
		{
			if (ShowGladeInfo.Value)
			{
				__result = true;
			}
		}

		[HarmonyPatch(typeof(GladeMarker), "SetUpElements")]
		[HarmonyPostfix]
		private static void ForceMarkerUI(GladeMarker __instance)
		{
			if (ShowGladeInfo.Value)
			{
				if (!__instance.IsDangerous && (Object)(object)__instance.infoParent != (Object)null)
				{
					__instance.infoParent.SetActive(true);
				}
				if (__instance.IsDangerous && (Object)(object)__instance.dangerInfoParent != (Object)null)
				{
					__instance.dangerInfoParent.SetActive(true);
				}
			}
		}

		private static void RefreshAllMarkers()
		{
			GladeMarker[] array = Object.FindObjectsOfType<GladeMarker>();
			GladeMarker[] array2 = array;
			foreach (GladeMarker val in array2)
			{
				val.SetUpElements(val.GladeInfoActive);
			}
			((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Refreshed all glade markers after config change.");
		}

		[HarmonyPatch(typeof(GameController), "StartGame")]
		[HarmonyPostfix]
		private static void RefreshOnStart()
		{
			RefreshAllMarkers();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ShowGladeInfo";

		public const string PLUGIN_NAME = "ShowGladeInfo";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}