Interface IPlayerRule<TPayload>
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
TPayloadGame-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
playersIReadOnlyList<LobbyPlayerState<TPayload>>All current players in the lobby.
reasonstringIf 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
senderIdulongThe client ID requesting the update.
currentLobbyPlayerState<TPayload>The player's current state.
proposedTPayloadThe proposed new payload.
Returns
- bool
True if the update is valid.