game

package
v0.0.0-...-bd7307a Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	Id int
	// contains filtered or unexported fields
}

func NewCard

func NewCard(i int, t string, b bool) *Card

func (*Card) ToJson

func (c *Card) ToJson() JsonCard

type Game

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

func NewGame

func NewGame(id GameId, n string, owner *Player) *Game

func (*Game) AddPlayer

func (g *Game) AddPlayer(p *Player)

func (*Game) MarshalJSON

func (g *Game) MarshalJSON() ([]byte, error)

func (*Game) PlayerNames

func (g *Game) PlayerNames() []string

func (*Game) PlayerView

func (g *Game) PlayerView() PlayerViewGame

func (*Game) StartNewRound

func (g *Game) StartNewRound() *Round

type GameId

type GameId uint64

type GameManager

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

func NewGameManager

func NewGameManager() *GameManager

func (*GameManager) AddPlayerToGame

func (gm *GameManager) AddPlayerToGame(p *Player, gid GameId) error

func (*GameManager) CreateGame

func (gm *GameManager) CreateGame(name string, owner *Player) *Game

func (*GameManager) Get

func (gm *GameManager) Get(id GameId) (*Game, error)

func (*GameManager) List

func (gm *GameManager) List() []*Game

type JsonCard

type JsonCard struct {
	Text       string
	IsQuestion bool
}

type JsonRound

type JsonRound struct {
	Number   int
	Judge    *Player
	Question *Card
	Answers  []*Card
}

type Player

type Player struct {
	Id   PlayerId
	Name string
}

func (*Player) MarshalJSON

func (p *Player) MarshalJSON() ([]byte, error)

func (*Player) String

func (p *Player) String() string

func (*Player) UnmarshalJSON

func (p *Player) UnmarshalJSON(b []byte) error

type PlayerId

type PlayerId uint64

type PlayerManager

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

func NewPlayerManager

func NewPlayerManager() *PlayerManager

func (*PlayerManager) FindPlayer

func (pm *PlayerManager) FindPlayer(id PlayerId) (*Player, error)

func (*PlayerManager) NewPlayer

func (pm *PlayerManager) NewPlayer(name string) *Player

type PlayerViewGame

type PlayerViewGame struct {
	Name        string   `json:"name"`
	PlayerCount int      `json:"playerCount"`
	PlayerNames []string `json:"playerNames"`
	Owner       string   `json:"owner"`
	Id          GameId   `json:"id"`
}

type Round

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

func NewRound

func NewRound(n int, p *Player, q *Card) *Round

func (*Round) PlayCard

func (r *Round) PlayCard(p *Player, c *Card) error

func (*Round) ToJson

func (r *Round) ToJson() JsonRound

Jump to

Keyboard shortcuts

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