Пример #1
0
 /// <summary>
 /// Small utility to make the TestSuitColor more DRY
 /// Iterates over each face value to test if each suit type evaluates it color correctly.
 /// </summary>
 /// <param name="card">The Card which should have its Suit type set.</param>
 /// <param name="color">The suitColor that the Suit should evaluate to. </param>
 public void FaceValueEnumerationTestSuitColorUtility(Card card, SuitColor color)
 {
     foreach (FaceValue fv in Enum.GetValues(typeof(FaceValue)))
     {
         card.faceValue = fv;
         Assert.AreEqual(color, card.suitColor);
     }
 }
Пример #2
0
    public void CreateCard(CardForm card)
    {
        cardForm = card;
        SuitColor suit = SuitConverter(card.Suit);

        SuitText.SetText(suit.Symbol);
        SuitText.color = suit.color;
        ValueText.SetText(ValueConverter(card.Value));
        ValueText.color = suit.color;
    }
Пример #3
0
 public PlayingCard(Suit s, Rank r, GameObject go)
 {
     rank      = r;
     suit      = s;
     suitColor = SuitColor.RED;
     if (s == Suit.CLUB || s == Suit.SPADE)
     {
         suitColor = SuitColor.BLACK;
     }
     cardGameObject = go;
 }
Пример #4
0
        private static int ContainsTileType(List <MahjongMeld> melds, SuitColor type)
        {
            int ret = 0;

            foreach (MahjongMeld meld in melds)
            {
                if (meld.Cards[0].Suit.Color == type)                // Melds can only be made of uniform suits, which implies uniform type, so this is fine
                {
                    ret++;
                }
            }

            return(ret);
        }
Пример #5
0
 public Card(int value, Suit suit)
 {
     this.value     = value;
     this.suit      = suit;
     this.suitColor = suit.GetSuitColor();
 }
Пример #6
0
    public SuitColor   fifth;  //color of the chord where this note is the fifth

    private Suit(SuitColor _root, SuitColor _third, SuitColor _fifth)
    {
        root  = _root;
        third = _third;
        fifth = _fifth;
    }