Documentation ¶
Overview ¶
Package teoroom (teo-room) is the Teonet room controller service package
Room controller used to connect users to rooms and send commands between it. This package used in server and client applications.
Index ¶
Constants ¶
View Source
const ( RoomCreating = iota // 0 - Creating room state RoomRunning // 1 - Running room state RoomClosed // 2 - Closed room state: running but adding clients is prohibited RoomStopped // 3 - Stopped room state (game over) )
Room state
View Source
const ( GetError = iota ConfigCdbDoesNotExists UnmarshalJSON )
Teorooms errors code
Variables ¶
View Source
var MODULE = teokeys.Color(teokeys.ANSIBrown, "(teoroom)")
MODULE is this package module name
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *teonet.L0PacketData // Client L0 address // contains filtered or unexported fields }
Client data
type ClientInRoom ¶
type ClientInRoom struct { *Client // contains filtered or unexported fields }
ClientInRoom Data
type ConfHolder ¶
type ConfHolder struct {
*GameParameters
}
ConfHolder is configuration methods holder
func (*ConfHolder) Default ¶
func (c *ConfHolder) Default() []byte
Default return default value in json format.
type GameParameters ¶
type GameParameters struct { Name string `json:"name,omitempty"` // Name of game GameTime int `json:"game_time,omitempty"` // Game time in millisecond = 2 min * 60 sec * 1000 GameClosedAfter int `json:"game_closed_after,omitempty"` // Game closed after (does not add new clients after closed) MaxClientsInRoom int `json:"max_clients_in_room,omitempty"` // Maximum lients in room MinClientsToStart int `json:"min_clients_to_start,omitempty"` // Minimum clients to start room WaitForMinClients int `json:"wait_for_min_clients,omitempty"` // Wait for minimum clients connected WaitForMaxClients int `json:"wait_for_max_clients,omitempty"` // Wait for maximum clients connected after minimum clients connected }
GameParameters holds game parameters running in room
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process receiver to process teoroom commands
func (*Process) ComDisconnect ¶
ComDisconnect remove client from room
func (*Process) ComRoomData ¶
ComRoomData process data received from client and resend it to all clients connected to room with this client
Source Files ¶
Click to show internal directories.
Click to hide internal directories.