Feat: card counter
This commit is contained in:
@ -62,6 +62,34 @@ type Room struct {
|
||||
IsOver bool
|
||||
}
|
||||
|
||||
func (r *Room) GetOppositeTeamColor() string {
|
||||
switch r.TeamTurn {
|
||||
case "red":
|
||||
return "blue"
|
||||
case "blue":
|
||||
return "red"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (r *Room) UpdateCounter() {
|
||||
redCounter := uint8(0)
|
||||
blueCounter := uint8(0)
|
||||
for _, card := range r.Cards {
|
||||
if card.Revealed {
|
||||
continue
|
||||
}
|
||||
switch card.Color {
|
||||
case WordColorRed:
|
||||
redCounter++
|
||||
case WordColorBlue:
|
||||
blueCounter++
|
||||
}
|
||||
}
|
||||
r.RedCounter = redCounter
|
||||
r.BlueCounter = blueCounter
|
||||
}
|
||||
|
||||
func (r *Room) LoadTestCards() {
|
||||
cards := []WordCard{
|
||||
{Word: "hamster", Color: "blue"},
|
||||
|
Reference in New Issue
Block a user