Enha: wait for mime clue
This commit is contained in:
		| @@ -45,15 +45,17 @@ | |||||||
|   <div> |   <div> | ||||||
|     {{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn)}} |     {{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn)}} | ||||||
|     <button hx-get="/end-turn" hx-target="#room" class="bg-amber-100 text-black px-4 py-2 rounded">End Turn</button> |     <button hx-get="/end-turn" hx-target="#room" class="bg-amber-100 text-black px-4 py-2 rounded">End Turn</button> | ||||||
|     {{else if eq .State.Role "mime"}} |     {{else if and (eq .State.Role "mime") (not .Room.MimeDone)}} | ||||||
|     {{template "mimeclue"}} |     {{template "mimeclue"}} | ||||||
|     {{end}} |     {{end}} | ||||||
|   </div> |   </div> | ||||||
|   <div hx-get="/actionhistory" hx-trigger="sse:backlog_{{.Room.ID}}"> |   <div hx-get="/actionhistory" hx-trigger="sse:backlog_{{.Room.ID}}"> | ||||||
|   {{template "actionhistory" .Room.ActionHistory}} |   {{template "actionhistory" .Room.ActionHistory}} | ||||||
|   </div> |   </div> | ||||||
|  |   {{if not .Room.IsRunning}} | ||||||
|   <div id="exitbtn"> |   <div id="exitbtn"> | ||||||
|           <button button id="exit-room-btn" type="submit" class="justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" hx-get="/room/exit" hx-target="#ancestor">Exit Room</button> |           <button button id="exit-room-btn" type="submit" class="justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" hx-get="/room/exit" hx-target="#ancestor">Exit Room</button> | ||||||
|   </div> |   </div> | ||||||
|  |   {{end}} | ||||||
| </div> | </div> | ||||||
| {{end}} | {{end}} | ||||||
|   | |||||||
| @@ -51,6 +51,10 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | |||||||
| 		abortWithError(w, err.Error()) | 		abortWithError(w, err.Error()) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	if !fi.Room.MimeDone { | ||||||
|  | 		abortWithError(w, "wait for the clue") | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
| 	color, exists := roundWords[word] | 	color, exists := roundWords[word] | ||||||
| 	log.Debug("got show-color request", "word", word, "color", color) | 	log.Debug("got show-color request", "word", word, "color", color) | ||||||
| 	if !exists { | 	if !exists { | ||||||
|   | |||||||
| @@ -40,12 +40,6 @@ func HandleCreateRoom(w http.ResponseWriter, r *http.Request) { | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	notify(models.NotifyRoomListUpdate, "") | 	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") | 	tmpl, err := template.ParseGlob("components/*.html") | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		abortWithError(w, err.Error()) | 		abortWithError(w, err.Error()) | ||||||
|   | |||||||
| @@ -94,6 +94,10 @@ func HandleExit(w http.ResponseWriter, r *http.Request) { | |||||||
| 		abortWithError(w, err.Error()) | 		abortWithError(w, err.Error()) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	if fi.Room.IsRunning { | ||||||
|  | 		abortWithError(w, "cannot leave when game is running") | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
| 	var creatorLeft bool | 	var creatorLeft bool | ||||||
| 	if fi.Room.CreatorName == fi.State.Username { | 	if fi.Room.CreatorName == fi.State.Username { | ||||||
| 		creatorLeft = true | 		creatorLeft = true | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								todos.md
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								todos.md
									
									
									
									
									
								
							| @@ -1,7 +1,9 @@ | |||||||
| ### feats | ### feats | ||||||
| - ability to leave room; | - auto close room if nothing is going on there (hmm) for ~1h; | ||||||
| - close room if creator left (or pass role to other player); | - words database (file) load and form random 25 words; | ||||||
| - notify on creation of new room; | - mark cards (instead of opening them (right click?); | ||||||
|  | - invite link; | ||||||
|  | - login with invite link; | ||||||
|  |  | ||||||
| #### sse points | #### sse points | ||||||
| - clue sse update; | - clue sse update; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder