public void LoadList(DominosRegularVMData model, IGamePackageResolver resolver)
        {
            _model = model;
            IProportionImage thisP = resolver.Resolve <IProportionImage>(ts.TagUsed);

            Text      = "Display";
            _thisGrid = new Grid();
            Grid finalGrid = new Grid();

            _dominoList = _model.GameBoard1 !.DominoList;
            _dominoList.CollectionChanged += DominoCollectionChange;
            if (_dominoList.Count != 3)
            {
                throw new BasicBlankException("Only 3 dominos are supported");
            }
            if (_dominoList.First().DefaultSize.Width == 0)
            {
                throw new BasicBlankException("The width can never be 0 for dominos");
            }
            SKSize thisSize = _dominoList.First().DefaultSize.GetSizeUsed(thisP.Proportion);
            int    pixels   = (int)thisSize.Width / 2;

            for (int x = 0; x < 4; x++)
            {
                AddPixelColumn(_thisGrid, pixels);
            }
            RepopulateList();
            SetUpMarginsOnParentControl(_thisGrid);
            finalGrid.Children.Add(ThisDraw);
            finalGrid.Children.Add(_thisGrid);
            Content = finalGrid;
        }
예제 #2
0
        public DominosRegularMainView(IEventAggregator aggregator,
                                      TestOptions test,
                                      DominosRegularVMData model,
                                      IGamePackageResolver resolver
                                      )
        {
            _aggregator = aggregator;
            _model      = model;
            _resolver   = resolver;
            _aggregator.Subscribe(this);
            StackPanel mainStack = new StackPanel();

            ParentSingleUIContainer?restoreP = null;

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


            _bone          = new BoneYardWPF <SimpleDominoInfo, ts, DominosWPF <SimpleDominoInfo>, DominosBasicShuffler <SimpleDominoInfo> >();
            _playerHandWPF = new BaseHandWPF <SimpleDominoInfo, ts, DominosWPF <SimpleDominoInfo> >();
            _score         = new ScoreBoardWPF();
            _gameBoard1    = new GameBoardUI();
            _bone.Height   = 300;
            _bone.Width    = 800; //can adjust as needed.
            mainStack.Children.Add(_bone);
            mainStack.Children.Add(_gameBoard1);
            mainStack.Children.Add(_playerHandWPF);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(DominosRegularMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(DominosRegularMainViewModel.Status));
            mainStack.Children.Add(firstInfo.GetContent);
            _score.AddColumn("Total Score", true, nameof(DominosRegularPlayerItem.TotalScore));
            _score.AddColumn("Dominos Left", true, nameof(DominosRegularPlayerItem.ObjectCount)); // if not important, can just comment
            mainStack.Children.Add(_score);
            Button endTurn = GetGamingButton("End Turn", nameof(DominosRegularMainViewModel.EndTurnAsync));

            endTurn.HorizontalAlignment = HorizontalAlignment.Left;
            mainStack.Children.Add(endTurn);



            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;
        }
예제 #3
0
 public DominosRegularMainGameClass(IGamePackageResolver resolver,
                                    IEventAggregator aggregator,
                                    BasicData basic,
                                    TestOptions test,
                                    DominosRegularVMData model,
                                    IMultiplayerSaveState state,
                                    IAsyncDelayer delay,
                                    CommandContainer command,
                                    BasicGameContainer <DominosRegularPlayerItem, DominosRegularSaveInfo> gameContainer
                                    ) : base(resolver, aggregator, basic, test, model, state, delay, command, gameContainer)
 {
     _model           = model;
     DominosToPassOut = 6; //usually 6 but can be changed.
     _model.GameBoard1.DominoPileClicked = DominoPileClicked;
 }
예제 #4
0
        public DominosRegularMainView(IEventAggregator aggregator,
                                      TestOptions test,
                                      DominosRegularVMData model,
                                      IGamePackageResolver resolver
                                      )
        {
            _aggregator = aggregator;
            _model      = model;
            _resolver   = resolver;
            _aggregator.Subscribe(this);
            StackLayout mainStack = new StackLayout();

            _gameBoard1 = new GameBoardUI();
            ParentSingleUIContainer?restoreP = null;

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


            _bone         = new BoneYardXF <SimpleDominoInfo, ts, DominosXF <SimpleDominoInfo>, DominosBasicShuffler <SimpleDominoInfo> >();
            _playerHandXF = new BaseHandXF <SimpleDominoInfo, ts, DominosXF <SimpleDominoInfo> >();
            _score        = new ScoreBoardXF();
            if (ScreenUsed != EnumScreen.SmallPhone)
            {
                _bone.HeightRequest = 300;
            }
            else
            {
                _bone.HeightRequest = 90;
            }
            _bone.WidthRequest = 300;
            mainStack.Children.Add(_bone);
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(DominosRegularMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(DominosRegularMainViewModel.Status));
            mainStack.Children.Add(firstInfo.GetContent);
            _score.AddColumn("Total Score", true, nameof(DominosRegularPlayerItem.TotalScore));
            _score.AddColumn("Dominos Left", true, nameof(DominosRegularPlayerItem.ObjectCount)); // if not important, can just comment
            mainStack.Children.Add(_score);
            Button endTurn = GetGamingButton("End Turn", nameof(DominosRegularMainViewModel.EndTurnAsync));

            endTurn.HorizontalOptions = LayoutOptions.Start;

            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            mainStack.Children.Add(otherStack);
            otherStack.Children.Add(_gameBoard1);
            mainStack.Children.Add(_playerHandXF);
            otherStack.Children.Add(firstInfo.GetContent);
            otherStack             = new StackLayout();
            otherStack.Orientation = StackOrientation.Horizontal;
            otherStack.Children.Add(_score);
            otherStack.Children.Add(endTurn);
            mainStack.Children.Add(otherStack);



            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }