private DeckOfCardsWPF <HeapSolitaireCardInfo> GetNewCard(HeapSolitaireCardInfo thisCard)
        {
            var output = new DeckOfCardsWPF <HeapSolitaireCardInfo>();

            output.SendSize(ts.TagUsed, thisCard);
            return(output); //hopefully this simple.
        }
示例#2
0
        private DeckOfCardsWPF <SolitaireCard> GetNewCard(SolitaireCard thisCard)
        {
            var output = new DeckOfCardsWPF <SolitaireCard>();

            output.SendSize(ts.TagUsed, thisCard);
            return(output);
        }
        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;
            }
        private DeckOfCardsWPF <SolitaireCard> GetGraphics(SolitaireCard thisCard)
        {
            DeckOfCardsWPF <SolitaireCard> output = new DeckOfCardsWPF <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 (?)
        }
        private DeckOfCardsWPF <PokerCardInfo> GetNewCard(DisplayCard thisPoker)
        {
            DeckOfCardsWPF <PokerCardInfo> thisCard = new DeckOfCardsWPF <PokerCardInfo>();

            thisCard.SendSize(ts.TagUsed, thisPoker.CurrentCard);


            //thisCard.Name = nameof(PokerMainViewModel.HoldUnhold);



            thisCard.Command = _command !;
            return(thisCard);
        }
 private void PopulateControls()
 {
     _thisGrid !.Children.Clear();
     foreach (var thisCard in _cardList !)
     {
         DeckOfCardsWPF <TR> thisGraphics = new DeckOfCardsWPF <TR>();
         thisGraphics.Margin = new Thickness(0, 0, 6, 0);
         thisGraphics.SendSize(ts.TagUsed, thisCard);
         var thisBind = GetCommandBinding(nameof(PlayerBoardObservable <TR> .CardCommand));
         thisGraphics.SetBinding(GraphicsCommand.CommandProperty, thisBind);
         thisGraphics.CommandParameter = thisCard;
         var(Row, Column) = _thisMod !.GetRowColumnData(thisCard);
         GridHelper.AddControlToGrid(_thisGrid, thisGraphics, Row - 1, Column - 1);
         Grid.SetRowSpan(thisGraphics, 2);
     }
 }
        public void Init()
        {
            CustomWaste thisWaste = Resolve <CustomWaste>(); //can't do unit testing with ui anyways.

            if (thisWaste.CardList.Count != 4)
            {
                throw new BasicBlankException("Must have 4 piles");
            }
            if (thisWaste.CardList.Any(items => items.Value != EnumCardValueList.Queen))
            {
                throw new BasicBlankException("Only Queens are supported for the special waste piles");
            }
            Grid thisGrid = new Grid();

            AddAutoColumns(thisGrid, 2);
            var thisCard = new DeckOfCardsWPF <SolitaireCard>();

            thisCard.SendSize(ts.TagUsed, thisWaste.CardList.First());
            var tempSize = thisCard.ObjectSize.Height * .67f;

            thisCard.Margin = new Thickness(0, tempSize, 0, 0);
            AddControlToGrid(thisGrid, thisCard, 0, 0);
            var newCard = new DeckOfCardsWPF <SolitaireCard>();

            newCard.SendSize(ts.TagUsed, thisWaste.CardList[1]);
            var tempWidth  = thisCard.ObjectSize.Width;
            var tempHeight = thisCard.ObjectSize.Height;

            newCard.Margin = new Thickness(tempWidth - 10, tempHeight + 10, 0, 0);
            AddControlToGrid(thisGrid, newCard, 0, 0);
            thisCard = new DeckOfCardsWPF <SolitaireCard>();
            thisCard.SendSize(ts.TagUsed, thisWaste.CardList[2]);
            thisCard.Margin = new Thickness((tempSize / 2) * -1, tempSize, 0, 0);
            AddControlToGrid(thisGrid, thisCard, 0, 1);
            newCard = new DeckOfCardsWPF <SolitaireCard>();
            newCard.SendSize(ts.TagUsed, thisWaste.CardList.Last());
            newCard.Margin = new Thickness(tempWidth * -1, 0, 0, 0);
            AddControlToGrid(thisGrid, newCard, 0, 1);
            Content = thisGrid;
        }
        public BisleySolitaireMainView(IEventAggregator aggregator)
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);


            StackPanel stack = new StackPanel();

            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            _main        = new BasicMultiplePilesWPF <SolitaireCard, ts, DeckOfCardsWPF <SolitaireCard> >();
            _main.Margin = new Thickness(10, 5, 5, 5);
            stack.Children.Add(otherStack);
            var autoBut = GetGamingButton("Auto Make Move", nameof(BisleySolitaireMainViewModel.AutoMoveAsync));
            //not sure where to place it.
            //it probably varies from game to game.
            var scoresAlone = new SimpleLabelGrid();

            scoresAlone.AddRow("Score", nameof(BisleySolitaireMainViewModel.Score));
            var tempGrid = scoresAlone.GetContent;

            //not sure where to place.
            //_waste = new SolitairePilesWPF();


            otherStack.Children.Add(autoBut);
            otherStack.Children.Add(tempGrid);
            stack.Children.Add(_main);
            _discard = new BasicMultiplePilesWPF <SolitaireCard, ts, DeckOfCardsWPF <SolitaireCard> >();
            var tempCard = new DeckOfCardsWPF <SolitaireCard>();

            tempCard.SendSize(ts.TagUsed, new SolitaireCard());
            _discard.Margin = new Thickness(10, (tempCard.ObjectSize.Height * -1) - 10, 0, 0);
            stack.Children.Add(_discard);


            Content = stack; //if not doing this, rethink.
        }
