public BackgammonMainViewModel(CommandContainer commandContainer,
                                BackgammonMainGameClass mainGame,
                                BackgammonVMData model,
                                BasicData basicData,
                                TestOptions test,
                                IGamePackageResolver resolver,
                                IStandardRollProcesses roller,
                                GameBoardProcesses gameBoard,
                                BackgammonGameContainer gameContainer
                                )
     : base(commandContainer, mainGame, model, basicData, test, resolver, roller)
 {
     _mainGame  = mainGame;
     _gameBoard = gameBoard;
     gameContainer.MakeMoveAsync = MakeMoveAsync;
 }
Example #2
0
 public BackgammonMainGameClass(IGamePackageResolver resolver,
                                IEventAggregator aggregator,
                                BasicData basic,
                                TestOptions test,
                                BackgammonVMData model,
                                IMultiplayerSaveState state,
                                IAsyncDelayer delay,
                                CommandContainer command,
                                BackgammonGameContainer container,
                                StandardRollProcesses <SimpleDice, BackgammonPlayerItem> roller,
                                GameBoardProcesses gameBoard
                                ) : base(resolver, aggregator, basic, test, model, state, delay, command, container, roller)
 {
     _model         = model;
     _command       = command;
     _gameBoard     = gameBoard;
     _gameContainer = container;
     _gameContainer.DiceVisibleProcesses = DiceVisibleProcesses;
 }
Example #3
0
 public GameBoardProcesses(BackgammonGameContainer gameContainer, GameBoardGraphicsCP graphicsBoard, BackgammonVMData model)
 {
     _gameContainer = gameContainer;
     _graphicsBoard = graphicsBoard;
     _model         = model;
 }
Example #4
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;
        }
Example #5
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;
        }