예제 #1
0
        public void OnNext(GameEvent e)
        {
            var task = e
                       switch
            {
                HandReceived hand => _client.HandReceived(GetHandReceivedData(e.Context, hand)),
                CardPlayed move => _client.CardPlayed(new CardPlayedDto(e.Context.GameId, e.Context.RoundIndex, move.Player, GetIndex(move.Card))),
                GuessGiven guess => _client.GuessGiven(new GuessGivenDto(e.Context.GameId, e.Context.RoundIndex, guess.Player, guess.Count)),
                TrickWon trick => _client.TrickWon(new TrickWonDto(e.Context.GameId, e.Context.RoundIndex, trick.Player)),
                _ => Task.CompletedTask,
            };

            task.GetAwaiter().GetResult();
        }