예제 #1
0
        public async Task ReceivingGameData(DecodedGameData decodedGameData)
        {
            var activeRound = await _gameRoundRepository.GetActive();

            if (activeRound == null || !activeRound.Start.HasValue)
            {
                return;
            }
            var nowTime = DateTime.UtcNow;

            if ((activeRound.Pause.HasValue) ||
                (activeRound.Start > nowTime) ||
                (activeRound.End < nowTime))
            {
                return;
            }
            var player = activeRound.Players.FirstOrDefault(p => p.PlayerId.Equals(decodedGameData.IdenCardId));

            if (player == null)
            {
                return;
            }
            var encodedGameData = _gameDataMapper.Map(decodedGameData);
            await _gameDataRepository.Add(encodedGameData);
        }