Beispiel #1
0
        public void UpdateGameState(Game game)
        {
            var player = game.Players.Single(p => p.Id == PlayerId);
            var activity = game.GetPendingActivity(player) as ChoiceActivity;

            if (activity == null)
                throw new InvalidOperationException("There must be a corresponding activity");

            activity.MakeChoice(Choice);
        }
        public void UpdateGameState(Game game)
        {
            var player = game.Players.Single(p => p.Id == PlayerId);
            var pile = game.Bank.Piles.SingleOrDefault(p => p.Id == PileId);
            var activity = game.GetPendingActivity(player) as ISelectPileActivity;

            if (activity == null)
                throw new InvalidOperationException("There must be a corresponding activity");

            activity.SelectPile(pile);
        }
Beispiel #3
0
        private void PopulateActivityRelated(Game game, Player player)
        {
            var activity = game.GetPendingActivity(player);
            if(activity != null)
                PendingActivity = new ActivityModel(activity);

            if (activity is IRevealedCardsActivity)
            {
                this.Revealed = ((IRevealedCardsActivity)activity).RevealedCards
                    .Select(c => new CardViewModel(c)).ToArray();
            }
        }
        public void UpdateGameState(Game game)
        {
            var player = game.Players.Single(p => p.Id == PlayerId);
            var activity = game.GetPendingActivity(player) as ISelectCardsActivity;

            if (activity == null)
                throw new InvalidOperationException("There must be a corresponding activity");

            IEnumerable<ICard> cardSource;

            if(activity is ISelectFromRevealedCardsActivity)
            {
                cardSource = ((ISelectFromRevealedCardsActivity) activity).RevealedCards;
            }
            else
            {
                cardSource = player.Hand;
            }

            var cards = cardSource.Where(c => CardIds.Contains(c.Id)).ToList();                   
            activity.SelectCards(cards);            
        }