Update rules to match Chezy Champs changes and add tooltips containing rule descriptions.

This commit is contained in:
Patrick Fairbank
2018-08-18 18:40:21 -07:00
parent cd050d4e18
commit 11b1b6a943
7 changed files with 61 additions and 10 deletions

View File

@@ -156,7 +156,8 @@ func (web *Web) announcerDisplayWebsocketHandler(w http.ResponseWriter, r *http.
BlueCards map[string]string
}{web.arena.SavedMatch.CapitalizedType(), web.arena.SavedMatch.DisplayName,
web.arena.SavedMatchResult.RedScoreSummary(), web.arena.SavedMatchResult.BlueScoreSummary(),
web.arena.SavedMatchResult.RedScore.Fouls, web.arena.SavedMatchResult.BlueScore.Fouls,
populateFoulDescriptions(web.arena.SavedMatchResult.RedScore.Fouls),
populateFoulDescriptions(web.arena.SavedMatchResult.BlueScore.Fouls),
web.arena.SavedMatchResult.RedCards, web.arena.SavedMatchResult.BlueCards}
case _, ok := <-audienceDisplayListener:
if !ok {
@@ -206,3 +207,16 @@ func (web *Web) announcerDisplayWebsocketHandler(w http.ResponseWriter, r *http.
}
}
}
// Copy the description from the rules to the fouls so that they are available to the announcer.
func populateFoulDescriptions(fouls []game.Foul) []game.Foul {
for i := range fouls {
for _, rule := range game.Rules {
if fouls[i].RuleNumber == rule.RuleNumber {
fouls[i].Description = rule.Description
break
}
}
}
return fouls
}