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

C# CardColor类代码示例

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

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



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


示例16: OnObjAiBaseProcessSpellCast

            private static void OnObjAiBaseProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
            {
                try
                {
                    if (!sender.IsMe)
                    {
                        return;
                    }

                    if (args.SData.Name == "PickACard")
                    {
                        Status = SelectStatus.Selecting;
                    }
                    if (args.SData.Name == "goldcardlock")
                    {
                        LastCard = CardColor.Gold;
                        Status = SelectStatus.Selected;
                    }
                    else if (args.SData.Name == "bluecardlock")
                    {
                        LastCard = CardColor.Blue;
                        Status = SelectStatus.Selected;
                    }
                    else if (args.SData.Name == "redcardlock")
                    {
                        LastCard = CardColor.Red;
                        Status = SelectStatus.Selected;
                    }
                }
                catch (Exception ex)
                {
                    Global.Logger.AddItem(new LogItem(ex));
                }
            }
开发者ID:4859aa,项目名称:LeagueSharp-Dev,代码行数:34,代码来源:TwistedFate.cs


示例17: GetBestCardOfSingleColorOrColorless

 protected Card GetBestCardOfSingleColorOrColorless(IEnumerable<Card> cards, CardColor? primaryColor = null)
 {
     return cards
     .Where(x => x.Colors.Length == 1 || (primaryColor.HasValue && IsUsableNonbasicLand(x, primaryColor.Value)))
     .OrderByDescending(GetRating)
     .FirstOrDefault();
 }
开发者ID:leloulight,项目名称:magicgrove,代码行数:7,代码来源:DraftingStrategy.cs


示例18: Has

 public static bool Has(CardColor color)
 {
     return color == CardColor.Gold && ObjectManager.Player.HasBuff("goldcardpreattack") ||
            color == CardColor.Red && ObjectManager.Player.HasBuff("redcardpreattack") ||
            color == CardColor.Blue && ObjectManager.Player.HasBuff("bluecardpreattack");
 }
开发者ID:4859aa,项目名称:LeagueSharp-Dev,代码行数:6,代码来源:TwistedFate.cs


示例19: Card

		}// property



		public Card(CardColor color, int value, int position) {
			_color = color;
			_value = value;
			_position = position;
		}// Card
开发者ID:HardnHeavy,项目名称:Routines,代码行数:9,代码来源:Card.cs


示例20: IsUsableNonbasicLand

        private bool IsUsableNonbasicLand(Card card, CardColor color1, CardColor? color2 = null)
        {
            if (!card.Is().Land)
            return false;

              var landColors = card.ProducableManaColors;

              if (landColors.Count == 0)
            return true;

              if (landColors.Count == 1)
              {
            if (landColors[0] == (int) CardColor.Colorless)
              return true;

            if (landColors[0] == (int) color1)
              return true;

            if (color2.HasValue && landColors[0] == (int) color2.Value)
              return true;

            return false;
              }

              if (!color2.HasValue)
            return false;

              return landColors.Contains((int) color1) &&
            landColors.Contains((int) color2.Value);
        }
开发者ID:leloulight,项目名称:magicgrove,代码行数:30,代码来源:DraftingStrategy.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# CardEffect类代码示例发布时间:2022-05-24
下一篇:
C# CardCollection类代码示例发布时间: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