Table of Contents

Interface IPlayerRule<TPayload>

Namespace
Wyn.Lobby
Assembly
Wyn.Lobby.Runtime.dll

Extension point for game-specific lobby rules. Implement this interface to define validation logic and start conditions.

public interface IPlayerRule<TPayload> where TPayload : unmanaged, INetworkSerializable, IEquatable<TPayload>

Type Parameters

TPayload

Game-specific player data type.

Methods

CanStartGame(IReadOnlyList<LobbyPlayerState<TPayload>>, out string)

Determine if all conditions are met to start the game.

bool CanStartGame(IReadOnlyList<LobbyPlayerState<TPayload>> players, out string reason)

Parameters

players IReadOnlyList<LobbyPlayerState<TPayload>>

All current players in the lobby.

reason string

If returning false, the reason why the game cannot start.

Returns

bool

True if the game can start.

ValidatePayloadUpdate(ulong, in LobbyPlayerState<TPayload>, in TPayload)

Validate whether a player's payload update is allowed. For example, check if a character selection conflicts with another player.

bool ValidatePayloadUpdate(ulong senderId, in LobbyPlayerState<TPayload> current, in TPayload proposed)

Parameters

senderId ulong

The client ID requesting the update.

current LobbyPlayerState<TPayload>

The player's current state.

proposed TPayload

The proposed new payload.

Returns

bool

True if the update is valid.