示例#9
0
        private void PopulateList()
        {
            if (_cardList !.Count == 0)
            {
                _thisGrid !.Children.Clear(); // needs to clear because no card list.  the cardlist works together with the scores
                return;
            }
            var ScoreStack = new StackPanel();

            AddControlToGrid(_thisGrid !, ScoreStack, 0, 2);
            Grid.SetRowSpan(ScoreStack, 2);
            if (_cardList.Count != 4)
            {
                throw new BasicBlankException("Must have 4 cards for this control, not " + _cardList.Count);
            }
            foreach (var ThisItem in _tempMod !.Scores)
            {
                var ThisLabel = GetDefaultLabel();
                ThisLabel.Margin = new Thickness(5, 0, 0, 0);
                ThisLabel.Text   = ThisItem.Description + " - " + ThisItem.Points;
                ScoreStack.Children.Add(ThisLabel);
            }
            int x;
            int y;
            int z = 0;

            for (y = 1; y <= 2; y++)
            {
                for (x = 1; x <= 2; x++)
                {
                    var thisCard     = _cardList[z];
                    var thisGraphics = new DeckOfCardsWPF <CribbageCard>();
                    thisGraphics.SendSize(ts.TagUsed, thisCard);
                    AddControlToGrid(_thisGrid !, thisGraphics, y - 1, x - 1);
                    z += 1;
                }
            }
        }
