本文整理汇总了C#中Choice.AddCards方法的典型用法代码示例。如果您正苦于以下问题:C# Choice.AddCards方法的具体用法?C# Choice.AddCards怎么用?C# Choice.AddCards使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Choice
的用法示例。
在下文中一共展示了Choice.AddCards方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Play
public override void Play(Player player)
{
base.Play(player);
SupplyCollection availableSupplies = new SupplyCollection(player._Game.Table.Supplies.Where(kvp => kvp.Value.Randomizer != null && kvp.Value.Randomizer.GroupMembership != Group.None));
CardCollection cards = new CardCollection();
Choice choice = new Choice("Name a card", this, availableSupplies, player, false);
foreach (Supply supply in player._Game.Table.Supplies.Values.Union(player._Game.Table.SpecialPiles.Values))
{
foreach (Type type in supply.CardTypes)
{
if (!choice.Supplies.Any(kvp => kvp.Value.CardType == type))
cards.Add(Card.CreateInstance(type));
}
}
cards.Sort();
choice.AddCards(cards);
ChoiceResult result = player.MakeChoice(choice);
ICard namedCard = null;
if (result.Supply != null)
namedCard = result.Supply;
else
namedCard = result.Cards[0];
player._Game.SendMessage(player, this, namedCard);
if (player.CanDraw)
{
player.Draw(DeckLocation.Revealed);
if (player.Revealed[namedCard.CardType].Count > 0)
{
player.AddCardsToHand(DeckLocation.Revealed);
}
else
{
player.AddCardsToDeck(player.RetrieveCardsFrom(DeckLocation.Revealed), DeckPosition.Top);
}
}
}
示例2: Play
public override void Play(Player player)
{
base.Play(player);
SupplyCollection availableSupplies = new SupplyCollection(player._Game.Table.Supplies.Where(kvp => kvp.Value.Randomizer != null && kvp.Value.Randomizer.GroupMembership != Group.None));
CardCollection cards = new CardCollection();
Choice choice = new Choice("Name a card", this, availableSupplies, player, false);
foreach (Supply supply in player._Game.Table.Supplies.Values.Union(player._Game.Table.SpecialPiles.Values))
{
foreach (Type type in supply.CardTypes)
{
if (!choice.Supplies.Any(kvp => kvp.Value.CardType == type))
cards.Add(Card.CreateInstance(type));
}
}
cards.Sort();
choice.AddCards(cards);
ChoiceResult result = player.MakeChoice(choice);
ICard namedCard = null;
if (result.Supply != null)
namedCard = result.Supply;
else
namedCard = result.Cards[0];
player._Game.SendMessage(player, this, namedCard);
CardCollection newCards = player.Draw(3, DeckLocation.Revealed);
player.Trash(player.RetrieveCardsFrom(DeckLocation.Revealed, c => c.Name == namedCard.Name));
Choice replaceChoice = new Choice("Choose order of cards to put back on your deck", this, player.Revealed, player, true, player.Revealed.Count, player.Revealed.Count);
ChoiceResult replaceResult = player.MakeChoice(replaceChoice);
player.RetrieveCardsFrom(DeckLocation.Revealed, replaceResult.Cards);
player.AddCardsToDeck(replaceResult.Cards, DeckPosition.Top);
}