• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CardCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CardCollection的典型用法代码示例。如果您正苦于以下问题:C# CardCollection类的具体用法?C# CardCollection怎么用?C# CardCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CardCollection类属于命名空间,在下文中一共展示了CardCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: BitsToCardCollection

        internal static CardCollection BitsToCardCollection(int source)
        {
            var result = new CardCollection();

            for (int i = 0; i < 32; i++)
            {
                int card = (1 << i);
                if ((source & card) != 0)
                    result.Add(BitsToCard(card));
            }

            return result;
        }
开发者ID:DVorobyev,项目名称:Preference,代码行数:13,代码来源:BitwiseCardHelper.cs


示例17: Choice

		private Choice(String text, Card cardSource, CardCollection cardTriggers, ChoiceType choiceType, Player playerSource, EventArgs eventArgs, Boolean isOrdered, Boolean isSpecific, int minimum, int maximum)
		{
			_Text = text;
			_CardSource = cardSource;
			_CardTriggers = cardTriggers;
			_ChoiceType = choiceType;
			_PlayerSource = playerSource;
			_EventArgs = eventArgs;
			_IsOrdered = isOrdered;
			_IsSpecific = isSpecific;
			_Minimum = minimum < 0 ? 0 : minimum;
			_Maximum = maximum < _Minimum ? _Minimum : maximum;
		}
开发者ID:micahpaul,项目名称:dominion_net_multi,代码行数:13,代码来源:Choice.cs


示例18: ClearShouldReturn0Cards

 public void ClearShouldReturn0Cards()
 {
     var collection = new CardCollection
                          {
                              new Card(CardSuit.Club, CardType.Ace),
                              new Card(CardSuit.Diamond, CardType.Ten),
                              new Card(CardSuit.Heart, CardType.Jack),
                              new Card(CardSuit.Spade, CardType.Nine)
                          };
     collection.Clear();
     Assert.AreEqual(0, collection.Count);
     Assert.AreEqual(0, collection.ToList().Count);
 }
开发者ID:NotDemons,项目名称:NotDemonsRepo,代码行数:13,代码来源:CardCollectionTests.cs


示例19: DeckManager

    /* Builds a deck given the types and their respective quantities in the array arguments.
     * NOTE: types and weights MUST be of the same length!
     * Also, there should be no null values in types and weights should contain no nonpositive values either! */
    public DeckManager(CardScript.CardType[] types, int[] weights)
    {
        deck = new CardCollection ();
        // Adds a number of each card type equal to their respective weights
        for (int idx = 0; idx < types.Length; ++idx) {
            for (int qty = 0; qty < weights[idx]; ++qty) {
                deck.add(new CardScript(types[idx]));
            }
        }

        hand = new CardCollection();
        discardPile = new CardCollection();
    }
开发者ID:mtkloepf,项目名称:HGD-Lava,代码行数:16,代码来源:DeckManager.cs


示例20: AddCards

		public override bool AddCards( CardCollection cards )
		{
			foreach ( Card c in cards )
			{
				base.m_cards.Add( c );

				// First card should be placed exactly where the pile is located,
				// but next cards should be lowered accordingly
				c.Location = TranslatePoint( this.Location );
			}

			return true;
		}
开发者ID:VictorGressier,项目名称:skul,代码行数:13,代码来源:FlatPile.cs



注:本文中的CardCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CardColor类代码示例发布时间:2022-05-24
下一篇:
C# Card类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap