Decompiled source of RumbleDarkMode v2.0.0

Mods/RumbleDarkMode.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MelonLoader;
using Microsoft.CodeAnalysis;
using RumbleDarkMode;
using RumbleModdingAPI;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Main), "Rumble Dark Mode", "2.0.0", "ERROR", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 255, 0, 0)]
[assembly: MelonAuthorColor(255, 255, 0, 0)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b10c94a1-8a40-4701-bc5b-98eabb44dfea")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RumbleDarkMode")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+858e0976c3de6a25d51de2d1df9a31226a2214ba")]
[assembly: AssemblyProduct("RumbleDarkMode")]
[assembly: AssemblyTitle("RumbleDarkMode")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : 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]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace RumbleDarkMode
{
	public class Main : MelonMod
	{
		private string currentScene = "Loader";

		public override void OnLateInitializeMelon()
		{
			Calls.onMapInitialized += OnMapInitialized;
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			currentScene = sceneName;
		}

		private void OnMapInitialized()
		{
			if (currentScene == "Gym" || currentScene == "Park")
			{
				Initialize();
			}
		}

		private void Initialize()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			RenderSettings.ambientMode = (AmbientMode)1;
			RenderSettings.ambientIntensity = 1f;
			RenderSettings.defaultReflectionMode = (DefaultReflectionMode)0;
			RenderSettings.fogColor = Color.black;
			Light[] array = Il2CppArrayBase<Light>.op_Implicit(Object.FindObjectsOfType<Light>());
			Light[] array2 = array;
			foreach (Light val in array2)
			{
				val.cullingMask = -1;
			}
			Renderer[] array3 = Il2CppArrayBase<Renderer>.op_Implicit(Object.FindObjectsOfType<Renderer>());
			Renderer[] array4 = array3;
			foreach (Renderer val2 in array4)
			{
				val2.lightmapIndex = -1;
				val2.lightProbeUsage = (LightProbeUsage)0;
			}
			LightmapSettings.lightmaps = null;
			GameObject val3 = new GameObject("Moonlight");
			Light val4 = val3.AddComponent<Light>();
			val4.type = (LightType)1;
			val4.intensity = 0.1f;
			val4.color = new Color(0.72f, 0.8084f, 0.9344f);
			val3.transform.rotation = Quaternion.Euler(42.8454f, 0f, 0f);
			if (currentScene == "Gym")
			{
				FTraceLightmaps.GetGameObject().SetActive(false);
				Light component = DirectionalLight.GetGameObject().GetComponent<Light>();
				component.intensity = 0.4f;
				((Component)component).transform.rotation = Quaternion.Euler(42.8454f, 0f, 0f);
				component.color = new Color(0.72f, 0.8084f, 0.9344f);
				Probes.GetGameObject().SetActive(false);
				AlertLightVFX.GetGameObject().SetActive(false);
			}
			else if (currentScene == "Park")
			{
				FTraceLightMaps.GetGameObject().SetActive(false);
				Light component2 = DirectionalLight.GetGameObject().GetComponent<Light>();
				component2.intensity = 0.4f;
				((Component)component2).transform.rotation = Quaternion.Euler(42.8454f, 0f, 0f);
				component2.color = new Color(0.72f, 0.8084f, 0.9344f);
				Probes.GetGameObject().SetActive(false);
			}
			using Stream stream = ((MelonBase)this).MelonAssembly.Assembly.GetManifestResourceStream("RumbleDarkMode.Resources.skyearlydusk");
			byte[] array5 = new byte[stream.Length];
			stream.Read(array5, 0, array5.Length);
			Il2CppAssetBundle val5 = Il2CppAssetBundleManager.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array5));
			RenderSettings.skybox = Object.Instantiate<Material>(val5.LoadAsset<Material>("SkyEarlyDusk"));
			val5.Unload(false);
		}
	}
}