Documentation ¶
Index ¶
- Constants
- type ArrowMessage
- type DarkOrbMessage
- type GameMatchMessage
- type GamePlayer
- type IncomingGameMessage
- type KillMessage
- type LavaOrbMessage
- type MatchUpdateMessage
- type PlayerStateUpdateMessage
- type ScrollOrbMessage
- type ShieldMessage
- type SlowOrbMessage
- type StartMatchMessage
- type StartPlayMessage
- type StartRoundMessage
- type TournamentCompleteMessage
- type WebsocketBroker
- func (w *WebsocketBroker) DisableWebsocketUpdates()
- func (w *WebsocketBroker) EnableWebsocketUpdates()
- func (w *WebsocketBroker) HandleRequest(rw http.ResponseWriter, r *http.Request) error
- func (w *WebsocketBroker) MatchEndUpdate(t *models.Tournament, ms []*models.Match, runnerups []*models.PlayerSummary, ...) error
- func (w *WebsocketBroker) MatchUpdate(m *models.Match, sts []*models.PlayerState) error
- func (w *WebsocketBroker) MatchesUpdate(t *models.Tournament, ms []*models.Match) error
- func (w *WebsocketBroker) PlayerSummariesUpdate(t *models.Tournament, summaries []*models.PlayerSummary) error
- func (w *WebsocketBroker) TournamentUpdate(t *models.Tournament) error
- func (w *WebsocketBroker) WebsocketUpdate(kind string, data interface{}) error
- type WingsMessage
Constants ¶
const ( InKill = "kill" InRoundStart = "round_start" InRoundEnd = "round_end" InMatchStart = "match_start" InMatchEnd = "match_end" InPickup = "arrows_collected" InShot = "arrow_shot" InShield = "shield_state" InWings = "wings_state" InOrbLava = "lava_orb_state" // TODO(thiderman): Non-player orbs are not implemented InOrbSlow = "slow_orb_state" InOrbDark = "dark_orb_state" InOrbScroll = "scroll_orb_state" )
Message types as used by IncomingGameMessage nolint
const ( GameMatch = "match" GameConnect = "game_connected" GameDisconnect = "game_disconnected" GameStartPlay = "start_play" GameComplete = "tournament_complete" )
Constant strings for use as kinds when communicating with the game
const EnvironmentKill = -1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrowMessage ¶
type DarkOrbMessage ¶
type DarkOrbMessage struct {
State bool `json:"state"`
}
type GameMatchMessage ¶
type GameMatchMessage struct { Players []GamePlayer `json:"players"` Tournament string `json:"tournament"` Level string `json:"level"` Length int `json:"length"` Ruleset string `json:"ruleset"` Kind string `json:"kind"` }
GameMatchMessage is the message sent to the game about the configuration of the next match
type GamePlayer ¶
type GamePlayer struct { TopName string `json:"top_name"` BottomName string `json:"bottom_name"` Color int `json:"color"` ArcherType int `json:"archer_type"` }
GamePlayer is a player object to be consumed by the game
type IncomingGameMessage ¶
type IncomingGameMessage struct { ID uint `json:"id"` MatchID uint `json:"match_id"` Type string `json:"type"` Data interface{} `json:"data" sql:"-"` JSON string `json:"-"` Timestamp time.Time `json:"timestamp"` RoundID uint `json:"round_id"` // contains filtered or unexported fields }
An IncomingGameMessage is a message from the game put into the DB consumer queue
type KillMessage ¶
type LavaOrbMessage ¶
type MatchUpdateMessage ¶
type MatchUpdateMessage struct { Tournament uint `json:"tournament"` Match *models.Match `json:"match"` Players []*models.PlayerState `json:"player_states"` }
type PlayerStateUpdateMessage ¶
type PlayerStateUpdateMessage struct { Tournament uint `json:"tournament"` Match int `json:"match"` State *models.PlayerState `json:"state"` }
type ScrollOrbMessage ¶
type ScrollOrbMessage struct {
State bool `json:"state"`
}
type ShieldMessage ¶
type SlowOrbMessage ¶
type SlowOrbMessage struct {
State bool `json:"state"`
}
type StartMatchMessage ¶
type StartMatchMessage struct{}
StartMatchMessage is sent when a match is starting
type StartPlayMessage ¶
type StartPlayMessage struct{}
StartPlayMessage is sent to the game whenever one of the shot girls have indicated that the next round can start
type StartRoundMessage ¶
type TournamentCompleteMessage ¶
type TournamentCompleteMessage struct{}
TournamentCompleteMessage is sent when the tournament is done
type WebsocketBroker ¶
type WebsocketBroker struct {
// contains filtered or unexported fields
}
func NewWebsocketBroker ¶
func NewWebsocketBroker(log *zap.Logger) *WebsocketBroker
func (*WebsocketBroker) DisableWebsocketUpdates ¶
func (w *WebsocketBroker) DisableWebsocketUpdates()
DisableWebsocketUpdates... disables websocket updates.
func (*WebsocketBroker) EnableWebsocketUpdates ¶
func (w *WebsocketBroker) EnableWebsocketUpdates()
EnableWebsocketUpdates... enables websocket updates.
func (*WebsocketBroker) HandleRequest ¶
func (w *WebsocketBroker) HandleRequest(rw http.ResponseWriter, r *http.Request) error
HandleRequest passes the handling on to Melody
func (*WebsocketBroker) MatchEndUpdate ¶
func (w *WebsocketBroker) MatchEndUpdate(t *models.Tournament, ms []*models.Match, runnerups []*models.PlayerSummary, summaries []*models.PlayerSummary) error
MatchEndUpdate sends the updates needed when a match is ended
func (*WebsocketBroker) MatchUpdate ¶
func (w *WebsocketBroker) MatchUpdate(m *models.Match, sts []*models.PlayerState) error
MatchUpdate sends a status update for the entire match
func (*WebsocketBroker) MatchesUpdate ¶
func (w *WebsocketBroker) MatchesUpdate(t *models.Tournament, ms []*models.Match) error
MatchesUpdate sends an update about the matches
func (*WebsocketBroker) PlayerSummariesUpdate ¶
func (w *WebsocketBroker) PlayerSummariesUpdate(t *models.Tournament, summaries []*models.PlayerSummary) error
PlayerSummariesUpdate sends an update to the player summaries
func (*WebsocketBroker) TournamentUpdate ¶
func (w *WebsocketBroker) TournamentUpdate(t *models.Tournament) error
TournamentUpdate sends an update about the tournament
func (*WebsocketBroker) WebsocketUpdate ¶
func (w *WebsocketBroker) WebsocketUpdate(kind string, data interface{}) error
WebsocketUpdate sends an update to all listening sockets