Decompiled source of GambleDirectConnect v2.1.0

ip_conntction.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Mirror;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ip_conntction")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ip_conntction")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("63512e08-a8b6-4269-82e9-d9af1735f9a0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace GambleDirectConnect;

[BepInPlugin("com.yourname.gambledirectconnect", "Gamble Direct Connect", "1.6.0")]
public class Plugin : BaseUnityPlugin
{
	private string targetIP = "26.x.x.x";

	private bool showMenu = true;

	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Мод Gamble Direct Connect успешно загружен!");
	}

	private void Update()
	{
		if (Input.GetKeyUp((KeyCode)285))
		{
			showMenu = !showMenu;
		}
	}

	private void OnGUI()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Invalid comparison between Unknown and I4
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Invalid comparison between Unknown and I4
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Expected O, but got Unknown
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Expected O, but got Unknown
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		if (Event.current != null && Event.current.isKey && (int)Event.current.keyCode == 285 && (int)Event.current.type == 5)
		{
			showMenu = !showMenu;
			Event.current.Use();
		}
		if (showMenu)
		{
			GUI.color = Color.white;
			GUI.contentColor = Color.white;
			GUI.backgroundColor = Color.white;
			GUIStyle val = new GUIStyle(GUI.skin.label);
			val.normal.textColor = Color.white;
			val.fontStyle = (FontStyle)1;
			GUIStyle val2 = new GUIStyle(GUI.skin.button);
			val2.normal.textColor = Color.white;
			GUILayout.BeginArea(new Rect(20f, 20f, 260f, 140f), GUIStyle.none);
			GUILayout.Label("=== Gamble LAN Menu ===", val, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Press F4 to Hide / Show", val, Array.Empty<GUILayoutOption>());
			targetIP = GUILayout.TextField(targetIP, 30, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Host LAN", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				StartLanServer();
			}
			if (GUILayout.Button("Connect (IP)", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				ConnectToLanServer(targetIP);
			}
			GUILayout.EndHorizontal();
			GUILayout.EndArea();
		}
	}

	private void StartLanServer()
	{
		if (!((Object)(object)NetworkManager.singleton == (Object)null))
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Запуск LAN Сервера...");
			NetworkManager.singleton.StartHost();
			showMenu = false;
		}
	}

	private void ConnectToLanServer(string ip)
	{
		if (!((Object)(object)NetworkManager.singleton == (Object)null))
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Подключение к серверу: " + ip));
			NetworkManager.singleton.networkAddress = ip;
			NetworkManager.singleton.StartClient();
			showMenu = false;
		}
	}
}