diff --git a/components/room.html b/components/room.html index 2613c6b..b8ef2b7 100644 --- a/components/room.html +++ b/components/room.html @@ -45,15 +45,17 @@
{{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn)}} - {{else if eq .State.Role "mime"}} + {{else if and (eq .State.Role "mime") (not .Room.MimeDone)}} {{template "mimeclue"}} {{end}}
{{template "actionhistory" .Room.ActionHistory}}
+ {{if not .Room.IsRunning}}
+ {{end}} {{end}} diff --git a/handlers/elements.go b/handlers/elements.go index 98808c7..7c032cb 100644 --- a/handlers/elements.go +++ b/handlers/elements.go @@ -51,6 +51,10 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { abortWithError(w, err.Error()) return } + if !fi.Room.MimeDone { + abortWithError(w, "wait for the clue") + return + } color, exists := roundWords[word] log.Debug("got show-color request", "word", word, "color", color) if !exists { diff --git a/handlers/game.go b/handlers/game.go index 7740f84..bf8c33f 100644 --- a/handlers/game.go +++ b/handlers/game.go @@ -40,12 +40,6 @@ func HandleCreateRoom(w http.ResponseWriter, r *http.Request) { return } notify(models.NotifyRoomListUpdate, "") - // send msg of created room - // h.Broker.Notifier <- broker.NotificationEvent{ - // EventName: models.MsgRoomListUpdate, - // Payload: fmt.Sprintf("%s created a room named %s", r.CreatorName, r.RoomName), - // } - // return html tmpl, err := template.ParseGlob("components/*.html") if err != nil { abortWithError(w, err.Error()) diff --git a/handlers/handlers.go b/handlers/handlers.go index 0197b78..b8baf26 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -94,6 +94,10 @@ func HandleExit(w http.ResponseWriter, r *http.Request) { abortWithError(w, err.Error()) return } + if fi.Room.IsRunning { + abortWithError(w, "cannot leave when game is running") + return + } var creatorLeft bool if fi.Room.CreatorName == fi.State.Username { creatorLeft = true diff --git a/todos.md b/todos.md index 9861381..f9e32ef 100644 --- a/todos.md +++ b/todos.md @@ -1,7 +1,9 @@ ### feats -- ability to leave room; -- close room if creator left (or pass role to other player); -- notify on creation of new room; +- auto close room if nothing is going on there (hmm) for ~1h; +- words database (file) load and form random 25 words; +- mark cards (instead of opening them (right click?); +- invite link; +- login with invite link; #### sse points - clue sse update;