當前位置: 首頁>>代碼示例>>C#>>正文


C# CardCollection類代碼示例

本文整理匯總了C#中CardCollection的典型用法代碼示例。如果您正苦於以下問題:C# CardCollection類的具體用法?C# CardCollection怎麽用?C# CardCollection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CardCollection類屬於命名空間,在下文中一共展示了CardCollection類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetCardsToDrag

		/// <summary>
		/// 
		/// </summary>
		/// <param name="pt"></param>
		/// <returns></returns>
		public override CardCollection GetCardsToDrag( Point pt )
		{
			// Loop backwards through all cards in this collection
			// and when we find a card that fits the bill, we return
			// that card and all cards on top of that card.
			// Also note that we don't allow dragging cards which are
			// face down.

			int i = base.Count - 1; 

			for ( ; i >= 0; i-- )
			{
				Card c = base.m_cards[ i ];
				if ( c.Contains( pt ) && c.FaceUp )
				{
					break;
				}
			}

			if ( i != -1 )
			{
				CardCollection cards = new CardCollection( );
				cards.AddRange( base.m_cards.GetRange( i, base.Count - i ) );
				return cards;
			}
			return null;
		}
開發者ID:VictorGressier,項目名稱:skul,代碼行數:32,代碼來源:KlondikeFlatPile.cs

示例2: TestAlternatingColors

		public void TestAlternatingColors( )
		{
			CardCollection coll = new CardCollection( );

			// An empty one is also alternating:
			Assert.AreEqual( coll.IsAlternatingColors( ), true );
			coll.Add( new Card( Suit.Clubs, 10, true, null ) );

			// So is a collection of only one element:
			Assert.AreEqual( coll.IsAlternatingColors( ), true );

			// Then, add a few cards of alternating colors:
			coll.Add( new Card( Suit.Diamonds, 11, true, null ) );
			coll.Add( new Card( Suit.Clubs, 7, true, null ) );
			coll.Add( new Card( Suit.Diamonds, 11, true, null ) );
			coll.Add( new Card( Suit.Spades, 7, true, null ) );
			coll.Add( new Card( Suit.Hearts, 11, true, null ) );
			coll.Add( new Card( Suit.Clubs, 7, true, null ) );

			// This should hold:
			Assert.AreEqual( coll.IsAlternatingColors( ), true );

			// Finally, remove a card in the middle:

			coll.RemoveAt( 2 );

			// ... which should make it no longer alternating:
			Assert.AreEqual( coll.IsAlternatingColors( ), false );
		}
開發者ID:VictorGressier,項目名稱:skul,代碼行數:29,代碼來源:CardCollectionTest.cs

示例3: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        HttpResponse<string> response = Unirest.get("https://omgvamp-hearthstone-v1.p.mashape.com/cards?collectible=1")
        .header("X-Mashape-Key", "Y6G2Ve8iAOmshQFq4sGVgvBtI1HVp1CVLrWjsnPikTu4oqy2EK")
        .asJson<string>();

        CardCollection collection = new CardCollection();
        collection = JsonConvert.DeserializeObject<CardCollection>(response.Body);

        List<Card> cards = new List<Card>();
        cards.AddRange(collection.basic);
        cards.AddRange(collection.classic);
        cards.AddRange(collection.naxxramas);
        cards.AddRange(collection.gvg);
        cards.AddRange(collection.blackrock);
        cards.AddRange(collection.grandTournament);
        cards.AddRange(collection.leagueOfExplorers);

        DataAccessLayer layer1 = new DataAccessLayer();

        try
        {
            layer1.InsertCardsToDb(cards);
        }
        catch (Exception)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('Kortit jo kannassa');", true);
        }

        //Grid.DataSource = cards as IEnumerable<Card>;
        Grid.DataSource = cards as IEnumerable<Card>;
        Grid.DataBind();
    }
開發者ID:TuoKy,項目名稱:IIO13200-HTYO-LeppanenKytta,代碼行數:33,代碼來源:Test.aspx.cs

