Feat: game over event to be seen in backog
This commit is contained in:
		| @@ -90,6 +90,13 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | |||||||
| 		fi.Room.IsRunning = false | 		fi.Room.IsRunning = false | ||||||
| 		fi.Room.IsOver = true | 		fi.Room.IsOver = true | ||||||
| 		fi.Room.TeamWon = oppositeColor | 		fi.Room.TeamWon = oppositeColor | ||||||
|  | 		action := models.Action{ | ||||||
|  | 			Actor:      fi.State.Username, | ||||||
|  | 			ActorColor: string(fi.State.Team), | ||||||
|  | 			WordColor:  "black", | ||||||
|  | 			Action:     "game over", | ||||||
|  | 		} | ||||||
|  | 		fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | ||||||
| 	case "white", string(oppositeColor): | 	case "white", string(oppositeColor): | ||||||
| 		// end turn | 		// end turn | ||||||
| 		fi.Room.TeamTurn = oppositeColor | 		fi.Room.TeamTurn = oppositeColor | ||||||
| @@ -101,12 +108,26 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | |||||||
| 		fi.Room.IsRunning = false | 		fi.Room.IsRunning = false | ||||||
| 		fi.Room.IsOver = true | 		fi.Room.IsOver = true | ||||||
| 		fi.Room.TeamWon = "blue" | 		fi.Room.TeamWon = "blue" | ||||||
|  | 		action := models.Action{ | ||||||
|  | 			Actor:      fi.State.Username, | ||||||
|  | 			ActorColor: string(fi.State.Team), | ||||||
|  | 			WordColor:  "blue", | ||||||
|  | 			Action:     "game over", | ||||||
|  | 		} | ||||||
|  | 		fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | ||||||
| 	} | 	} | ||||||
| 	if fi.Room.RedCounter == 0 { | 	if fi.Room.RedCounter == 0 { | ||||||
| 		// red won | 		// red won | ||||||
| 		fi.Room.IsRunning = false | 		fi.Room.IsRunning = false | ||||||
| 		fi.Room.IsOver = true | 		fi.Room.IsOver = true | ||||||
| 		fi.Room.TeamWon = "red" | 		fi.Room.TeamWon = "red" | ||||||
|  | 		action := models.Action{ | ||||||
|  | 			Actor:      fi.State.Username, | ||||||
|  | 			ActorColor: string(fi.State.Team), | ||||||
|  | 			WordColor:  "red", | ||||||
|  | 			Action:     "game over", | ||||||
|  | 		} | ||||||
|  | 		fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | ||||||
| 	} | 	} | ||||||
| 	if err := saveFullInfo(fi); err != nil { | 	if err := saveFullInfo(fi); err != nil { | ||||||
| 		abortWithError(w, err.Error()) | 		abortWithError(w, err.Error()) | ||||||
|   | |||||||
| @@ -42,7 +42,7 @@ type Team struct { | |||||||
| type Action struct { | type Action struct { | ||||||
| 	Actor      string | 	Actor      string | ||||||
| 	ActorColor string | 	ActorColor string | ||||||
| 	Action     WordColor // clue | guess | 	Action     string // clue | guess | ||||||
| 	Word       string | 	Word       string | ||||||
| 	WordColor  string | 	WordColor  string | ||||||
| 	Number     string // for clue | 	Number     string // for clue | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								todos.md
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								todos.md
									
									
									
									
									
								
							| @@ -25,3 +25,5 @@ | |||||||
| - cleanup backlog after new game is started; | - cleanup backlog after new game is started; | ||||||
| - guessers should not be able to open more cards, than mime gave them +1; | - guessers should not be able to open more cards, than mime gave them +1; | ||||||
| - sse hangs / fails connection which causes to wait for cards to open a few seconds (on local machine); | - sse hangs / fails connection which causes to wait for cards to open a few seconds (on local machine); | ||||||
|  | - after starting a new game (after old one) blue mime has no clue input; | ||||||
|  | - gameover to backlog; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder