Documentation ¶
Index ¶
- type GameState
- type LambdaSvc
- func (s *LambdaSvc) Connect(e events.APIGatewayWebsocketProxyRequest) (interface{}, error)
- func (s *LambdaSvc) Default(e events.APIGatewayWebsocketProxyRequest) (interface{}, error)
- func (s *LambdaSvc) Disconnect(e events.APIGatewayWebsocketProxyRequest) (interface{}, error)
- func (s *LambdaSvc) JoinGame(connectionID string, message PlayerMessage) error
- func (s *LambdaSvc) NewGame(connectionID string, message PlayerMessage) error
- func (s *LambdaSvc) NotifyPlayers(gc *game.GameContext) error
- func (s *LambdaSvc) Play(connectionID string, message PlayerMessage) error
- func (s *LambdaSvc) SendGameState(gc *game.GameContext) error
- func (s *LambdaSvc) SendStateMessage(gs *GameState, address string) error
- type PlayerMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GameState ¶
type GameState struct { Round int `json:"round"` GameID string `json:"gameId"` YourScore int `json:"yourScore"` TheirScore int `json:"theirScore"` Winner bool `json:"winner"` YourPlay string `json:"yourPlay,omitempty"` TheirPlay string `json:"theirPlay,omitempty"` RoundSummary string `json:"roundSummary,omitempty"` }
GameState structures for sending to players. Fields are optional especially on setup
type LambdaSvc ¶
type LambdaSvc struct {
// contains filtered or unexported fields
}
func NewLambdaSvc ¶
func NewLambdaSvc(store *store.Store, ws *notify.APIGWNotifier) *LambdaSvc
NewLambdaSvc returns a new lambda service
func (*LambdaSvc) Connect ¶
func (s *LambdaSvc) Connect(e events.APIGatewayWebsocketProxyRequest) (interface{}, error)
Connect is currently a no-op
func (*LambdaSvc) Default ¶
func (s *LambdaSvc) Default(e events.APIGatewayWebsocketProxyRequest) (interface{}, error)
func (*LambdaSvc) Disconnect ¶
func (s *LambdaSvc) Disconnect(e events.APIGatewayWebsocketProxyRequest) (interface{}, error)
Disconnect is currently a no-op
func (*LambdaSvc) JoinGame ¶
func (s *LambdaSvc) JoinGame(connectionID string, message PlayerMessage) error
JoinGame joins a game in progress
func (*LambdaSvc) NewGame ¶
func (s *LambdaSvc) NewGame(connectionID string, message PlayerMessage) error
NewGame creates a new game record in the database
func (*LambdaSvc) NotifyPlayers ¶
func (s *LambdaSvc) NotifyPlayers(gc *game.GameContext) error
NotifyPlayers sends out a notification about a game round to all connected parties
func (*LambdaSvc) Play ¶
func (s *LambdaSvc) Play(connectionID string, message PlayerMessage) error
Play handles a single player's play.
func (*LambdaSvc) SendGameState ¶
func (s *LambdaSvc) SendGameState(gc *game.GameContext) error
SendGameState will send a game state to a given connection
Click to show internal directories.
Click to hide internal directories.