Beispiel #1
0
        public int resolveTrick()
        {
            RawCard winCard;

            if (playedCards.Exists(x => x.Number == 15))
            {
                winCard = playedCards.Find(x => x.Number == 15);
            }
            else if (playedCards.Exists(x => x.Suit == trump.Suit && x.Number != 1))
            {
                playedCards.Sort();
                winCard = playedCards.FindLast(x => x.Suit == trump.Suit);
            }
            else if (playedCards.TrueForAll(x => x.Number == 1))
            {
                winCard = playedCards[0];
            }
            else
            {
                ESuit lead = playedCards.Find(x => x.Number != 1).Suit;
                playedCards.Sort();
                winCard = playedCards.FindLast(x => x.Suit == lead);
            }
            int winPlayer = cardMap[winCard];

            return(winPlayer);
        }
Beispiel #2
0
        public Card(EValue value, ESuit suit)
        {
            Suit  = suit;
            Value = value;

            Name = $"{value} of {Suit}";
        }
Beispiel #3
0
    //カードの設定
    public void Set(CardData data)
    {
        //カード情報を設定
        this.mData = data;

        //IDを設定する
        this.Id = data.Id;

        // スートを設定する
        this.Suit = data.Suit;

        //表示する画像を設定する
        //初回はすべて裏面表示とする
        this.CardImage.sprite = Resources.Load <Sprite>("Image/TrumpBack");

        //選択判定フラグを初期化する
        this.mIsSelected = false;

        // アルファ値を1に設定
        this.CanGroup.alpha = 1;
        if (this.CanGroup.alpha == 1)
        {
            //Debug.Log("alpha=1!");
        }

        // 座標情報を取得しておく
        this.mRt = this.GetComponent <RectTransform> ();
    }
Beispiel #4
0
 public CardData(ECard _ID)
 {
     ID = _ID;
     if (ID == ECard.None)
     {
         Suit = ESuit.None;
     }
     else
     {
         Suit = CardManager.m_kCardSuits[ID - 1];
     }
 }
Beispiel #5
0
        public void Deserialize(System.IO.Stream inputStream)
        {
            byte[] _intSuit = new byte[sizeof(int)];
            inputStream.Read(_intSuit, 0, sizeof(int));
            intSuit = BitConverter.ToInt32(_intSuit, 0);

            suit = (ESuit)intSuit;

            byte[] _number = new byte[sizeof(int)];
            inputStream.Read(_number, 0, sizeof(int));
            number = BitConverter.ToInt32(_number, 0);

            byte[] _playerID = new byte[sizeof(int)];
            inputStream.Read(_playerID, 0, sizeof(int));
            playerID = BitConverter.ToInt32(_playerID, 0);
        }
Beispiel #6
0
        /// <summary>
        /// Может ли вторая карта стать парой для первой
        /// </summary>
        /// <param name="enMainSuit">козырная масть</param>
        /// <param name="pCard2">отбивающая карта</param>
        /// <returns></returns>
        public bool Response(ESuit enMainSuit,
                             Card pCard2)
        {
            if (pCard2.Suit == Card1.Suit)
            {
                if (pCard2.Value > Card1.Value)
                {
                    Card2 = pCard2;
                    return(true);
                }
            }
            else
            {
                if (pCard2.Suit == enMainSuit)
                {
                    Card2 = pCard2;
                    return(true);
                }
            }

            return(false);
        }
Beispiel #7
0
 public Card(ESuit newSuit, ECardValue newCardValue)
 {
     m_eSuit      = newSuit;
     m_eCardValue = newCardValue;
 }
Beispiel #8
0
 public Card(ESuit mSuit, EValue mValue)
 {
     Suit = mSuit;
     Value = mValue;
     Initialize();
 }
Beispiel #9
0
 public RawCard(ESuit suit, int number, int playerID)
 {
     this.suit     = suit;
     this.number   = number;
     this.playerID = playerID;
 }
Beispiel #10
0
 public RawCard(ESuit suit, int number)
 {
     this.suit   = suit;
     this.number = number;
 }
Beispiel #11
0
 public PlayingCard(int value, ESuit suit)
     : base(suit.ToString() + value, 1, 51, null, null)
 {
 }
Beispiel #12
0
 public static Color getSuitColourDark(ESuit suit)
 {
     return(suitArrayDark[(int)suit]);
 }
Beispiel #13
0
 public Card(ESuit enSuit, EValue enValue)
 {
     Suit  = enSuit;
     Value = enValue;
 }
Beispiel #14
0
 public Rectangle getTexRect(ESuit suit, int number)
 {
     return(rectangleMapArray [(int)suit] [number]);
 }
Beispiel #15
0
 public CardInfo(int _id, ESuit _suit)
 {
     this.Id   = _id;
     this.Suit = _suit;
 }
Beispiel #16
0
 public CardData(int _id, ESuit _suit, Sprite _sprite)
 {
     this.Id        = _id;
     this.Suit      = _suit;
     this.ImgSprite = _sprite;
 }