public MancalaMainView(IEventAggregator aggregator,
                               TestOptions test,
                               IGamePackageRegister register
                               )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            _register = register;
            _register.RegisterControl(_board.Element, "");
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

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

            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(MancalaMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(MancalaMainViewModel.Status));
            firstInfo.AddRow("Instructions", nameof(MancalaMainViewModel.Instructions));
            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            mainStack.Children.Add(otherStack);
            otherStack.Children.Add(_board);
            otherStack.Children.Add(firstInfo.GetContent);

            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
Exemplo n.º 2
0
        public RollEmMainView(IEventAggregator aggregator,
                              TestOptions test, RollEmVMData model,
                              GameBoardGraphicsCP graphicsCP,
                              IGamePackageRegister register
                              )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            StackPanel mainStack = new StackPanel();

            register.RegisterControl(_board.Element, "");
            graphicsCP.LinkBoard();
            ParentSingleUIContainer?restoreP = null;

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

            mainStack.Children.Add(tempStack);
            tempStack.Orientation = Orientation.Horizontal;
            tempStack.Children.Add(_board);
            var        thisRoll   = GetGamingButton("Roll Dice", nameof(RollEmMainViewModel.RollDiceAsync));
            StackPanel otherStack = new StackPanel();

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

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            otherStack.Children.Add(endButton);
            mainStack.Children.Add(otherStack);
            _score = new ScoreBoardWPF();
            _score.AddColumn("Score Round", true, nameof(RollEmPlayerItem.ScoreRound));
            _score.AddColumn("Score Game", true, nameof(RollEmPlayerItem.ScoreGame));
            tempStack.Children.Add(_score);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(RollEmMainViewModel.NormalTurn)); // there is no roll number needed for this game.
            firstInfo.AddRow("Round", nameof(RollEmMainViewModel.Round));     //if you don't need, it comment it out.
            firstInfo.AddRow("Status", nameof(RollEmMainViewModel.Status));
            mainStack.Children.Add(firstInfo.GetContent);



            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;
        }
        public LifeBoardGameMainView(IEventAggregator aggregator,
                                     IGamePackageRegister register,
                                     GameBoardGraphicsCP graphicsCP
                                     )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            Grid grid = new Grid();

            AddAutoColumns(grid, 1);
            AddLeftOverColumn(grid, 70);
            AddLeftOverColumn(grid, 30);//i think split 50/50 is fine.
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

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

            StackPanel stack = new StackPanel();

            stack.Margin = new Thickness(3);
            stack.Children.Add(firstInfo.GetContent);
            AddVerticalLabelGroup("Space Details", nameof(LifeBoardGameMainViewModel.GameDetails), stack);
            AddControlToGrid(grid, stack, 0, 2);
            //on tablets will be different.

            GameBoardWPF gameBoard = new GameBoardWPF(aggregator);

            gameBoard.VerticalAlignment = VerticalAlignment.Top;
            register.RegisterControl(gameBoard.Element, "");
            graphicsCP.LinkBoard();
            AddControlToGrid(grid, gameBoard, 0, 0);
            gameBoard.Margin = new Thickness(3);
            stack            = new StackPanel();
            //everything else will go to this stack.
            stack.Margin = new Thickness(3);

            Type type = typeof(LifeBoardGameMainViewModel);
            CustomBasicList <string> list = type.GetProperties(x => x.Name.EndsWith("Screen") && x.Name != "MainScreen" && x.Name != "BoardScreen").Select(x => x.Name).ToCustomBasicList();

            if (list.Count == 0)
            {
                throw new BasicBlankException("No screens found using reflection.  Rethink");
            }
            list.ForEach(x =>
            {
                ParentSingleUIContainer middle = new ParentSingleUIContainer()
                {
                    Name = x,
                    HorizontalAlignment = HorizontalAlignment.Left
                                          //Margin = new Thickness(5)
                };
                stack.Children.Add(middle);
            });
            AddControlToGrid(grid, stack, 0, 1);
            Content = grid;
        }
        public PassOutDiceGameMainView(IEventAggregator aggregator,
                                       TestOptions test,
                                       PassOutDiceGameVMData model,
                                       GameBoardGraphicsCP graphicsCP,
                                       IGamePackageRegister register
                                       )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

            register.RegisterControl(_board.ThisElement, ""); //hopefully okay.
            graphicsCP.LinkBoard();
            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(PassOutDiceGameMainViewModel.RestoreScreen)
                };
            }
            StackPanel finalStack = new StackPanel();
            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            _diceControl           = new DiceListControlWPF <SimpleDice>();

            otherStack.Children.Add(finalStack);
            otherStack.Children.Add(_board);


            var endButton = GetGamingButton("End Turn", nameof(PassOutDiceGameMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            mainStack.Children.Add(otherStack);


            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

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


            finalStack.Children.Add(firstInfo.GetContent);
            finalStack.Children.Add(endButton);
            finalStack.Children.Add(_diceControl);


            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;
        }
Exemplo n.º 5
0
        public ChessMainView(IEventAggregator aggregator,
                             TestOptions test, IGamePackageRegister register,
                             GameBoardGraphicsCP graphics)
        {
            _aggregator = aggregator;
            _register   = register;
            _aggregator.Subscribe(this);
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(ChessMainViewModel.RestoreScreen)
                };
            }
            _register.RegisterControl(_board.Element, "main");
            graphics.LinkBoard(); //this is always needed now.
            _board.Margin = new Thickness(3);
            var endButton = GetGamingButton("End Turn", nameof(ChessMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            Button other = GetGamingButton("Show Tie", nameof(ChessMainViewModel.TieAsync));

            other.HorizontalAlignment = HorizontalAlignment.Left;
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(ChessMainViewModel.NormalTurn));
            firstInfo.AddRow("Instructions", nameof(ChessMainViewModel.Instructions));
            firstInfo.AddRow("Status", nameof(ChessMainViewModel.Status));
            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_board);
            mainStack.Children.Add(otherStack);
            StackPanel tempStack = new StackPanel();

            tempStack.Orientation = Orientation.Horizontal;
            tempStack.Children.Add(endButton);
            Button undo = GetGamingButton("Undo Moves", nameof(ChessMainViewModel.UndoMovesAsync));

            tempStack.Children.Add(undo);
            tempStack.Children.Add(other);
            StackPanel finals = new StackPanel();

            finals.Children.Add(tempStack);
            finals.Children.Add(firstInfo.GetContent);
            otherStack.Children.Add(finals);
            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
        public CandylandMainView(IEventAggregator aggregator,
                                 TestOptions test,
                                 IGamePackageRegister register //unless i extend the contract, will be done this way.
                                 )
        {
            Background  = Brushes.White;
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

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

            StackPanel otherStack = new StackPanel();

            _ourBoard = new GameboardWPF();
            register.RegisterControl(_ourBoard.Element1, "main");
            //register!.RegisterSingleton(_ourBoard.Element1, "main"); //i think
            _ourCard = new CardGraphicsWPF(); // bindings are finished
            _ourCard.SendSize("main", new CandylandCardData());
            otherStack.Margin      = new Thickness(5, 5, 5, 5);
            otherStack.Orientation = Orientation.Horizontal;
            StackPanel firstStack = new StackPanel();

            otherStack.Children.Add(firstStack);
            firstStack.Children.Add(_ourCard); //you already subscribed.  just hook up another event for this.
            _ourPiece        = new PieceWPF();
            _ourPiece.Margin = new Thickness(0, 5, 0, 0);
            _ourPiece.SetSizes();
            BaseLabelGrid firstInfo = new BaseLabelGrid();

            firstInfo.AddRow("Turn", nameof(CandylandMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(CandylandMainViewModel.Status));
            firstStack.Children.Add(firstInfo.GetContent);
            firstStack.Children.Add(_ourPiece);
            _ourBoard.HorizontalAlignment = HorizontalAlignment.Left;
            _ourBoard.VerticalAlignment   = VerticalAlignment.Top;
            _ourBoard.Margin = new Thickness(5, 0, 0, 0);
            otherStack.Children.Add(_ourBoard);
            mainStack.Children.Add(otherStack);
            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;
        }
        public TroubleMainView(IEventAggregator aggregator,
                               TestOptions test,
                               TroubleVMData model,
                               TroubleGameContainer gameContainer,
                               GameBoardGraphicsCP graphicsCP,
                               IGamePackageRegister register
                               )
        {
            _aggregator = aggregator;
            _model      = model;
            _graphicsCP = graphicsCP;
            _aggregator.Subscribe(this);
            gameContainer.PositionDice = PositionDice;
            register.RegisterControl(_board.ThisElement, "");
            graphicsCP.LinkBoard();
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(TroubleMainViewModel.RestoreScreen));
            }
            _tempGrid.Margin    = new Thickness(5, 5, 5, 5);
            _diceControl        = new DiceListControlXF <SimpleDice>();
            _diceControl.Margin = new Thickness(10, 0, 0, 0);

            var endButton = GetGamingButton("End Turn", nameof(TroubleMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;


            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

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


            mainStack.Children.Add(_tempGrid);
            mainStack.Children.Add(firstInfo.GetContent);
            _tempStack.Children.Add(_diceControl);
            _tempStack.InputTransparent = true; //maybe this will be okay.
            _tempGrid.Children.Add(_board);


            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;
        }
Exemplo n.º 8
0
        public TroubleMainView(IEventAggregator aggregator,
                               TestOptions test,
                               TroubleVMData model,
                               TroubleGameContainer gameContainer,
                               GameBoardGraphicsCP graphicsCP,
                               IGamePackageRegister register
                               )
        {
            _aggregator = aggregator;
            _model      = model;
            _graphicsCP = graphicsCP;
            _aggregator.Subscribe(this);
            gameContainer.PositionDice = PositionDice;
            register.RegisterControl(_board.ThisElement, "");
            graphicsCP.LinkBoard();
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

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

            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            _diceControl           = new DiceListControlWPF <SimpleDice>();
            mainStack.Children.Add(otherStack);


            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(TroubleMainViewModel.NormalTurn));
            firstInfo.AddRow("Instructions", nameof(TroubleMainViewModel.Instructions));
            firstInfo.AddRow("Status", nameof(TroubleMainViewModel.Status));
            otherStack.Children.Add(_tempGrid);
            otherStack.Children.Add(firstInfo.GetContent);
            _tempGrid.Margin = new Thickness(5);

            _tempStack.Children.Add(_diceControl);
            _tempGrid.Children.Add(_board);

            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;
        }
