private void displayCardUpdate_Click(object sender, EventArgs e) { string curItem = listBox1.SelectedItem.ToString(); if (decklist.ContainsKey(curItem)) { decklist[curItem].cardQty = (int)DisplayCardQtyBox.Value; decklist.Add(decklist[curItem].cardQty.ToString() + "x " + decklist[curItem].cardName + " [" + decklist[curItem].set + "]", decklist[curItem]); decklist.Remove(curItem); updateListBox(); } }
// Generate a pdf using double sided processing... private void doubleSidedCardsToolStripMenuItem_Click(object sender, EventArgs e) { DeckList sendToGen = (DeckList)decklist.Clone(); if (sendToGen == decklist) { printToScriptLog("HEY..."); return; } List <Card> basics; foreach (Card c in sendToGen.Values.ToList()) { if (typeof(Basics).GetEnumNames().Contains <string>(c.cardName)) { sendToGen.Remove(c.cardQty.ToString() + "x " + c.cardName); basics = cdb.RandomBasics(c.cardName, Series.FULLART, c.cardQty); foreach (Card basic in basics) { if (sendToGen.ContainsKey(basic.cardName)) { sendToGen[basic.cardName].cardQty += basic.cardQty; } else { sendToGen.Add(basic.cardName, basic); } } } } sendToGen.doublesided = true; Generate(sendToGen); }
/// <summary> /// creates 13 cards for each suit and puts them into a list /// </summary> public PlayingCardDeck() { int cardsPerSuit = 13; int suitCount = 4; for (int suit = 0; suit < suitCount; suit++) { for (int value = 1; value <= cardsPerSuit; value++) { switch (value) { case (int)Symbol.Jack: DeckList.Add(new PlayingCard((Symbol)value, (Suit)suit, 10)); break; case (int)Symbol.Queen: DeckList.Add(new PlayingCard((Symbol)value, (Suit)suit, 10)); break; case (int)Symbol.King: DeckList.Add(new PlayingCard((Symbol)value, (Suit)suit, 10)); break; case (int)Symbol.Ace: DeckList.Add(new PlayingCard((Symbol)value, (Suit)suit, 11)); break; default: DeckList.Add(new PlayingCard((Symbol)value, (Suit)suit, value)); break; } } } }
private void ImportCardsFromString(string cards) { DeckList.Clear(); List <string> cardNumberList; if (Uri.TryCreate(cards, UriKind.Absolute, out Uri uri)) { cards = HttpUtility.ParseQueryString(uri.Query).Get("deck"); DeckName = HttpUtility.ParseQueryString(uri.Query).Get("deckname"); } cardNumberList = cards.Split(',').ToList(); foreach (string currentCardNumber in cardNumberList) { Card newCard = CardList.Where(x => x.Number == currentCardNumber).FirstOrDefault(); if (newCard != null) { DeckList.Add(newCard); } } }
private void AddAllCardsToDeckList() { foreach (Card card in CardList) { DeckList.Add(card); } }
public void AddCard(int id) { if (!CheckCard(id)) { return; } var cardModel = CardUtils.GetCardModel(id); var deckModel = new DeckModel { Id = id, TypeCode = cardModel.TypeCode, CampCode = cardModel.CampCode, Cost = cardModel.Cost, Name = cardModel.Name, ImagePath = CardUtils.GetThumbnailPath(id) }; DeckList.Add(deckModel); DeckOrder(); UpdateChartColumn(DeckStatistical()); GetTypeCountList(); }
public Deck(string DeckType) { if (DeckType == "Uno") { //Adding all colours of 0,Draw_Two_Cards,Reverse and Skip for (int i = 0; i < 4; i++) { DeckList.Add(new UnoCard(UnoCardType.Zero, (UnoCardSuit)Enum.ToObject(typeof(UnoCardSuit), i))); DeckList.Add(new UnoCard(UnoCardType.Draw_Two_Cards, (UnoCardSuit)Enum.ToObject(typeof(UnoCardSuit), i))); DeckList.Add(new UnoCard(UnoCardType.Draw_Two_Cards, (UnoCardSuit)Enum.ToObject(typeof(UnoCardSuit), i))); DeckList.Add(new UnoCard(UnoCardType.Reverse, (UnoCardSuit)Enum.ToObject(typeof(UnoCardSuit), i))); DeckList.Add(new UnoCard(UnoCardType.Reverse, (UnoCardSuit)Enum.ToObject(typeof(UnoCardSuit), i))); DeckList.Add(new UnoCard(UnoCardType.Skip, (UnoCardSuit)Enum.ToObject(typeof(UnoCardSuit), i))); DeckList.Add(new UnoCard(UnoCardType.Skip, (UnoCardSuit)Enum.ToObject(typeof(UnoCardSuit), i))); DeckList.Add(new UnoCard(UnoCardType.Wild)); DeckList.Add(new UnoCard(UnoCardType.Wild_Draw_Four_Cards)); } //Adding all colours of cards from 1 to 9 for (int i = 1; i <= 9; i++) { for (int y = 0; y < 4; y++) { DeckList.Add(new UnoCard((UnoCardType)Enum.ToObject(typeof(UnoCardType), i), (UnoCardSuit)Enum.ToObject(typeof(UnoCardSuit), y))); DeckList.Add(new UnoCard((UnoCardType)Enum.ToObject(typeof(UnoCardType), i), (UnoCardSuit)Enum.ToObject(typeof(UnoCardSuit), y))); } } } else { for (int i = 2; i < 15; i++) { for (int y = 1; y < 5; y++) { DeckList.Add(new Card((NormalCardsType)Enum.ToObject(typeof(NormalCardsType), i), (NormalCardsSuit)Enum.ToObject(typeof(NormalCardsSuit), y))); } } } }
public void Handeath() { if (HandsList.Count != 0) { int card = Random.Range(0, HandsList.Count); HandsList[card].transform.parent = Deck.transform; if (TurnPlayer) { HideHand(card); } DeckList.Add(HandsList[card]); DeckShuffle(); HandsList.RemoveAt(card); if (TurnPlayer) { HandsAnimeStart(); } else { HandsUpdate(); } } }
private void diffDecks(object sender, EventArgs e) { openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory() + "\\decks"; openFileDialog1.Filter = "Deck files (*.txt or *.dec)|*.txt; *.dec|All files (*.*)|*.*"; openFileDialog1.RestoreDirectory = true; string currCard; string[] parameters; int qty; string deckfnA; string deckfnB; DeckList A = new DeckList(); DeckList B = new DeckList(); openFileDialog1.Title = "Choose original deck ..."; if (openFileDialog1.ShowDialog() == DialogResult.OK) { deckfnA = openFileDialog1.FileName; openFileDialog1.Title = "Choose new / modified deck ..."; if (openFileDialog1.ShowDialog() == DialogResult.OK) { deckfnB = openFileDialog1.FileName; if (deckfnA != deckfnB) { printToScriptLog("Diffing " + Path.GetFileName(deckfnA) + " vs. " + Path.GetFileName(deckfnB)); // Loads Deck A first StreamReader sr = new StreamReader(new FileStream(deckfnA, FileMode.Open)); while (!sr.EndOfStream) { currCard = sr.ReadLine(); printToScriptLog(" " + currCard); parameters = currCard.Split(); try { qty = Int32.Parse(parameters[0]); currCard = currCard.Replace(qty.ToString() + " ", ""); A.Add(qty + "x " + currCard, cdb.findCard(currCard, qty)); } catch (Exception) { continue; } } sr.BaseStream.Close(); // Loads Deck B First sr = new StreamReader(new FileStream(deckfnB, FileMode.Open)); while (!sr.EndOfStream) { currCard = sr.ReadLine(); printToScriptLog(" " + currCard); parameters = currCard.Split(); try { qty = Int32.Parse(parameters[0]); currCard = currCard.Replace(qty.ToString() + " ", ""); B.Add(qty + "x " + currCard, cdb.findCard(currCard, qty)); } catch (Exception) { continue; } } sr.BaseStream.Close(); // Diff then update A.Diff(B); decklist.Merge(A); updateListBox(); } else { printToScriptLog("Unable to diff. Same file."); } } } }
private void AddCardToDeckList(Card SelectedCard) { DeckList.Add(SelectedCard); }