interface SeatingInterface {
    store: Store<GameRoomState>;
    haveSeat(index: number): boolean;
    isSeatEmpty(index: number): boolean;
    leaveSeat(seat: number): Promise<void>;
    seatOf(): number;
    takeAvailableSeat(): Promise<number>;
    takeSeat(seat: number): Promise<void>;
}

Implemented by

Properties

store: Store<GameRoomState>

The Redux-like store that manages the state of the game room.

Methods

  • Checks if the current user currecntly occupies a specific seat.

    Parameters

    • index: number

      The index of the seat to check.

    Returns boolean

    true if the user can occupy the seat, otherwise false.

  • Checks if a specific seat is empty.

    Parameters

    • index: number

      The index of the seat to check.

    Returns boolean

    true if the seat is empty, otherwise false.

  • Leaves a specific seat in the game room.

    Parameters

    • seat: number

      The index of the seat to leave.

    Returns Promise<void>

  • Gets the seat index of the current user.

    Returns number

    The seat index of the user.

  • Takes the first available seat in the game room.

    Returns Promise<number>

    A promise that resolves to the index of the seat taken.

  • Takes a specific seat in the game room.

    Parameters

    • seat: number

      The index of the seat to take.

    Returns Promise<void>