Example #1
0
 public GameBoardCP(DiceDominosGameContainer gameContainer, DiceDominosVMData model) : base(gameContainer.Command)
 {
     Columns        = 7;
     Rows           = 4;
     Text           = "Dominos";
     HasFrame       = true;
     _gameContainer = gameContainer;
     _model         = model;
 }
        public DiceDominosMainView(IEventAggregator aggregator,
                                   TestOptions test, DiceDominosVMData model,
                                   GameBoardCP gameBoard
                                   )
        {
            _aggregator = aggregator;
            _model      = model;
            _gameBoard  = gameBoard;
            _aggregator.Subscribe(this);
            StackPanel mainStack = new StackPanel();

            ParentSingleUIContainer?restoreP = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(DiceDominosMainViewModel.RestoreScreen)
                };
            }
            _gameBoard1 = new CardBoardWPF <SimpleDominoInfo, ts, DominosWPF <SimpleDominoInfo> >();
            mainStack.Children.Add(_gameBoard1);
            var        thisRoll   = GetGamingButton("Roll Dice", nameof(DiceDominosMainViewModel.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(DiceDominosMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            mainStack.Children.Add(otherStack);
            mainStack.Children.Add(endButton);
            _score = new ScoreBoardWPF();
            //anything you need for the scoreboard.
            _score.AddColumn("Dominos Won", true, nameof(DiceDominosPlayerItem.DominosWon), rightMargin: 10);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(DiceDominosMainViewModel.NormalTurn)); // there is no roll number needed for this game.
            firstInfo.AddRow("Status", nameof(DiceDominosMainViewModel.Status));
            mainStack.Children.Add(firstInfo.GetContent);
            mainStack.Children.Add(_score);
            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
 public DiceDominosMainViewModel(CommandContainer commandContainer,
                                 DiceDominosMainGameClass mainGame,
                                 DiceDominosVMData viewModel,
                                 BasicData basicData,
                                 TestOptions test,
                                 IGamePackageResolver resolver,
                                 IStandardRollProcesses roller,
                                 DiceDominosGameContainer gameContainer,
                                 GameBoardCP gameBoard
                                 )
     : base(commandContainer, mainGame, viewModel, basicData, test, resolver, roller)
 {
     _mainGame  = mainGame;
     _gameBoard = gameBoard;
     gameContainer.DominoClickedAsync = DominoClickedAsync;
     gameBoard.SendEnableProcesses(this, (() => _mainGame.SaveRoot.HasRolled));
 }
Example #4
0
 public DiceDominosMainGameClass(IGamePackageResolver mainContainer,
                                 IEventAggregator aggregator,
                                 BasicData basicData,
                                 TestOptions test,
                                 DiceDominosVMData currentMod,
                                 IMultiplayerSaveState state,
                                 IAsyncDelayer delay,
                                 CommandContainer command,
                                 DiceDominosGameContainer gameContainer,
                                 StandardRollProcesses <SimpleDice, DiceDominosPlayerItem> roller,
                                 DiceDominosComputerAI computerAI,
                                 GameBoardCP gameBoard
                                 ) :
     base(mainContainer, aggregator, basicData, test, currentMod, state, delay, command, gameContainer, roller)
 {
     _model          = currentMod; //if not needed, take this out and the _model variable.
     _roller         = roller;
     _computerAI     = computerAI;
     _gameBoard      = gameBoard;
     _gameBoard.Text = "Dominos";
     _gameContainer  = gameContainer;
 }
Example #5
0
        public DiceDominosMainView(IEventAggregator aggregator,
                                   TestOptions test, DiceDominosVMData model,
                                   GameBoardCP gameBoard
                                   )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            _model     = model;
            _gameBoard = gameBoard;
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(DiceDominosMainViewModel.RestoreScreen));
            }
            _gameBoard1 = new CardBoardXF <SimpleDominoInfo, ts, DominosXF <SimpleDominoInfo> >();
            mainStack.Children.Add(_gameBoard1);

            var thisRoll = GetGamingButton("Roll Dice", nameof(DiceDominosMainViewModel.RollDiceAsync));

            thisRoll.VerticalOptions   = LayoutOptions.Start;
            thisRoll.HorizontalOptions = LayoutOptions.Start;
            StackLayout otherStack = new StackLayout();

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

            endButton.HorizontalOptions = LayoutOptions.Start;
            otherStack.Children.Add(endButton);
            mainStack.Children.Add(otherStack);
            _score = new ScoreBoardXF();
            _score.AddColumn("Dominos Won", true, nameof(DiceDominosPlayerItem.DominosWon), rightMargin: 10);
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(DiceDominosMainViewModel.NormalTurn)); // there is no roll number needed for this game.
            firstInfo.AddRow("Status", nameof(DiceDominosMainViewModel.Status));

            if (ScreenUsed == EnumScreen.SmallPhone)
            {
                otherStack.Children.Add(_score);
                otherStack.Children.Add(firstInfo.GetContent);
                otherStack.Children.Add(thisRoll);
                otherStack.Children.Add(endButton);
                otherStack.Children.Add(_diceControl);
            }
            else
            {
                otherStack.Children.Add(thisRoll);
                otherStack.Children.Add(endButton);
                otherStack.Children.Add(_diceControl);
                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;
        }