コード例 #1
0
        public async Task SubmitTeam(GameAndPlayerIdDto model)
        {
            Game g = GameStore.GetGame(model.GameId);

            g.CurrentRound.Status = RoundStatus.VotingForTeam;
            GameStore.AddOrUpdateGame(g);
            await _gameHub.Clients.Group(model.GameId.ToString()).SendAsync("UpdateAll");
        }
コード例 #2
0
        public async Task Assassinate(GameAndPlayerIdDto model)
        {
            Game   g = GameStore.GetGame(model.GameId);
            Player p = g.GetPlayer(model.PlayerId);

            if (p.RoleId == GameRole.Merlin)
            {
                g.PointsEvil += 100;
            }
            g.Status = GameStatus.Ended;
            GameStore.AddOrUpdateGame(g);
            await _gameHub.Clients.Group(g.Id.ToString()).SendAsync("UpdateAll");
        }
コード例 #3
0
        public async Task NextRound(GameAndPlayerIdDto model)
        {
            Game g = GameStore.GetGame(model.GameId);

            if (g.PointsEvil >= 3 || g.PointsInnocent >= 3)
            {
                await GameEnd(model.GameId);
            }
            else
            {
                g.CurrentRound.TeamString = String.Join(' ', g.CurrentRound.CurrentTeam.Select(p => p.Name));
                g.PreviousRounds.Add(g.CurrentRound);
                g.CurrentRound = new Round(g.PreviousRounds.Count, g.Players.Count);
            }
            GameStore.AddOrUpdateGame(g);
            await _gameHub.Clients.Group(g.Id.ToString()).SendAsync("UpdateAll");
        }