Updates to match new primary repo.
This commit is contained in:
@@ -8,7 +8,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
MAX_RANDOM_INCREMENT = 50
|
||||
LDRBRD_MAX_RANDOM_INCREMENT = 50
|
||||
LDRBRD_BAR_CLR_GRD_24TOP = 0xeb40d4
|
||||
LDRBRD_BAR_CLR_GRD_24BOT = 0xc625af
|
||||
)
|
||||
|
||||
type Leaderboard struct {
|
||||
@@ -43,12 +45,14 @@ func (l *Leaderboard) UpdateScoreForTeam(name string, score int) {
|
||||
}
|
||||
}
|
||||
|
||||
// return current list of leaders, and while we're at it, update our current lead indicators
|
||||
func (l *Leaderboard) GetLeaders() []*AnimatedScoreBar {
|
||||
leaders := []*AnimatedScoreBar{}
|
||||
|
||||
highScore := 0
|
||||
|
||||
for _, team := range l.teams {
|
||||
team.ResetLead()
|
||||
teamscore := int(team.GetTarget())
|
||||
if teamscore > highScore {
|
||||
leaders = leaders[:0]
|
||||
@@ -59,6 +63,11 @@ func (l *Leaderboard) GetLeaders() []*AnimatedScoreBar {
|
||||
}
|
||||
}
|
||||
|
||||
//for new set of leaders, set appropriate lead indicators
|
||||
for _, bar := range leaders {
|
||||
bar.SetLead()
|
||||
}
|
||||
|
||||
return leaders
|
||||
}
|
||||
|
||||
@@ -82,6 +91,12 @@ func (l *Leaderboard) SetAllTargets(t float64) {
|
||||
|
||||
func (l *Leaderboard) RandomizeTeamTargets() {
|
||||
for _, board := range l.teams {
|
||||
board.SetTarget(board.GetTarget() + float64(rand.Int()%MAX_RANDOM_INCREMENT))
|
||||
board.SetTarget(board.GetTarget() + float64(rand.Int()%LDRBRD_MAX_RANDOM_INCREMENT))
|
||||
}
|
||||
}
|
||||
|
||||
func (l *Leaderboard) Pinkify() {
|
||||
for _, board := range l.teams {
|
||||
board.SetBarColors(HexToRGBA(LDRBRD_BAR_CLR_GRD_24TOP), HexToRGBA(LDRBRD_BAR_CLR_GRD_24BOT))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user