コード例 #1
0
        private readonly SequenceDiceMainGameClass _mainGame; //if we don't need, delete.

        public SequenceDiceMainViewModel(CommandContainer commandContainer,
                                         SequenceDiceMainGameClass mainGame,
                                         SequenceDiceVMData model,
                                         BasicData basicData,
                                         TestOptions test,
                                         IGamePackageResolver resolver,
                                         IStandardRollProcesses roller
                                         )
            : base(commandContainer, mainGame, model, basicData, test, resolver, roller)
        {
            _mainGame = mainGame;
        }
コード例 #2
0
 public SequenceDiceMainGameClass(IGamePackageResolver resolver,
                                  IEventAggregator aggregator,
                                  BasicData basic,
                                  TestOptions test,
                                  SequenceDiceVMData model,
                                  IMultiplayerSaveState state,
                                  IAsyncDelayer delay,
                                  CommandContainer command,
                                  SequenceDiceGameContainer container,
                                  StandardRollProcesses <SimpleDice, SequenceDicePlayerItem> roller
                                  ) : base(resolver, aggregator, basic, test, model, state, delay, command, container, roller)
 {
     _model = model;
 }
コード例 #3
0
        public SequenceDiceMainView(IEventAggregator aggregator,
                                    TestOptions test,
                                    SequenceDiceVMData model
                                    )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            _board        = new GameBoardWPF();
            _board.Margin = new Thickness(3);

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

            tempStack.Orientation = Orientation.Horizontal;
            mainStack.Children.Add(tempStack);
            tempStack.Children.Add(_board);
            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(SequenceDiceMainViewModel.RestoreScreen)
                };
            }

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

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

            mainStack.Children.Add(otherStack);

            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(SequenceDiceMainViewModel.NormalTurn));
            firstInfo.AddRow("Instructions", nameof(SequenceDiceMainViewModel.Instructions));
            firstInfo.AddRow("Status", nameof(SequenceDiceMainViewModel.Status));
            //if we need to put to main, just change to main (?)
            tempStack.Children.Add(firstInfo.GetContent);
            if (restoreP != null)
            {
                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
 public void LoadBoard(PlayerCollection <SequenceDicePlayerItem> playerList, TestOptions thisTest, SequenceDiceVMData model)
 {
     //has to be done this way so it can figure out what it needs.
     _model = model;
     if (_didInit == true)
     {
         return;
     }
     if (playerList.Count() == 2)
     {
         _winList = _privateBoard.GetPossibleCombinations(6);
     }
     else if (playerList.Count() == 3)
     {
         _winList = _privateBoard.GetPossibleCombinations(5);
     }
     else
     {
         throw new BasicBlankException("Should have been 2 or 3 players.  Rethink");
     }
     _privateBoard.MainObjectSelector = Items => Items.Player;
     _didInit = true;
     //_thisMod = thisMod;
     _thisTest = thisTest;
     if (_autoResume == true)
     {
         return;
     }
     _privateBoard.ForEach(thisSpace =>
     {
         //populate the numbers.  that is needed for lots of things.
         if (thisSpace.Vector.Row == 1 & thisSpace.Vector.Column == 1 |
             thisSpace.Vector.Row == 6 & thisSpace.Vector.Column == 6 |
             thisSpace.Vector.Row == 1 & thisSpace.Vector.Column == 6 |
             thisSpace.Vector.Row == 6 & thisSpace.Vector.Column == 1)
         {
             thisSpace.Number = 2;
         }
         else if (((thisSpace.Vector.Row == 5) & (thisSpace.Vector.Column == 1)) |
                  ((thisSpace.Vector.Row == 1) & (thisSpace.Vector.Column == 2)) |
                  ((thisSpace.Vector.Row == 2) & (thisSpace.Vector.Column == 6)) |
                  ((thisSpace.Vector.Row == 6) & (thisSpace.Vector.Column == 5)))
         {
             thisSpace.Number = 3;
         }
         else if (((thisSpace.Vector.Row == 4) & (thisSpace.Vector.Column == 1)) |
                  ((thisSpace.Vector.Row == 1) & (thisSpace.Vector.Column == 3)) |
                  ((thisSpace.Vector.Row == 3) & (thisSpace.Vector.Column == 6)) |
                  ((thisSpace.Vector.Row == 6) & (thisSpace.Vector.Column == 4)))
         {
             thisSpace.Number = 4;
         }
         else if (((thisSpace.Vector.Row == 3) & (thisSpace.Vector.Column == 1)) |
                  ((thisSpace.Vector.Row == 1) & (thisSpace.Vector.Column == 4)) |
                  ((thisSpace.Vector.Row == 4) & (thisSpace.Vector.Column == 6)) |
                  ((thisSpace.Vector.Row == 6) & (thisSpace.Vector.Column == 3)))
         {
             thisSpace.Number = 5;
         }
         else if (((thisSpace.Vector.Row == 2) & (thisSpace.Vector.Column == 1)) |
                  ((thisSpace.Vector.Row == 1) & (thisSpace.Vector.Column == 5)) |
                  ((thisSpace.Vector.Row == 5) & (thisSpace.Vector.Column == 6)) |
                  ((thisSpace.Vector.Row == 6) & (thisSpace.Vector.Column == 2)))
         {
             thisSpace.Number = 6;
         }
         else if (((thisSpace.Vector.Row == 5) & (thisSpace.Vector.Column == 2)) |
                  ((thisSpace.Vector.Row == 2) & (thisSpace.Vector.Column == 2)) |
                  ((thisSpace.Vector.Row == 5) & (thisSpace.Vector.Column == 5)) |
                  ((thisSpace.Vector.Row == 2) & (thisSpace.Vector.Column == 5)))
         {
             thisSpace.Number = 7;
         }
         else if (((thisSpace.Vector.Row == 4) & (thisSpace.Vector.Column == 2)) |
                  ((thisSpace.Vector.Row == 2) & (thisSpace.Vector.Column == 3)) |
                  ((thisSpace.Vector.Row == 5) & (thisSpace.Vector.Column == 4)) |
                  ((thisSpace.Vector.Row == 3) & (thisSpace.Vector.Column == 5)))
         {
             thisSpace.Number = 8;
         }
         else if (((thisSpace.Vector.Row == 3) & (thisSpace.Vector.Column == 2)) |
                  ((thisSpace.Vector.Row == 2) & (thisSpace.Vector.Column == 4)) |
                  ((thisSpace.Vector.Row == 5) & (thisSpace.Vector.Column == 3)) |
                  ((thisSpace.Vector.Row == 4) & (thisSpace.Vector.Column == 5)))
         {
             thisSpace.Number = 9;
         }
         else if (((thisSpace.Vector.Row == 4) & (thisSpace.Vector.Column == 3)) |
                  ((thisSpace.Vector.Row == 3) & (thisSpace.Vector.Column == 3)) |
                  ((thisSpace.Vector.Row == 3) & (thisSpace.Vector.Column == 4)) |
                  ((thisSpace.Vector.Row == 4) & (thisSpace.Vector.Column == 4)))
         {
             thisSpace.Number = 12;
         }
         else
         {
             throw new BasicBlankException($"Cannnot find a space for {thisSpace.Vector.Row} row, {thisSpace.Vector.Column} column");
         }
     });
 }