public PaydayMainView(IEventAggregator aggregator,
                              TestOptions test,
                              GameBoardGraphicsCP graphicsCP,
                              IGamePackageRegister register,
                              PaydayGameContainer gameContainer,
                              PaydayVMData model
                              )
        {
            StackPanel mainStack = new StackPanel();

            _aggregator    = aggregator;
            _gameContainer = gameContainer;
            _model         = model;
            _aggregator.Subscribe(this);
            _board = new GameBoardWPF();
            register.RegisterControl(_board.Element, "main");
            graphicsCP.LinkBoard();
            _score = new ScoreBoardWPF();
            _score.AddColumn("Money", true, nameof(PaydayPlayerItem.MoneyHas), useCurrency: true, rightMargin: 10);
            _score.AddColumn("Loans", true, nameof(PaydayPlayerItem.Loans), useCurrency: true, rightMargin: 10);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Main Turn", nameof(PaydayMainViewModel.NormalTurn));
            firstInfo.AddRow("Other Turn", nameof(PaydayMainViewModel.OtherLabel));
            firstInfo.AddRow("Progress", nameof(PaydayMainViewModel.MonthLabel));
            firstInfo.AddRow("Status", nameof(PaydayMainViewModel.Status));
            //firstInfo.AddRow("Instructions", nameof(PaydayMainViewModel.Instructions));
            var        firstContent = firstInfo.GetContent;
            StackPanel tempStack    = new StackPanel();

            AddVerticalLabelGroup("Instructions", nameof(PaydayMainViewModel.Instructions), tempStack);
            ScrollViewer tempScroll = new ScrollViewer();

            tempScroll.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            tempScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            tempScroll.Content = tempStack;

            ParentSingleUIContainer?restoreP = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(PaydayMainViewModel.RestoreScreen)
                };
            }
            StackPanel firstStack = new StackPanel();

            firstStack.Orientation = Orientation.Horizontal;
            firstStack.Children.Add(_board);
            mainStack.Children.Add(firstStack);
            firstStack.Margin = new Thickness(3, 3, 3, 3);
            Grid rightGrid = new Grid();


            firstStack.Children.Add(rightGrid);
            AddPixelRow(rightGrid, 225);
            AddLeftOverRow(rightGrid, 1);
            AddAutoColumns(rightGrid, 1);
            Grid grid1 = new Grid();

            AddControlToGrid(rightGrid, grid1, 0, 0);
            AddAutoRows(grid1, 1);
            AddPixelColumn(grid1, 200);
            AddPixelColumn(grid1, 150);
            AddPixelColumn(grid1, 200);
            AddLeftOverColumn(grid1, 1);
            StackPanel stack1 = new StackPanel();

            AddControlToGrid(grid1, stack1, 0, 0);

            ParentSingleUIContainer mailPile = new ParentSingleUIContainer()
            {
                Name = nameof(PaydayMainViewModel.MailPileScreen)
            };
            ParentSingleUIContainer dealPile = new ParentSingleUIContainer()
            {
                Name = nameof(PaydayMainViewModel.DealPileScreen)
            };

            stack1.Children.Add(mailPile);
            stack1.Children.Add(dealPile);

            ParentSingleUIContainer roller = new ParentSingleUIContainer()
            {
                Name = nameof(PaydayMainViewModel.RollerScreen)
            };

            stack1.Children.Add(roller);
            AddControlToGrid(grid1, tempScroll, 0, 1); // instructions on card
            AddControlToGrid(grid1, firstContent, 0, 2);
            AddControlToGrid(grid1, _score, 0, 3);
            Grid grid2 = new Grid();

            AddControlToGrid(rightGrid, grid2, 1, 0);
            AddAutoRows(grid2, 1);
            AddAutoColumns(grid2, 1);
            AddLeftOverColumn(grid2, 1);
            StackPanel finalStack = new StackPanel();

            _dealList                     = new BaseHandWPF <DealCard, CardGraphicsCP, DealCardWPF>();
            _dealList.Height              = 500;
            _dealList.HandType            = HandObservable <DealCard> .EnumHandList.Vertical;
            _dealList.HorizontalAlignment = HorizontalAlignment.Left;

            finalStack.Children.Add(_dealList);
            AddControlToGrid(grid2, finalStack, 0, 0);
            _currentPiece            = new PawnPiecesWPF <EnumColorChoice>();
            _currentPiece.Visibility = Visibility.Collapsed; // until proven to need it
            _currentPiece.Width      = 80;
            _currentPiece.Height     = 80;
            _currentPiece.Margin     = new Thickness(5, 5, 5, 5);
            _currentPiece.Init();
            finalStack.Children.Add(_currentPiece);

            ParentSingleUIContainer mailList = new ParentSingleUIContainer()
            {
                Name = nameof(PaydayMainViewModel.MailListScreen)
            };

            AddControlToGrid(grid2, mailList, 0, 1);


            ParentSingleUIContainer extras = new ParentSingleUIContainer()
            {
                Name = nameof(PaydayMainViewModel.DealOrBuyScreen)
            };

            AddControlToGrid(grid2, extras, 0, 1);

            extras = new ParentSingleUIContainer()
            {
                Name = nameof(PaydayMainViewModel.ChooseDealScreen)
            };
            AddControlToGrid(grid2, extras, 0, 1);
            extras = new ParentSingleUIContainer()
            {
                Name = nameof(PaydayMainViewModel.LotteryScreen)
            };
            AddControlToGrid(grid2, extras, 0, 1);
            extras = new ParentSingleUIContainer()
            {
                Name = nameof(PaydayMainViewModel.PlayerScreen)
            };
            AddControlToGrid(grid2, extras, 0, 1);



            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;
        }
Example #2
0
        public ClueBoardGameMainView(IEventAggregator aggregator,
                                     TestOptions test,
                                     ClueBoardGameVMData model,
                                     GameBoardGraphicsCP graphicsCP,
                                     IGamePackageRegister register,
                                     ClueBoardGameMainGameClass mainGame,
                                     ClueBoardGameGameContainer gameContainer
                                     )
        {
            _mainGame      = mainGame;
            _gameContainer = gameContainer;
            _aggregator    = aggregator;
            _model         = model;
            _aggregator.Subscribe(this);
            register.RegisterControl(_board.ThisElement, "");
            graphicsCP.LinkBoard();
            _piece        = new PawnPiecesWPF <EnumColorChoice>();
            _piece.Height = 60;
            _piece.Width  = 60;
            _piece.Init();
            _pile       = new BasePileWPF <CardInfo, CardCP, CardWPF>();
            _hand       = new BaseHandWPF <CardInfo, CardCP, CardWPF>();
            _detective  = new DetectiveNotebookWPF();
            _prediction = new PredictionAccusationWPF();

            StackPanel mainStack  = new StackPanel();
            StackPanel finalStack = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            ParentSingleUIContainer?restoreP = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(ClueBoardGameMainViewModel.RestoreScreen)
                };
            }

            var thisRoll         = GetGamingButton("Roll Dice", nameof(ClueBoardGameMainViewModel.RollDiceAsync));
            var preButton        = GetGamingButton("Predict", nameof(ClueBoardGameMainViewModel.MakePredictionAsync));
            var accusationButton = GetGamingButton("Accusation", nameof(ClueBoardGameMainViewModel.MakeAccusationAsync));

            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            _diceControl           = new DiceListControlWPF <SimpleDice>();
            var endButton = GetGamingButton("End Turn", nameof(ClueBoardGameMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;


            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

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

            StackPanel firstRowStack = new StackPanel();

            firstRowStack.Children.Add(_board);
            otherStack.Children.Add(_piece);
            otherStack.Children.Add(firstInfo.GetContent);
            firstRowStack.Children.Add(otherStack);
            finalStack.Children.Add(firstRowStack);
            StackPanel secondRowStack = new StackPanel();

            finalStack.Children.Add(secondRowStack);
            StackPanel thirdRowStack = new StackPanel();

            finalStack.Children.Add(thirdRowStack);
            otherStack             = new StackPanel();
            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_hand);
            otherStack.Children.Add(_pile);
            secondRowStack.Children.Add(otherStack);
            _prediction.Margin = new Thickness(0, 0, 0, 30);
            secondRowStack.Children.Add(_prediction);
            secondRowStack.Children.Add(_detective);
            AddVerticalLabelGroup("Instructions", nameof(ClueBoardGameMainViewModel.Instructions), thirdRowStack);

            otherStack             = new StackPanel();
            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_diceControl);
            TextBlock label = new TextBlock();

            label.FontSize   = 100;
            label.Foreground = Brushes.White;
            label.FontWeight = FontWeights.Bold;
            label.SetBinding(TextBlock.TextProperty, new Binding(nameof(ClueBoardGameMainViewModel.LeftToMove)));
            otherStack.Children.Add(label);
            thirdRowStack.Children.Add(otherStack);
            thirdRowStack.Children.Add(thisRoll);

            thirdRowStack.Children.Add(preButton);
            thirdRowStack.Children.Add(accusationButton);
            thirdRowStack.Children.Add(endButton);
            var nextInfo = new SimpleLabelGrid();

            nextInfo.AddRow("Room", nameof(ClueBoardGameMainViewModel.CurrentRoomName));
            nextInfo.AddRow("Character", nameof(ClueBoardGameMainViewModel.CurrentCharacterName));
            nextInfo.AddRow("Weapon", nameof(ClueBoardGameMainViewModel.CurrentWeaponName));
            thirdRowStack.Children.Add(nextInfo.GetContent);
            mainStack.Children.Add(finalStack);

            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;
        }