Decompiled source of BackgroundMusic v1.1.0

Mods/BackgroundMusic.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BGM;
using MelonLoader;
using RumbleModUI;
using RumbleModdingAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Class1), "BGM", "1.1.0", "Davilonchi", null)]
[assembly: MelonColor(255, 67, 216, 250)]
[assembly: MelonAuthorColor(255, 67, 216, 250)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: AssemblyTitle("BGM")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Davilonchi")]
[assembly: AssemblyProduct("BGM")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("253fbba0-bccc-4fed-8963-2ee8ba271145")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BGM;

public static class BuildInfo
{
	public const string ModName = "BGM";

	public const string ModVersion = "1.1.0";

	public const string Description = "Adds the unused background music for the gym";

	public const string Author = "Davilonchi";

	public const string Company = "";
}
public class Class1 : MelonMod
{
	private Mod BGM = new Mod();

	private bool init;

	private string currentScene = "Loader";

	private int enable_music;

	private float mod_volume;

	private GameObject BGM_on;

	public void OnUIInit()
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Expected O, but got Unknown
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Expected O, but got Unknown
		BGM.ModName = "BGM";
		BGM.ModVersion = "1.1.0";
		BGM.SetFolder("BGM");
		BGM.AddDescription("Description", "", "Adds the unused background music for the gym", new Tags
		{
			IsSummary = true
		});
		BGM.AddToList("Enable", 1, "Turns on or off the unused background music" + Environment.NewLine + "1 for on" + Environment.NewLine + "0 for off", new Tags());
		BGM.AddToList("Volume", 0.5f, "Changes the volume of the background music" + Environment.NewLine + "1 is max volume and 0 is on mute", new Tags());
		BGM.GetFromFile();
		UI.instance.AddMod(BGM);
		MelonLogger.Msg("Added Mod");
		OnSettingSave();
	}

	public void OnSettingSave()
	{
		enable_music = (int)BGM.Settings[1].SavedValue;
		mod_volume = (float)BGM.Settings[2].SavedValue;
	}

	public override void OnLateInitializeMelon()
	{
		Calls.onMapInitialized += openningidk;
		BGM.ModSaved += OnSettingSave;
		UI.instance.UI_Initialized += OnUIInit;
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		init = false;
		currentScene = sceneName;
		if (sceneName == "Gym")
		{
			BGM_on = ((Component)GameObject.Find("--------------LOGIC--------------").transform.GetChild(12)).gameObject;
		}
	}

	public void openningidk()
	{
		init = true;
	}

	public override void OnFixedUpdate()
	{
		if (currentScene == "Gym")
		{
			BGM_on.GetComponent<AudioSource>().volume = mod_volume;
			if (enable_music == 1)
			{
				BGM_on.active = true;
			}
			else
			{
				BGM_on.active = false;
			}
		}
	}
}