当前位置: 首页>>代码示例>>C#>>正文


C# CardColor类代码示例

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


CardColor类属于命名空间,在下文中一共展示了CardColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Card

        public Card(CardColor color, Shape shape, Fill fill, int count)
        {
            #region validation
            if (color == CardColor.Other)
            {
                throw new InvalidCardException("color", color);
            }
            if (shape == Shape.Other)
            {
                throw new InvalidCardException("shape", shape);
            }
            if (fill == Fill.Other)
            {
                throw new InvalidCardException("fill", fill);
            }
            if (count > 3 || count < 1)
            {
                throw new InvalidCardException("count", count);
            }
            #endregion validation

            this.Color = color;
            this.Shape = shape;
            this.Fill = fill;
            this.Count = count;
        }
开发者ID:LoyVanBeek,项目名称:SetVision,代码行数:26,代码来源:Card.cs

示例2: GameResultCard

        public GameResultCard(CardColor color, CardPosition position)
        {
            this.color = color;
            this.position = position;

            this.Init();
        }
开发者ID:Wotuu,项目名称:GDD_Game_2,代码行数:7,代码来源:GameResultCard.cs

示例3: Card

        //bool selected = false;
        public Card(ContentManager cm, float scale, Point pos, CardColor cardColor, int cardID)
        {
            //Load content
            backOfCard = cm.Load<Texture2D>("backofcard");
            frameSheet = cm.Load<Texture2D>("frameSheet");
            numberSheet = cm.Load<Texture2D>("numbers");

            this.scale = scale;
            hexWidth = (int)(backOfCard.Width);
            hexHeight = (int)(backOfCard.Height);
            radius = hexWidth / 2 * scale;

            //Assign Numbers
            this.cardColor = cardColor;
            Tuple<byte, byte, byte> cardNumbers = CardNumbers(cardID);
            TopNumber = cardNumbers.Item1;
            LeftNumber = cardNumbers.Item2;
            RightNumber = cardNumbers.Item3;

            //Position Card Elements
            drawRectangle = new Rectangle(0, 0, (int)(hexWidth * scale), (int)(hexHeight * scale));
            drawRectangle.Location = pos;
            frameRectangle = new Rectangle((int)cardColor * hexWidth, 0, hexWidth, hexHeight);

            //This just defines the size of the draw rectangle for the numbers
            topNumSource = new Rectangle(TopNumber * 18, 0, 18, 22);
            leftNumSource = new Rectangle(LeftNumber * 18, 0, 18, 22);
            rightNumSource = new Rectangle(RightNumber * 18, 0, 18, 22);
        }
开发者ID:jmarlow4,项目名称:HexCards_Josh,代码行数:30,代码来源:Card.cs

示例4: Card

        ///////////////////////////////////////////////////////////////////////////////////////
        // Constructors
        ///////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Construct a new card
        /// </summary>
        /// <param name="theColor"></param>
        /// <param name="theFace"></param>
        public Card(CardColor theColor, CardFace theFace)
        {
            // Check the card is value, otherwise throw a runtime error
            if (!IsValidCard(theColor, theFace))
                throw new Exception(CardColorToString(theColor) + " " + CardFaceToString(theFace) + " is not a valid Uno card");

            // Save parameters in private attributes
            color = theColor;
            face = theFace;
        }
开发者ID:DouglasHeriot,项目名称:Uno,代码行数:18,代码来源:Card.cs

