QoL improvements unity side
This commit is contained in:
parent
a4548a72c1
commit
68b840bfb8
3 changed files with 24 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ namespace LightReflectiveMirror
|
||||||
public TimeSpan GetUptime() => DateTime.Now - _startupTime;
|
public TimeSpan GetUptime() => DateTime.Now - _startupTime;
|
||||||
public int GetPublicRoomCount() => _relay.rooms.Where(x => x.isPublic).Count();
|
public int GetPublicRoomCount() => _relay.rooms.Where(x => x.isPublic).Count();
|
||||||
|
|
||||||
static void WriteLogMessage(string message, ConsoleColor color = ConsoleColor.White, bool oneLine = false)
|
public static void WriteLogMessage(string message, ConsoleColor color = ConsoleColor.White, bool oneLine = false)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = color;
|
Console.ForegroundColor = color;
|
||||||
if (oneLine)
|
if (oneLine)
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,11 @@ namespace LightReflectiveMirror
|
||||||
sendBuffer.WriteByte(ref writePos, (byte)OpCodes.Authenticated);
|
sendBuffer.WriteByte(ref writePos, (byte)OpCodes.Authenticated);
|
||||||
Program.transport.ServerSend(clientId, 0, new ArraySegment<byte>(sendBuffer, 0, writePos));
|
Program.transport.ServerSend(clientId, 0, new ArraySegment<byte>(sendBuffer, 0, writePos));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Program.WriteLogMessage($"Client {clientId} sent wrong auth key! Removing from LRM node.");
|
||||||
|
Program.transport.ServerDisconnect(clientId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +78,7 @@ namespace LightReflectiveMirror
|
||||||
case OpCodes.UpdateRoomData:
|
case OpCodes.UpdateRoomData:
|
||||||
var plyRoom = _cachedClientRooms[clientId];
|
var plyRoom = _cachedClientRooms[clientId];
|
||||||
|
|
||||||
if (plyRoom == null)
|
if (plyRoom == null || plyRoom.hostId != clientId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool newName = data.ReadBool(ref pos);
|
bool newName = data.ReadBool(ref pos);
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,20 @@ namespace LightReflectiveMirror
|
||||||
{
|
{
|
||||||
// They have completed the "setup guide" Show them the main UI
|
// They have completed the "setup guide" Show them the main UI
|
||||||
|
|
||||||
|
// Remove unused transports...
|
||||||
|
foreach(var transport in lrm.GetComponentsInChildren<Transport>())
|
||||||
|
{
|
||||||
|
if(!(transport is LightReflectiveMirrorTransport))
|
||||||
|
{
|
||||||
|
if(transport != lrm.clientToServerTransport && (directModule == null ? true : directModule.directConnectTransport != transport))
|
||||||
|
{
|
||||||
|
if (transport.gameObject == lrm.gameObject)
|
||||||
|
DestroyImmediate(transport);
|
||||||
|
else
|
||||||
|
DestroyImmediate(transport.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#if !NET_4_6
|
#if !NET_4_6
|
||||||
EditorGUILayout.BeginVertical("Box");
|
EditorGUILayout.BeginVertical("Box");
|
||||||
EditorGUILayout.HelpBox("For LRM to function properly, it needs the API Compatibility to be at 4.x", MessageType.Error);
|
EditorGUILayout.HelpBox("For LRM to function properly, it needs the API Compatibility to be at 4.x", MessageType.Error);
|
||||||
|
|
@ -231,7 +245,9 @@ namespace LightReflectiveMirror
|
||||||
// NAT punch tab.
|
// NAT punch tab.
|
||||||
if (directModule == null)
|
if (directModule == null)
|
||||||
{
|
{
|
||||||
EditorGUILayout.HelpBox("If you wish to use NAT punch, you will need to add a \"Direct Connect Module\" to this gameobject.", MessageType.Info);
|
EditorGUILayout.HelpBox("NAT Punchthrough disabled, missing Direct Connect.", MessageType.Info);
|
||||||
|
if (GUILayout.Button("Add Direct Connect"))
|
||||||
|
lrm.gameObject.AddComponent<LRMDirectConnectModule>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue