LobbyServer/LobbyClient/LobbyClientEvent.cs

73 lines
3.1 KiB
C#

namespace Lobbies
{
/// <summary>
/// Contains a lobby client event
/// </summary>
public class LobbyClientEvent
{
/// <summary>
/// Identifier type of the event
/// </summary>
public LobbyClientEventTypes EventType { get; internal set; }
/// <summary>
/// Optional data object, contains additional information for the event. See <see cref="LobbyClientEventTypes"/> for possible values.
/// </summary>
public object? EventData { get; internal set; }
}
/// <summary>
/// The list of events that can occur.
/// </summary>
public enum LobbyClientEventTypes
{
/// <summary>
/// Client connected to lobby server. EventData is null.
/// </summary>
Connected,
/// <summary>
/// Client disconnected from lobby server graceful. EventData is <see cref="LobbyClientDisconnectReason"/>.
/// </summary>
Disconnected,
/// <summary>
/// Connection lost to lobby server. EventData is LobbyClientDisconnectReason.
/// </summary>
Failed,
/// <summary>
/// A lobby was added to the lobby list for the observed game id. EventData is <see cref="LobbyAdd"/> with the lobby data.
/// </summary>
LobbyAdd,
/// <summary>
/// A lobby was changed for the observed game id. EventData is <see cref="LobbyUpdate"/> with the lobby data.
/// </summary>
LobbyUpdate,
/// <summary>
/// A lobby was removed from the lobby list for the observed game id. EventData is <see cref="LobbyDelete"/> with the lobby id.
/// </summary>
LobbyDelete,
/// <summary>
/// The game host shared his self known address. EventData is <see cref="LobbyHostInfo"/> with the games hosts self known address, most likely internal.
/// </summary>
LobbyHostInfo,
/// <summary>
/// A nat punch was requested by another LobbyClient to be performed by the host LobbyClient. EventData is <see cref="LobbyRequestNatPunch"/> with the clients seen external address to nat punch to.
/// </summary>
LobbyRequestNatPunch,
/// <summary>
/// Game host has finished the nat punch. EventData is <see cref="LobbyRequestNatPunch"/> with the games hosts external address.
/// </summary>
LobbyNatPunchDone,
/// <summary>
/// Response to a query of our external ip and port seen by the lobby server. EventData is <see cref="SeenExternalIpAndPort"/> with the clients seen external address.
/// </summary>
ExternalIpAndPort,
/// <summary>
/// A direct connection test without a nat punch was testet. EventData is <see cref="DirectConnectionResultTest"/> with information if a direct connection was possible and on what address.
/// </summary>
DirectConnectionTestComplete,
/// <summary>
/// A join request to a lobby has failed. EventData is <see cref="LobbyJoinFailReason"/> with information about the failure.
/// </summary>
LobbyJoinFailed,
}
}