コード例 #1
0
        public MainBoardView(GameBoardCP boardcp)
        {
            CardBoardXF <SimpleDominoInfo, ts, DominosXF <SimpleDominoInfo> > boardui = new CardBoardXF <SimpleDominoInfo, ts, DominosXF <SimpleDominoInfo> >();

            Content = boardui;
            boardui.LoadList(boardcp, ts.TagUsed);
        }
コード例 #2
0
        public MainBoardView(GameBoardCP boardcp)
        {
            CardBoardWPF <SimpleDominoInfo, ts, DominosWPF <SimpleDominoInfo> > boardui = new CardBoardWPF <SimpleDominoInfo, ts, DominosWPF <SimpleDominoInfo> >();

            Content = boardui;
            boardui.LoadList(boardcp, ts.TagUsed);
            //hopefully this simple this time.
        }
コード例 #3
0
        //for mexican train dominos, will go ahead and change the type of dominos used.

        public DominosRegularVMData(CommandContainer command,
                                    IGamePackageResolver resolver,
                                    DominosBasicShuffler <SimpleDominoInfo> shuffle
                                    )
        {
            PlayerHand1 = new HandObservable <SimpleDominoInfo>(command);
            BoneYard    = new DominosBoneYardClass <SimpleDominoInfo>(this, command, resolver, shuffle);
            PlayerHand1.ObjectClickedAsync += PlayerHand1_ObjectClickedAsync;
            PlayerHand1.BoardClickedAsync  += PlayerHand1_BoardClickedAsync;
            GameBoard1 = new GameBoardCP(command);
        }
コード例 #4
0
 //private bool _disableDrawing = true;
 public SpaceXF(FieldInfoCP field)
 {
     //return;
     BindingContext         = field; // needs to be this way so if somethign changes,can act accordingly
     _space                 = field.Vector;
     CommandParameter       = _space;
     _gameBoard1            = Resolve <GameBoardCP>();
     ThisDraw.PaintSurface += ThisDraw_PaintSurface;
     this.SetName(nameof(BattleshipMainViewModel.MakeMoveAsync));
     GamePackageViewModelBinder.ManuelElements.Add(this);
     WidthRequest  = _gameBoard1.SpaceSize;
     HeightRequest = _gameBoard1.SpaceSize; // used the idea from tic tac toe.
 }
コード例 #5
0
 public SpaceWPF(FieldInfoCP field)
 {
     DataContext             = field; // needs to be this way so if somethign changes,can act accordingly
     _thisDraw               = new SKElement();
     _space                  = field.Vector;
     CommandParameter        = _space;
     _gameBoard1             = Resolve <GameBoardCP>();
     _thisDraw.PaintSurface += ThisDraw_PaintSurface;
     Name = nameof(BattleshipMainViewModel.MakeMoveAsync);
     GamePackageViewModelBinder.ManuelElements.Add(this); //just in case.  because i have seen patterns where ones i get later never get picked up.
     Width   = _gameBoard1.SpaceSize;
     Height  = _gameBoard1.SpaceSize;                     // used the idea from tic tac toe.
     Content = _thisDraw;
 }
コード例 #6
0
        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;
        }
コード例 #7
0
 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));
 }
コード例 #8
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;
        }