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 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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("VolumeScroll")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adjust the song volume using the scroll wheel")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c62c3afd5542af4bae0f631834961e06d9ae81af")]
[assembly: AssemblyProduct("VolumeScroll")]
[assembly: AssemblyTitle("VolumeScroll")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 VolumeScroll
{
[BepInPlugin("VolumeScroll", "VolumeScroll", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static class VolumeScrollPatches
{
private static float? defaultTrackVolume;
[HarmonyPatch(typeof(GameController), "Start")]
[HarmonyPrefix]
public static void OnSongStart(GameController __instance)
{
defaultTrackVolume = null;
}
[HarmonyPatch(typeof(GameController), "adjustTrackVolume")]
[HarmonyPrefix]
public static void CaptureDefaultVolume(GameController __instance)
{
if (!defaultTrackVolume.HasValue)
{
defaultTrackVolume = __instance.musictrack.volume;
}
}
[HarmonyPatch(typeof(GameController), "Update")]
[HarmonyPostfix]
public static void OnGameUpdate(GameController __instance)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
float axis = Input.GetAxis("Mouse ScrollWheel");
if (axis != 0f)
{
float num = ((axis > 0f) ? 1 : (-1));
__instance.adjustTrackVolume(num);
}
if (Input.GetKeyDown(_resetVolumeKey.Value) && defaultTrackVolume.HasValue)
{
__instance.musictrack.volume = defaultTrackVolume.Value;
__instance.sfxrefs.click.volume = (__instance.musictrack.volume + 1f) * 0.25f;
__instance.sfxrefs.click.Play();
}
}
}
private static ConfigEntry<KeyCode> _resetVolumeKey;
private void Awake()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
_resetVolumeKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Bindings", "ResetVolumeKey", (KeyCode)325, "Key to reset the volume");
Harmony val = new Harmony("VolumeScroll");
val.PatchAll(typeof(VolumeScrollPatches));
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "VolumeScroll";
public const string PLUGIN_NAME = "VolumeScroll";
public const string PLUGIN_VERSION = "1.0.0";
}
}