refactor: Folder and Namespace Restructure of Network Code

This commit is contained in:
Syntriax 2024-02-09 10:00:36 +03:00
parent 6c326b1fc6
commit 86ef57fb62
13 changed files with 29 additions and 20 deletions

View File

@ -1,15 +1,15 @@
using System; using System;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Content;
using LiteNetLib; using LiteNetLib;
using Pong.Network;
using Syntriax.Engine.Core; using Syntriax.Engine.Core;
using Syntriax.Engine.Network;
using Syntriax.Engine.Network.Abstract;
using Syntriax.Engine.Physics2D; using Syntriax.Engine.Physics2D;
using Syntriax.Engine.Physics2D.Abstract; using Syntriax.Engine.Physics2D.Abstract;
using Microsoft.Xna.Framework.Audio;
namespace Pong.Behaviours; namespace Pong.Behaviours;

View File

@ -5,10 +5,10 @@ using Microsoft.Xna.Framework.Input;
using LiteNetLib; using LiteNetLib;
using LiteNetLib.Utils; using LiteNetLib.Utils;
using Pong.Network;
using Syntriax.Engine.Core; using Syntriax.Engine.Core;
using Syntriax.Engine.Input; using Syntriax.Engine.Input;
using Syntriax.Engine.Network;
using Syntriax.Engine.Network.Abstract;
namespace Pong.Behaviours; namespace Pong.Behaviours;

View File

@ -4,9 +4,9 @@ using Microsoft.Xna.Framework.Input;
using LiteNetLib; using LiteNetLib;
using Pong.Network;
using Syntriax.Engine.Core; using Syntriax.Engine.Core;
using Syntriax.Engine.Network;
using Syntriax.Engine.Network.Abstract;
namespace Pong.Behaviours; namespace Pong.Behaviours;

View File

@ -7,7 +7,7 @@ using Microsoft.Xna.Framework.Input;
using Apos.Shapes; using Apos.Shapes;
using Pong.Behaviours; using Pong.Behaviours;
using Pong.Network; using Syntriax.Engine.Network;
using Syntriax.Engine.Core; using Syntriax.Engine.Core;
using Syntriax.Engine.Core.Abstract; using Syntriax.Engine.Core.Abstract;

View File

@ -1,6 +1,6 @@
using Syntriax.Engine.Core.Abstract; using Syntriax.Engine.Core.Abstract;
namespace Pong.Network; namespace Syntriax.Engine.Network.Abstract;
public interface INetworkBehaviour : IBehaviour public interface INetworkBehaviour : IBehaviour
{ {

View File

@ -1,4 +1,4 @@
namespace Pong.Network; namespace Syntriax.Engine.Network.Abstract;
public interface INetworkClient : INetworkCommunicator public interface INetworkClient : INetworkCommunicator
{ {

View File

@ -1,9 +1,11 @@
using System; using System;
using LiteNetLib; using LiteNetLib;
using LiteNetLib.Utils; using LiteNetLib.Utils;
using Syntriax.Engine.Core.Abstract; using Syntriax.Engine.Core.Abstract;
namespace Pong.Network; namespace Syntriax.Engine.Network.Abstract;
public interface INetworkCommunicator public interface INetworkCommunicator
{ {

View File

@ -1,4 +1,4 @@
namespace Pong.Network; namespace Syntriax.Engine.Network.Abstract;
public interface INetworkServer : INetworkCommunicator public interface INetworkServer : INetworkCommunicator
{ {

View File

@ -6,8 +6,9 @@ using LiteNetLib.Utils;
using Syntriax.Engine.Core; using Syntriax.Engine.Core;
using Syntriax.Engine.Core.Abstract; using Syntriax.Engine.Core.Abstract;
using Syntriax.Engine.Network.Abstract;
namespace Pong.Network; namespace Syntriax.Engine.Network;
public abstract class NetworkBase : BehaviourOverride, INetworkCommunicator public abstract class NetworkBase : BehaviourOverride, INetworkCommunicator
{ {

View File

@ -1,6 +1,7 @@
using Syntriax.Engine.Core; using Syntriax.Engine.Core;
using Syntriax.Engine.Network.Abstract;
namespace Pong.Network; namespace Syntriax.Engine.Network;
public class NetworkBehaviour : BehaviourOverride, INetworkBehaviour public class NetworkBehaviour : BehaviourOverride, INetworkBehaviour
{ {
@ -20,10 +21,10 @@ public class NetworkBehaviour : BehaviourOverride, INetworkBehaviour
if (NetworkCommunicator is INetworkServer server) if (NetworkCommunicator is INetworkServer server)
{ {
IsServer = true; IsServer = true;
LocalAssigned = true; LocalAssigned = true;
// TODO Set and send Network Id // TODO Set and send Network Id
} }
else else
IsClient = true; IsClient = true;

View File

@ -1,4 +1,6 @@
namespace Pong.Network; using Syntriax.Engine.Network.Abstract;
namespace Syntriax.Engine.Network;
public class NetworkClient : NetworkBase, INetworkClient public class NetworkClient : NetworkBase, INetworkClient
{ {

View File

@ -1,8 +1,9 @@
using LiteNetLib; using LiteNetLib;
using LiteNetLib.Utils; using LiteNetLib.Utils;
using Syntriax.Engine.Core; using Syntriax.Engine.Core;
namespace Pong.Network; namespace Syntriax.Engine.Network;
public static class NetworkExtensions public static class NetworkExtensions
{ {

View File

@ -1,4 +1,6 @@
namespace Pong.Network; using Syntriax.Engine.Network.Abstract;
namespace Syntriax.Engine.Network;
public class NetworkServer : NetworkBase, INetworkServer public class NetworkServer : NetworkBase, INetworkServer
{ {