Decompiled source of NewSplashes v1.1.0

mod/NewSplashes.dll

Decompiled 3 weeks 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 BepInEx;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("IHATEPROGRAMMING")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("IHATEPROGRAMMING")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0e59b134-f599-4b91-a570-162325848ee9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace IHATEPROGRAMMING;

[BepInPlugin("Migel.NewSplashes", "NewSplashes", "1.1.0")]
public class NewSplashes : BaseUnityPlugin
{
	private GameObject val;

	private bool inMainMenu = false;

	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogWarning((object)"Plugin Loaded!");
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		inMainMenu = SceneHelper.CurrentScene == "Main Menu";
		if (!inMainMenu)
		{
			return;
		}
		val = GameObject.Find("Canvas/Main Menu (1)/LeftSide/Text (3)/Text");
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"!!!!!!!!!!!!!! TEXT NOT FOUND");
			return;
		}
		TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
		if ((Object)(object)component == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"!!!!!!!!!!!!!! TEXT COMPONENT NOT FOUND");
			return;
		}
		string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		string path = Path.Combine(directoryName, "splashes.txt");
		if (File.Exists(path))
		{
			string[] array = File.ReadAllLines(path);
			if (array.Length != 0)
			{
				Random random = new Random();
				int num = random.Next(0, array.Length);
				((TMP_Text)component).text = array[num];
			}
		}
		else
		{
			((TMP_Text)component).text = "<color=red>WHERE IS MY splashes.txt</color>";
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"!!!!!!!!!!!!!! HELL YEAH");
	}

	private void Update()
	{
		if (inMainMenu)
		{
			EnsureTextIsActive();
		}
	}

	private void EnsureTextIsActive()
	{
		if ((Object)(object)val != (Object)null && !val.activeSelf)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"just put the Active in the bag bro...");
			val.SetActive(true);
		}
	}
}