mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 21:56:50 -04:00
Update rules to match Chezy Champs changes and add tooltips containing rule descriptions.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user