feat: add multiplayer session support with ENet host/join
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace Game.Features.Multiplayer.Contracts.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Thrown when trying to host or join while already connected to a session.
|
||||
/// </summary>
|
||||
public sealed class MultiplayerAlreadyConnectedException() : MultiplayerException("Already connected to a session.");
|
||||
+1
@@ -0,0 +1 @@
|
||||
uid://dr6f5t6nhh60w
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Game.Features.Multiplayer.Contracts.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Thrown when trying to host or join while already hosting a session.
|
||||
/// </summary>
|
||||
public sealed class MultiplayerAlreadyHostingException() : MultiplayerException("Already hosting a session.");
|
||||
+1
@@ -0,0 +1 @@
|
||||
uid://c41cffks8ymh0
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace Game.Features.Multiplayer.Contracts.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Base type for multiplayer connection failures.
|
||||
/// </summary>
|
||||
public abstract class MultiplayerException(string message) : Exception(message);
|
||||
@@ -0,0 +1 @@
|
||||
uid://ct5t3i77ovfx1
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Game.Features.Multiplayer.Contracts.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Thrown when starting a host fails at the transport level.
|
||||
/// </summary>
|
||||
public sealed class MultiplayerHostException(int port, string reason)
|
||||
: MultiplayerException($"Failed to start host on port {port}: {reason}.")
|
||||
{
|
||||
public int Port { get; } = port;
|
||||
public string Reason { get; } = reason;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://scqi785gvntu
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Game.Features.Multiplayer.Contracts.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Thrown when connecting to a host fails at the transport level.
|
||||
/// </summary>
|
||||
public sealed class MultiplayerJoinException(string address, int port, string reason)
|
||||
: MultiplayerException($"Failed to connect to {address}:{port}: {reason}.")
|
||||
{
|
||||
public string Address { get; } = address;
|
||||
public int Port { get; } = port;
|
||||
public string Reason { get; } = reason;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://q8oyea00yrxy
|
||||
Reference in New Issue
Block a user