Exemplo n.º 9
0
        public CandylandMainView(IEventAggregator aggregator,
                                 TestOptions test,
                                 IGamePackageRegister register
                                 )
        {
            BackgroundColor = Color.White;
            _aggregator     = aggregator;
            _aggregator.Subscribe(this);
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

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

            StackLayout otherStack = new StackLayout();

            _ourBoard = new GameBoardXF();
            register.RegisterControl(_ourBoard.Element, "main");
            _ourCard = new CardGraphicsXF(); // bindings are finished
            _ourCard.SendSize("main", new CandylandCardData());
            otherStack.Margin      = new Thickness(5, 5, 5, 5);
            otherStack.Orientation = StackOrientation.Horizontal;
            StackLayout firstStack = new StackLayout();

            otherStack.Children.Add(firstStack);
            firstStack.Children.Add(_ourCard); //you already subscribed.  just hook up another event for this.
            _ourPiece        = new PieceXF();
            _ourPiece.Margin = new Thickness(0, 5, 0, 0);
            _ourPiece.SetSizes();
            BaseLabelGrid firstInfo = new BaseLabelGrid();

            firstInfo.AddRow("Turn", nameof(CandylandMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(CandylandMainViewModel.Status));
            firstStack.Children.Add(firstInfo.GetContent);
            firstStack.Children.Add(_ourPiece);
            _ourBoard.HorizontalOptions = LayoutOptions.Start;
            _ourBoard.VerticalOptions   = LayoutOptions.Start;
            _ourBoard.Margin            = new Thickness(5, 0, 0, 0);
            otherStack.Children.Add(_ourBoard);
            mainStack.Children.Add(otherStack);


            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;
        }
        public ChessMainView(IEventAggregator aggregator,
                             TestOptions test, IGamePackageRegister register,
                             GameBoardGraphicsCP graphics)
        {
            _aggregator = aggregator;
            _register   = register;
            _aggregator.Subscribe(this);
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(ChessMainViewModel.RestoreScreen));
            }
            _register.RegisterControl(_board.Element, "main");
            graphics.LinkBoard(); //this is always needed now.
            _board.Margin = new Thickness(3);

            mainStack.Children.Add(_board);
            var endButton = GetGamingButton("End Turn", nameof(ChessMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;
            Button other = GetGamingButton("Show Tie", nameof(ChessMainViewModel.TieAsync));

            other.HorizontalOptions = LayoutOptions.Start;
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(ChessMainViewModel.NormalTurn));
            firstInfo.AddRow("Instructions", nameof(ChessMainViewModel.Instructions));
            firstInfo.AddRow("Status", nameof(ChessMainViewModel.Status));
            StackLayout tempStack = new StackLayout();

            tempStack.Orientation = StackOrientation.Horizontal;
            tempStack.Children.Add(endButton);
            tempStack.Children.Add(other);
            tempStack.Children.Add(firstInfo.GetContent);

            StackLayout finalStack = new StackLayout();

            finalStack.Children.Add(tempStack);
            finalStack.Children.Add(firstInfo.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;
        }
        public SorryMainView(IEventAggregator aggregator,
                             TestOptions test,
                             GameBoardGraphicsCP graphicsCP, IGamePackageRegister register
                             )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            register.RegisterControl(_board.ThisElement, "");
            graphicsCP.LinkBoard();
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

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

            StackPanel tempStack = new StackPanel();
            Grid       tempGrid  = new Grid();

            AddAutoRows(tempGrid, 1);
            AddPixelColumn(tempGrid, 500);
            AddAutoColumns(tempGrid, 1);
            AddControlToGrid(tempGrid, tempStack, 0, 0);
            AddControlToGrid(tempGrid, _board, 0, 1);
            mainStack.Children.Add(tempGrid);
            var endButton = GetGamingButton("End Turn", nameof(SorryMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(SorryMainViewModel.NormalTurn));
            firstInfo.AddRow("Instructions", nameof(SorryMainViewModel.Instructions));
            firstInfo.AddRow("Status", nameof(SorryMainViewModel.Status));
            tempStack.Children.Add(firstInfo.GetContent);
            AddVerticalLabelGroup("Card Details", nameof(SorryMainViewModel.CardDetails), tempStack);
            tempStack.Children.Add(endButton);
            //if we need to put to main, just change to main (?)
            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
        public SorryMainView(IEventAggregator aggregator,
                             TestOptions test,
                             GameBoardGraphicsCP graphicsCP, IGamePackageRegister register
                             )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            register.RegisterControl(_board.ThisElement, "");
            graphicsCP.LinkBoard();
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

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


            var endButton = GetGamingButton("End Turn", nameof(SorryMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

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


            mainStack.Children.Add(_board);


            mainStack.Children.Add(endButton);
            mainStack.Children.Add(firstInfo.GetContent);


            AddVerticalLabelGroup("Card Details", nameof(SorryMainViewModel.CardDetails), mainStack);


            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;
        }
        //something else has to register network classes because its unknown at this point.


        public static void RegisterNonSavedClasses <V>(this IGamePackageRegister thisContainer)
        {
            //thisContainer.RegisterSingleton<ListContainer, ListContainer>(); //maybe try it here now.
            thisContainer.RegisterSingleton <IPlayOrder, PlayOrderClass>();
            Assembly thisAssembly           = Assembly.GetAssembly(typeof(V)) !;
            CustomBasicList <Type> thisList = thisAssembly.GetTypes().Where(items => items.HasAttribute <SingletonGameAttribute>()).ToCustomBasicList();

            thisList.ForEach(items =>
            {
                thisContainer.RegisterSingleton(items);
            });

            thisList = thisAssembly.GetTypes().Where(items => items.HasAttribute <InstanceGameAttribute>()).ToCustomBasicList();
            thisList.ForEach(items =>
            {
                thisContainer.RegisterInstanceType(items);
            });
        }
Exemplo n.º 14
0
        private readonly TrainStationWPF _trainG = new TrainStationWPF(); //has to be new because of linking issues.
        public DominosMexicanTrainMainView(IEventAggregator aggregator,
                                           TestOptions test,
                                           DominosMexicanTrainVMData model,
                                           IGamePackageRegister register,
                                           TrainStationGraphicsCP graphics
                                           )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            StackPanel mainStack = new StackPanel();

            register.RegisterControl(_trainG.Element, "");
            graphics.LinkBoard();
            ParentSingleUIContainer?restoreP = null;

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


            _bone          = new BoneYardWPF <MexicanDomino, ts, DominosWPF <MexicanDomino>, DominosBasicShuffler <MexicanDomino> >();
            _playerHandWPF = new BaseHandWPF <MexicanDomino, ts, DominosWPF <MexicanDomino> >();
            _score         = new ScoreBoardWPF();
            _playerTrain   = new BaseHandWPF <MexicanDomino, ts, DominosWPF <MexicanDomino> >();
            _bone.Height   = 500;
            _bone.Width    = 1050; //can adjust as needed.

            mainStack.Children.Add(_playerHandWPF);


            Grid otherGrid = new Grid();

            AddLeftOverColumn(otherGrid, 1);
            AddAutoColumns(otherGrid, 1);
            mainStack.Children.Add(otherGrid);
            StackPanel finalStack = new StackPanel();

            AddControlToGrid(otherGrid, finalStack, 0, 0);
            _trainG.Margin = new Thickness(5, 5, 5, 5);
            _trainG.HorizontalAlignment = HorizontalAlignment.Left;
            _trainG.VerticalAlignment   = VerticalAlignment.Top;
            AddControlToGrid(otherGrid, _trainG, 0, 1);
            finalStack.Children.Add(_bone);
            _playerTrain.HorizontalAlignment = HorizontalAlignment.Left;
            finalStack.Children.Add(_playerTrain);
            StackPanel tempstack = new StackPanel();

            tempstack.Orientation = Orientation.Horizontal;
            finalStack.Children.Add(tempstack);
            Button endbutton = GetGamingButton("End Turn", nameof(DominosMexicanTrainMainViewModel.EndTurnAsync));

            endbutton.HorizontalAlignment = HorizontalAlignment.Left;
            tempstack.Children.Add(endbutton);
            Button thisButton = GetGamingButton("Longest Train", nameof(DominosMexicanTrainMainViewModel.LongestTrain));

            tempstack.Children.Add(thisButton);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(DominosMexicanTrainMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(DominosMexicanTrainMainViewModel.Status));
            _score.AddColumn("Dominos Left", true, nameof(DominosMexicanTrainPlayerItem.ObjectCount));
            _score.AddColumn("Total Score", true, nameof(DominosMexicanTrainPlayerItem.TotalScore));
            _score.AddColumn("Previous Score", true, nameof(DominosMexicanTrainPlayerItem.PreviousScore));
            _score.AddColumn("# Previous", true, nameof(DominosMexicanTrainPlayerItem.PreviousLeft));
            finalStack.Children.Add(_score);
            finalStack.Children.Add(firstInfo.GetContent);



            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; //hopefully this is still it (?)
        }
Exemplo n.º 15
0
        public XactikaMainView(IEventAggregator aggregator,
                               TestOptions test,
                               XactikaVMData model,
                               IGamePackageResolver resolver,
                               IGamePackageRegister register,
                               StatsBoardCP boardCP
                               )
        {
            _aggregator = aggregator;
            _model      = model;
            _resolver   = resolver;
            _aggregator.Subscribe(this);
            _shape1        = new ChooseShapeXF();
            _score         = new ScoreBoardXF();
            _playerHandWPF = new BaseHandXF <XactikaCardInformation, XactikaGraphicsCP, CardGraphicsXF>();
            _trick1        = new SeveralPlayersTrickXF <EnumShapes, XactikaCardInformation, XactikaGraphicsCP, CardGraphicsXF, XactikaPlayerItem>();
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(XactikaMainViewModel.RestoreScreen));
            }
            register.RegisterControl(_stats1.Element, "main");
            boardCP.LinkBoard();
            _score.AddColumn("Cards Left", false, nameof(XactikaPlayerItem.ObjectCount)); //very common.
            _score.AddColumn("Bid Amount", false, nameof(XactikaPlayerItem.BidAmount));
            _score.AddColumn("Tricks Won", false, nameof(XactikaPlayerItem.TricksWon));
            _score.AddColumn("Current Score", false, nameof(XactikaPlayerItem.CurrentScore));
            _score.AddColumn("Total Score", false, nameof(XactikaPlayerItem.TotalScore));
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(XactikaMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(XactikaMainViewModel.Status));
            firstInfo.AddRow("Round", nameof(XactikaMainViewModel.RoundNumber));
            firstInfo.AddRow("Mode", nameof(XactikaMainViewModel.GameModeText));
            StackLayout shapeStack = new StackLayout();

            shapeStack.Children.Add(_shape1);
            ParentSingleUIContainer parent = new ParentSingleUIContainer(nameof(XactikaMainViewModel.ShapeScreen));

            parent.HorizontalOptions = LayoutOptions.Start;
            parent.VerticalOptions   = LayoutOptions.Start;
            shapeStack.Children.Add(parent);
            Grid tempGrid = new Grid();

            AddAutoRows(tempGrid, 1);
            AddLeftOverColumn(tempGrid, 1);
            AddAutoColumns(tempGrid, 2);
            StackLayout tempStack = new StackLayout();

            tempStack.Orientation = StackOrientation.Horizontal;
            tempStack.Children.Add(_trick1);
            tempStack.Children.Add(shapeStack);
            AddControlToGrid(tempGrid, tempStack, 0, 0);
            parent = new ParentSingleUIContainer(nameof(XactikaMainViewModel.BidScreen));
            AddControlToGrid(tempGrid, parent, 0, 0); // if one is visible, then the other is not
            AddControlToGrid(tempGrid, _stats1, 0, 2);
            AddControlToGrid(tempGrid, _score, 0, 1); //problem is scoreboard.

            Grid finalGrid = new Grid();

            AddLeftOverRow(finalGrid, 1);
            AddLeftOverRow(finalGrid, 1);
            AddControlToGrid(finalGrid, tempGrid, 0, 0);
            AddControlToGrid(finalGrid, mainStack, 1, 0);

            mainStack.Children.Add(_playerHandWPF);
            mainStack.Children.Add(firstInfo.GetContent);
            //tempGrid.BackgroundColor = Color.Red;
            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 = finalGrid;
        }
