示例#1
0
        private readonly FourSuitRummyGameContainer _gameContainer; //if we don't need it, take it out.

        public FourSuitRummyMainGameClass(IGamePackageResolver mainContainer,
                                          IEventAggregator aggregator,
                                          BasicData basicData,
                                          TestOptions test,
                                          FourSuitRummyVMData currentMod,
                                          IMultiplayerSaveState state,
                                          IAsyncDelayer delay,
                                          ICardInfo <RegularRummyCard> cardInfo,
                                          CommandContainer command,
                                          FourSuitRummyGameContainer gameContainer)
            : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer)
        {
            _model         = currentMod;
            _command       = command;
            _gameContainer = gameContainer;
        }
        public FourSuitRummyMainViewModel(CommandContainer commandContainer,
                                          FourSuitRummyMainGameClass mainGame,
                                          FourSuitRummyVMData viewModel,
                                          BasicData basicData,
                                          TestOptions test,
                                          IGamePackageResolver resolver,
                                          FourSuitRummyGameContainer gameContainer
                                          )
            : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
        {
            _mainGame      = mainGame;
            _model         = viewModel;
            _resolver      = resolver;
            _gameContainer = gameContainer;
            _model.Deck1.NeverAutoDisable = true;
            var player = _mainGame.PlayerList.GetSelf();

            _mainGame.Aggregator.Subscribe(player);
            _model.TempSets.Init(this);
            _model.TempSets.ClearBoard(); //try this too.
            _model.TempSets.SetClickedAsync += TempSets_SetClickedAsync;
            _model.PlayerHand1.AutoSelect    = HandObservable <RegularRummyCard> .EnumAutoType.SelectAsMany;
        }
示例#3
0
        public FourSuitRummyMainView(IEventAggregator aggregator,
                                     TestOptions test,
                                     FourSuitRummyVMData model
                                     )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);

            _deckGPile     = new BaseDeckWPF <RegularRummyCard, ts, DeckOfCardsWPF <RegularRummyCard> >();
            _discardGPile  = new BasePileWPF <RegularRummyCard, ts, DeckOfCardsWPF <RegularRummyCard> >();
            _score         = new ScoreBoardWPF();
            _playerHandWPF = new BaseHandWPF <RegularRummyCard, ts, DeckOfCardsWPF <RegularRummyCard> >();
            _tempG         = new TempRummySetsWPF <EnumSuitList, EnumColorList, RegularRummyCard, ts, DeckOfCardsWPF <RegularRummyCard> >();
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

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

            Grid finalGrid = new Grid();

            AddLeftOverRow(finalGrid, 20); // has to be this way because of scoreboard.
            AddLeftOverRow(finalGrid, 80);
            mainStack.Children.Add(finalGrid);



            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_deckGPile);
            otherStack.Children.Add(_discardGPile); // can reposition or not even have as well.

            Grid firstGrid = new Grid();

            AddLeftOverColumn(firstGrid, 60); // 50 was too much.  if there is scrolling, i guess okay.
            AddLeftOverColumn(firstGrid, 10); // for buttons (can change if necessary)
            AddAutoColumns(firstGrid, 1);     // maybe 1 (well see)
            AddLeftOverColumn(firstGrid, 15); // for other details
            AddLeftOverColumn(firstGrid, 30); // for scoreboard
            _deckGPile.HorizontalAlignment    = HorizontalAlignment.Left;
            _deckGPile.VerticalAlignment      = VerticalAlignment.Top;
            _discardGPile.HorizontalAlignment = HorizontalAlignment.Left;
            _discardGPile.VerticalAlignment   = VerticalAlignment.Top;
            AddControlToGrid(firstGrid, otherStack, 0, 2);     // i think
            AddControlToGrid(firstGrid, _playerHandWPF, 0, 0); // i think
            var thisBut = GetGamingButton("Play Sets", nameof(FourSuitRummyMainViewModel.PlaySetsAsync));

            AddControlToGrid(firstGrid, thisBut, 0, 1);
            _score.AddColumn("Cards Left", true, nameof(FourSuitRummyPlayerItem.ObjectCount)); //very common.
            _score.AddColumn("Total Score", true, nameof(FourSuitRummyPlayerItem.TotalScore));
            AddControlToGrid(firstGrid, _score, 0, 4);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(FourSuitRummyMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(FourSuitRummyMainViewModel.Status));
            AddControlToGrid(firstGrid, firstInfo.GetContent, 0, 3);
            AddControlToGrid(finalGrid, firstGrid, 0, 0); // i think
            _tempG.Height = 700;
            StackPanel thirdStack = new StackPanel();

            thirdStack.Orientation = Orientation.Horizontal;
            thirdStack.Children.Add(_tempG);
            Grid setGrid = new Grid();

            AddLeftOverColumn(setGrid, 50);
            AddLeftOverColumn(setGrid, 50);
            AddPixelRow(setGrid, 700); // i think this one needs that.
            thirdStack.Children.Add(setGrid);

            ParentSingleUIContainer parent = new ParentSingleUIContainer()
            {
                Name = nameof(FourSuitRummyMainViewModel.YourSetsScreen)
            };

            AddControlToGrid(setGrid, parent, 0, 0);
            parent = new ParentSingleUIContainer()
            {
                Name = nameof(FourSuitRummyMainViewModel.OpponentSetsScreen)
            };
            AddControlToGrid(setGrid, parent, 0, 1);

            AddControlToGrid(finalGrid, thirdStack, 1, 0); // i think


            _deckGPile.Margin = new Thickness(5, 5, 5, 5);

            _discardGPile.Margin = new Thickness(5, 5, 5, 5);


            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;
        }
示例#4
0
        //private readonly Grid _setGrid;

        public FourSuitRummyMainView(IEventAggregator aggregator,
                                     TestOptions test,
                                     FourSuitRummyVMData model
                                     )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);

            _deckGPile     = new BaseDeckXF <RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >();
            _discardGPile  = new BasePileXF <RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >();
            _score         = new ScoreBoardXF();
            _playerHandWPF = new BaseHandXF <RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >();
            _tempG         = new TempRummySetsXF <EnumSuitList, EnumColorList, RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >();
            ParentSingleUIContainer?restoreP = null;

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

            Grid finalGrid = new Grid();

            AddAutoRows(finalGrid, 3);
            Grid firstGrid = new Grid();

            AddLeftOverColumn(firstGrid, 40);
            AddAutoColumns(firstGrid, 1);
            AddLeftOverColumn(firstGrid, 15);
            AddLeftOverColumn(firstGrid, 30);



            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            otherStack.Children.Add(_deckGPile);
            otherStack.Children.Add(_discardGPile); // can reposition or not even have as well.

            AddControlToGrid(firstGrid, otherStack, 0, 1);
            StackLayout firstStack = new StackLayout();

            firstStack.Children.Add(_playerHandWPF);
            var thisBut = GetGamingButton("Play Sets", nameof(FourSuitRummyMainViewModel.PlaySetsAsync));

            firstStack.Children.Add(thisBut);
            AddControlToGrid(firstGrid, firstStack, 0, 0);

            _score.AddColumn("Cards Left", true, nameof(FourSuitRummyPlayerItem.ObjectCount)); //very common.
            _score.AddColumn("Total Score", true, nameof(FourSuitRummyPlayerItem.TotalScore));
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(FourSuitRummyMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(FourSuitRummyMainViewModel.Status));

            AddControlToGrid(firstGrid, firstInfo.GetContent, 0, 2);

            AddControlToGrid(firstGrid, _score, 0, 3);
            AddControlToGrid(finalGrid, firstGrid, 1, 0);
            StackLayout thirdStack = new StackLayout();

            thirdStack.Orientation = StackOrientation.Horizontal;
            thirdStack.Children.Add(_tempG);
            //_setGrid = new Grid();
            //thirdStack.Children.Add(_setGrid);
            Grid setgrid = new Grid();

            thirdStack.Children.Add(setgrid);
            AddControlToGrid(finalGrid, thirdStack, 2, 0);
            AddLeftOverColumn(setgrid, 50);
            AddLeftOverColumn(setgrid, 50);



            //var fins = new ParentSingleUIContainer(nameof(FourSuitRummyMainViewModel.OpponentSetsScreen));
            //AddControlToGrid(_setGrid, fins, 0, 1);
            ParentSingleUIContainer parent = new ParentSingleUIContainer(nameof(FourSuitRummyMainViewModel.YourSetsScreen));

            AddControlToGrid(setgrid, parent, 0, 0);
            parent = new ParentSingleUIContainer(nameof(FourSuitRummyMainViewModel.OpponentSetsScreen));
            AddControlToGrid(setgrid, parent, 0, 1);

            //StackLayout temps = new StackLayout();
            //temps.Orientation = StackOrientation.Horizontal;
            //temps.Children.Add(parent);
            //temps.Children.Add(fins);
            //_setGrid.Children.Add(temps);



            _deckGPile.Margin = new Thickness(5, 5, 5, 5);

            _discardGPile.Margin = new Thickness(5, 5, 5, 5);

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