本文整理汇总了C#中Deck类的典型用法代码示例。如果您正苦于以下问题:C# Deck类的具体用法?C# Deck怎么用?C# Deck使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Deck类属于命名空间,在下文中一共展示了Deck类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpectGetTrumpCardMethodToReturnACard
public void ExpectGetTrumpCardMethodToReturnACard()
{
var deck = new Deck();
var card = deck.GetTrumpCard;
Assert.IsInstanceOf(typeof(Card), card);
}
示例2: ExportDeck
private async void ExportDeck(Deck deck)
{
var export = true;
if(Config.Instance.ShowExportingDialog)
{
var message =
string.Format(
"1) create a new, empty {0}-Deck {1}.\n\n2) leave the deck creation screen open.\n\n3)do not move your mouse or type after clicking \"export\"",
deck.Class, (Config.Instance.AutoClearDeck ? "(or open an existing one to be cleared automatically)" : ""));
if(deck.GetSelectedDeckVersion().Cards.Any(c => c.Name == "Stalagg" || c.Name == "Feugen"))
{
message +=
"\n\nIMPORTANT: If you own golden versions of Feugen or Stalagg please make sure to configure\nOptions > Other > Exporting";
}
var settings = new MetroDialogSettings {AffirmativeButtonText = "export"};
var result =
await
this.ShowMessageAsync("Export " + deck.Name + " to Hearthstone", message, MessageDialogStyle.AffirmativeAndNegative, settings);
export = result == MessageDialogResult.Affirmative;
}
if(export)
{
var controller = await this.ShowProgressAsync("Creating Deck", "Please do not move your mouse or type.");
Topmost = false;
await Task.Delay(500);
await DeckExporter.Export(deck);
await controller.CloseAsync();
if(deck.MissingCards.Any())
this.ShowMissingCardsMessage(deck);
}
}
示例3: TestIfTrumpCardReturnsACard
public void TestIfTrumpCardReturnsACard()
{
var deck = new Deck();
var card = deck.GetTrumpCard;
Assert.IsInstanceOf(typeof(Card), card, "The method does not return an instace of Card class");
}
示例4: WrapTest
public WrapTest()
{
ClearColor = Color.White;
foreach (CardLoader.CardDeck deck in CardLoader.Decks)
deck.Include = true;
CardLoader.LoadCards();
blackDeck = new Deck(CardType.Black);
card = null;
Input.Key.Add(Keyboard.Key.Return, args =>
{
if (!args.Pressed)
return true;
if (card != null)
Entities.Remove(card);
card = blackDeck.Cards.Count == 0 ? null : new Card(blackDeck.Cards.Pop());
if (card != null)
{
card.Position = new Vector2f(GameOptions.Width / 2.0f - 256.0f, GameOptions.Height / 2.0f - 256.0f);
Entities.Add(card);
}
return true;
});
}
示例5: Handle
public void Handle(GameStartedEvent startedEvent, GameState gameState)
{
var deck = new Deck().ToList();
gameState.Id = startedEvent.GameId;
gameState.GameRules = startedEvent.Rules;
gameState.StartedAt = startedEvent.Occurred;
gameState.LastUpdated = startedEvent.Occurred;
gameState.OpeningRound = new OpeningRound
{
Deck = deck,
Complete = false,
CutCards = new List<PlayerIdCard>(),
WinningPlayerCut = null
};
gameState.IndividualScores = new List<PlayerScore>(startedEvent.Players.Select(player => new PlayerScore { Player = player, Score = 0 }));
gameState.PlayerIds = startedEvent.Players.ToList();
gameState.TeamScores = startedEvent.Players.Count == 2
? startedEvent.Players.Select(p => new TeamScore {Players = new List<int> {p}}).ToList()
: new List<TeamScore>
{
new TeamScore {Players = new List<int> {startedEvent.Players[0], startedEvent.Players[2]}},
new TeamScore {Players = new List<int> {startedEvent.Players[1], startedEvent.Players[3]}}
};
gameState.Rounds = new List<RoundState>();
}
示例6: DeckImage
public DeckImage(Deck deck)
{
DeckId = deck.Id;
Deck = deck;
Created = DateTime.Now;
Modified = DateTime.Now;
}
示例7: Main
static void Main(string[] args)
{
Deck deck1 = new Deck();
Deck deck2 = new Deck();
int step = 0;
bool flag = false;
while (!flag)
{
deck2.Shuffle();
for (int j = 0; j < 52; j++)
{
if (deck1[j].ShortName == deck2[j].ShortName) flag = true;
}
step++;
}
for (int j = 0; j < 52; j++)
{
Console.WriteLine(String.Format("{0} \t{2}\t {1}", deck1[j].ShortName, deck2[j].ShortName, (deck1[j].ShortName == deck2[j].ShortName)?"-----":" "));
}
Console.WriteLine(step);
Console.ReadLine();
}
示例8: Awake
void Awake()
{
Deck deck1 = new Deck();
deck1.Shuffle();
Card card1 = deck1.TakeCard();
Card[] hand1 = new Card[5];
hand1Size = hand1.Length; // atribui o numero de cartas na mao
for (i = 0; i < hand1.Length; i++)
{
hand1[i] = deck1.TakeCard();
}
//hand1[] = deck1.TakeCards(3);
//IEnumerable < Card > = deck1.TakeCards();
//Card mao1[] = deck1.TakeCards();
//Debug.Log( card1.Suit.ToString() + card1.CardNumber.ToString() );
for (i = 0; i < hand1.Length; i++)
{
Debug.Log(hand1[i].Suit.ToString() + hand1[i].CardNumber.ToString());
}
Debug.Log("tamanho da mao: " + hand1Size);
}
示例9: Main
private static void Main()
{
if (!StartGame()) return;
string playerName = GetPlayerName();
Deckpile shoe = new Deckpile();
for (int i = 0; i < 4; i++)
{
Deck deck = new Deck();
deck.AddToStack(shoe);
shoe.Shuffle();
}
BlackjackDealer dealer = new ConsoleDealer("DEALER", shoe, Console.Instance);
PlayerBase player = new ConsolePlayer(playerName, Console.Instance, new Bank(1000));
dealer.Hand.HandChanged += (sender, changedArgs) => Console.Instance.Print(changedArgs.Player.ToString());
player.Hand.HandChanged += (sender, changedArgs) => Console.Instance.Print(changedArgs.Player.ToString());
dealer.AddPlayer(player);
do
{
dealer.NewGame();
} while (PlayAgain());
}
示例10: Deck_TrumpCardChange_ShouldChangeTrump
public void Deck_TrumpCardChange_ShouldChangeTrump()
{
var deck = new Deck();
var card = new Card(CardSuit.Club, CardType.Ace);
deck.ChangeTrumpCard(card);
Assert.AreEqual(card, deck.TrumpCard);
}
示例11: Play
public void Play(Deck gameDeck)
{
if (!this.HasBlackJack() && !this.IsBusted() && Hand.GetTotal() < 17)
{
gameDeck.Draw(this);
}
}
示例12: ListViewDecks_OnSelectionChanged
private void ListViewDecks_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
var item = ListViewDecks.SelectedItem as DeckPickerItem;
if(item != null)
SelectedDeck = item.Deck;
Close();
}
示例13: BtnIdString_Click
private async void BtnIdString_Click(object sender, RoutedEventArgs e)
{
var settings = new MetroDialogSettings();
var clipboard = Clipboard.GetText();
if(clipboard.Count(c => c == ':') > 0 && clipboard.Count(c => c == ';') > 0)
settings.DefaultText = clipboard;
//import dialog
var idString = await this.ShowInputAsync("Import deck", "id:count;id2:count2;... (e.g. EX1_050:2;EX1_556:1;)\nObtained from: \nEXPORT > COPY IDS TO CLIPBOARD", settings);
if(string.IsNullOrEmpty(idString))
return;
var deck = new Deck();
foreach(var entry in idString.Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries))
{
var splitEntry = entry.Split(':');
if(splitEntry.Length != 2)
continue;
var card = Game.GetCardFromId(splitEntry[0]);
if(card.Id == "UNKNOWN")
continue;
int count;
int.TryParse(splitEntry[1], out count);
card.Count = count;
if(string.IsNullOrEmpty(deck.Class) && card.GetPlayerClass != "Neutral")
deck.Class = card.GetPlayerClass;
deck.Cards.Add(card);
}
SetNewDeck(deck);
}
示例14: NewGame
public bool NewGame(Deck a_deck, Dealer a_dealer, Player a_player)
{
a_dealer.NewCard(a_player, true);
a_dealer.NewCard(a_dealer, true);
a_dealer.NewCard(a_player, true);
a_dealer.NewCard(a_dealer, false);
//Card c;
//c = a_deck.GetCard();
//c.Show(true);
//a_player.DealCard(c);
//c = a_deck.GetCard();
//c.Show(true);
//a_dealer.DealCard(c);
//c = a_deck.GetCard();
//c.Show(true);
//a_player.DealCard(c);
return true;
}
示例15: getShowAndDealCard
public void getShowAndDealCard(Deck a_deck, bool shouldShow, Player player)
{
Card c;
c = a_deck.GetCard();
c.Show(shouldShow);
player.DealCard(c);
}