Exemplo n.º 1
0
        public async Task StartGame(GameOptionsDTO gameOptions)
        {
            var info = _gameEngine.StartGame(PublicGameId, gameOptions.OptionalRoles);

            foreach (string username in info.Keys)
            {
                await Clients.User(CustomUserIdProvider.GetUserId(username, PublicGameId)).StartGame(info[username]);
            }
        }
Exemplo n.º 2
0
        public async Task SendEndQuestInfo()
        {
            if (_gameEngine.TryEvilWins(GameId, out Game gameSummary))
            {
                await Clients.Group(PublicGameId).EndGameAndReceiveSummary(gameSummary);
            }
            else if (_gameEngine.TryMoveToLakeStage(GameId, out string usernameWithLake, out IEnumerable <string> usernamesToLake))
            {
                await Clients.User(CustomUserIdProvider.GetUserId(usernameWithLake, PublicGameId)).ReceiveUsernamesToLake(usernamesToLake);

                await Clients.Group(PublicGameId).MoveToLakeStage(usernameWithLake);
            }