private HandReceivedDto GetHandReceivedData(GameEventContext ctx, HandReceived hand) { if (hand.Player == _playerIndex) { var knownHand = hand.Hand as KnownHand; return(HandReceivedDto.ForKnownHand(ctx.GameId, ctx.RoundIndex, hand.Player, knownHand.Select(GetIndex).ToList())); } return(HandReceivedDto.ForSecretHand(ctx.GameId, ctx.RoundIndex, hand.Player, hand.Hand.NumberOfCards)); }
public Task HandReceived(HandReceivedDto data) { System.Console.WriteLine(data); var hand = data.CardIndices == null ? (IHand) new UnknownHand(data.NumberOfCards) : new KnownHand(data.CardIndices.Select(i => _deck[i])); var ctx = new GameEventContext(data.GameId, data.RoundIndex); var e = new HandReceived(ctx, new PlayerIndex(data.PlayerIndex), hand); System.Console.WriteLine(e); _gameEventCallback(e); return(Task.CompletedTask); }