mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
feat: NetworkManagerHUD exposes configurable Port field if Transport uses a Port
This commit is contained in:
parent
4193d75551
commit
fa7977f5ae
@ -1,5 +1,3 @@
|
||||
// vis2k: GUILayout instead of spacey += ...; removed Update hotkeys to avoid
|
||||
// confusion if someone accidentally presses one.
|
||||
using UnityEngine;
|
||||
|
||||
namespace Mirror
|
||||
@ -64,14 +62,26 @@ void StartButtons()
|
||||
}
|
||||
}
|
||||
|
||||
// Client + IP
|
||||
// Client + IP (+ PORT)
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Client"))
|
||||
{
|
||||
manager.StartClient();
|
||||
}
|
||||
// This updates networkAddress every frame from the TextField
|
||||
manager.networkAddress = GUILayout.TextField(manager.networkAddress);
|
||||
// only show a port field if we have a port transport
|
||||
// we can't have "IP:PORT" in the address field since this only
|
||||
// works for IPV4:PORT.
|
||||
// for IPV6:PORT it would be misleading since IPV6 contains ":":
|
||||
// 2001:0db8:0000:0000:0000:ff00:0042:8329
|
||||
if (Transport.active is PortTransport portTransport)
|
||||
{
|
||||
// use TryParse in case someone tries to enter non-numeric characters
|
||||
if (ushort.TryParse(GUILayout.TextField(portTransport.Port.ToString()), out ushort port))
|
||||
{
|
||||
portTransport.Port = port;
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Server Only
|
||||
|
Loading…
Reference in New Issue
Block a user