refactor: client is now running on a different thread
This commit is contained in:
@@ -3,6 +3,8 @@ using System.Linq;
|
||||
using LiteNetLib;
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
using Syntriax.Engine.Core;
|
||||
|
||||
namespace Syntriax.Engine.Network;
|
||||
|
||||
public class LiteNetLibServer : LiteNetLibCommunicatorBase, INetworkCommunicatorServer
|
||||
@@ -42,7 +44,6 @@ public class LiteNetLibServer : LiteNetLibCommunicatorBase, INetworkCommunicator
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public INetworkCommunicatorServer SendToClient<T>(string to, T packet) where T : class, new()
|
||||
{
|
||||
bool isBroadcastToAll = to.CompareTo("*") == 0;
|
||||
@@ -58,4 +59,8 @@ public class LiteNetLibServer : LiteNetLibCommunicatorBase, INetworkCommunicator
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
protected override void OnEnteredUniverse(IUniverse universe) => universe.OnPostUpdate += PollEvents;
|
||||
protected override void OnExitedUniverse(IUniverse universe) => universe.OnPostUpdate -= PollEvents;
|
||||
private void PollEvents(IUniverse sender, UniverseTime engineTime) => Manager.PollEvents();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user