public async Task <SavedWaste> GetSavedGameAsync() { SavedWaste output = new SavedWaste(); output.PileData = await js.SerializeObjectAsync(CardList.ToRegularDeckDict()); return(output); }
public SavedDiscardPile <D> GetSavedPile() { SavedDiscardPile <D> output = new SavedDiscardPile <D>(); output.CurrentCard = CurrentCard; output.PileList = _objectList.ToRegularDeckDict(); return(output); }
private int WhoWonTrick(DeckObservableDict <GalaxyCardGameCardInformation> thisCol) { var leadCard = thisCol.First(); var tempList = thisCol.ToRegularDeckDict(); tempList.RemoveSpecificItem(leadCard); if (!tempList.Any(items => items.Suit == leadCard.Suit && items.Value > leadCard.Value)) { return(leadCard.Player); } return(WhoTurn); }
async Task nm.IReshuffledCardsNM.ReshuffledCardsReceived(string data) { CustomBasicList <int> firstList = await js.DeserializeObjectAsync <CustomBasicList <int> >(data); if (_deckList.Count == 0) { _deckList.OrderedObjects(); //maybe this was needed. i think this is the best way to handle this situation. } DeckObservableDict <D> NewList = firstList.GetNewObjectListFromDeckList(_deckList); SaveRoot !.CardList = NewList.ToRegularDeckDict(); await AfterReshuffleAsync(); }
private void CardList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Replace) { if (e.OldItems.Count > 1) { throw new BasicBlankException("Not sure when there are more than one to replace"); } var oldCard = (RackoCardInformation)e.OldItems[0] !; var oldGrid = FindControl(oldCard); CardGraphicsWPF nextControl = (CardGraphicsWPF)oldGrid !.Children[1]; nextControl.DataContext = null; nextControl.DataContext = e.NewItems[0]; //nextControl.CommandParameter = e.NewItems[0]!; var row = (RowClickerWPF)oldGrid !.Children[2]; row.CommandParameter = e.NewItems[0] !; oldGrid.DataContext = e.NewItems[0]; // i think i forgot the 0 return; } if (e.Action == NotifyCollectionChangedAction.Reset) { if (_cardList !.Count == 0) { return; //because there could be more eventually. } var tempList = _cardList.ToRegularDeckDict(); tempList.Reverse(); if (_thisStack !.Children.Count != 10) { throw new BasicBlankException("Not Supported"); } int x = 0; foreach (var thisCon in _thisStack.Children) { var thisGrid = (Grid)thisCon !; thisGrid.DataContext = tempList[x]; CardGraphicsWPF nextControl = (CardGraphicsWPF)thisGrid.Children[1]; nextControl.DataContext = null; //nextControl.CommandParameter = tempList[x]; nextControl.DataContext = tempList[x]; var row = (RowClickerWPF)thisGrid !.Children[2]; row.CommandParameter = e.NewItems[0] !; x += 1; } } }
public DeckRegularDict <D> SavedList() { return(_objectList.ToRegularDeckDict()); }