Exemplo n.º 16
0
        public BackgammonMainView(IEventAggregator aggregator,
                                  TestOptions test,
                                  BackgammonVMData model,
                                  GameBoardGraphicsCP graphicsCP,
                                  IGamePackageRegister register
                                  )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            register.RegisterControl(_board.ThisElement, "main");
            graphicsCP.LinkBoard();
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

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


            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            _diceControl           = new DiceListControlXF <SimpleDice>();
            otherStack.Children.Add(_board);
            Grid tempGrid = new Grid();

            AddLeftOverRow(tempGrid, 5);
            AddLeftOverRow(tempGrid, 1);
            AddControlToGrid(tempGrid, _diceControl, 1, 0);
            otherStack.Children.Add(tempGrid);

            StackLayout finalStack = new StackLayout();
            StackLayout tempStack  = new StackLayout();

            tempStack.Orientation = StackOrientation.Horizontal;

            var endButton = GetSmallerButton("End Turn", nameof(BackgammonMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;

            tempStack.Children.Add(endButton);



            Button other = GetSmallerButton("Undo All Moves", nameof(BackgammonMainViewModel.UndoMoveAsync));

            tempStack.Children.Add(other);

            mainStack.Children.Add(otherStack);


            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(BackgammonMainViewModel.NormalTurn));
            firstInfo.AddRow("Game Status", nameof(BackgammonMainViewModel.Status));
            firstInfo.AddRow("Moves Made", nameof(BackgammonMainViewModel.MovesMade));
            firstInfo.AddRow("Last Status", nameof(BackgammonMainViewModel.LastStatus));
            firstInfo.AddRow("Instructions", nameof(BackgammonMainViewModel.Instructions));


            finalStack.Children.Add(tempStack);
            AddControlToGrid(tempGrid, finalStack, 0, 0);
            finalStack.Children.Add(firstInfo.GetContent);


            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
Exemplo n.º 17
0
        public AggravationMainView(IEventAggregator aggregator,
                                   TestOptions test,
                                   AggravationVMData model,
                                   AggravationGameContainer gameContainer,
                                   GameBoardGraphicsCP graphicsCP,
                                   IGamePackageRegister register
                                   )
        {
            _aggregator    = aggregator;
            _model         = model;
            _gameContainer = gameContainer;
            _aggregator.Subscribe(this);
            register.RegisterControl(_board.ThisElement, "");
            graphicsCP.LinkBoard();
            _ourPiece        = new MarblePiecesWPF <EnumColorChoice>();
            _ourPiece.Width  = 80;
            _ourPiece.Height = 80;
            _ourPiece.Init(); //i think.
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

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

            mainStack.Children.Add(tempGrid);
            var        thisRoll   = GetGamingButton("Roll Dice", nameof(AggravationMainViewModel.RollDiceAsync));
            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            _diceControl           = new DiceListControlWPF <SimpleDice>();


            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(AggravationMainViewModel.NormalTurn));
            firstInfo.AddRow("Instructions", nameof(AggravationMainViewModel.Instructions));
            firstInfo.AddRow("Status", nameof(AggravationMainViewModel.Status));
            //if we need to put to main, just change to main (?)

            StackPanel firstStack = new StackPanel();

            firstStack.Margin = new Thickness(3, 3, 3, 3);
            firstStack.Children.Add(firstInfo.GetContent);
            firstStack.Children.Add(_ourPiece);
            otherStack.Children.Add(thisRoll);
            otherStack.Children.Add(_diceControl);
            firstStack.Children.Add(otherStack);
            tempGrid.Children.Add(firstStack);
            tempGrid.Children.Add(_board);

            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;
        }
        public ChineseCheckersMainView(IEventAggregator aggregator,
                                       TestOptions test, GameBoardGraphicsCP tempBoard, IGamePackageRegister register
                                       )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(ChineseCheckersMainViewModel.RestoreScreen)
                };
            }
            register.RegisterControl(_board.ThisElement, "main");
            tempBoard.LinkBoard(); //i think
            var endButton = GetGamingButton("End Turn", nameof(ChineseCheckersMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

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

            _board.Margin = new Thickness(-10, 0, 0, 0);
            _board.HorizontalAlignment = HorizontalAlignment.Left;
            _board.VerticalAlignment   = VerticalAlignment.Top;
            Grid tempGrid = new Grid();

            AddPixelColumn(tempGrid, 300);
            AddAutoColumns(tempGrid, 1);
            StackPanel tempStack = new StackPanel();

            tempStack.Children.Add(endButton);
            tempStack.Children.Add(firstInfo.GetContent);
            AddControlToGrid(tempGrid, tempStack, 0, 0);
            AddControlToGrid(tempGrid, _board, 0, 1);
            mainStack.Children.Add(tempGrid);
            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;
        }
        public ConnectTheDotsMainView(IEventAggregator aggregator,
                                      TestOptions test, GameBoardGraphicsCP graphicsCP, IGamePackageRegister register
                                      )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            StackPanel mainStack = new StackPanel();

            register.RegisterControl(_board.Element, "");
            graphicsCP.LinkBoard();
            ParentSingleUIContainer?restoreP = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(ConnectTheDotsMainViewModel.RestoreScreen)
                };
            }
            _score = new ScoreBoardWPF();
            _score.AddColumn("Score", true, nameof(ConnectTheDotsPlayerItem.Score));


            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(ConnectTheDotsMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(ConnectTheDotsMainViewModel.Status));
            StackPanel otherStack = new StackPanel();

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

            finalStack.Children.Add(firstInfo.GetContent);
            finalStack.Children.Add(_score);
            otherStack.Children.Add(finalStack);

            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