示例4: Test_DetermineWinners_FullHouse_TwoWinners

        public void Test_DetermineWinners_FullHouse_TwoWinners()
        {
            Player winner1 = new Player("Winner1", 1000);
            winner1.Cards.Add(new Card(Rank.Two, Suit.Spades));
            winner1.Cards.Add(new Card(Rank.Two, Suit.Hearts));

            Player winner2 = new Player("Winner2", 1000);
            winner2.Cards.Add(new Card(Rank.Two, Suit.Diamonds));
            winner2.Cards.Add(new Card(Rank.Two, Suit.Clubs));

            CardCollection communityCards = new CardCollection();
            communityCards.Add(new Card(Rank.Three, Suit.Hearts));
            communityCards.Add(new Card(Rank.Six, Suit.Clubs));
            communityCards.Add(new Card(Rank.King, Suit.Hearts));
            communityCards.Add(new Card(Rank.King, Suit.Spades));
            communityCards.Add(new Card(Rank.King, Suit.Diamonds));

            HandEvaluator eval = new HandEvaluator();

            Hand hand1 = eval.GetBestHand(winner1.Cards + communityCards);

            Hand hand2 = eval.GetBestHand(winner2.Cards + communityCards);

            Assert.AreEqual(0, HandEvaluator.Compare(hand1, hand2));
        }
開發者ID:bberak,項目名稱:PokerDotNet,代碼行數:25,代碼來源:HandEvaluatorTest.cs

示例5: CheckCardExistence

 internal static CardBehaviour CheckCardExistence(CardCollection cardType, GameObject player, GameObject systemObject)
 {
     if (player != null)
     {
         if(systemObject != null)
         {
             var cardBehaviour = CardObjectList.Find(x => x.CardType == cardType && x.Player == player && x.System == systemObject);
             return cardBehaviour;
         }
         else
         {
             var cardBehaviour = CardObjectList.Find(x => x.CardType == cardType && x.Player == player);
             return cardBehaviour;
         }
     }
     else
     {
         if (systemObject != null)
         {
             var cardBehaviour = CardObjectList.Find(x => x.CardType == cardType && x.System == systemObject);
             return cardBehaviour;
         }
         else
         {
             var cardBehaviour = CardObjectList.Find(x => x.CardType == cardType);
             return cardBehaviour;
         }
     }
 }
開發者ID:meatz89,項目名稱:CyberWarfare,代碼行數:29,代碼來源:CardBehaviour.cs

示例6: CardCollection_AdditionTest

        public void CardCollection_AdditionTest()
        {
            CardCollection left = new CardCollection();

            ColorettoCard card1 = new ColorettoCard(ColorettoCardColors.Blue);
            ColorettoCard card2 = new ColorettoCard(ColorettoCardColors.Brown);
            ColorettoCard card3 = new ColorettoCard(ColorettoCardColors.Gray);

            left = left.Add(card1);
            left = left.Add(card2);
            left = left.Add(card3);

            CardCollection right = new CardCollection();

            card1 = new ColorettoCard(ColorettoCardColors.Blue);
            card2 = new ColorettoCard(ColorettoCardColors.Brown);
            card3 = new ColorettoCard(ColorettoCardColors.Gray);

            right = right.Add(card1);
            right = right.Add(card2);
            right = right.Add(card3);

            CardCollection added = left + right;
            Assert.AreEqual<int>(6, added.Count);
            Assert.AreEqual<int>(9, added.Score);
        }
開發者ID:ischyrus,項目名稱:coloretto_old,代碼行數:26,代碼來源:CardCollectionTest.cs

示例7: GetOpponentCards

        public ICollection<Card> GetOpponentCards(ICollection<Card> myCards, ICollection<Card> playedCards, Card activeTrumpCard, CardSuit suit)
        {
            var playerCards = new CardCollection
                                  {
                                      new Card(suit, CardType.Nine),
                                      new Card(suit, CardType.Jack),
                                      new Card(suit, CardType.Queen),
                                      new Card(suit, CardType.King),
                                      new Card(suit, CardType.Ten),
                                      new Card(suit, CardType.Ace),
                                  };

            foreach (var card in myCards.Where(x => x.Suit == suit))
            {
                playerCards.Remove(card);
            }

            foreach (var card in playedCards.Where(x => x.Suit == suit))
            {
                playerCards.Remove(card);
            }

            if (activeTrumpCard != null)
            {
                playerCards.Remove(activeTrumpCard);
            }

            return playerCards;
        }
