public ActionResult JoinRoom(NewRoomModel newRoom) { ViewBag.RoomID = newRoom.ID; ViewBag.Nickname = newRoom.Nickname; GameManagerModel gameModel = GameManagerModel.GetInstance(); ViewBag.Players = gameModel.GetGame(newRoom.ID).PlayerNickNames.Values; return(View("NewRoom")); }
public ActionResult StartGame(StartGameModel startGame) { ViewBag.Player = startGame.PlayerName; ViewBag.RoomID = startGame.RoomID; ViewBag.QuestionNumber = 1; ViewBag.Question = startGame.Question; GameManagerModel gameModel = GameManagerModel.GetInstance(); try { ViewBag.Players = gameModel.GetGame(startGame.RoomID).PlayerNickNames.Values; } catch (Exception) { } return(View()); }
public void JoinRoom(string nickname, string roomID) { GameManagerModel gameManager = GameManagerModel.GetInstance(); GameModel game = gameManager.GetGame(roomID); if (game == null) { Clients.Caller.throwExeption(); } else { game.AddPlayer(new PlayerModel(nickname, Context.ConnectionId)); Clients.Caller.submitJoinRoomForm(); } }