public static void Reload() { Interface.LabelGroup.Clear(); Interface.CardsGroup.Clear(); Interface.ButtonGroup.Clear(); if (Client.IsConnected) { Client.Disconnect(); } if (Server.IsHosting) { Server.Stop(); } PlayerController.LocalPlayer = null; PlayerController.LocalUnit = null; Client.IsConnected = false; NetworkManager.HostPlayer = new Player(0, "server", true); NetworkManager.PlayersGroup.Clear(); NetworkManager.UnitsGroup.Clear(); World.rules = null; CurrentState = State.Menu; Interface.tree.ChangeScene(path_frags + "/Menu.tscn"); }
public static void DisconnectToMenu() { Client.Disconnect(); ThreadManager.ExecuteOnMainThread(() => { if (Server.IsHosting) { Server.Stop(); } }); Reload(); }