開發者ID:NotDemons,項目名稱:NotDemonsRepo,代碼行數:29,代碼來源:OpponentSuitCardsProvider.cs

示例8: getAllCards

 public CardCollection getAllCards()
 {
     CardCollection allCards = new CardCollection ();
     allCards.addList (hand.getCards());
     allCards.addList (deck.getCards ());
     allCards.addList (discardPile.getCards ());
     return allCards;
 }
開發者ID:mtkloepf,項目名稱:HGD-Lava,代碼行數:8,代碼來源:DeckManager.cs

示例9: Player

 public Player(string name, double chips, PlayerState state, string gatewayServerId)
 {
     Name = name;
     Chips = chips;
     State = state;
     GatewayServerId = gatewayServerId;
     Cards = new CardCollection();
 }
開發者ID:bberak,項目名稱:PokerDotNet,代碼行數:8,代碼來源:Player.cs

示例10: Hand

 public Hand(CardCollection cards, Combination HandType)
     : base(cards)
 {
     if (cards == null || cards.Count <= 0)
         throw new InvalidOperationException("You cannot add an empty collection of cards to a hand.");
     m_cmbBestCombination = HandType;
     base.Sort();
     m_cdHighCard = base[base.Count - 1];
 }
開發者ID:bberak,項目名稱:PokerDotNet,代碼行數:9,代碼來源:Hand.cs

示例11: AddTest

        public void AddTest()
        {
            var cc = new CardCollection();

            cc.Add(new Card("TEST1", "Test1"));
            cc.Add("TEST2", new Card("TEST2", "Test2"));

            // Test add with existing keyword
        }
開發者ID:skyquery,項目名稱:sharpfitsio,代碼行數:9,代碼來源:CardCollectionTest.cs

示例12: CopyToShouldWorkProperly

 public void CopyToShouldWorkProperly()
 {
     var card1 = new Card(CardSuit.Club, CardType.Ace); // 1
     var card2 = new Card(CardSuit.Spade, CardType.King); // 52
     var collection = new CardCollection { card1, card2 };
     var array = new Card[2];
     collection.CopyTo(array, 0);
     Assert.IsTrue(array.Contains(card1));
     Assert.IsTrue(array.Contains(card2));
 }
開發者ID:NotDemons,項目名稱:NotDemonsRepo,代碼行數:10,代碼來源:CardCollectionTests.cs

示例13: CreateEnemyCollection

 public static CardCollection CreateEnemyCollection()
 {
     // Create enemy deck collection and return
     CardCollection enemyDeck = new CardCollection();
     foreach (string c in EnemyDeck1)
     {
         enemyDeck.Add(CardData.CreateCardFromName(c));
     }
     return enemyDeck;
 }
開發者ID:sgastudio,項目名稱:Yugioh,代碼行數:10,代碼來源:EnemyDecks.cs

示例14: AddCards

		/// <summary>
		/// SuitPile overrides the default behaviour of AddCards, since there are 
		/// restrictions to what kind of cards can be added where. 
		/// </summary>
		/// <param name="cards"></param>
		/// <returns></returns>
		public override bool AddCards( CardCollection cards )
		{
			if ( cards.Count > 0
				&& CanAddCard( cards[ 0 ] )
				&& cards.IsAscendingRank( ) )
			{
				return base.AddCards( cards );
			}

			return false;
		}
開發者ID:VictorGressier,項目名稱:skul,代碼行數:17,代碼來源:SuitPile.cs

示例15: CardCollection

        public static CardCollection operator +(Card c1, Card c2)
        {
            CardCollection summCollection = new CardCollection();

            if (c1 != null)
                summCollection.Add(c1);

            if (c2 != null)
                summCollection.Add(c2);

            return summCollection;
        }
開發者ID:bberak,項目名稱:PokerDotNet,代碼行數:12,代碼來源:Card.cs


注:本文中的CardCollection類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。