Exemple #1
0
        public void AddGame()
        {
            Game g = new Game();

            GameStore.AddGame(g);

            Assert.AreEqual(g, GameStore.Instance.Games[g.Id]);
        }
        public Game Create()
        {
            Game g = new Game();

            GameStore.AddGame(g);

            return(g);
        }
Exemple #3
0
        private static void AddDummyGames()
        {
            var player1 = new Player("", "Alfred");

            GameStore.AddGame(player1, 0, 0);

            var player2 = new Player("", "Britney");
            var game    = GameStore.AddGame(player2, 0, 0);

            game.Status = GameStatus.NormalTurn;
        }
Exemple #4
0
        public async Task CreateGame(string playerName, int answerSeconds, int challengeSeconds)
        {
            Player admin = new Player(Context.ConnectionId, playerName);
            Game   game  = GameStore.AddGame(admin, answerSeconds, challengeSeconds);

            await Groups.AddToGroupAsync(Context.ConnectionId, game.Code);

            await Clients.Caller.GameUpdated(game);

            await Clients.Group(GameList).GameListUpdated(GameStore.GetGames());
        }
Exemple #5
0
        public IActionResult CreateGame(string playerName, int answerSeconds, int challengeSeconds)
        {
            Player admin = new Player("", playerName);

            GameStore.AddGame(admin, answerSeconds, challengeSeconds);

            // TODO Subscribe caller to game update

            // TODO _gameClient.GameCreated(_games.Values.ToList());

            return(Ok(admin.ConnectionId));
        }