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

C# ICard类代码示例

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

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



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

示例1: Deal

        /// <summary>
        /// Deals the specified players.
        /// </summary>
        /// <param name="players">The players.</param>
        /// <param name="cardsOnBoard">The cards on board.</param>
        public void Deal(IList<IParticipant> players, ICard[] cardsOnBoard)
        {
            this.Shuffle();

            int toTakeFromDeckIndex = 0;

            // deal cards to players
            foreach (IParticipant player in players.Where(p => p.IsInGame))
            {
                this.DealCardsToPlayers(player, ref toTakeFromDeckIndex);
            }

            // place cards on board
            Point boardCardsPosition = GlobalVariables.BoardCardsPlace;
            int positionCardChangeX = boardCardsPosition.X;
            for (int i = 0; i < 5; i++)
            {
                this.DealCardsOnBoard(
                    cardsOnBoard, 
                    i, 
                    ref toTakeFromDeckIndex, 
                    boardCardsPosition, 
                    ref positionCardChangeX);
            }

            // turn the player cards up
            foreach (var player in players.Where(p => p.IsInGame && p is Player))
            {
                player.Hand.CurrentCards[0].IsFacingUp = true;
                player.Hand.CurrentCards[1].IsFacingUp = true;
            }               
        }
开发者ID:KrasiNedew,项目名称:HighQualityCodeTeamWork,代码行数:37,代码来源:Deck.cs


示例2: SaveChangesToCard

        private void SaveChangesToCard(IUserSet currentUserSet, ICard currentCard)
        {       
            Card existingCard = FindCard(currentUserSet, currentCard);
            Card modifiedCard = (Card)currentCard;

            Type typeOfExistingCard = existingCard.GetType();
            Type typeOfModifiedCard = modifiedCard.GetType();

            List<PropertyInfo> propertiesExistingCard = new List<PropertyInfo>(typeOfExistingCard.GetRuntimeProperties());
            List<PropertyInfo> propertiesModifiedCard = new List<PropertyInfo>(typeOfModifiedCard.GetRuntimeProperties());

            // check if the properties are changed in the meantime. Should not be.
            for (int i = 0; i < propertiesExistingCard.Count; i++)
            {
                if(propertiesExistingCard[i].Name == propertiesModifiedCard[i].Name)
                {
                    propertiesExistingCard[i].SetValue(existingCard, propertiesModifiedCard[i].GetValue(modifiedCard));
                }
                else
                {
                    throw new ArrayTypeMismatchException("Cannot save the modified Card information",
                                                            new Exception(
                                                                "The type of the card is changed, because the properties ofthe existing and modified cards are not the same "));
                }
            }
        }
开发者ID:kryban,项目名称:FlashLearnW,代码行数:26,代码来源:CardExplorerNew.cs


示例3: Verify

 protected override VerifierResult Verify(Player source, ICard card, List<Player> targets)
 {
     if (targets == null || targets.Count == 0)
     {
         return VerifierResult.Partial;
     }
     if (targets.Count > 1)
     {
         return VerifierResult.Fail;
     }
     Player player = targets[0];
     if (player == source)
     {
         return VerifierResult.Fail;
     }
     if (!ShunChaiAdditionalCheck(source, player, card))
     {
         return VerifierResult.Fail;
     }
     if (Game.CurrentGame.Decks[player, DeckType.Hand].Count == 0 &&
         Game.CurrentGame.Decks[player, DeckType.DelayedTools].Count == 0 &&
         Game.CurrentGame.Decks[player, DeckType.Equipment].Count == 0)
     {
         return VerifierResult.Fail;
     }
     return VerifierResult.Success;
 }
开发者ID:maplegh,项目名称:sgs,代码行数:27,代码来源:ShunChai.cs


示例4: Main

    /// <summary>
    /// The entry point of the program.
    /// </summary>
    private static void Main()
    {
        try
        {
            IHandEvaluator handEvaluator = new HandEvaluator();

            ICard[] cards = new ICard[]
                {
                    new Card(CardRank.Queen, CardSuit.Hearts),
                    new Card(CardRank.Queen, CardSuit.Spades),
                    new Card(CardRank.Ten, CardSuit.Hearts),
                    new Card(CardRank.Queen, CardSuit.Diamonds),
                    new Card(CardRank.Queen, CardSuit.Clubs)
                };

            IHand hand = new Hand(cards);

            Console.WriteLine(handEvaluator.GetCategory(hand) == HandCategory.FourOfAKind);

            IHand handFromString = new Hand("7♠ 5♣ 4♦ 3♦ 2♣");
            Console.WriteLine(handFromString);
        }
        catch (ArgumentException aex)
        {
            Console.WriteLine(aex.Message);
        }
    }
