Decompiled source of MKD BoomboxVolume v1.0.5

MKDBoomboxVolume.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
[assembly: AssemblyCompany("MKDBoomboxVolume")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+575d7a74bb8b8b6d27a972347036309de2a2fb4c")]
[assembly: AssemblyProduct("MKDBoomboxVolume")]
[assembly: AssemblyTitle("MKDBoomboxVolume")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : System.Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class NullableAttribute : System.Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class NullableContextAttribute : System.Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class RefSafetyRulesAttribute : System.Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MKDBoomboxVolume
{
	[BepInPlugin("mknightdev.BoomboxVolume", "MKD's Boombox Volume", "1.0.5")]
	public class MKDBoomboxVolume : BaseUnityPlugin
	{
		private const string m_modGUID = "mknightdev.BoomboxVolume";

		private const string m_modName = "MKD's Boombox Volume";

		private const string m_modVersion = "1.0.5";

		public static MKDBoomboxVolume Instance;

		private readonly Harmony m_harmony = new Harmony("mknightdev.BoomboxVolume");

		public static BoomboxVolumeInput BoomboxVolumeInput = new BoomboxVolumeInput();

		private static ManualLogSource m_bepInExLogSource;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			m_bepInExLogSource = Logger.CreateLogSource("mknightdev.BoomboxVolume");
			m_bepInExLogSource.LogMessage((object)"mknightdev.BoomboxVolume v1.0.5 has loaded successfully.");
			m_harmony.PatchAll();
		}
	}
	public class BoomboxVolumeInput : LcInputActions
	{
		[InputAction("<Keyboard>/equals", Name = "Increase Boombox Volume")]
		[field: CompilerGenerated]
		[field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		public InputAction IncreaseKey
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[InputAction("<Keyboard>/minus", Name = "Decrease Boombox Volume")]
		[field: CompilerGenerated]
		[field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		public InputAction DecreaseKey
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}
	}
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class BoomboxVolume
	{
		private const float m_volumeIncrementAmount = 0.1f;

		private const float m_volumeMax = 1f;

		private const float m_volumeMin = 0f;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void AdjustVolume(ref AudioSource ___boomboxAudio)
		{
			if (MKDBoomboxVolume.BoomboxVolumeInput.IncreaseKey.triggered && ___boomboxAudio.volume < 1f)
			{
				AudioSource obj = ___boomboxAudio;
				obj.volume += 0.1f;
			}
			else if (MKDBoomboxVolume.BoomboxVolumeInput.DecreaseKey.triggered && ___boomboxAudio.volume > 0f)
			{
				AudioSource obj2 = ___boomboxAudio;
				obj2.volume -= 0.1f;
			}
		}
	}
}