Fix alliance selection and lower third overlays to work across a refresh.

This commit is contained in:
Patrick Fairbank
2018-09-21 18:42:06 -07:00
parent 9ebea8a51c
commit 2c2d86ea7a
6 changed files with 70 additions and 57 deletions

View File

@@ -66,6 +66,8 @@ type Arena struct {
SavedMatch *model.Match
SavedMatchResult *model.MatchResult
AllianceStationDisplayMode string
AllianceSelectionAlliances [][]model.AllianceTeam
LowerThird *model.LowerThird
MuteMatchSounds bool
matchAborted bool
Scale *game.Seesaw

View File

@@ -60,7 +60,7 @@ type audienceAllianceScoreFields struct {
// Instantiates notifiers and configures their message producing methods.
func (arena *Arena) configureNotifiers() {
arena.AllianceSelectionNotifier = websocket.NewNotifier("allianceSelection", nil)
arena.AllianceSelectionNotifier = websocket.NewNotifier("allianceSelection", arena.generateAllianceSelectionMessage)
arena.AllianceStationDisplayModeNotifier = websocket.NewNotifier("allianceStationDisplayMode",
arena.generateAllianceStationDisplayModeMessage)
arena.ArenaStatusNotifier = websocket.NewNotifier("arenaStatus", arena.generateArenaStatusMessage)
@@ -69,7 +69,7 @@ func (arena *Arena) configureNotifiers() {
arena.DisplayConfigurationNotifier = websocket.NewNotifier("displayConfiguration",
arena.generateDisplayConfigurationMessage)
arena.LedModeNotifier = websocket.NewNotifier("ledMode", arena.generateLedModeMessage)
arena.LowerThirdNotifier = websocket.NewNotifier("lowerThird", nil)
arena.LowerThirdNotifier = websocket.NewNotifier("lowerThird", arena.generateLowerThirdMessage)
arena.MatchLoadNotifier = websocket.NewNotifier("matchLoad", arena.generateMatchLoadMessage)
arena.MatchTimeNotifier = websocket.NewNotifier("matchTime", arena.generateMatchTimeMessage)
arena.MatchTimingNotifier = websocket.NewNotifier("matchTiming", arena.generateMatchTimingMessage)
@@ -80,6 +80,10 @@ func (arena *Arena) configureNotifiers() {
arena.ScoringStatusNotifier = websocket.NewNotifier("scoringStatus", arena.generateScoringStatusMessage)
}
func (arena *Arena) generateAllianceSelectionMessage() interface{} {
return &arena.AllianceSelectionAlliances
}
func (arena *Arena) generateAllianceStationDisplayModeMessage() interface{} {
return arena.AllianceStationDisplayMode
}
@@ -112,6 +116,10 @@ func (arena *Arena) generateLedModeMessage() interface{} {
return &LedModeMessage{arena.ScaleLeds.GetCurrentMode(), arena.RedVaultLeds.CurrentForceMode}
}
func (arena *Arena) generateLowerThirdMessage() interface{} {
return arena.LowerThird
}
func (arena *Arena) generateMatchLoadMessage() interface{} {
teams := make(map[string]*model.Team)
for station, allianceStation := range arena.AllianceStations {