private DeckOfCardsWPF <SolitaireCard> GetNewCard(SolitaireCard thisCard) { var output = new DeckOfCardsWPF <SolitaireCard>(); output.SendSize(ts.TagUsed, thisCard); return(output); }
public void AddCardToPile(int pile, SolitaireCard thisCard) { if (ShowCenter) { throw new BasicBlankException("Cannot add card to pile because the goal is to get rid of cards"); } var thisClock = ClockList ![pile];
public override bool CanAddCard(int pile, SolitaireCard thisCard) { if (GlobalClass.MainModel !.DeckPile !.IsEndOfDeck() && pile > 1) { return(base.CanAddCard(pile, thisCard)); } if (GlobalClass.MainModel !.DeckPile.IsEndOfDeck()) { return(CanBuildFromKing(pile, thisCard)); } if (GlobalClass.MainModel !.WastePiles1 !.OneSelected() == -1) { throw new BasicBlankException($"No card selected for placing to {pile}"); } if (GlobalClass.MainModel !.WastePiles1.OneSelected() <= 3) { if (pile > 1) { return(base.CanAddCard(pile, thisCard)); } return(CanBuildFromKing(pile, thisCard)); } int oldPile = GlobalClass.MainModel !.WastePiles1.OneSelected() - 4; if (oldPile != pile) { return(false); } if (pile > 1) { return(base.CanAddCard(pile, thisCard)); } return(CanBuildFromKing(pile, thisCard)); }
private void BindCard(DeckOfCardsXF <SolitaireCard> thisGraphics, SolitaireCard thisCard) { thisGraphics.NeedsExtraSuitForSolitaire = true; //i think thisGraphics.SendSize(ts.TagUsed, thisCard); thisGraphics.DisableInput = true; //try this too. was originally disableone. //thisGraphics.InputTransparent = true; //try both this time. }
public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard) { if (Piles.HasCardInColumn(whichOne) == false && GlobalClass.MainModel !.Heel1.IsEndOfDeck()) { return(true); } return(Piles.HasCardInColumn(whichOne) == false && GlobalClass.MainModel !.Heel1 !.CardsLeft() == 1); }
private bool CanClickCard(SolitaireCard card) { if (card.IsEnabled == false || card.Visible == false) { return(false); } return(_inPlay); }
public void AddCard(int pile, SolitaireCard thisCard) { if (thisCard.Suit == EnumSuitList.None) { throw new BasicBlankException("The suit cannot be none. Hint: May be a problem with cloning. Find out what happened"); } if (ShowNextNeeded) { var thisPile = Piles.PileList ![pile];
public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard) { if (Piles.HasCardInColumn(whichOne) == false) { return(thisCard.Value == EnumCardValueList.King); } var prevCard = Piles.GetLastCard(whichOne); return(prevCard.Value - 1 == thisCard.Value && prevCard.Color != thisCard.Color); }
public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard) { if (Piles.HasCardInColumn(whichOne) == false) { return(true); } var prevCard = Piles.GetLastCard(PreviousSelected); return(prevCard.Value - 1 == thisCard.Value && prevCard.Color == thisCard.Color); }
private void CalculateMargins(DeckOfCardsWPF <SolitaireCard> thisDeck, SolitaireCard thisCard) { float adds; if (thisCard.IsUnknown == false || MainMod !.IsKlondike == false) { adds = thisDeck.ObjectSize.Height / 4; //try this way adds = thisDeck.ObjectSize.Height - adds; adds *= -1; }
protected async Task FinishAddingToMainPileAsync(int pile, SolitaireCard thisCard) { if (thisCard.Deck > 0) { _thisMod !.MainPiles1 !.AddCard(pile, thisCard); } if (_thisMod !.MainDiscardPile !.PileEmpty() == false && _thisMod.MainDiscardPile.GetCardInfo().Equals(thisCard)) { _thisMod.MainDiscardPile.RemoveFromPile(); }
public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard) { if (Piles.HasCardInColumn(whichOne) == false) { return(true); } var oldCard = Piles.GetLastCard(whichOne); return(oldCard.Value - 1 == thisCard.Value && oldCard.Color != thisCard.Color); }
private DeckOfCardsXF <SolitaireCard> GetGraphics(SolitaireCard thisCard) { DeckOfCardsXF <SolitaireCard> output = new DeckOfCardsXF <SolitaireCard>(); output.SendSize(ts.TagUsed, thisCard); output.CommandParameter = thisCard; var binding = GetCommandBinding(nameof(TriangleObservable.CardCommand)); output.SetBinding(GraphicsCommand.CommandProperty, binding); return(output); //hopefully this is enough (?) }
async Task ITriangleVM.CardClickedAsync(SolitaireCard thisCard) { if (PlayList1 !.AlreadyHasTwoCards()) { await UIPlatform.ShowMessageAsync("Sorry, 2 has already been selected"); return; } PlayList1.AddCard(thisCard); GameBoard1 !.MakeInvisible(thisCard.Deck); }
async Task ITriangleVM.CardClickedAsync(SolitaireCard thisCard) { var pileCard = Pile1 !.GetCardInfo(); if (_mainGame !.IsValidMove(thisCard, pileCard, out EnumIncreaseList tempi) == false) { await UIPlatform.ShowMessageAsync("Sorry, wrong card"); return; } await _mainGame.MakeMoveAsync(thisCard.Deck, tempi, this); }
private DeckOfCardsWPF <SolitaireCard> FindControl(SolitaireCard thisCard) { foreach (var firstControl in _thisCanvas !.Children) { var thisGraphics = firstControl as DeckOfCardsWPF <SolitaireCard>; if (thisGraphics !.DataContext.Equals(thisCard)) { return(thisGraphics); } } throw new BasicBlankException("UI Not Found"); }
public void AddSingleCard(int whichOne, SolitaireCard thisCard) { thisCard.IsSelected = false; if (HasDiscard == false) { Piles.AddCardToColumn(whichOne, thisCard); } else { Discards !.AddCardToPile(whichOne, thisCard); } }
private DeckOfCardsWPF <SolitaireCard>?FindControl(SolitaireCard thisCard) { foreach (var firstControl in _thisStack !.Children) { var thisGraphics = firstControl as DeckOfCardsWPF <SolitaireCard>; if (thisGraphics !.DataContext.Equals(thisCard)) { return(thisGraphics); } } return(null); //you can have null this time. }
public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard) { if (Piles.HasCardInColumn(whichOne) == false) { if (GlobalClass.MainModel !.Heel1.IsEndOfDeck() == false) { throw new BasicBlankException("If its not at the end of the deck; a card needs to be placed"); } return(true); } var prevCard = Piles.GetLastCard(whichOne); return(prevCard.Value - 1 == thisCard.Value && prevCard.Suit != thisCard.Suit); }
public bool CanAddCard(int pile, SolitaireCard thiscard) { var oldCard = GetLastCard(pile); if (thiscard.Suit != oldCard.Suit) { return(false); } if (oldCard.Value + 1 == thiscard.Value) { return(true); } return(oldCard.Value == EnumCardValueList.King && thiscard.Value == EnumCardValueList.LowAce); }
public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard) { if (Piles.HasCardInColumn(whichOne) == false) { return(thisCard.Value == EnumCardValueList.King); } var oldCard = Piles.GetLastCard(whichOne); if (thisCard.Suit != oldCard.Suit) { return(false); } return(oldCard.Value - 1 == thisCard.Value); }
private bool CanBuildFromKing(int pile, SolitaireCard thisCard) { if (pile > 1) { throw new BasicBlankException($"Kings must be 0, or 1; not {pile}"); } var oldCard = Piles.GetLastCard(pile); if (oldCard.Suit != thisCard.Suit) { return(false); } return(oldCard.Value - 1 == thisCard.Value); }
public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard) { if (Discards !.HasCard(whichOne) == false) { return(true); } var oldCard = Discards.GetLastCard(whichOne); if (thisCard.Suit != oldCard.Suit) { return(false); } return(oldCard.Value - 1 == thisCard.Value); }
public void Init(TriangleObservable thisMod) { SolitaireCard card = new SolitaireCard(); GamePackageDIContainer tt = Resolve <GamePackageDIContainer>(); IProportionImage pp = tt.Resolve <IProportionImage>(ts.TagUsed); _size = card.DefaultSize.GetSizeUsed(pp.Proportion); _thisMod = thisMod; _cardList = thisMod.CardList; _cardList.CollectionChanged += CollectionChange; _thisCanvas = new AbsoluteLayout(); _thisMod.PositionUI = this; PopulateCards(); Content = _thisCanvas; }
public void LoadControls(ClockObservable thisMod) { _thisMod = thisMod; _thisCanvas = new AbsoluteLayout(); thisMod.PositionUI = this; Content = _thisCanvas; SolitaireCard card = new SolitaireCard(); GamePackageDIContainer tt = Resolve <GamePackageDIContainer>(); IProportionImage pp = tt.Resolve <IProportionImage>(ts.TagUsed); _size = card.DefaultSize.GetSizeUsed(pp.Proportion); if (_thisMod.ClockList != null && _thisMod.ClockList.Count > 0) { PrivateReposition(); } }
public override bool CanAddSingleCard(int whichOne, SolitaireCard thisCard) { if (Discards !.HasCard(whichOne) == false) { return(true); } if (whichOne == 2) { return(false); } var oldCard = Discards.GetLastCard(whichOne); if (oldCard.Value - 1 == thisCard.Value) { return(true); } return(oldCard.Value == EnumCardValueList.LowAce && thisCard.Value == EnumCardValueList.King); //because round corner. }
private void LoadBoard() { CardList = new CustomBasicCollection <SolitaireCard>(); SolitaireCard tempCard = new SolitaireCard(); SKSize tempSize = tempCard.DefaultSize.GetSizeUsed(_thisP.Proportion); _cardWidth = tempSize.Width; _cardHeight = tempSize.Height; _totalWidth = _maxRowsColumns * _cardWidth; int nums = HowManyCards; nums.Times(x => { tempCard = new SolitaireCard(); tempCard.IsEnabled = false; CardList.Add(tempCard); }); PositionCards(); }
public override bool CanAddCard(int pile, SolitaireCard thisCard) { if (pile > 3) { return(base.CanAddCard(pile, thisCard)); } //for this; starts from kings and moves down if (Piles.HasCard(pile) == false) { return(thisCard.Value == EnumCardValueList.King); } var oldCard = Piles.GetLastCard(pile); if (oldCard.Suit != thisCard.Suit) { return(false); } return(oldCard.Value == thisCard.Value + 1); }
} //decided its not worth taking a risk on this one. //public PlainCommand<SolitaireCard> ClockCommand { get; set; } public void ClearBoard() { int decks = 10000; ClockList !.ForEach(thisClock => { thisClock.CardList.Clear(); var thisCard = new SolitaireCard(); decks++; thisCard.Deck = decks; //because of how the dictionary works. thisClock.CardList.Add(thisCard); if (ShowCenter || ClockList.IndexOf(thisClock) + 1 <= 4) { thisClock.LeftGuide = 4; } else { thisClock.LeftGuide = 3; } }); }
public void Init(SolitairePilesCP thisMod) { _thisStack = new StackLayout(); SolitaireCard card = new SolitaireCard(); DeckOfCardsXF <SolitaireCard> temps = new DeckOfCardsXF <SolitaireCard>(); temps.SendSize(ts.TagUsed, card); var size = temps.Measure(double.PositiveInfinity, double.PositiveInfinity); if (size.Request.Height == 0 || size.Request.Width == 0) { throw new BasicBlankException("Was unable to get the width or height request. Rethink"); } else { SolitaireOverlapLayoutXF.MinWidth = size.Request.Width + 9; } _thisStack.Orientation = StackOrientation.Horizontal; _thisStack.Spacing = 0; ScrollView thisScroll = new ScrollView(); thisScroll.Orientation = ScrollOrientation.Horizontal; _thisMod = thisMod; if (thisMod.PileList.Count == 0) { throw new BasicBlankException("Must have at least one pile. Otherwise, not worth even using this"); } thisMod.PileList.ForEach(thisPile => { IndividualSolitairePileXF thisG = new IndividualSolitairePileXF(); thisG.MainMod = thisMod; thisG.ThisPile = thisPile; thisG.Margin = new Thickness(0, 0, 0, 0); //try this _thisStack.Children.Add(thisG); thisG.Init(_needsPopulating); }); _needsPopulating = false; thisScroll.Content = _thisStack; Content = thisScroll; }