Exemplo n.º 20
0
        public BackgammonMainView(IEventAggregator aggregator,
                                  TestOptions test,
                                  BackgammonVMData model,
                                  GameBoardGraphicsCP graphicsCP,
                                  IGamePackageRegister register
                                  )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

            register.RegisterControl(_board.ThisElement, "main");
            graphicsCP.LinkBoard();
            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(BackgammonMainViewModel.RestoreScreen)
                };
            }

            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            _diceControl           = new DiceListControlWPF <SimpleDice>();

            otherStack.Children.Add(_board);
            StackPanel finalStack = new StackPanel();
            StackPanel tempStack  = new StackPanel();

            tempStack.Orientation = Orientation.Horizontal;

            var endButton = GetGamingButton("End Turn", nameof(BackgammonMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            mainStack.Children.Add(otherStack);
            Button other = GetGamingButton("Undo All Moves", nameof(BackgammonMainViewModel.UndoMoveAsync));



            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(BackgammonMainViewModel.NormalTurn));
            firstInfo.AddRow("Game Status", nameof(BackgammonMainViewModel.Status));
            firstInfo.AddRow("Moves Made", nameof(BackgammonMainViewModel.MovesMade));
            firstInfo.AddRow("Last Status", nameof(BackgammonMainViewModel.LastStatus));
            firstInfo.AddRow("Instructions", nameof(BackgammonMainViewModel.Instructions));
            tempStack.Children.Add(endButton);
            tempStack.Children.Add(other);
            tempStack.Children.Add(_diceControl);
            finalStack.Children.Add(tempStack);
            finalStack.Children.Add(firstInfo.GetContent);
            otherStack.Children.Add(finalStack);
            //if we need to put to main, just change to main (?)

            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
        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 PawnPiecesXF <EnumColorChoice>();
            _piece.HeightRequest = 80;
            _piece.WidthRequest  = 80;
            _piece.Init();
            _pile       = new BasePileXF <CardInfo, CardCP, CardXF>();
            _hand       = new BaseHandXF <CardInfo, CardCP, CardXF>();
            _detective  = new DetectiveNotebookXF();
            _prediction = new PredictionAccusationXF();
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(ClueBoardGameMainViewModel.RestoreScreen));
            }
            _predictionButton = GetSmallerButton("Predict", nameof(ClueBoardGameMainViewModel.MakePredictionAsync));
            _accusationButton = GetSmallerButton("Accusation", nameof(ClueBoardGameMainViewModel.MakeAccusationAsync));

            StackLayout firstStack = new StackLayout();

            firstStack.Orientation = StackOrientation.Horizontal;
            firstStack.Children.Add(_board);

            firstStack.Children.Add(_piece);
            mainStack.Children.Add(firstStack);
            Grid tempGrid = new Grid();

            AddLeftOverColumn(tempGrid, 50);
            AddLeftOverColumn(tempGrid, 50);
            AddAutoColumns(tempGrid, 1);
            mainStack.Children.Add(tempGrid);
            AddControlToGrid(tempGrid, _prediction, 0, 0);
            _board.HorizontalOptions = LayoutOptions.Start;
            _board.VerticalOptions   = LayoutOptions.Start;
            Label label = new Label();

            label.FontSize       = 30;
            label.TextColor      = Color.White;
            label.FontAttributes = FontAttributes.Bold;
            label.SetBinding(Label.TextProperty, new Binding(nameof(ClueBoardGameMainViewModel.LeftToMove)));
            StackLayout tempStack = new StackLayout();

            var thisRoll = GetSmallerButton("Roll Dice", nameof(ClueBoardGameMainViewModel.RollDiceAsync));

            _diceControl = new DiceListControlXF <SimpleDice>();
            var endButton = GetSmallerButton("End Turn", nameof(ClueBoardGameMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;
            tempStack.Children.Add(label);
            tempStack.Children.Add(thisRoll);
            tempStack.Children.Add(endButton);
            tempStack.Children.Add(_pile);
            tempStack.Children.Add(_diceControl);
            AddControlToGrid(tempGrid, _detective, 0, 1);
            AddControlToGrid(tempGrid, tempStack, 0, 2);
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(ClueBoardGameMainViewModel.NormalTurn));
            firstInfo.AddRow("Instructions", nameof(ClueBoardGameMainViewModel.Instructions));
            _details = firstInfo.GetContent;
            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;
        }
        public AggravationMainView(IEventAggregator aggregator,
                                   TestOptions test,
                                   AggravationVMData model,
                                   AggravationGameContainer gameContainer,
                                   GameBoardGraphicsCP graphicsCP,
                                   IGamePackageRegister register
                                   )
        {
            _aggregator    = aggregator;
            _model         = model;
            _gameContainer = gameContainer;
            _aggregator.Subscribe(this);
            register.RegisterControl(_board.ThisElement, "");
            graphicsCP.LinkBoard();
            _ourPiece                   = new MarblePiecesXF <EnumColorChoice>();
            _ourPiece.Margin            = new Thickness(3, 3, 3, 3);
            _ourPiece.HorizontalOptions = LayoutOptions.Start;
            _ourPiece.VerticalOptions   = LayoutOptions.Start;
            _ourPiece.Init(); //i think.
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

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


            Button thisRoll;

            if (ScreenUsed == EnumScreen.SmallPhone)
            {
                thisRoll = GetSmallerButton("Roll Dice", nameof(AggravationMainViewModel.RollDiceAsync));
            }
            else
            {
                thisRoll           = GetGamingButton("Roll Dice", nameof(AggravationMainViewModel.RollDiceAsync));
                thisRoll.FontSize += 20;
            }

            thisRoll.Margin            = new Thickness(3, 3, 0, 0);
            thisRoll.HorizontalOptions = LayoutOptions.Start;
            thisRoll.VerticalOptions   = LayoutOptions.Start;

            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            _diceControl           = new DiceListControlXF <SimpleDice>();
            otherStack.Spacing     = 2;
            var endButton = GetGamingButton("End Turn", nameof(AggravationMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;



            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

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



            otherStack.Children.Add(_ourPiece);
            otherStack.Children.Add(thisRoll);
            otherStack.Children.Add(_diceControl);
            mainStack.Children.Add(otherStack);
            mainStack.Children.Add(_board);
            mainStack.Children.Add(firstInfo.GetContent);


            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;
        }
Exemplo n.º 23
0
        public ChineseCheckersMainView(IEventAggregator aggregator,
                                       TestOptions test, GameBoardGraphicsCP tempBoard, IGamePackageRegister register
                                       )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(ChineseCheckersMainViewModel.RestoreScreen));
            }
            register.RegisterControl(_board.ThisElement, "main");
            tempBoard.LinkBoard(); //i think
            _board.HorizontalOptions = LayoutOptions.Start;
            _board.VerticalOptions   = LayoutOptions.Start;
            mainStack.Children.Add(_board);


            var endButton = GetGamingButton("End Turn", nameof(ChineseCheckersMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

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


            mainStack.Children.Add(endButton);
            mainStack.Children.Add(firstInfo.GetContent);


            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
Exemplo n.º 24
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;
        }
        public LifeBoardGameMainView(IEventAggregator aggregator,
                                     IGamePackageRegister register,
                                     GameBoardGraphicsCP graphicsCP
                                     )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);

            Grid grid = new Grid();

            AddAutoColumns(grid, 1);
            AddLeftOverColumn(grid, 70);
            AddLeftOverColumn(grid, 30);//i think split 50/50 is fine.

            //ParentSingleUIContainer? restoreP = null;

            //risk no testing.
            //because we don't have restore this time.


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



            StackLayout stack = new StackLayout();

            stack.Margin = new Thickness(3);
            AddVerticalLabelGroup("Space Details", nameof(LifeBoardGameMainViewModel.GameDetails), stack);
            AddControlToGrid(grid, stack, 0, 2);
            //on tablets will be different.

            GameBoardXF gameBoard = new GameBoardXF(aggregator);

            gameBoard.VerticalOptions = LayoutOptions.Start;
            register.RegisterControl(gameBoard.Element, "");
            graphicsCP.LinkBoard();
            StackLayout finStack = new StackLayout();

            finStack.Children.Add(gameBoard);
            AddControlToGrid(grid, finStack, 0, 0);
            var firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(LifeBoardGameMainViewModel.NormalTurn));
            firstInfo.AddRow("Instructions", nameof(LifeBoardGameMainViewModel.Instructions));
            Grid temps = firstInfo.GetContent;

            temps.WidthRequest = gameBoard.WidthRequest;
            finStack.Children.Add(firstInfo.GetContent);
            gameBoard.Margin = new Thickness(3);
            stack            = new StackLayout();
            //everything else will go to this stack.
            stack.Margin = new Thickness(3);

            Type type = typeof(LifeBoardGameMainViewModel);
            CustomBasicList <string> list = type.GetProperties(x => x.Name.EndsWith("Screen") && x.Name != "MainScreen" && x.Name != "BoardScreen").Select(x => x.Name).ToCustomBasicList();

            if (list.Count == 0)
            {
                throw new BasicBlankException("No screens found using reflection.  Rethink");
            }
            list.ForEach(x =>
            {
                ParentSingleUIContainer middle = new ParentSingleUIContainer(x)
                {
                    HorizontalOptions = LayoutOptions.Start
                                        //Margin = new Thickness(5)
                };
                stack.Children.Add(middle);
            });
            AddControlToGrid(grid, stack, 0, 1);


            //ParentSingleUIContainer board = new ParentSingleUIContainer(nameof(LifeBoardGameMainViewModel.BoardScreen));


            //decided to attempt to use same format for desktop as for tablets.



            //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 = grid;
        }
        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;
        }
        public PaydayMainView(IEventAggregator aggregator,
                              TestOptions test,
                              GameBoardGraphicsCP graphicsCP,
                              IGamePackageRegister register,
                              PaydayGameContainer gameContainer,
                              PaydayVMData model
                              )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

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

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



            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

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


            var         firstContent = firstInfo.GetContent;
            StackLayout tempStack    = new StackLayout();

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

            tempScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Never;

            tempScroll.Content = tempStack;

            StackLayout firstStack = new StackLayout();

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

            //this is very iffy.  lots of adjustments may be needed.
            //it only works for large tablets now anyways.


            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, 130);
            AddPixelColumn(grid1, 250);
            //AddLeftOverColumn(grid1, 1);
            StackLayout stack1 = new StackLayout();

            AddControlToGrid(grid1, stack1, 0, 0);

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

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

            ParentSingleUIContainer roller = new ParentSingleUIContainer(nameof(PaydayMainViewModel.RollerScreen));

            stack1.Children.Add(roller);
            AddControlToGrid(grid1, tempScroll, 0, 1); // instructions on card
            //StackLayout endStack = new StackLayout();
            //endStack.Children.Add(_score);
            //endStack.Children.Add(firstContent);


            AddControlToGrid(grid1, _score, 0, 2);
            //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);
            StackLayout finalStack = new StackLayout();

            _dealList = new BaseHandXF <DealCard, CardGraphicsCP, DealCardXF>();
            _dealList.HeightRequest     = 500;
            _dealList.HandType          = HandObservable <DealCard> .EnumHandList.Vertical;
            _dealList.HorizontalOptions = LayoutOptions.Start;

            finalStack.Children.Add(_dealList);
            AddControlToGrid(grid2, finalStack, 0, 0);
            _currentPiece               = new PawnPiecesXF <EnumColorChoice>();
            _currentPiece.IsVisible     = false; // until proven to need it
            _currentPiece.WidthRequest  = 70;
            _currentPiece.HeightRequest = 70;
            _currentPiece.Margin        = new Thickness(5, 5, 5, 5);
            _currentPiece.Init();
            finalStack.Children.Add(_currentPiece);

            ParentSingleUIContainer mailList = new ParentSingleUIContainer(nameof(PaydayMainViewModel.MailListScreen));

            AddControlToGrid(grid2, mailList, 0, 1);



            ParentSingleUIContainer extras = new ParentSingleUIContainer(nameof(PaydayMainViewModel.DealOrBuyScreen));

            AddControlToGrid(grid2, extras, 0, 1);

            extras = new ParentSingleUIContainer(nameof(PaydayMainViewModel.BuyDealScreen));
            AddControlToGrid(grid2, extras, 0, 1);

            extras = new ParentSingleUIContainer(nameof(PaydayMainViewModel.ChooseDealScreen));
            AddControlToGrid(grid2, extras, 0, 1);
            extras = new ParentSingleUIContainer(nameof(PaydayMainViewModel.LotteryScreen));
            AddControlToGrid(grid2, extras, 0, 1);
            extras = new ParentSingleUIContainer(nameof(PaydayMainViewModel.PlayerScreen));
            AddControlToGrid(grid2, extras, 0, 1);
            //_score.Margin = new Thickness(0, -150, 0, 0);
            mainStack.Children.Add(firstContent);

            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;
        }
        public PassOutDiceGameMainView(IEventAggregator aggregator,
                                       TestOptions test,
                                       PassOutDiceGameVMData model,
                                       GameBoardGraphicsCP graphicsCP,
                                       IGamePackageRegister register
                                       )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(PassOutDiceGameMainViewModel.RestoreScreen));
            }
            register.RegisterControl(_board.ThisElement, ""); //hopefully okay.
            graphicsCP.LinkBoard();


            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            _diceControl           = new DiceListControlXF <SimpleDice>();
            otherStack.Children.Add(_diceControl);

            Grid grid = new Grid();

            AddLeftOverColumn(grid, 1);
            AddAutoColumns(grid, 1);
            AddControlToGrid(grid, _board, 0, 1);
            AddControlToGrid(grid, mainStack, 0, 0);

            StackLayout finalStack = new StackLayout();

            otherStack.Children.Add(finalStack);
            var endButton = GetGamingButton("End Turn", nameof(PassOutDiceGameMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;
            otherStack.Children.Add(endButton);
            mainStack.Children.Add(otherStack);


            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

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

            finalStack.Children.Add(firstInfo.GetContent);
            finalStack.Children.Add(endButton);
            finalStack.Children.Add(_diceControl);



            if (restoreP != null)
            {
                //todo:  figure out where to place the restore ui if there is a restore option.
                finalStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = grid;
        }
Exemplo n.º 29
0
        public XactikaMainView(IEventAggregator aggregator,
                               TestOptions test,
                               XactikaVMData model,
                               IGamePackageRegister register,
                               StatsBoardCP boardCP
                               )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            register.RegisterControl(_stats1.Element, "main");
            boardCP.LinkBoard();
            _score         = new ScoreBoardWPF();
            _playerHandWPF = new BaseHandWPF <XactikaCardInformation, XactikaGraphicsCP, CardGraphicsWPF>();
            _shape1        = new ChooseShapeWPF();
            _trick1        = new SeveralPlayersTrickWPF <EnumShapes, XactikaCardInformation, XactikaGraphicsCP, CardGraphicsWPF, XactikaPlayerItem>();

            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

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


            _score.AddColumn("Cards Left", false, nameof(XactikaPlayerItem.ObjectCount)); //very common.
            _score.AddColumn("Bid Amount", false, nameof(XactikaPlayerItem.BidAmount));
            _score.AddColumn("Tricks Won", false, nameof(XactikaPlayerItem.TricksWon));
            _score.AddColumn("Current Score", false, nameof(XactikaPlayerItem.CurrentScore));
            _score.AddColumn("Total Score", false, nameof(XactikaPlayerItem.TotalScore));
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(XactikaMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(XactikaMainViewModel.Status));
            firstInfo.AddRow("Round", nameof(XactikaMainViewModel.RoundNumber));
            firstInfo.AddRow("Mode", nameof(XactikaMainViewModel.GameModeText));
            StackPanel shapeStack = new StackPanel();

            shapeStack.Children.Add(_shape1);
            ParentSingleUIContainer parent = new ParentSingleUIContainer()
            {
                Name = nameof(XactikaMainViewModel.ShapeScreen)
            };

            shapeStack.Children.Add(parent);
            Grid tempGrid = new Grid();

            AddAutoRows(tempGrid, 1);
            AddLeftOverColumn(tempGrid, 1);
            AddAutoColumns(tempGrid, 2);
            StackPanel tempStack = new StackPanel();

            tempStack.Orientation = Orientation.Horizontal;
            tempStack.Children.Add(_trick1);
            tempStack.Children.Add(shapeStack);
            AddControlToGrid(tempGrid, tempStack, 0, 0);
            parent = new ParentSingleUIContainer()
            {
                Name = nameof(XactikaMainViewModel.BidScreen)
            };
            AddControlToGrid(tempGrid, parent, 0, 0); // if one is visible, then the other is not
            AddControlToGrid(tempGrid, _stats1, 0, 2);
            AddControlToGrid(tempGrid, _score, 0, 1);
            mainStack.Children.Add(tempGrid);
            mainStack.Children.Add(_playerHandWPF);
            mainStack.Children.Add(firstInfo.GetContent);
            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
        public ConnectTheDotsMainView(IEventAggregator aggregator,
                                      TestOptions test, GameBoardGraphicsCP graphicsCP, IGamePackageRegister register
                                      )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            register.RegisterControl(_board.Element, "");
            graphicsCP.LinkBoard();
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(ConnectTheDotsMainViewModel.RestoreScreen));
            }
            _score = new ScoreBoardXF();
            _score.AddColumn("Score", true, nameof(ConnectTheDotsPlayerItem.Score));

            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

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


            mainStack.Children.Add(_board);
            mainStack.Children.Add(firstInfo.GetContent);
            mainStack.Children.Add(_score);


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