public GameGeneratorPage() { InitializeComponent(); var deck = new Deck(0, false); var cardList = deck.GetCards(52, Owner.Uninitialized); // // this puts the cards into the list in the right order for the columns. for (var i = 0; i < 13; i++) { for (var j = 0; j < 4; j++) { var cardCtrl = new CardCtrl(cardList[i + j * 13], true) { Tag = DeckCards.Count, Location = Location.Deck, CanDrag = true }; cardCtrl.DragStarting += Card_DragStarting; cardCtrl.PointerPressed += CardCtrl_PointerPressed; DeckCards.Add(cardCtrl); _sortedCards.Add(cardCtrl); } } CurrentCount = 20; _lvDeck.Tag = new DropTargetTag(Location.Deck, DeckCards); _lvComputer.Tag = new DropTargetTag(Location.Computer, ComputerCards) { Owner = Owner.Computer }; _lvCountedCards.Tag = new DropTargetTag(Location.Counted, CountedCards); _lvCrib.Tag = new DropTargetTag(Location.Crib, CribCards); _lvPlayer.Tag = new DropTargetTag(Location.Player, PlayerCards) { Owner = Owner.Player }; _lvSharedCard.Tag = new DropTargetTag(Location.Shared, SharedCard) { Owner = Owner.Shared }; GameStates.AddRange(_validStates); _cmbDealer.ItemsSource = Enum.GetValues(typeof(PlayerType)).Cast <PlayerType>(); _cmbOwner.ItemsSource = Enum.GetValues(typeof(Owner)).Cast <Owner>(); _cmbLocation.ItemsSource = Enum.GetValues(typeof(Location)).Cast <Location>(); _droppedCards.Add(ComputerCards); _droppedCards.Add(PlayerCards); _droppedCards.Add(CountedCards); _droppedCards.Add(CribCards); _droppedCards.Add(SharedCard); }
public override void NewStartingHand() { //Вернуть карты из руки в колоду ReservCards.ForEach(x => { DeckCards.Add(x.Combat.CardData); x.DestroyUI(); }); ReservCards.Clear(); ShuffleCards(DeckCards); //Перетасовать AddCardsReserve(startPositionReservCard); ReservCards.StartingHandLocation(); }
public void AddToDeck(WorkspaceCard workspaceCard) { if (!DeckCards.Any(dc => dc.WorkspaceCardId == workspaceCard.Id)) { var nextId = Id <DeckCard> .GetNextId(DeckCards); var deckCard = new DeckCard(nextId, workspaceCard.Id, 1); DeckCards.Add(deckCard); } else { var deckCard = DeckCards.Find(dc => dc.WorkspaceCardId == workspaceCard.Id); //deckCard.Quantity++; } }