Decompiled source of InGameRoomMenu v1.0.0

InGameRoomMenu.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using ToolClasses;
using UnityEngine;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("InGameRoomMenu")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InGameRoomMenu")]
[assembly: AssemblyTitle("InGameRoomMenu")]
[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 InGameRoomMenu
{
	[BepInPlugin("InGameRoomMenu", "InGameRoomMenu", "1.0.0")]
	[BepInProcess("Void Crew.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BepinPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin InGameRoomMenu is loaded!");
		}
	}
	internal class UGRMGUI : ModSettingsMenu
	{
		private string RoomName;

		private bool RoomIsPrivate = false;

		private float PlayerLimit;

		public override string Name()
		{
			return "In-Game Room Menu";
		}

		public override void Draw()
		{
			if (!Game.InGame)
			{
				GUILayout.Label("Must be in game", Array.Empty<GUILayoutOption>());
				return;
			}
			if (RoomName == null)
			{
				((ModSettingsMenu)this).OnOpen();
			}
			GUILayout.Label("Usage: While in game and host, change values below and hit 'apply'. Loaded values are reloaded on menu open.", Array.Empty<GUILayoutOption>());
			GUILayout.Label("Room Name:", Array.Empty<GUILayoutOption>());
			RoomName = GUILayout.TextField(RoomName, Array.Empty<GUILayoutOption>());
			if (GUILayout.Button($"Private Room: {RoomIsPrivate}", Array.Empty<GUILayoutOption>()) && PhotonNetwork.IsMasterClient)
			{
				RoomIsPrivate = !RoomIsPrivate;
			}
			GUILayout.Label("Player Limit: " + PlayerLimit + "/4", Array.Empty<GUILayoutOption>());
			PlayerLimit = GUILayout.HorizontalSlider(PlayerLimit, 0f, 4f, Array.Empty<GUILayoutOption>());
			PlayerLimit = (int)PlayerLimit;
			if (!PhotonNetwork.IsMasterClient)
			{
				GUILayout.Label("Must be host to change settings", Array.Empty<GUILayoutOption>());
			}
			else if (GUILayout.Button("Apply", Array.Empty<GUILayoutOption>()))
			{
				if (PunSingleton<PhotonService>.Instance.GetCurrentRoomPrivate() != RoomIsPrivate)
				{
					PunSingleton<PhotonService>.Instance.SetCurrentRoomPrivate(RoomIsPrivate);
				}
				if (RoomName != PunSingleton<PhotonService>.Instance.GetCurrentRoomName())
				{
					PunSingleton<PhotonService>.Instance.SetCurrentRoomName(RoomName);
				}
				if ((byte)PlayerLimit != PhotonNetwork.CurrentRoom.MaxPlayers)
				{
					PhotonNetwork.CurrentRoom.MaxPlayers = (byte)PlayerLimit;
				}
			}
		}

		public override void OnOpen()
		{
			if (Game.InGame)
			{
				RoomName = PunSingleton<PhotonService>.Instance.GetCurrentRoomName();
				RoomIsPrivate = PunSingleton<PhotonService>.Instance.GetCurrentRoomPrivate();
				PlayerLimit = (int)PhotonNetwork.CurrentRoom.MaxPlayers;
			}
		}
	}
	public class VoidManagerPlugin : VoidPlugin
	{
		public override MultiplayerType MPType => (MultiplayerType)3;

		public override string Author => "Dragon";

		public override string Description => "Allows host to manage room settings during gameplay. Accessed with F5 menu.";
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "InGameRoomMenu";

		public const string PLUGIN_NAME = "InGameRoomMenu";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}