teoroom

package
v0.0.0-...-2e4d9bc Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: BSD-3-Clause Imports: 14 Imported by: 0

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.

func (*ConfHolder) Dir

func (c *ConfHolder) Dir() string

Dir return configuration file folder.

func (*ConfHolder) Key

func (c *ConfHolder) Key() string

Key return configuration key.

func (*ConfHolder) Name

func (c *ConfHolder) Name() string

Name return configuration file name.

func (*ConfHolder) Value

func (c *ConfHolder) Value() interface{}

Value real value as interfaxe

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

func (p *Process) ComDisconnect(pac interface{}) (err error)

ComDisconnect remove client from room

func (*Process) ComRoomData

func (p *Process) ComRoomData(pac *teonet.Packet) (err error)

ComRoomData process data received from client and resend it to all clients connected to room with this client

func (*Process) ComRoomRequest

func (p *Process) ComRoomRequest(pac *teonet.Packet) (err error)

ComRoomRequest process clients request, connect to room controller, entering to room and send room request answer with client room id (room position)

type Room

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

Room Data

type Teoroom

type Teoroom struct {
	*Process
	// contains filtered or unexported fields
}

Teoroom is room controller data

func New

func New(teo *teonet.Teonet) (tr *Teoroom, err error)

New creates teonet room controller.

func (*Teoroom) Destroy

func (tr *Teoroom) Destroy()

Destroy the room controller.

Directories

Path Synopsis
Package stats is the Teonet room statistic functions and datbase themes.
Package stats is the Teonet room statistic functions and datbase themes.

Jump to

Keyboard shortcuts

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