示例#10
0
        public GalaxyCardGameMainView(IEventAggregator aggregator,
                                      TestOptions test,
                                      GalaxyCardGameVMData model,
                                      GalaxyCardGameGameContainer gameContainer
                                      )
        {
            _aggregator    = aggregator;
            _model         = model;
            _model.WinUI   = this;
            _gameContainer = gameContainer;
            _aggregator.Subscribe(this);
            gameContainer.SaveRoot.LoadWin(this);
            _deckGPile     = new BaseDeckWPF <GalaxyCardGameCardInformation, ts, DeckOfCardsWPF <GalaxyCardGameCardInformation> >();
            _score         = new ScoreBoardWPF();
            _playerHandWPF = new BaseHandWPF <GalaxyCardGameCardInformation, ts, DeckOfCardsWPF <GalaxyCardGameCardInformation> >();

            _trick1                  = new TwoPlayerTrickWPF <EnumSuitList, GalaxyCardGameCardInformation, ts, DeckOfCardsWPF <GalaxyCardGameCardInformation> >();
            _trick1.Width            = 500;
            _nextCard                = new DeckOfCardsWPF <GalaxyCardGameCardInformation>();
            _planetStack             = new StackPanel();
            _moonGrid                = new Grid();
            _planetStack.Orientation = Orientation.Horizontal;
            AddLeftOverColumn(_moonGrid, 50);
            AddLeftOverColumn(_moonGrid, 50);
            AddAutoRows(_moonGrid, 1);
            _nextCard.SendSize(ts.TagUsed, _gameContainer.SaveRoot !.WinningCard);
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(GalaxyCardGameMainViewModel.RestoreScreen)
                };
            }
            var endButton = GetGamingButton("End Turn", nameof(GalaxyCardGameMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            endButton.VerticalAlignment   = VerticalAlignment.Top;

            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_trick1);
            otherStack.Children.Add(_nextCard);
            otherStack.Children.Add(_deckGPile);
            mainStack.Children.Add(otherStack);
            _score.AddColumn("Cards Left", false, nameof(GalaxyCardGamePlayerItem.ObjectCount)); //very common.
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(GalaxyCardGameMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(GalaxyCardGameMainViewModel.Status));

            mainStack.Children.Add(_moonGrid);
            otherStack             = new StackPanel();
            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_playerHandWPF);
            StackPanel finalStack = new StackPanel();

            finalStack.Children.Add(firstInfo.GetContent);
            var button = GetGamingButton("Create New Moon", nameof(GalaxyCardGameMainViewModel.MoonAsync));

            finalStack.Children.Add(endButton);
            finalStack.Children.Add(button);
            otherStack.Children.Add(finalStack);
            mainStack.Children.Add(otherStack);
            otherStack             = new StackPanel();
            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_planetStack);
            otherStack.Children.Add(_score);
            mainStack.Children.Add(otherStack);


            _deckGPile.Margin = new Thickness(5, 5, 5, 5);



            if (restoreP != null)
            {
                //todo:  figure out where to place the restore ui if there is a restore option.
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
 private void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         foreach (var thisItem in e.NewItems)
         {
             var newCard = thisItem as SolitaireCard;
             DeckOfCardsWPF <SolitaireCard> thisD = new DeckOfCardsWPF <SolitaireCard>();
             thisD.NeedsExtraSuitForSolitaire = true;
             thisD.SendSize(ts.TagUsed, newCard !);
             _thisStack !.Children.Add(thisD);//hopefully this simple (?)
         }
     }
     if (e.Action == NotifyCollectionChangedAction.Replace)
     {
         if (e.OldItems.Count == e.NewItems.Count)
         {
             int x = 0;
             foreach (var thisItem in e.OldItems)
             {
                 var oldCard = thisItem as SolitaireCard;
                 var newCard = e.NewItems[x] as SolitaireCard;
                 var thisCon = FindControl(oldCard !);
                 thisCon !.DataContext = null;    //i think this is needed too
                 thisCon.DataContext   = newCard; //the upperright is iffy.
                 x++;
             }
         }
         else
         {
             throw new BasicBlankException("Not sure when the numbers don't match");
         }
     }
     if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         foreach (var thisItem in e.OldItems)
         {
             var oldCard = thisItem as SolitaireCard;
             var thisCon = FindControl(oldCard !);
             _thisStack !.Children.Remove(thisCon);
         }
     }
     if (e.Action == NotifyCollectionChangedAction.Reset)
     {
         _thisStack !.Children.Clear();
         PopulateList();
     }
     if (e.Action == NotifyCollectionChangedAction.Move)
     {
         if (e.OldStartingIndex == e.NewStartingIndex)
         {
             RefreshItems();
         }
         else
         {
             var firstCon = _thisStack !.Children[e.OldStartingIndex];
             _thisStack.Children.Remove(firstCon);
             _thisStack.Children.Insert(e.NewStartingIndex, firstCon);
         }
     }
     RecalculatePositioning();
     _thisScroll !.ScrollToBottom();
 }