diff --git a/.vscode/launch.json b/.vscode/launch.json index 9a2e007..243f436 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build-client", - "program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net9.0/Pong.dll", + "program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net10.0/Pong.dll", "args": [], "cwd": "${workspaceFolder}", "stopAtEntry": false, @@ -22,7 +22,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build-client", - "program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net9.0/Desktop.dll", + "program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net10.0/Pong.dll", "args": [], "cwd": "${workspaceFolder}", "stopAtEntry": false, @@ -38,7 +38,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build-server", - "program": "${workspaceFolder}/Platforms/Server/bin/Debug/net9.0/Server.dll", + "program": "${workspaceFolder}/Platforms/Server/bin/Debug/net10.0/Server.dll", "args": [], "env": { "PORT": "8888", diff --git a/Engine b/Engine index a050909..913af2a 160000 --- a/Engine +++ b/Engine @@ -1 +1 @@ -Subproject commit a05090937565b1ee055ee9765675c3637fca446f +Subproject commit 913af2a4a4cb01908e9d46507a42892e6adf3741 diff --git a/Platforms/Desktop/Desktop.csproj b/Platforms/Desktop/Desktop.csproj index 6606edc..01a6fbe 100644 --- a/Platforms/Desktop/Desktop.csproj +++ b/Platforms/Desktop/Desktop.csproj @@ -1,7 +1,7 @@ WinExe - net9.0 + net10.0 Major false false diff --git a/Platforms/Server/Server.csproj b/Platforms/Server/Server.csproj index 1a41871..512207a 100644 --- a/Platforms/Server/Server.csproj +++ b/Platforms/Server/Server.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 disable enable Pong.Platforms.Server diff --git a/Shared/Behaviours/DrawableColliderCircle.cs b/Shared/Behaviours/DrawableColliderCircle.cs index 32d57f6..0a86ee8 100644 --- a/Shared/Behaviours/DrawableColliderCircle.cs +++ b/Shared/Behaviours/DrawableColliderCircle.cs @@ -1,5 +1,5 @@ using Engine.Core; -using Engine.Integration.MonoGame; +using Engine.Systems.Graphics; namespace Pong.Behaviours; diff --git a/Shared/Behaviours/DrawableColliderShape.cs b/Shared/Behaviours/DrawableColliderShape.cs index bfb79ed..6b647c5 100644 --- a/Shared/Behaviours/DrawableColliderShape.cs +++ b/Shared/Behaviours/DrawableColliderShape.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Engine.Core; -using Engine.Integration.MonoGame; +using Engine.Systems.Graphics; namespace Pong.Behaviours; diff --git a/Shared/Behaviours/Paddle.cs b/Shared/Behaviours/Paddle.cs index ebb6e6f..b2e4055 100644 --- a/Shared/Behaviours/Paddle.cs +++ b/Shared/Behaviours/Paddle.cs @@ -7,19 +7,14 @@ using Engine.Systems.Network; using Engine.Physics2D; using Engine.Systems.Input; using Engine.Systems.Tween; +using Engine.Core.Debug; namespace Pong.Behaviours; public class Paddle(Keys Up, Keys Down, float High, float Low, float Speed) : Behaviour2D, IFirstFrameUpdate, IPhysicsIteration, IPostPhysicsUpdate, - IPacketListenerServer, IPacketListenerClient + IPacketListenerServerEntity, IPacketListenerClientEntity { - private Keys Up { get; } = Up; - private Keys Down { get; } = Down; - public float High { get; } = High; - public float Low { get; } = Low; - public float Speed { get; set; } = Speed; - private bool isUpPressed = false; private bool isDownPressed = false; @@ -66,18 +61,19 @@ public class Paddle(Keys Up, Keys Down, float High, float Low, float Speed) : Be private void OnDownPressed(IButtonInputs sender, IButtonInputs.ButtonCallbackArguments args) { isDownPressed = true; networkClient?.SendToServer(new PaddleKeyStatePacket(this)); } private void OnDownReleased(IButtonInputs sender, IButtonInputs.ButtonCallbackArguments args) { isDownPressed = false; networkClient?.SendToServer(new PaddleKeyStatePacket(this)); } - public void OnServerPacketArrived(IConnection sender, PaddleKeyStatePacket packet) + public void OnEntityServerPacketArrived(IConnection sender, PaddleKeyStatePacket packet) { physicsEngine2D.StepIndividual(rigidBody, -sender.Ping.Min(.05f)); isUpPressed = packet.IsUpPressed; isDownPressed = packet.IsDownPressed; + ILogger.Shared.Log(this, $"Packet Server {isUpPressed} | {isDownPressed}"); physicsEngine2D.StepIndividual(rigidBody, sender.Ping.Min(.05f)); networkServer?.SendToAll(new PaddleKeyStatePacket(this)); } - public void OnClientPacketArrived(IConnection sender, PaddleKeyStatePacket packet) + public void OnEntityClientPacketArrived(IConnection sender, PaddleKeyStatePacket packet) { if (packet.IsDownPressed || packet.IsUpPressed) // Check if the server paddle is moving if (isDownPressed == packet.IsDownPressed && isUpPressed == packet.IsUpPressed) // Check if we are the ones giving the inputs @@ -87,6 +83,7 @@ public class Paddle(Keys Up, Keys Down, float High, float Low, float Speed) : Be isUpPressed = packet.IsUpPressed; isDownPressed = packet.IsDownPressed; + ILogger.Shared.Log(this, $"Packet Client {isUpPressed} | {isDownPressed}"); physicsEngine2D.StepIndividual(rigidBody, sender.Ping); diff --git a/Shared/PongUniverse.cs b/Shared/PongUniverse.cs index e6ec23a..f426a8c 100644 --- a/Shared/PongUniverse.cs +++ b/Shared/PongUniverse.cs @@ -8,6 +8,7 @@ using Engine.Integration.MonoGame; using Engine.Physics2D; using Engine.Systems.Network; using Engine.Systems.Tween; +using Engine.Systems.Graphics; using Pong.Behaviours; @@ -31,6 +32,7 @@ public static class PongUniverse universe.InstantiateUniverseObject().SetUniverseObject("Camera") .BehaviourController.AddBehaviour() .BehaviourController.AddBehaviour() + .BehaviourController.AddBehaviour() .BehaviourController.AddBehaviour(); //////////////////////////////////////////////////////////////////////////////////// diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index 1ca360c..f5a8fa4 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 enable Pong.Shared Pong.Shared