mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Revert "fix: NetworkManagerHUD use NetworkManager.singleton"
This reverts commit 294011803b
.
This commit is contained in:
parent
d17f91c447
commit
eff3687a19
@ -11,9 +11,16 @@ namespace Mirror
|
||||
[HelpURL("https://mirror-networking.gitbook.io/docs/components/network-manager-hud")]
|
||||
public class NetworkManagerHUD : MonoBehaviour
|
||||
{
|
||||
NetworkManager manager;
|
||||
|
||||
public int offsetX;
|
||||
public int offsetY;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
manager = GetComponent<NetworkManager>();
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
GUILayout.BeginArea(new Rect(10 + offsetX, 40 + offsetY, 215, 9999));
|
||||
@ -53,7 +60,7 @@ void StartButtons()
|
||||
{
|
||||
if (GUILayout.Button("Host (Server + Client)"))
|
||||
{
|
||||
NetworkManager.singleton.StartHost();
|
||||
manager.StartHost();
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,10 +68,10 @@ void StartButtons()
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Client"))
|
||||
{
|
||||
NetworkManager.singleton.StartClient();
|
||||
manager.StartClient();
|
||||
}
|
||||
// This updates networkAddress every frame from the TextField
|
||||
NetworkManager.singleton.networkAddress = GUILayout.TextField(NetworkManager.singleton.networkAddress);
|
||||
manager.networkAddress = GUILayout.TextField(manager.networkAddress);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Server Only
|
||||
@ -75,16 +82,16 @@ void StartButtons()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUILayout.Button("Server Only")) NetworkManager.singleton.StartServer();
|
||||
if (GUILayout.Button("Server Only")) manager.StartServer();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Connecting
|
||||
GUILayout.Label($"Connecting to {NetworkManager.singleton.networkAddress}..");
|
||||
GUILayout.Label($"Connecting to {manager.networkAddress}..");
|
||||
if (GUILayout.Button("Cancel Connection Attempt"))
|
||||
{
|
||||
NetworkManager.singleton.StopClient();
|
||||
manager.StopClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,7 +114,7 @@ void StatusLabels()
|
||||
// client only
|
||||
else if (NetworkClient.isConnected)
|
||||
{
|
||||
GUILayout.Label($"<b>Client</b>: connected to {NetworkManager.singleton.networkAddress} via {Transport.activeTransport}");
|
||||
GUILayout.Label($"<b>Client</b>: connected to {manager.networkAddress} via {Transport.activeTransport}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +125,7 @@ void StopButtons()
|
||||
{
|
||||
if (GUILayout.Button("Stop Host"))
|
||||
{
|
||||
NetworkManager.singleton.StopHost();
|
||||
manager.StopHost();
|
||||
}
|
||||
}
|
||||
// stop client if client-only
|
||||
@ -126,7 +133,7 @@ void StopButtons()
|
||||
{
|
||||
if (GUILayout.Button("Stop Client"))
|
||||
{
|
||||
NetworkManager.singleton.StopClient();
|
||||
manager.StopClient();
|
||||
}
|
||||
}
|
||||
// stop server if server-only
|
||||
@ -134,7 +141,7 @@ void StopButtons()
|
||||
{
|
||||
if (GUILayout.Button("Stop Server"))
|
||||
{
|
||||
NetworkManager.singleton.StopServer();
|
||||
manager.StopServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user