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 HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using RemoteVolumeControl.Patches;
using UnityEngine;
using UnityEngine.InputSystem;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RemoteVolumeControl")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A mod for Lethal Company allowing you to change the client-side volume of all Boomboxes from anywhere on the map.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+94659aafba25a457cfb640e4c8bebb39c8e17ec3")]
[assembly: AssemblyProduct("RemoteVolumeControl")]
[assembly: AssemblyTitle("RemoteVolumeControl")]
[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 RemoteVolumeControl
{
[BepInPlugin("RemoteVolumeControl", "RemoteVolumeControl", "1.0.0")]
public class RemoteVolumeControl : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("RemoteVolumeControl");
private static RemoteVolumeControl instance;
public static ButtonPress InputActionInstance = new ButtonPress();
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RemoteVolumeControl is loaded!");
harmony.PatchAll(typeof(RemoteVolumeControl));
harmony.PatchAll(typeof(VolChangePatch));
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "RemoteVolumeControl";
public const string PLUGIN_NAME = "RemoteVolumeControl";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace RemoteVolumeControl.Patches
{
public class ButtonPress : LcInputActions
{
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction BoomboxVolDownKey { get; set; }
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction BoomboxVolUpKey { get; set; }
}
[HarmonyPatch(typeof(BoomboxItem))]
internal class VolChangePatch
{
private const float VOL_INCREMENT = 0.1f;
private const float VOL_MAX = 1f;
private const float VOL_MIN = 0f;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void volumeDown(ref AudioSource ___boomboxAudio)
{
if (RemoteVolumeControl.InputActionInstance.BoomboxVolDownKey.triggered && ___boomboxAudio.volume > 0f)
{
AudioSource obj = ___boomboxAudio;
obj.volume -= 0.1f;
}
else if (RemoteVolumeControl.InputActionInstance.BoomboxVolUpKey.triggered && ___boomboxAudio.volume < 1f)
{
AudioSource obj2 = ___boomboxAudio;
obj2.volume += 0.1f;
}
}
}
}