Documentation ¶
Index ¶
- func MixManager(ctx context.Context, m *Manager) context.Context
- type Game
- func (g *Game) AddPlayer(p *player.Player) error
- func (g *Game) ApplyAction() error
- func (g *Game) Dump(addition ...string) *GameJSON
- func (g *Game) GetMaxPlayers() uint32
- func (g *Game) ID() string
- func (g *Game) IsPrivate() bool
- func (g *Game) ListPlayers() []*player.Player
- func (g *Game) Load(src *GameJSON) error
- func (g *Game) Owner() string
- func (g *Game) Password() string
- func (g *Game) RemovePlayer(p *player.Player)
- func (g *Game) SetMaxPlayers(max *uint32) error
- func (g *Game) Start() error
- func (g *Game) Status() Status
- type GameJSON
- type Manager
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
func (*Game) ApplyAction ¶
func (*Game) Dump ¶
Dump game to GameJSON
normally, the "password" were filter out from ret-val include it in addition to add it into ret-val
func (*Game) GetMaxPlayers ¶
func (*Game) ListPlayers ¶
func (*Game) RemovePlayer ¶
func (*Game) SetMaxPlayers ¶
SetMaxPlayers when max==nil, 12 is used when max not in (6,12], error returned
type GameJSON ¶
type GameJSON struct { // meta data ID string `json:"ID,omitempty"` CreatedAt uint64 `json:"created_at,omitempty"` Owner string `json:"owner,omitempty"` // settings MaxPlayers *uint32 `json:"max_players,omitempty"` IsPrivate bool `json:"is_private,omitempty"` Password string `json:"password,omitempty"` // contained data Players []*player.PlayerJSON `json:"players,omitempty"` }
GameJSON represents the JSON format of a game, used to communicate
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager() *Manager
Click to show internal directories.
Click to hide internal directories.