コード例 #1
0
        public ConnectFourMainView(IEventAggregator aggregator,
                                   TestOptions test
                                   )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

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

            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(ConnectFourMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(ConnectFourMainViewModel.Status));
            mainStack.Children.Add(firstInfo.GetContent);
            mainStack.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;
        }
コード例 #2
0
        public TicTacToeMainView(IEventAggregator aggregator,
                                 TestOptions test
                                 )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(TicTacToeMainViewModel.RestoreScreen));
            }
            _board = new GameBoardXF();
            mainStack.Children.Add(_board);
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(TicTacToeMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(TicTacToeMainViewModel.Status)); // this may have to show the status to begin with (?)
            mainStack.Children.Add(firstInfo.GetContent);

            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
コード例 #3
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;
        }
コード例 #4
0
        public SequenceDiceMainView(IEventAggregator aggregator,
                                    TestOptions test,
                                    SequenceDiceVMData model
                                    )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            _board        = new GameBoardXF();
            _board.Margin = new Thickness(2);
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

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

            mainStack.Children.Add(_board);


            var         thisRoll   = GetGamingButton("Roll Dice", nameof(SequenceDiceMainViewModel.RollDiceAsync));
            StackLayout otherStack = new StackLayout();

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


            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(SequenceDiceMainViewModel.NormalTurn));
            firstInfo.AddRow("Instructions", nameof(SequenceDiceMainViewModel.Instructions));
            firstInfo.AddRow("Status", nameof(SequenceDiceMainViewModel.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;
        }
コード例 #5
0
        //private Button _button;
        public FroggiesMainView(IEventAggregator aggregator, FroggiesMainGameClass game)
        {
            //InputTransparent = true;
            //TestControl test = new TestControl();

            //Content = test;
            //GamePackageViewModelBinder.StopRun = true;
            //TestControl test = new TestControl();
            //Content = test;
            //_button = new Button()
            //{
            //    Text = "Main"
            //};
            //_button.Clicked += Button_Clicked;
            //Content = _button;
            aggregator.Subscribe(this);

            Grid thisGrid = new Grid();

            AddAutoColumns(thisGrid, 3);
            StackLayout stack = new StackLayout();
            GameBoardXF board = new GameBoardXF(aggregator, game, this);

            board.Margin = new Thickness(5, 5, 5, 5);
            stack.Margin = new Thickness(5, 5, 5, 5);

            AddControlToGrid(thisGrid, board, 0, 0);
            Button redoButton = GetGamingButton("Redo Game", nameof(FroggiesMainViewModel.RedoAsync));

            stack.Children.Add(redoButton);
            SimpleLabelGridXF thisLab = new SimpleLabelGridXF();

            thisLab.AddRow("Moves Left", nameof(FroggiesMainViewModel.MovesLeft));
            thisLab.AddRow("How Many Frogs Currently", nameof(FroggiesMainViewModel.NumberOfFrogs));
            thisLab.AddRow("How Many Frogs To Start", nameof(FroggiesMainViewModel.StartingFrogs));
            stack.Children.Add(thisLab.GetContent);
            AddControlToGrid(thisGrid, stack, 0, 1);
            TestControl test = new TestControl();

            AddControlToGrid(thisGrid, test, 0, 2);
            Content = thisGrid; //i think.
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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;
        }