开发者ID:Ivan-Dimitrov-bg,项目名称:.Net-framework,代码行数:30,代码来源:PokerDemo.cs


示例5: Process

        protected override void Process(Player source, Player dest, ICard card, ReadOnlyCard readonlyCard, GameEventArgs inResponseTo)
        {
            IUiProxy ui = Game.CurrentGame.UiProxies[source];
            if (source.IsDead) return;
            List<DeckPlace> places = new List<DeckPlace>();
            places.Add(new DeckPlace(dest, DeckType.Hand));
            places.Add(new DeckPlace(dest, DeckType.Equipment));
            places.Add(new DeckPlace(dest, DeckType.DelayedTools));
            List<string> resultDeckPlace = new List<string>();
            resultDeckPlace.Add(ResultDeckName);
            List<int> resultDeckMax = new List<int>();
            resultDeckMax.Add(1);
            List<List<Card>> answer;
            if (!ui.AskForCardChoice(new CardChoicePrompt(ChoicePrompt), places, resultDeckPlace, resultDeckMax, new RequireOneCardChoiceVerifier(true), out answer))
            {
                Trace.TraceInformation("Player {0} Invalid answer", source.Id);
                answer = new List<List<Card>>();
                answer.Add(Game.CurrentGame.PickDefaultCardsFrom(places));
            }
            Card theCard = answer[0][0];

            if (ShunChaiDest(source, dest).DeckType == DeckType.Discard)
            {
                Game.CurrentGame.HandleCardDiscard(dest, new List<Card>() { theCard });
            }
            else
            {
                Game.CurrentGame.HandleCardTransferToHand(dest, source, new List<Card>() { theCard });
            }
        }
开发者ID:h1398123,项目名称:sgs,代码行数:30,代码来源:ShunChai.cs


示例6: Process

 public override void Process(Player source, List<Player> dests, ICard card, ReadOnlyCard cardr)
 {
     Trace.Assert(dests == null || dests.Count == 0);
     Trace.Assert(card is Card);
     Card c = (Card)card;
     Install(source, c);
 }
开发者ID:maplegh,项目名称:sgs,代码行数:7,代码来源:Equipment.cs


示例7: Verify

 protected override VerifierResult Verify(Player source, ICard card, List<Player> targets)
 {
     if (Game.CurrentGame.IsDying.Count == 0 && targets != null && targets.Count >= 1)
     {
         return VerifierResult.Fail;
     }
     if (Game.CurrentGame.IsDying.Count > 0 && (targets == null || targets.Count != 1))
     {
         return VerifierResult.Fail;
     }
     if (Game.CurrentGame.IsDying.Count == 0)
     {
         if (source[JiuUsed] == 1)
         {
             return VerifierResult.Fail;
         }
     }
     else
     {
         if (targets[0] != source)
         {
             return VerifierResult.Fail;
         }
     }
     return VerifierResult.Success;
 }
开发者ID:maplegh,项目名称:sgs,代码行数:26,代码来源:Jiu.cs


