refactor: Folder and Namespace Restructure of Network Code
This commit is contained in:
15
Game/Network/Abstract/INetworkBehaviour.cs
Normal file
15
Game/Network/Abstract/INetworkBehaviour.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Syntriax.Engine.Core.Abstract;
|
||||
|
||||
namespace Syntriax.Engine.Network.Abstract;
|
||||
|
||||
public interface INetworkBehaviour : IBehaviour
|
||||
{
|
||||
int NetworkId { get; }
|
||||
|
||||
bool LocalAssigned { get; }
|
||||
|
||||
bool IsServer { get; }
|
||||
bool IsClient { get; }
|
||||
|
||||
INetworkCommunicator NetworkCommunicator { get; }
|
||||
}
|
6
Game/Network/Abstract/INetworkClient.cs
Normal file
6
Game/Network/Abstract/INetworkClient.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Syntriax.Engine.Network.Abstract;
|
||||
|
||||
public interface INetworkClient : INetworkCommunicator
|
||||
{
|
||||
void Connect(string address, int port, string? password = null);
|
||||
}
|
21
Game/Network/Abstract/INetworkCommunicator.cs
Normal file
21
Game/Network/Abstract/INetworkCommunicator.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
using LiteNetLib;
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
using Syntriax.Engine.Core.Abstract;
|
||||
|
||||
namespace Syntriax.Engine.Network.Abstract;
|
||||
|
||||
public interface INetworkCommunicator
|
||||
{
|
||||
EventBasedNetListener Listener { get; }
|
||||
NetManager Manager { get; }
|
||||
|
||||
void PollEvents();
|
||||
void Stop();
|
||||
|
||||
void RegisterEntityListener(IEntity entity, Action<NetPacketReader> onDataReceived);
|
||||
void UnregisterEntityListener(IEntity entity);
|
||||
NetDataWriter GetEntityWriter(IEntity entity);
|
||||
}
|
10
Game/Network/Abstract/INetworkServer.cs
Normal file
10
Game/Network/Abstract/INetworkServer.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Syntriax.Engine.Network.Abstract;
|
||||
|
||||
public interface INetworkServer : INetworkCommunicator
|
||||
{
|
||||
string Password { get; }
|
||||
int MaxConnectionCount { get; }
|
||||
int Port { get; }
|
||||
|
||||
void Start(int port, int maxConnectionCount, string? password = null);
|
||||
}
|
Reference in New Issue
Block a user