lobby

package
v0.0.0-...-1aa1bea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInRange

func IsInRange(players []models.Player, i int) bool

Types

type Lobby

type Lobby struct {
	pokerModels.LobbyBase

	Players       []models.Player
	PublicPlayers []models.PublicPlayer
	PlayerQueue   *queue.PlayerQueue
	RemovalQueue  queue.IQueue
	Bank          bank.Interface

	GameStarted bool
	// contains filtered or unexported fields
}

Lobby is the Parent structure for a poker lobby it handles the player joins and removals and the game starts.

func NewLobby

func NewLobby(b bank.Interface, sdk *sdk.SDK) *Lobby

NewLobby creates a new lobby object

func (*Lobby) Count

func (l *Lobby) Count() int

func (*Lobby) FillLobbyPosition

func (l *Lobby) FillLobbyPosition()

FillLobbyPosition recursively adds players to the lobby until the maximum of 10

func (*Lobby) FindPlayerByID

func (l *Lobby) FindPlayerByID(id string) int

FindPlayerByID searches a player based on the given id linearly.

func (*Lobby) GetGameStarted

func (l *Lobby) GetGameStarted() bool

GetGameStarted determines whether a game has already in this lobby started.

func (*Lobby) HasToBeAdded

func (l *Lobby) HasToBeAdded() bool

HasToBeAdded determines whether there are any pending lobby joins

func (*Lobby) HasToBeRemoved

func (l *Lobby) HasToBeRemoved() bool

HasToBeRemoved determines whether there are any pending removals

func (*Lobby) Join

func (l *Lobby) Join(player *models.Player) error

Join adds the player to the waiting queue and starts the queue emptying if possible.

func (*Lobby) PrepareForRound

func (l *Lobby) PrepareForRound()

PrepareForRound prepares the lobby for a new Round

func (*Lobby) RegisterLobbyValue

func (l *Lobby) RegisterLobbyValue(class *pokerModels.Class, classIndex int, id string)

func (*Lobby) RemoveLeftPlayers

func (l *Lobby) RemoveLeftPlayers()

RemoveLeftPlayers starts the recursive removal of hanging players

func (*Lobby) RemovePlayer

func (l *Lobby) RemovePlayer(index int) error

func (*Lobby) RemovePlayerByID

func (l *Lobby) RemovePlayerByID(id string) error

RemovePlayerByID removes the given player identified by his id. (LOCKS)

func (*Lobby) SetPlayerCountLabel

func (l *Lobby) SetPlayerCountLabel()

func (*Lobby) Start

func (l *Lobby) Start()

Start starts a poker game

type Once

type Once struct {
	// contains filtered or unexported fields
}

func (*Once) CheckIfAlreadyDone

func (o *Once) CheckIfAlreadyDone() bool

func (*Once) Do

func (o *Once) Do(f func())

func (*Once) Reset

func (o *Once) Reset()

type RemovalRequest

type RemovalRequest struct {
	Pos int
	ID  string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL