room

package
v0.0.0-...-14a1528 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRandomRoomID

func GetRandomRoomID() (string, error)

Types

type Player

type Player struct {
	Name     string        `json:"Name"`
	TimeLeft time.Duration `json:"TimeLeft"`
}

func NewPlayer

func NewPlayer(name string, t time.Duration) *Player

type Room

type Room struct {
	RoomID   string `json:"RoomID"`   // Unique id of this room
	RoomName string `json:"RoomName"` // Name of this room

	Players       []*Player `json:"Players"`       // List of players in the room
	NumPlayers    int       `json:"NumPlayers"`    // Number of players expected in the room
	CurrentPlayer int       `json:"CurrentPlayer"` // Current player index

	TimeStart    time.Duration `json:"TimeStart"`    // Time each player starts with
	TimePerRound time.Duration `json:"TimePerRound"` // Time added each round

	RoundNum int // Current "round"
	// contains filtered or unexported fields
}

func NewRoom

func NewRoom(socket *socketio.Server, name string, count int, start, perRound time.Duration) (*Room, error)

func (*Room) AddPlayer

func (r *Room) AddPlayer(p *Player) error

func (*Room) BroadcastRoomUpdate

func (r *Room) BroadcastRoomUpdate() error

func (*Room) BroadcastUpdate

func (r *Room) BroadcastUpdate(msg string) error

func (*Room) GetID

func (r *Room) GetID() string

Jump to

Keyboard shortcuts

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