コード例 #1
0
 public ChangeTrumpCardManager(IDeckState deckState, IGameState gameState, ITrickState trickState, IPlayerActionValidator playerActionValidator)
     : base(gameState, trickState)
 {
     this.deckState             = deckState;
     this.gameState             = gameState;
     this.playerActionValidator = playerActionValidator;
 }
コード例 #2
0
 public CardsDealer(IGameState gameState, IDeckState deckState, ICardsProvider cardsProvider, IAnnounceProvider announceProvider)
 {
     this.gameState        = gameState;
     this.deckState        = deckState;
     this.cardsProvider    = cardsProvider;
     this.announceProvider = announceProvider;
 }
コード例 #3
0
 public DeckNotClosedRoundWinner(IGameState gameState, IDeckState deckState, ITrickState trickState)
     : base(gameState)
 {
     this.gameState  = gameState;
     this.deckState  = deckState;
     this.trickState = trickState;
 }
コード例 #4
0
 public AnnounceMarriage(ITrickState trickState, IDeckState deckState, IAnnounceProvider announceProvider, IPlayerActionValidator playerActionValidator)
     : base(trickState)
 {
     this.deckState             = deckState;
     this.announceProvider      = announceProvider;
     this.playerActionValidator = playerActionValidator;
 }
コード例 #5
0
 public PlayCardManager(IDeckState deckState, IGameState gameState, ITrickState trickState, IEnumerable <IPlayCardValidator> playCardValidators)
     : base(gameState, trickState)
 {
     this.deckState          = deckState;
     this.gameState          = gameState;
     this.trickState         = trickState;
     this.playCardValidators = playCardValidators;
 }
コード例 #6
0
ファイル: CardGameUtils.cs プロジェクト: Zugamifk/Cards
 public static TCardState DrawCard <TCardState>(IDeckState <TCardState> deck)
     where TCardState : ICardState
 {
     if (deck.OrderedDeck.Count > 0)
     {
         var card = deck.OrderedDeck[0];
         deck.OrderedDeck.RemoveAt(0);
         return(card);
     }
     else
     {
         return(default(TCardState));
     }
 }
コード例 #7
0
ファイル: CardGameUtils.cs プロジェクト: Zugamifk/Cards
 public static IEnumerable <TCardState> DrawCards <TCardState>(IDeckState <TCardState> deck, int numberToDraw)
     where TCardState : ICardState
 {
     for (int i = 0; i < numberToDraw; i++)
     {
         var card = DrawCard(deck);
         if (card != null)
         {
             yield return(card);
         }
         else
         {
             yield break;
         }
     }
 }
コード例 #8
0
ファイル: CardGameUtils.cs プロジェクト: Zugamifk/Cards
    public static void Shuffle <TCardState>(IDeckState <TCardState> deck)
        where TCardState : ICardState
    {
        if (deck.OrderedDeck.Count < 2)
        {
            return;
        }

        for (int i = 1; i < deck.OrderedDeck.Count; i++)
        {
            var a = deck.OrderedDeck[i];
            var j = Random.Range(0, i);
            var b = deck.OrderedDeck[j];
            deck.OrderedDeck[i] = b;
            deck.OrderedDeck[j] = a;
        }
    }
コード例 #9
0
 public PlaySecondFollowingSuitStrategy(IDeckState deckState, ITrickState trickState, IEnumerable <IPlayLogic> playLogics)
     : base(trickState, playLogics)
 {
     this.deckState  = deckState;
     this.trickState = trickState;
 }
コード例 #10
0
 public PlayTrumpCardValidator(IDeckState deckState)
 {
     this.deckState = deckState;
 }
コード例 #11
0
 public StatesManager(IGameState gameState, IDeckState deckState, ITrickState trickState)
 {
     this.gameState  = gameState;
     this.deckState  = deckState;
     this.trickState = trickState;
 }
コード例 #12
0
 public AnnounceProvider(IDeckState deckState, IPlayerActionValidator playerActionValidator)
 {
     this.deckState             = deckState;
     this.playerActionValidator = playerActionValidator;
 }
コード例 #13
0
 public DeckClosedRoundWinner(IGameState gameState, IDeckState deckState)
     : base(gameState)
 {
     this.gameState = gameState;
     this.deckState = deckState;
 }
コード例 #14
0
 public PlayDifferentCard(ITrickState trickState, IDeckState deckState)
     : base(trickState)
 {
     this.deckState = deckState;
 }
コード例 #15
0
 public ChangeTrumpCard(ITrickState trickState, IDeckState deckState, IPlayerActionValidator playerActionValidator)
     : base(trickState)
 {
     this.deckState             = deckState;
     this.playerActionValidator = playerActionValidator;
 }
コード例 #16
0
 public PlayerActionValidator(IDeckState deckState, ITrickState trickState)
 {
     this.deckState  = deckState;
     this.trickState = trickState;
 }
コード例 #17
0
 public PlayTrumpCard(ITrickState trickState, IDeckState deckState)
     : base(trickState)
 {
     this.deckState = deckState;
 }
コード例 #18
0
ファイル: PlayCard.cs プロジェクト: itplamen/SantaseCardGame
 public PlayCard(ITrickState trickState, IDeckState deckState, IAnnounceProvider announceProvider)
     : base(trickState)
 {
     this.deckState        = deckState;
     this.announceProvider = announceProvider;
 }
コード例 #19
0
        private PlaySecondFollowingSuitStrategy RegisterPlaySecondFollowingSuitStrategy(IDeckState deckState, ITrickState trickState, IEnumerable <IPlayLogic> playLogics)
        {
            List <Type> types = new List <Type>()
            {
                typeof(PlayHigherCard),
                typeof(PlayLowerCard),
                typeof(PlayTrumpCard),
                typeof(PlayDifferentCard)
            };

            IEnumerable <IPlayLogic> strategyLogics = GetOrderedPlayLogics(types, playLogics);

            return(new PlaySecondFollowingSuitStrategy(deckState, trickState, strategyLogics));
        }
コード例 #20
0
        private PlayFirstFollowingSuitStrategy RegisterPlayFirstFollowingSuitStrategy(IDeckState deckState, ITrickState trickState, IEnumerable <IPlayLogic> playLogics)
        {
            List <Type> types = new List <Type>()
            {
                typeof(AnnounceMarriage),
                typeof(PlayCard)
            };

            IEnumerable <IPlayLogic> strategyLogics = GetOrderedPlayLogics(types, playLogics);

            return(new PlayFirstFollowingSuitStrategy(deckState, trickState, strategyLogics));
        }