Player count fix

This commit is contained in:
cxxpxr 2021-04-06 11:29:09 -04:00
parent 7e44665cbb
commit 2b731eb5bf
3 changed files with 23 additions and 5 deletions

View file

@ -13,8 +13,9 @@ using kcp2k;
#if UNITY_EDITOR #if UNITY_EDITOR
namespace LightReflectiveMirror namespace LightReflectiveMirror
{ {
[CustomEditor(typeof(LightReflectiveMirrorTransport))] [UnityEditor.CustomEditor(typeof(LightReflectiveMirrorTransport))]
public class LRMInspector : Editor
public class LRMInspector : UnityEditor.Editor
{ {
int serverPort = 7070; int serverPort = 7070;
string serverIP; string serverIP;
@ -251,4 +252,4 @@ namespace LightReflectiveMirror
} }
} }
} }
#endif #endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 588870f5e430f334592ddea2aedd6c98
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -331,7 +331,7 @@ namespace LightReflectiveMirror
{ {
for(int i = 0; i < relayServerList.Count; i++) for(int i = 0; i < relayServerList.Count; i++)
{ {
if(relayServerList[i].serverId == serverId) if(relayServerList[i].serverId == serverID)
return relayServerList[i]; return relayServerList[i];
} }
@ -372,12 +372,18 @@ namespace LightReflectiveMirror
public struct Room public struct Room
{ {
public string serverName; public string serverName;
public int currentPlayers;
public int maxPlayers; public int maxPlayers;
public int serverId; public int serverId;
public string serverData; public string serverData;
public int hostId;
public List<int> clients;
public RelayAddress relayInfo; public RelayAddress relayInfo;
/// <summary>
/// This variable is only available on the client
/// </summary>
public int currentPlayers { get => clients.Count + 1; }
} }
[Serializable] [Serializable]