Documentation ¶
Index ¶
- Variables
- func CreateGame(db *sql.DB, h *ws.Hub) http.HandlerFunc
- func DeleteGame(h *ws.Hub) http.HandlerFunc
- func GetAllGames() http.HandlerFunc
- func GetSpecificGame() http.HandlerFunc
- func GetSpecificGameDisplay() http.HandlerFunc
- func InsertThrow(h *ws.Hub) http.HandlerFunc
- func NextPlayer(h *ws.Hub) http.HandlerFunc
- func Rematch(h *ws.Hub) http.HandlerFunc
- func Undo(h *ws.Hub) http.HandlerFunc
- func UndoATCIncreaseNumber(action undo.Action)
- func UndoBustAndWin(action undo.Action, base *BaseGame)
- func UndoCloseControllerNumber(action undo.Action, base *BaseGame)
- func UndoClosePlayerNumber(action undo.Action)
- func UndoClosePlayerThrowRound(action undo.Action, base *BaseGame)
- func UndoCreateThrow(action undo.Action)
- func UndoCreateThrowRound(action undo.Action)
- func UndoDoPodium(action undo.Action, base *BaseGame)
- func UndoGainPoints(action undo.Action)
- func UndoIncreaseHitCount(action undo.Action)
- func UndoIncreaseThrowRound(action undo.Action, base *BaseGame)
- func UndoNextPlayer(action undo.Action, base *BaseGame)
- func UndoRevealNumber(action undo.Action, base *BaseGame)
- func UndoScore(action undo.Action)
- func UndoScoreAndPark(action undo.Action)
- func UndoUpdateSplitScore(action undo.Action)
- func UndoWin(action undo.Action, base *BaseGame)
- type ATCGame
- func (g *ATCGame) GetStatus() BaseGame
- func (g *ATCGame) GetStatusDisplay() BaseGame
- func (g *ATCGame) NextPlayer(h *ws.Hub)
- func (g *ATCGame) Rematch(h *ws.Hub) error
- func (g *ATCGame) RequestThrow(number, modifier int, h *ws.Hub) error
- func (g *ATCGame) StartGame() error
- func (g *ATCGame) Undo(h *ws.Hub) error
- type BaseGame
- type CricketGame
- func (g *CricketGame) GetStatus() BaseGame
- func (g *CricketGame) GetStatusDisplay() BaseGame
- func (g *CricketGame) NextPlayer(h *ws.Hub)
- func (g *CricketGame) Rematch(h *ws.Hub) error
- func (g *CricketGame) RequestThrow(number, modifier int, h *ws.Hub) error
- func (g *CricketGame) StartGame() error
- func (g *CricketGame) Undo(h *ws.Hub) error
- type CricketGameController
- type Data
- type EliminiationGame
- func (g *EliminiationGame) GetStatus() BaseGame
- func (g *EliminiationGame) GetStatusDisplay() BaseGame
- func (g *EliminiationGame) NextPlayer(h *ws.Hub)
- func (g *EliminiationGame) Rematch(h *ws.Hub) error
- func (g *EliminiationGame) RequestThrow(number, modifier int, h *ws.Hub) error
- func (g *EliminiationGame) StartGame() error
- func (g *EliminiationGame) Undo(h *ws.Hub) error
- type Game
- type ShanghaiGame
- func (g *ShanghaiGame) GetStatus() BaseGame
- func (g *ShanghaiGame) GetStatusDisplay() BaseGame
- func (g *ShanghaiGame) NextPlayer(h *ws.Hub)
- func (g *ShanghaiGame) Rematch(h *ws.Hub) error
- func (g *ShanghaiGame) RequestThrow(number, modifier int, h *ws.Hub) error
- func (g *ShanghaiGame) StartGame() error
- func (g *ShanghaiGame) Undo(h *ws.Hub) error
- type SplitGame
- func (g *SplitGame) GetStatus() BaseGame
- func (g *SplitGame) GetStatusDisplay() BaseGame
- func (g *SplitGame) NextPlayer(h *ws.Hub)
- func (g *SplitGame) Rematch(h *ws.Hub) error
- func (g *SplitGame) RequestThrow(number, modifier int, h *ws.Hub) error
- func (g *SplitGame) StartGame() error
- func (g *SplitGame) Undo(h *ws.Hub) error
- type X01Game
- func (g *X01Game) GetStatus() BaseGame
- func (g *X01Game) GetStatusDisplay() BaseGame
- func (g *X01Game) NextPlayer(h *ws.Hub)
- func (g *X01Game) Rematch(h *ws.Hub) error
- func (g *X01Game) RequestThrow(number, modifier int, h *ws.Hub) error
- func (g *X01Game) StartGame() error
- func (g *X01Game) Undo(h *ws.Hub) error
Constants ¶
This section is empty.
Variables ¶
var Games = make(map[string]Data)
Games hold the running games
Functions ¶
func CreateGame ¶
CreateGame will dispatch the creation of a game to the corresponding game creation handler after adding it to the in memory games map
func DeleteGame ¶
func DeleteGame(h *ws.Hub) http.HandlerFunc
DeleteGame will delete game from in memory map
func GetSpecificGame ¶
func GetSpecificGame() http.HandlerFunc
GetSpecificGame lists a specific in memory game
func GetSpecificGameDisplay ¶
func GetSpecificGameDisplay() http.HandlerFunc
GetSpecificGameDisplay lists a specific in memory game and only provides the data necessary to display the Scoreboard information (small data size)
func InsertThrow ¶
func InsertThrow(h *ws.Hub) http.HandlerFunc
InsertThrow will handle to add a throw to a game
func NextPlayer ¶
func NextPlayer(h *ws.Hub) http.HandlerFunc
NextPlayer will switch to next player in game
func Rematch ¶
func Rematch(h *ws.Hub) http.HandlerFunc
Rematch will handle the rematch action per game
func UndoATCIncreaseNumber ¶
UndoATCIncreaseNumber is the undo action for ATCINCREASENUMBER
func UndoBustAndWin ¶
UndoBustAndWin is the undo action for X01BUST and DOWIN
func UndoCloseControllerNumber ¶
UndoCloseControllerNumber is the undo action for CLOSECONTROLLERNUMBER
func UndoClosePlayerNumber ¶
UndoClosePlayerNumber is the undo action for CLOSEPLAYERNUMBER
func UndoClosePlayerThrowRound ¶
UndoClosePlayerThrowRound is the undo action for CLOSEPLAYERTHROWROUND
func UndoCreateThrow ¶
UndoCreateThrow is the undo action for CREATETHROW
func UndoCreateThrowRound ¶
UndoCreateThrowRound is the undo action for CREATETHROWROUND
func UndoDoPodium ¶
UndoDoPodium is the undo action for DOPODIUM
func UndoGainPoints ¶
UndoGainPoints is the undo action for GAINPOINTS
func UndoIncreaseHitCount ¶
UndoIncreaseHitCount is the undo action for INCREASEHITCOUNT
func UndoIncreaseThrowRound ¶
UndoIncreaseThrowRound is the undo action for INCREASETHROWROUND
func UndoNextPlayer ¶
UndoNextPlayer is the undo action for NEXTPLAYER
func UndoRevealNumber ¶
UndoRevealNumber is the undo action for REVEALNUMBER
func UndoScoreAndPark ¶
UndoScoreAndPark is the undo action for UPDATESCOREANDPARK
func UndoUpdateSplitScore ¶
UndoUpdateSplitScore is the undo action for UPDATESPLITSCORE
Types ¶
type ATCGame ¶
type ATCGame struct {
Base BaseGame
}
ATCGame will hold the ATC game information
func (*ATCGame) GetStatusDisplay ¶
GetStatusDisplay will satisfy interface Game for game ATC
func (*ATCGame) NextPlayer ¶
NextPlayer will satisfy interface Game for game ATC
func (*ATCGame) RequestThrow ¶
RequestThrow will satisfy inteface Game for ATC
type BaseGame ¶
type BaseGame struct { UID string Game string Player []player.Player Variant string In string Out string ActivePlayer int ThrowRound int GameState string Message string Settings *settings.Settings UndoLog *undo.Log Podium *podium.Podium CricketController *CricketGameController SoundToPlay string }
BaseGame will hold all the game specific stuff for all games combined
type CricketGame ¶
type CricketGame struct {
Base BaseGame
}
CricketGame will hold the Cricket game information
func (*CricketGame) GetStatus ¶
func (g *CricketGame) GetStatus() BaseGame
GetStatus will satisfy interface Game for game Cricket
func (*CricketGame) GetStatusDisplay ¶
func (g *CricketGame) GetStatusDisplay() BaseGame
GetStatusDisplay will satisfy interface Game for game Cricket
func (*CricketGame) NextPlayer ¶
func (g *CricketGame) NextPlayer(h *ws.Hub)
NextPlayer will satisfy interface Game for game Cricket
func (*CricketGame) Rematch ¶
func (g *CricketGame) Rematch(h *ws.Hub) error
Rematch will satisfy interface Game for game Cricket
func (*CricketGame) RequestThrow ¶
func (g *CricketGame) RequestThrow(number, modifier int, h *ws.Hub) error
RequestThrow will satisfy interface Game for game Cricket
func (*CricketGame) StartGame ¶
func (g *CricketGame) StartGame() error
StartGame will satisfy interface Game for game Cricket
type CricketGameController ¶
type CricketGameController struct { NumberClosed []bool Numbers []int NumberRevealed []bool // For Ghost Cricket Random bool Ghost bool }
CricketGameController will hold the status of different numbers This will hold information if the number is closed in game and can be hit or not Also it maps the 7 numbers to actual dart values Classic is 15-20 + 25 Otherwise random or ghost can be used
type Data ¶
type Data struct { UID string `json:"uid"` Player []int `json:"player"` Game string `json:"game"` Variant string `json:"variant"` In string `json:"in"` Out string `json:"out"` Punisher bool `json:"punisher"` Sound bool `json:"sound"` Podium bool `json:"podium"` AutoSwitch bool `json:"autoswitch"` CricketRandom bool `json:"cricketrandom"` CricketGhost bool `json:"cricketghost"` GameObject Game }
Data stuct will hold the generic game data handed over by the frontend. It might be used in the different game types
type EliminiationGame ¶
type EliminiationGame struct {
Base BaseGame
}
EliminiationGame will hold the Eliminiation game information
func (*EliminiationGame) GetStatus ¶
func (g *EliminiationGame) GetStatus() BaseGame
GetStatus will satisfy interface Game for game Eliminiation
func (*EliminiationGame) GetStatusDisplay ¶
func (g *EliminiationGame) GetStatusDisplay() BaseGame
GetStatusDisplay will satisfy interface Game for game Eliminiation
func (*EliminiationGame) NextPlayer ¶
func (g *EliminiationGame) NextPlayer(h *ws.Hub)
NextPlayer will satisfy interface Game for game Eliminiation
func (*EliminiationGame) Rematch ¶
func (g *EliminiationGame) Rematch(h *ws.Hub) error
Rematch will satisfy interface Game for game Eliminiation
func (*EliminiationGame) RequestThrow ¶
func (g *EliminiationGame) RequestThrow(number, modifier int, h *ws.Hub) error
RequestThrow will satisfy interface Game for game Eliminiation
func (*EliminiationGame) StartGame ¶
func (g *EliminiationGame) StartGame() error
StartGame will satisfy interface Game for game Eliminiation
type Game ¶
type Game interface { StartGame() error GetStatus() BaseGame GetStatusDisplay() BaseGame NextPlayer(h *ws.Hub) RequestThrow(number, modifier int, h *ws.Hub) error Undo(h *ws.Hub) error Rematch(h *ws.Hub) error }
Game will be the interface for different games
type ShanghaiGame ¶
type ShanghaiGame struct {
Base BaseGame
}
ShanghaiGame will hold the Shanghai game information
func (*ShanghaiGame) GetStatus ¶
func (g *ShanghaiGame) GetStatus() BaseGame
GetStatus will satisfy interface Game for Shanghai
func (*ShanghaiGame) GetStatusDisplay ¶
func (g *ShanghaiGame) GetStatusDisplay() BaseGame
GetStatusDisplay will satisfy interface Game for game Shanghai
func (*ShanghaiGame) NextPlayer ¶
func (g *ShanghaiGame) NextPlayer(h *ws.Hub)
NextPlayer will satisfy interface Game for game Shanghai
func (*ShanghaiGame) Rematch ¶
func (g *ShanghaiGame) Rematch(h *ws.Hub) error
Rematch will satisfy interface Game for game Shanghai
func (*ShanghaiGame) RequestThrow ¶
func (g *ShanghaiGame) RequestThrow(number, modifier int, h *ws.Hub) error
RequestThrow will satisfy inteface Game for Shanghai
func (*ShanghaiGame) StartGame ¶
func (g *ShanghaiGame) StartGame() error
StartGame will satisfy interface Game for Shanghai
type SplitGame ¶
type SplitGame struct {
Base BaseGame
}
SplitGame will hold the Split game information
func (*SplitGame) GetStatusDisplay ¶
GetStatusDisplay will satisfy interface Game for game Split
func (*SplitGame) NextPlayer ¶
NextPlayer will satisfy interface Game for game Split
func (*SplitGame) RequestThrow ¶
RequestThrow will satisfy interface Game for game Split
type X01Game ¶
type X01Game struct {
Base BaseGame
}
X01Game will hold the X01 game information
func (*X01Game) GetStatusDisplay ¶
GetStatusDisplay will satisfy interface Game for game X01
func (*X01Game) NextPlayer ¶
NextPlayer will satisfy interface Game for game X01
func (*X01Game) RequestThrow ¶
RequestThrow will satisfy interface Game for game X01