public Task CardPlayed(CardPlayedDto data) { var ctx = new GameEventContext(data.GameId, data.RoundIndex); var e = new CardPlayed(ctx, new PlayerIndex(data.PlayerIndex), _deck[data.CardIndex]); _gameEventCallback(e); return(Task.CompletedTask); }
public Task PlayCard(Card card) { System.Console.WriteLine("Playing card"); var cardIndex = _deck.AllCards.ToList().IndexOf(card); // TODO dont reuse the event dto var data = new CardPlayedDto(null, -1, PlayerIndex, cardIndex); return(_connection.SendAsync(nameof(IGameHub.PlayCard), data)); }
public Task PlayCard(CardPlayedDto data) { _logger.LogInformation("Received move for card {cardIndex}", data.CardIndex); var(room, playerIndex) = _connectionManager.GetPlayerConnection(Context.ConnectionId); var res = room.TryPlayCard(playerIndex, data.CardIndex); if (!res) { _logger.LogInformation("move is currently INVALID"); } return(Task.CompletedTask); }