Feat: roomlist & join room

This commit is contained in:
Grail Finder
2025-05-09 14:39:33 +03:00
parent 45761446e5
commit 6c9c86f02b
10 changed files with 141 additions and 10 deletions

View File

@ -52,6 +52,7 @@ type Room struct {
BlueCounter uint8
RedCounter uint8
RedTurn bool // false is blue turn
IsPublic bool
// GameSettings *GameSettings `json:"settings"`
IsRunning bool `json:"is_running"`
Language string `json:"language" example:"en" form:"language"`
@ -102,6 +103,12 @@ func (r *Room) ChangeTurn() {
}
}
func (r *Room) RevealAllCards() {
for i := range r.Cards {
r.Cards[i].Revealed = true
}
}
type WordCard struct {
Word string
Color WordColor
@ -142,4 +149,5 @@ func (rr *RoomReq) CreateRoom(creator string) *Room {
type FullInfo struct {
State *UserState
Room *Room
List []*Room
}