Decompiled source of R2MM BoomboxMod v1.0.1

R2MM_BoomboxMod.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LLBML.States;
using LLBML.Utils;
using LLScreen;
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: AssemblyCompany("avg_duck")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+b90cefa0bf4adfdeaef87ff893bf9b85d0bc02de")]
[assembly: AssemblyProduct("R2MM_BoomboxMod")]
[assembly: AssemblyTitle("R2MM_BoomboxMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 R2MM_BoomboxMod
{
	public class Configs
	{
		internal static ConfigEntry<bool> IsMusicTextEnabled { get; private set; }

		internal static ConfigEntry<bool> IsTimerTextEnabled { get; private set; }

		internal static void BindConfigs(ConfigFile config)
		{
			IsMusicTextEnabled = config.Bind<bool>("Toggles", "musicText", false, (ConfigDescription)null);
			IsTimerTextEnabled = config.Bind<bool>("Toggles", "timerText", false, (ConfigDescription)null);
		}
	}
	[BepInPlugin("avgduck.plugins.llb.r2mm-boomboxmod", "R2MM_BoomboxMod", "1.0.1")]
	[BepInProcess("LLBlaze.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static Plugin Instance { get; private set; }

		internal static ManualLogSource GlobalLogSource { get; private set; }

		private void Awake()
		{
			Instance = this;
			GlobalLogSource = ((BaseUnityPlugin)this).Logger;
			GlobalLogSource.LogInfo((object)"Plugin R2MM_BoomboxMod is loaded!");
			Harmony.CreateAndPatchAll(typeof(Plugin), "avgduck.plugins.llb.r2mm-boomboxmod");
			Configs.BindConfigs(((BaseUnityPlugin)this).Config);
		}

		private void Start()
		{
			ModDependenciesUtils.RegisterToModMenu(((BaseUnityPlugin)this).Info, PluginDetails.MODMENU_TEXT);
		}

		[HarmonyPatch(typeof(UIScreen), "Open", new Type[]
		{
			typeof(ScreenType),
			typeof(int),
			typeof(ScreenTransition),
			typeof(bool)
		})]
		[HarmonyPostfix]
		private static void HideText()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			GameState current = GameStates.GetCurrent();
			if ((EnumWrapper<JOFJHDJHJGI>)(object)current != (EnumWrapper<JOFJHDJHJGI>)(object)GameState.GAME)
			{
				return;
			}
			ScreenGameHud val = (ScreenGameHud)UIScreen.GetScreen((ScreenType)20);
			if (!((Object)(object)val == (Object)null))
			{
				if (!Configs.IsTimerTextEnabled.Value)
				{
					GlobalLogSource.LogInfo((object)"Timer text DISABLED -> hiding boombox timer text");
					((Component)val.imtextTime).gameObject.SetActive(false);
				}
				else
				{
					GlobalLogSource.LogInfo((object)"Timer text ENABLED -> showing boombox timer text");
					((Component)val.imtextTime).gameObject.SetActive(true);
				}
				if (!Configs.IsMusicTextEnabled.Value)
				{
					GlobalLogSource.LogInfo((object)"Music text DISABLED -> hiding boombox music text");
					val.lbTrack.text = "";
				}
				else
				{
					GlobalLogSource.LogInfo((object)"Music text ENABLED -> showing boombox music text");
				}
			}
		}
	}
	public static class PluginDetails
	{
		public const string PLUGIN_GUID = "avgduck.plugins.llb.r2mm-boomboxmod";

		public const string PLUGIN_NAME = "R2MM_BoomboxMod";

		public const string PLUGIN_VERSION = "1.0.1";

		public const string DEPENDENCY_LLBMODDINGLIB = "fr.glomzubuk.plugins.llb.llbml";

		public const string DEPENDENCY_MODMENU = "no.mrgentle.plugins.llb.modmenu";

		public static readonly List<string> MODMENU_TEXT = new List<string>(1) { "This mod allows the user to toggle both the music text and timer text of the in-game boombox HUD" };
	}
}