示例5: GetColorRank

        protected static int GetColorRank(CardColor cardColor, ColorScore[] scores)
        {
            var i = 1;
              foreach (var colorScore in scores.OrderByDescending(x => x.Score))
              {
            if (cardColor == colorScore.Color)
              return i;
              }

              return scores.Length;
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:11,代码来源:DraftingStrategy.cs

示例6: CardViewModel

        public CardViewModel(Card card)
        {
            Card = card;
              Colors = new CardColor[] {};

              Update();

              _timer = new Timer(delegate { Update(); }, null,
            TimeSpan.FromMilliseconds(20),
            TimeSpan.FromMilliseconds(20));
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:11,代码来源:CardViewModel.cs

示例7: GenerateCards

        public List<Card> GenerateCards()
        {
            List<Card> cards = new List<Card>();
            CardColor[] validColors = new CardColor[] { CardColor.Green, CardColor.Purple, CardColor.Red };
            Fill[] validFills = new Fill[] { Fill.Dashed, Fill.Open, Fill.Solid };
            Shape[] validShapes = new Shape[] { Shape.Diamond, Shape.Oval, Shape.Squiggle };
            int[] validCounts = new int[] { 1, 2, 3 };

            foreach (CardColor color in validColors)
            {
                foreach (Fill fill in validFills)
                {
                    foreach (Shape shape in validShapes)
                    {
                        foreach(int i in validCounts)
                        {
                            cards.Add(new Card(color, shape, fill, i));
                        }
                    }
                }
            }

            return cards;
        }
开发者ID:LoyVanBeek,项目名称:SetVision,代码行数:24,代码来源:Logic.cs

示例8: AddCardView

		}// AddCard



		protected CardView AddCardView(int player, CardColor col, int value){
			CardView cv = null;

			// Try to find a free one.
			for (int i = 0; cv == null && i < _cardViewsPerPlayer [player].Count; i++) {
				if (!_cardViewsPerPlayer [player] [i].gameObject.activeSelf)
					cv = _cardViewsPerPlayer [player] [i];
			}// for

			if (cv != null) {
				cv.SetCardColor (col);
				cv.SetCardNumber (value);
				cv.gameObject.SetActive (true);
			} else {
				cv = SpawnCard (
					col,
					value
				);

				int count = _cardViewsPerPlayer [player].Count;
				int row = Mathf.FloorToInt (((float)count) / ((float)CardsMaxPerRow));
				cv.transform.position =
					//ParentPlayerHands[p].transform.position +
					new Vector3 ((count % CardsMaxPerRow) * CardPlayerHandOffset.x, CardPlayerHandOffset.y, row * CardPlayerHandOffset.z);
				cv.transform.rotation = Quaternion.Euler (CardPlayerHandRotation);// + ParentPlayerHands[p].transform.rotation.eulerAngles);
				cv.transform.SetParent (ParentPlayerHands [player].transform, false);

				cv.gameObject.name = "CardPlayer_" + player + "_" + count;

				_cardViewsPerPlayer [player].Add (cv);
			}// fi

			return cv;
		}// AddCardView
开发者ID:HardnHeavy,项目名称:Routines,代码行数:38,代码来源:GameCtrl.cs

示例9: SpawnCard

		}// AbortMatch


		#endregion match management




		#region view management

		protected CardView SpawnCard(CardColor color, int value){

			GameObject card = GameObject.Instantiate (PrefabCard);
			CardView view = card.GetComponent<CardView> ();
			view.SetCardColor (color);
			view.SetCardNumber (value);

			return view;
		}// SpawnCard
开发者ID:HardnHeavy,项目名称:Routines,代码行数:19,代码来源:GameCtrl.cs

示例10: GetCurrentMaxCardInColor

        private Card GetCurrentMaxCardInColor( CardColor color )
        {
            Card maxCard = null;
            CardComparer comparer = new CardComparer( _playingManager.CurrentAnnouncement.Type );

            foreach ( Card card in _playingManager.RemainingCards )
            {
                if ( card.CardColor == color )
                {
                    if ( maxCard == null )
                    {
                        maxCard = card;
                    }

                    if ( comparer.Compare( maxCard, card ) < 0 )
                    {
                        maxCard = card;
                    }
                }
            }

            foreach ( Card card in _playingManager.CurrentHand )
            {
                if ( card.CardColor == color )
                {
                    if ( maxCard == null )
                    {
                        maxCard = card;
                    }

                    if ( comparer.Compare( maxCard, card ) < 0 )
                    {
                        maxCard = card;
                    }
                }
            }

            return maxCard;
        }
开发者ID:NikolayIT,项目名称:BelotGameEngine,代码行数:39,代码来源:AIPlayer.cs

示例11: DrawFourCard

 private DrawFourCard(CardColor cc)
     : base(cc, CardFace.DF)
 {
 }
开发者ID:Rafa652,项目名称:GameChannel,代码行数:4,代码来源:DrawFourCard.cs

示例12: HasColor

 public bool HasColor(CardColor color)
 {
     return Effect().HasColor(color);
 }
开发者ID:BlacksheepNZ,项目名称:BattleOn,代码行数:4,代码来源:ScenarioEffect.cs

示例13: NumberCard

 private NumberCard(CardColor cc, CardFace cf)
     : base(cc, cf)
 {
 }
开发者ID:Rafa652,项目名称:GameChannel,代码行数:4,代码来源:NumberCard.cs

示例14: switch

 protected override object this[string index]
 {
     get
     {
         #region
         switch (index)
         {
             case "Id": return _id;
             case "Name": return _name;
             case "Color": return _color;
             case "Value": return _value;
             case "HeadIcon": return _headIcon;
             default: throw new ArgumentException(string.Format("PokerInfo index[{0}] isn't exist.", index));
         }
         #endregion
     }
     set
     {
         #region
         switch (index)
         {
             case "Id":
                 _id = value.ToInt();
                 break;
             case "Name":
                 _name = value.ToNotNullString();
                 break;
             case "Color":
                 _color = value.ToEnum<CardColor>();
                 break;
             case "Value":
                 _value = value.ToShort();
                 break;
             case "HeadIcon":
                 _headIcon = value.ToNotNullString();
                 break;
             default: throw new ArgumentException(string.Format("PokerInfo index[{0}] isn't exist.", index));
         }
         #endregion
     }
 }
开发者ID:87170360,项目名称:Maximus,代码行数:41,代码来源:PokerInfo.cs

示例15: DrawTwoCard

 private DrawTwoCard(CardColor cc)
     : base(cc, CardFace.DT)
 {
 }
开发者ID:Rafa652,项目名称:GameChannel,代码行数:4,代码来源:DrawTwoCard.cs


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