Decompiled source of Eclipsed Shores v4.4.0

EclipsedShoresBaseMod.dll

Decompiled 2 days ago
using System;
using System.Collections;
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 Microsoft.CodeAnalysis;
using On.RoR2.UI.MainMenu;
using RoR2.UI.MainMenu;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EclipsedShoresBaseMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EclipsedShoresBaseMod")]
[assembly: AssemblyTitle("EclipsedShoresBaseMod")]
[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 EclipsedShoresBaseMod
{
	[BepInPlugin("zzzzzzz.HIFU.EclipsedShoresBaseMod", "EclipsedShoresBaseMod", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "zzzzzzz.HIFU.EclipsedShoresBaseMod";

		public const string PluginAuthor = "zzzzzzz.HIFU";

		public const string PluginName = "EclipsedShoresBaseMod";

		public const string PluginVersion = "1.0.1";

		public static AssetBundle assetBundle;

		public static ConfigFile esbmConfig;

		public static ConfigEntry<bool> mainMenuChanges { get; set; }

		public void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			esbmConfig = new ConfigFile(Paths.ConfigPath + "\\Smxrez.ESBM2.cfg", true);
			mainMenuChanges = esbmConfig.Bind<bool>("Main Menu Tweaks", "Enabled", true, "Enable main menu changes? This makes it darker and changes the logo.");
			if (mainMenuChanges.Value)
			{
				assetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("EclipsedShoresBaseMod.dll", "eclipsedshoresbasemod"));
				MainMenuController.Start += new hook_Start(MainMenuController_Start);
			}
		}

		private void MainMenuController_Start(orig_Start orig, MainMenuController self)
		{
			orig.Invoke(self);
			((MonoBehaviour)this).StartCoroutine(Changes());
		}

		public IEnumerator Changes()
		{
			yield return (object)new WaitForSeconds(0.03f);
			Transform mainMenu = GameObject.Find("MainMenu").transform;
			if (Object.op_Implicit((Object)(object)mainMenu))
			{
				Transform menuTitle = mainMenu.Find("MENU: Title");
				if (Object.op_Implicit((Object)(object)menuTitle))
				{
					Transform titleMenu = menuTitle.Find("TitleMenu");
					if (Object.op_Implicit((Object)(object)titleMenu))
					{
						Transform safeZone = titleMenu.Find("SafeZone");
						if (Object.op_Implicit((Object)(object)safeZone))
						{
							Transform imagePanelJuiced = safeZone.Find("ImagePanel (JUICED)");
							if (Object.op_Implicit((Object)(object)imagePanelJuiced))
							{
								Transform logoImage = imagePanelJuiced.Find("LogoImage");
								RectTransform logoRect = ((Component)logoImage).GetComponent<RectTransform>();
								((Transform)logoRect).localPosition = new Vector3(0f, 30f, 0f);
								((Transform)logoRect).localScale = Vector3.one * 1.1f;
								if (Object.op_Implicit((Object)(object)logoImage))
								{
									Image logo = ((Component)logoImage).GetComponent<Image>();
									if (Object.op_Implicit((Object)(object)logo))
									{
										Sprite eclipsedShoresLogo = (logo.sprite = assetBundle.LoadAsset<Sprite>("texEclipsedShoresLogo.png"));
										logo.overrideSprite = eclipsedShoresLogo;
									}
								}
							}
						}
					}
				}
			}
			Transform mainCamera = GameObject.Find("Main Camera").transform;
			if (Object.op_Implicit((Object)(object)mainCamera))
			{
				Transform globalPP = mainCamera.Find("GlobalPostProcessVolume, Base");
				if (Object.op_Implicit((Object)(object)globalPP))
				{
					((Component)globalPP).gameObject.SetActive(false);
					PostProcessVolume postProcessVolume = ((Component)globalPP).GetComponent<PostProcessVolume>();
					if (Object.op_Implicit((Object)(object)postProcessVolume))
					{
						RampFog rampFog = default(RampFog);
						if (postProcessVolume.profile.TryGetSettings<RampFog>(ref rampFog))
						{
							((ParameterOverride<Color>)(object)rampFog.fogColorStart).value = Color32.op_Implicit(new Color32((byte)13, (byte)62, (byte)101, (byte)39));
							((ParameterOverride<Color>)(object)rampFog.fogColorMid).value = Color32.op_Implicit(new Color32((byte)15, (byte)50, (byte)79, (byte)201));
							((ParameterOverride<Color>)(object)rampFog.fogColorEnd).value = Color32.op_Implicit(new Color32((byte)2, (byte)18, (byte)49, byte.MaxValue));
							((ParameterOverride<float>)(object)rampFog.skyboxStrength).value = 0f;
						}
						Bloom bloom = default(Bloom);
						if (postProcessVolume.profile.TryGetSettings<Bloom>(ref bloom))
						{
							((ParameterOverride<bool>)(object)((PostProcessEffectSettings)bloom).enabled).value = false;
						}
						((Component)globalPP).gameObject.SetActive(true);
					}
				}
			}
			Transform titleBackground = GameObject.Find("HOLDER: Title Background").transform;
			if (!Object.op_Implicit((Object)(object)titleBackground))
			{
				yield break;
			}
			Transform FX = titleBackground.Find("FX");
			if (!Object.op_Implicit((Object)(object)FX))
			{
				yield break;
			}
			Transform directionalLight = FX.Find("Directional Light");
			if (Object.op_Implicit((Object)(object)directionalLight))
			{
				Light light = ((Component)directionalLight).GetComponent<Light>();
				if (Object.op_Implicit((Object)(object)light))
				{
					light.color = Color32.op_Implicit(new Color32((byte)133, (byte)242, (byte)252, byte.MaxValue));
					light.intensity = 3f;
				}
			}
		}
	}
}