Decompiled source of ClientHostInfo v1.0.1

Mods/ClientHostInfo.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ClientHostInfo;
using MelonLoader;
using Microsoft.CodeAnalysis;
using RumbleModdingAPI;
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), "Host info", "1.0.1", "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 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 ClientHostInfo
{
	public static class BuildInfo
	{
		public const string ModName = "Host info";

		public const string ModVersion = "1.0.1";

		public const string Author = "oreotrollturbo";
	}
	public class TestMod : MelonMod
	{
		private static string? _currentSceneName;

		private GameObject? _infoPanel;

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

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

		private void SceneLoaded()
		{
			string currentSceneName = _currentSceneName;
			if (currentSceneName == "Map0" || currentSceneName == "Map1")
			{
				MelonCoroutines.Start(DisableInfoPanelAfterDelay(5f));
			}
			MelonCoroutines.Start(WaitAndHandleSceneSwitch(1f));
		}

		private IEnumerator WaitAndHandleSceneSwitch(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			string currentSceneName = _currentSceneName;
			string text = currentSceneName;
			string text2 = text;
			if (!(text2 == "Map0"))
			{
				if (text2 == "Map1")
				{
					Map1Init();
				}
			}
			else
			{
				Map0Init();
			}
		}

		private IEnumerator DisableInfoPanelAfterDelay(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if ((Object)(object)_infoPanel == (Object)null)
			{
				MelonLogger.Warning("Info panel is null");
			}
			else
			{
				_infoPanel.SetActive(false);
			}
		}

		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)
			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));
			}
		}

		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)
			if (Players.IsHost())
			{
				_infoPanel = CreateTextBox("Host", 10f, Color.yellow, new Vector3(0f, 3.75f, -9f), Quaternion.Euler(0f, 30.5f, 0f));
			}
			else
			{
				_infoPanel = CreateTextBox("Client", 10f, Color.yellow, new Vector3(0f, 3.75f, 9f), Quaternion.Euler(0f, 12f, 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;
		}
	}
}