players

package
v0.0.0-...-0992052 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package players server. Keeps track of login players.

Index

Constants

View Source
const (
	ACTMess       = 1
	ACTInvite     = 2
	ACTInvAccept  = 3
	ACTInvDecline = 4
	ACTInvRetract = 5
	ACTMove       = 6
	ACTQuit       = 7
	ACTWatch      = 8
	ACTWatchStop  = 9
	ACTList       = 10
	ACTSave       = 11

	JTMess         = 1
	JTInvite       = 2
	JTMove         = 3
	JTBenchMove    = 4
	JTList         = 5
	JTCloseCon     = 6
	JTClearInvites = 7
)

Variables

This section is empty.

Functions

func NewPlayerErr

func NewPlayerErr(txt string, id int) (err error)

Types

type Action

type Action struct {
	ActType int
	ID      int
	Move    [2]int
	Mess    string
}

Action the client action.

func NewAction

func NewAction(actType int) (a *Action)

type ClearInvites

type ClearInvites string

Clear invites signal

type CloseCon

type CloseCon struct {
	Reason string
	// contains filtered or unexported fields
}

CloseCon close connection signal to netWrite.

type DisData

type DisData struct {
	Disable  bool
	PlayerID int
}

type GameState

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

GameState keeps track of the current game.

type JsonData

type JsonData struct {
	JsonType int
	Data     interface{}
}

JsonData a json wrapper for export of interface values via json.

type Player

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

Player it is the player information used to exchange between the logon server and the players server.

func NewPlayer

func NewPlayer(id int, name string, ws *websocket.Conn, errCh chan<- error,
	joinedCh chan<- *Player) (p *Player)

func (*Player) Start

func (player *Player) Start()

Start a player server. The server will not wait for its started go routine to finsh but it will send the kill signal to them.

type PlayerErr

type PlayerErr struct {
	PlayerID int
	Txt      string
}

PlayerErr a error message that include the player id.

func (*PlayerErr) Error

func (err *PlayerErr) Error() string

type Server

type Server struct {
	JoinCh    chan *Player
	DisableCh chan *DisData
	// contains filtered or unexported fields
}

func New

func New(pubList *pub.List, startGameChCl *pub.StartGameChCl) (s *Server)

func (*Server) Start

func (s *Server) Start()

func (*Server) Stop

func (s *Server) Stop()

Jump to

Keyboard shortcuts

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