Decompiled source of ClientHostInfo v1.1.2

Mods/ClientHostInfo.dll

Decompiled 2 weeks ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ClientHostInfo;
using MelonLoader;
using RumbleModdingAPI.RMAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(TestMod), "Client Host info", "1.1.2", "oreotrollturbo", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ClientHostInfo")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ClientHostInfo")]
[assembly: AssemblyTitle("ClientHostInfo")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ClientHostInfo;

public static class BuildInfo
{
	public const string ModName = "Client Host info";

	public const string ModVersion = "1.1.2";

	public const string Author = "oreotrollturbo";
}
public class TestMod : MelonMod
{
	private GameObject _infoPanel;

	public override void OnLateInitializeMelon()
	{
		Actions.onMapInitialized += SceneLoaded;
	}

	private void SceneLoaded(string sceneName)
	{
		MelonCoroutines.Start(InitializeMapTextBoxes(sceneName, 1f));
	}

	private IEnumerator InitializeMapTextBoxes(string sceneName, float delay)
	{
		yield return (object)new WaitForSeconds(delay);
		if (!(sceneName == "Map0"))
		{
			if (sceneName == "Map1")
			{
				Map1Init();
			}
		}
		else
		{
			Map0Init();
		}
	}

	private IEnumerator MoveInfoPanelAfterDelay(float delay, Vector3 vector3, Quaternion quaternion)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		yield return (object)new WaitForSeconds(delay);
		if ((Object)(object)_infoPanel == (Object)null)
		{
			MelonLogger.Warning("Info panel is null");
			yield break;
		}
		_infoPanel.transform.position = vector3;
		_infoPanel.transform.rotation = quaternion;
	}

	private void Map0Init()
	{
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		if (Players.IsHost())
		{
			_infoPanel = CreateTextBox("Host", 10f, Color.yellow, new Vector3(0f, 3.75f, -11f), Quaternion.Euler(0f, 183f, 0f));
		}
		else
		{
			_infoPanel = CreateTextBox("Client", 10f, Color.yellow, new Vector3(0f, 3.75f, 11f), Quaternion.Euler(0f, 12f, 0f));
		}
		MelonCoroutines.Start(MoveInfoPanelAfterDelay(5f, new Vector3(0f, 2f, -18f), Quaternion.Euler(0f, 183f, 0f)));
	}

	private void Map1Init()
	{
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		if (Players.IsHost())
		{
			_infoPanel = CreateTextBox("Host", 10f, Color.yellow, new Vector3(0f, 3.75f, -9f), Quaternion.Euler(0f, 183f, 0f));
		}
		else
		{
			_infoPanel = CreateTextBox("Client", 10f, Color.yellow, new Vector3(0f, 3.75f, 9f), Quaternion.Euler(0f, 12f, 0f));
		}
		MelonCoroutines.Start(MoveInfoPanelAfterDelay(5f, new Vector3(0f, 3.75f, -10.7f), Quaternion.Euler(0f, 183f, 0f)));
	}

	private static GameObject CreateTextBox(string text, float textSize, Color color, Vector3 vector, Quaternion rotation)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Create.NewText(text, textSize, color, default(Vector3), Quaternion.Euler(0f, 0f, 0f));
		val.transform.position = vector;
		val.transform.rotation = rotation;
		return val;
	}
}