Update v6

This commit is contained in:
Derek 2021-02-16 18:26:16 -06:00
parent 450d7ba309
commit a57b48105b
2 changed files with 8 additions and 4 deletions

View file

@ -43,9 +43,6 @@ Light Reflective Mirror has a built in room/server list if you would like to use
To request the server list you need a reference to the LightReflectiveMirrorTransport from your script and call 'RequestServerList()'. This will invoke a request to the server to update our server list. Once the response is recieved the field 'relayServerList' will be populated and you can get all the servers from there.
#### Free Relay
Note: If you would like to test without creating a server, feel free to use my test server with IP: 34.67.125.123. Which is in there by default :)
#### Server Setup
Download the latest Server release from: [Releases](https://github.com/Derek-R-S/Light-Reflective-Mirror/releases)
Make sure you have .NET Core 3.1

View file

@ -34,6 +34,7 @@ namespace LightReflectiveMirror
private bool _isServer = false;
private bool _isAuthenticated = false;
private int _currentMemberId;
private bool _callbacksInitialized = false;
private BiDictionary<int, int> _connectedRelayClients = new BiDictionary<int, int>();
public bool IsAuthenticated() => _isAuthenticated;
@ -44,14 +45,20 @@ namespace LightReflectiveMirror
throw new Exception("Haha real funny... Use a different transport.");
}
SetupCallbacks();
if (connectOnAwake)
ConnectToRelay();
InvokeRepeating(nameof(SendHeartbeat), heartBeatInterval, heartBeatInterval);
}
private void OnEnable()
private void SetupCallbacks()
{
if (_callbacksInitialized)
return;
_callbacksInitialized = true;
clientToServerTransport.OnClientConnected = ConnectedToRelay;
clientToServerTransport.OnClientDataReceived = DataReceived;
clientToServerTransport.OnClientDisconnected = Disconnected;