refactor: network implementations switched to universe objects
This commit is contained in:
@@ -15,7 +15,7 @@ public class LiteNetLibClient : LiteNetLibCommunicatorBase, INetworkCommunicator
|
||||
|
||||
public INetworkCommunicatorClient Connect(string address, int port, string? password = null)
|
||||
{
|
||||
if (!UniverseObject.IsInUniverse)
|
||||
if (!IsInUniverse)
|
||||
throw new($"{nameof(LiteNetLibClient)} must be in an universe to connect");
|
||||
|
||||
Manager.Start();
|
||||
@@ -33,14 +33,17 @@ public class LiteNetLibClient : LiteNetLibCommunicatorBase, INetworkCommunicator
|
||||
return this;
|
||||
}
|
||||
|
||||
protected override void OnEnteredUniverse(IUniverse universe)
|
||||
protected override void OnEnteringUniverse(IUniverse universe)
|
||||
{
|
||||
base.OnEnteringUniverse(universe);
|
||||
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
PollEvents(cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
protected override void OnExitedUniverse(IUniverse universe)
|
||||
protected override void OnExitingUniverse(IUniverse universe)
|
||||
{
|
||||
base.OnExitingUniverse(universe);
|
||||
cancellationTokenSource?.Cancel();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user