コード例 #1
0
 public DummyRummyMainGameClass(IGamePackageResolver mainContainer,
                                IEventAggregator aggregator,
                                BasicData basicData,
                                TestOptions test,
                                DummyRummyVMData currentMod,
                                IMultiplayerSaveState state,
                                IAsyncDelayer delay,
                                ICardInfo <RegularRummyCard> cardInfo,
                                CommandContainer command,
                                DummyRummyGameContainer gameContainer,
                                DummyRummyDelegates delegates
                                )
     : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer)
 {
     _model                   = currentMod;
     _command                 = command;
     _gameContainer           = gameContainer;
     _rummys                  = new RummyProcesses <EnumSuitList, EnumColorList, RegularRummyCard>();
     delegates.CardsToPassOut = (() => CardsToPassOut);
 }
コード例 #2
0
        public DummyRummyMainViewModel(CommandContainer commandContainer,
                                       DummyRummyMainGameClass mainGame,
                                       DummyRummyVMData viewModel,
                                       BasicData basicData,
                                       TestOptions test,
                                       IGamePackageResolver resolver,
                                       DummyRummyGameContainer gameContainer
                                       )
            : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
        {
            _mainGame      = mainGame;
            _model         = viewModel;
            _gameContainer = gameContainer;
            _model.Deck1.NeverAutoDisable = false;
            var player = _mainGame.PlayerList.GetSelf();

            mainGame.Aggregator.Subscribe(player); //hopefully this works now.
            _model.PlayerHand1.AutoSelect = HandObservable <RegularRummyCard> .EnumAutoType.SelectAsMany;
            _model.TempSets.Init(this);
            _model.TempSets.ClearBoard();                           //try this too.
            _model.TempSets.SetClickedAsync += TempSets_SetClickedAsync;
            _model.MainSets.SendEnableProcesses(this, () => false); //always disabled this time.
        }
コード例 #3
0
        public DummyRummyMainView(IEventAggregator aggregator,
                                  TestOptions test,
                                  DummyRummyVMData model
                                  )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            _tempG         = new TempRummySetsXF <EnumSuitList, EnumColorList, RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >();
            _mainG         = new MainRummySetsXF <EnumSuitList, EnumColorList, RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard>, DummySet, SavedSet>();
            _deckGPile     = new BaseDeckXF <RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >();
            _discardGPile  = new BasePileXF <RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >();
            _score         = new ScoreBoardXF();
            _playerHandWPF = new BaseHandXF <RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >();
            ParentSingleUIContainer?restoreP = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(DummyRummyMainViewModel.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.



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

            firstInfo.AddRow("Turn", nameof(DummyRummyMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(DummyRummyMainViewModel.Status));
            firstInfo.AddRow("Up To", nameof(DummyRummyMainViewModel.UpTo));

            AddControlToGrid(firstGrid, otherStack, 0, 1);


            StackLayout firstStack = new StackLayout();

            firstStack.Children.Add(_playerHandWPF);
            StackLayout secondStack = new StackLayout();

            secondStack.Orientation = StackOrientation.Horizontal;
            firstStack.Children.Add(secondStack);
            var button = GetSmallerButton("Lay Down", nameof(DummyRummyMainViewModel.LayDownSetsAsync));

            firstStack.Children.Add(button);
            button = GetSmallerButton("Back", nameof(DummyRummyMainViewModel.Back));
            firstStack.Children.Add(button);

            AddControlToGrid(firstGrid, firstStack, 0, 0);

            AddControlToGrid(firstGrid, _score, 0, 3);
            AddControlToGrid(finalGrid, firstGrid, 1, 0);

            AddControlToGrid(firstGrid, firstInfo.GetContent, 0, 2);
            _tempG.Divider = 1.1;
            StackLayout thirdStack = new StackLayout();

            thirdStack.Orientation = StackOrientation.Horizontal;
            thirdStack.Children.Add(_tempG);
            thirdStack.Children.Add(_mainG);
            AddControlToGrid(finalGrid, thirdStack, 2, 0); // i think

            _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;
        }
コード例 #4
0
        public DummyRummyMainView(IEventAggregator aggregator,
                                  TestOptions test,
                                  DummyRummyVMData 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> >();
            _mainG         = new MainRummySetsWPF <EnumSuitList, EnumColorList, RegularRummyCard, ts, DeckOfCardsWPF <RegularRummyCard>, DummySet, SavedSet>();
            StackPanel mainStack             = new StackPanel();
            ParentSingleUIContainer?restoreP = null;

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

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

            AddLeftOverColumn(firstGrid, 40); // 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;
            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_deckGPile);
            otherStack.Children.Add(_discardGPile);            // can reposition or not even have as well.
            AddControlToGrid(firstGrid, otherStack, 0, 2);     // i think
            AddControlToGrid(firstGrid, _playerHandWPF, 0, 0); // i think
            var        button    = GetGamingButton("Lay" + Constants.vbCrLf + "Down", nameof(DummyRummyMainViewModel.LayDownSetsAsync));
            StackPanel tempStack = new StackPanel();

            tempStack.Orientation = Orientation.Horizontal;
            tempStack.Children.Add(button);
            button           = GetGamingButton("Back", nameof(DummyRummyMainViewModel.Back));
            button.FontSize -= 4;
            tempStack.Children.Add(button);
            AddControlToGrid(firstGrid, tempStack, 0, 1);
            _score.AddColumn("Cards Left", true, nameof(DummyRummyPlayerItem.ObjectCount)); //very common.
            _score.AddColumn("Current Score", true, nameof(DummyRummyPlayerItem.CurrentScore));
            _score.AddColumn("Total Score", true, nameof(DummyRummyPlayerItem.TotalScore));
            AddControlToGrid(firstGrid, _score, 0, 4);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(DummyRummyMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(DummyRummyMainViewModel.Status));
            firstInfo.AddRow("Up To", nameof(DummyRummyMainViewModel.UpTo));
            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);
            _mainG.Height = 700;                           // try this way.
            thirdStack.Children.Add(_mainG);
            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)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }