Esempio n. 1
0
        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"));
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
        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();
            }
        }