示例8: Attack

            public override void Attack(Player victim, TurnContext context, ICard source)
            {
                var victoryTypes = victim.Hand.OfType<IVictoryCard>()
                    .WithDistinctTypes()
                    .ToList();

                if(victoryTypes.Count() > 1)
                {
                    var activity = Activities.PutCardOfTypeFromHandOnTopOfDeck(context.Game.Log, victim,
                                                                               "Select a victory card to put on top",
                                                                               typeof (IVictoryCard),
                                                                               source);
                   _activities.Add(activity);
                }
                else if(victoryTypes.Any())
                {
                    var card = victoryTypes.Single();
                    victim.Deck.MoveToTop(card);
                    context.Game.Log.LogMessage("{0} put a {1} on top of the deck.", victim.Name, card.Name);
                }
                else
                {
                    context.Game.Log.LogRevealHand(victim);
                }
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:25,代码来源:Bureaucrat.cs


示例9: Process

 public override void Process(Player source, List<Player> dests, ICard card, ReadOnlyCard readonlyCard)
 {
     DeckType wuguDeck = new DeckType("WuGu");
     DeckType wuguFakeDeck = new DeckType("WuGuFake");
     CardsMovement move = new CardsMovement();
     move.Cards = new List<Card>();
     for (int i = 0; i < dests.Count; i++)
     {
         Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
         Card c = Game.CurrentGame.DrawCard();
         move.Cards.Add(c);
     }
     move.To = new DeckPlace(null, wuguDeck);
     Game.CurrentGame.MoveCards(move);
     fakeMapping = new Dictionary<Card, Card>();
     Game.CurrentGame.Decks[null, wuguFakeDeck].Clear();
     foreach (var c in Game.CurrentGame.Decks[null, wuguDeck])
     {
         var faked = new Card(c);
         faked.Place = new DeckPlace(null, wuguFakeDeck);
         Game.CurrentGame.Decks[null, wuguFakeDeck].Add(faked);
         fakeMapping.Add(faked, c);
     }
     Game.CurrentGame.NotificationProxy.NotifyWuGuStart(new DeckPlace(null, wuguFakeDeck));
     base.Process(source, dests, card, readonlyCard);
     Game.CurrentGame.NotificationProxy.NotifyWuGuEnd();
     Game.CurrentGame.Decks[null, wuguFakeDeck].Clear();
     if (Game.CurrentGame.Decks[null, wuguDeck].Count > 0)
     {
         move = new CardsMovement();
         move.Cards = new List<Card>(Game.CurrentGame.Decks[null, wuguDeck]);
         move.To = new DeckPlace(null, DeckType.Discard);
         Game.CurrentGame.MoveCards(move);
     }
 }
开发者ID:pxoylngx,项目名称:sgs,代码行数:35,代码来源:WuGuFengDeng.cs


示例10: GetJudgeCardTrigger

 public GetJudgeCardTrigger(Player p, ISkill skill, ICard card, bool permenant = false)
 {
     Owner = p;
     jSkill = skill;
     jCard = card;
     doNotUnregister = permenant;
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:7,代码来源:GetJudgeCardTrigger.cs


示例11: TagAndNotify

        public override void TagAndNotify(Player source, List<Player> dests, ICard card, GameAction action = GameAction.Use)
        {
            if (this.IsReforging(source, null, null, dests))
            {
                if (card is CompositeCard)
                {
                    foreach (Card c in (card as CompositeCard).Subcards)
                    {
                        c.Log.Source = source;
                        c.Log.GameAction = GameAction.Reforge;
                    }

                }
                else
                {
                    var c = card as Card;
                    Trace.Assert(card != null);
                    c.Log.Source = source;
                    c.Log.GameAction = GameAction.Reforge;
                }
                Game.CurrentGame.NotificationProxy.NotifyReforge(source, card);
                return;
            }
            base.TagAndNotify(source, dests, card, action);
        }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:25,代码来源:TieSuoLianHuan.cs


示例12: CmdDestroyCard

 public void CmdDestroyCard(ICard card)
 {
     if(card.cardtype == ECardType.MONSTER_CARD)
     {
         for(int i = 0; i < monsterCards.Length; i++)
         {
             if(card == monsterCards[i])
             {
                 DestroyMonsterCard(i);
                 return;
             }
         }
     }
     else if(card.cardtype != ECardType.UNKNOWN)
     {
         for(int i = 0; i < effectCards.Length; i++)
         {
             if(card == effectCards[i])
             {
                 DestroyEffectCard(i);
                 return;
             }
         }
     }
 }
开发者ID:JMetcalfe201,项目名称:VRCardGame,代码行数:25,代码来源:PlayingField.cs


示例13: Attack

            public override void Attack(Player victim, TurnContext context, ICard source)
            {
                var swindledCard = victim.Deck.TopCard;
                if(swindledCard == null)
                {
                    context.Game.Log.LogMessage("{0} did not have any cards to be swindled.", victim.Name);
                    return;
                }
                
                context.Trash(victim, swindledCard);
                var candidates = context.Game.Bank.Piles.Where(p => p.IsEmpty == false && p.TopCard.Cost == swindledCard.Cost);                

                if(candidates.Count() == 0)
                {
                    context.Game.Log.LogMessage("There are no cards of cost {0}.", swindledCard.Cost);
                }
                else if (candidates.Count() == 1)
                {
                    var pile = candidates.Single();
                    var card = pile.TopCard;
                    card.MoveTo(victim.Discards);
                    context.Game.Log.LogGain(victim, card);
                }
                else
                {
                    var activity = Activities.SelectACardForOpponentToGain(context, context.ActivePlayer, victim, swindledCard.Cost, source);
                    _activities.Add(activity);    
                }
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:29,代码来源:Swindler.cs


示例14: Verify

        public override VerifierResult Verify(Player source, ICard card, List<Player> targets, bool isLooseVerify)
        {
            if (targets == null || targets.Count == 0)
            {
                return VerifierResult.Partial;
            }
            if (!isLooseVerify && targets.Count > 1)
            {
                return VerifierResult.Fail;
            }

            foreach (var player in targets)
            {
                if (player == source)
                {
                    return VerifierResult.Fail;
                }
                if (!ShunChaiAdditionalCheck(source, player, card))
                {
                    return VerifierResult.Fail;
                }
                if (Game.CurrentGame.Decks[player, DeckType.Hand].Count == 0 &&
                    Game.CurrentGame.Decks[player, DeckType.DelayedTools].Count == 0 &&
                    Game.CurrentGame.Decks[player, DeckType.Equipment].Count == 0)
                {
                    return VerifierResult.Fail;
                }
            }
            return VerifierResult.Success;
        }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:30,代码来源:ShunChai.cs


示例15: DamageDealt

 public DamageDealt(IGame game, ICard source, ICardInPlay target, byte damage)
     : base(game)
 {
     this.Source = source;
     this.Target = target;
     this.damage = damage;
 }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:DamageDealt.cs


示例16: AddCard

 public void AddCard(ICard card)
 {
     if (card == null)
         throw new ArgumentNullException("Card must not be null!");
     else
         _hand.AddCard(card);
 }
开发者ID:thebuchanan3,项目名称:Blackjack,代码行数:7,代码来源:Box.cs


示例17: Resolve

            public override void Resolve(TurnContext context, ICard source)
            {
                var estate = context.ActivePlayer.Hand.OfType<Estate>().FirstOrDefault();

                Action discardAction = () =>
                {
                    context.AvailableSpend += 4;
                    context.DiscardCard(context.ActivePlayer, estate);
                };

                Action gainAction = () => new GainUtility(context, context.ActivePlayer).Gain<Estate>();

                if (estate != null)
                {
                    var activity = Activities.ChooseYesOrNo
                        (context.Game.Log, context.ActivePlayer, "Discard an Estate?",
                         source,
                         discardAction, gainAction);

                    _activities.Add(activity);
                }
                else
                {
                    gainAction();
                }
            }
开发者ID:razzielx,项目名称:Dominion,代码行数:26,代码来源:Baron.cs


示例18: SaveCard

        public ICard SaveCard(IUserSession session, ICard newCard)
        {
            CardEffect effect = new CardEffect
            {
                Affected = (int)newCard.Effect.Affected,
                CardAttackChange = newCard.Effect.CardAttackChange,
                CardAttackMultiplier = newCard.Effect.CardAttackMultiplier,
                Description = newCard.Effect.Description,
                DisableOpponentEffect = newCard.Effect.DisableOpponentEffect,
                EffectTiming = (int)newCard.Effect.EffectTiming,
                LifePointsChange = newCard.Effect.LifePointsChange,
                Name = newCard.Effect.Name,
                ProbabilityOfEffect = newCard.Effect.ProbabilityOfEffect
            };

            Card created = new Card
            {
                Name = newCard.Name,
                ImageUrl = newCard.ImageUrl,
                Effect = effect,
                AttackPoints = newCard.AttackPoints,
                DefensePoints = newCard.DefensePoints
            };

            RequestContext.Model<Entities>().AddToCards(created);
            RequestContext.Model<Entities>().SaveChanges();

            return created;
        }
开发者ID:marcel-valdez,项目名称:dot_net_cop_example,代码行数:29,代码来源:CardContainer.cs


示例19: Verify

 protected override VerifierResult Verify(Player source, ICard card, List<Player> targets)
 {
     if (Game.CurrentGame.IsDying.Count == 0 && targets != null && targets.Count >= 1)
     {
         return VerifierResult.Fail;
     }
     if (Game.CurrentGame.IsDying.Count > 0 && (targets == null || targets.Count != 1))
     {
         return VerifierResult.Fail;
     }
     Player p;
     if (Game.CurrentGame.IsDying.Count == 0)
     {
         p = source;
     }
     else
     {
         p = targets[0];
     }
     if (p.Health >= p.MaxHealth)
     {
         return VerifierResult.Fail;
     }
     return VerifierResult.Success;
 }
开发者ID:h1398123,项目名称:sgs,代码行数:25,代码来源:Tao.cs


示例20: Resolve

            public override void Resolve(TurnContext context, ICard source)
            {
                var player = context.ActivePlayer;
                var log = context.Game.Log;

                if (player.Hand.OfType<IActionCard>().Any())
                {
                    var activity = new SelectCardsActivity(
                        log, player,
                        "Select an action to play twice",
                        SelectionSpecifications.SelectExactlyXCards(1), source);

                    activity.Hint = ActivityHint.PlayCards;
                    activity.Specification.CardTypeRestriction = typeof (IActionCard);
                    activity.AfterCardsSelected = cards =>
                    {
                        var actionCard = cards.OfType<IActionCard>().Single();
                        log.LogMessage("{0} selected {1} to be played twice.", player.Name, actionCard.Name);

                        actionCard.MoveTo(context.ActivePlayer.PlayArea);
                        context.AddEffect(source, new PlayCardEffect(actionCard));
                        context.AddEffect(source, new PlayCardEffect(actionCard));                        
                    };

                    _activities.Add(activity);
                }
                    
            }
开发者ID:anatolilightfoot,项目名称:Dominion,代码行数:28,代码来源:ThroneRoom.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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