Example #1
0
        public Pinochle2PlayerMainViewModel(CommandContainer commandContainer,
                                            Pinochle2PlayerMainGameClass mainGame,
                                            Pinochle2PlayerVMData viewModel,
                                            BasicData basicData,
                                            TestOptions test,
                                            IGamePackageResolver resolver
                                            )
            : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
        {
            _mainGame = mainGame;
            _model    = viewModel;
            _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.OpponentMelds.SendEnableProcesses(this, () => false);
            commandContainer.ExecutingChanged += CommandContainer_ExecutingChanged;
            _model.YourMelds.SendEnableProcesses(this, () =>
            {
                if (_mainGame !.SaveRoot !.ChooseToMeld)
                {
                    _model.YourMelds.AutoSelect = HandObservable <Pinochle2PlayerCardInformation> .EnumAutoType.SelectAsMany;
                    return(true);
                }
                _model.YourMelds.AutoSelect = HandObservable <Pinochle2PlayerCardInformation> .EnumAutoType.SelectOneOnly;
                return(_model.Pile1 !.PileEmpty() == false && _mainGame.SaveRoot.MeldList.Any(items => items.Player == _mainGame.WhoTurn && items.CardList.Count > 0));
            });
Example #2
0
        public void LoadList(Pinochle2PlayerVMData thisMod)
        {
            Text      = "Scoring Guide";
            _thisGrid = new Grid();
            SetUpMarginsOnParentControl(_thisGrid);
            AddAutoColumns(_thisGrid, 2);
            AddAutoRows(_thisGrid, 20);
            var thisLabel = GetLargestLabel("Point Values:");

            AddControlToGrid(_thisGrid, thisLabel, 0, 0);
            _rowNumber = 1;
            thisMod.Guide1 !.PointValueList.ForEach(thisScore => AddStandardLabel(thisScore));
            thisLabel = GetLargestLabel("Value Of Melds:");
            AddControlToGrid(_thisGrid, thisLabel, _rowNumber, 0);
            _rowNumber++;
            thisLabel = GetClassLabel("A");
            AddControlToGrid(_thisGrid, thisLabel, _rowNumber, 0);
            _rowNumber++;
            thisMod.Guide1.ClassAList.ForEach(thisScore => AddStandardLabel(thisScore));
            thisLabel = GetClassLabel("B");
            AddControlToGrid(_thisGrid, thisLabel, _rowNumber, 0);
            _rowNumber++;
            thisMod.Guide1.ClassBList.ForEach(thisScore => AddStandardLabel(thisScore));
            thisLabel = GetClassLabel("C");
            AddControlToGrid(_thisGrid, thisLabel, _rowNumber, 0);
            _rowNumber++;
            thisMod.Guide1.ClassCList.ForEach(thisScore => AddStandardLabel(thisScore));
            Grid finalGrid = new Grid();

            finalGrid.Children.Add(ThisDraw);
            finalGrid.Children.Add(_thisGrid);
            Content = finalGrid;
        }
 public Pinochle2PlayerMainGameClass(IGamePackageResolver mainContainer,
                                     IEventAggregator aggregator,
                                     BasicData basicData,
                                     TestOptions test,
                                     Pinochle2PlayerVMData currentMod,
                                     IMultiplayerSaveState state,
                                     IAsyncDelayer delay,
                                     ICardInfo <Pinochle2PlayerCardInformation> cardInfo,
                                     CommandContainer command,
                                     Pinochle2PlayerGameContainer gameContainer,
                                     ITrickData trickData,
                                     ITrickPlay trickPlay,
                                     IAdvancedTrickProcesses aTrick
                                     )
     : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer, trickData, trickPlay)
 {
     _model         = currentMod;
     _command       = command;
     _gameContainer = gameContainer;
     _trickPlay     = trickPlay;
     _aTrick        = aTrick;
 }
        public Pinochle2PlayerMainView(IEventAggregator aggregator,
                                       TestOptions test,
                                       Pinochle2PlayerVMData model,
                                       IGamePackageResolver resolver
                                       )
        {
            _aggregator = aggregator;
            _model      = model;
            _resolver   = resolver;
            _aggregator.Subscribe(this);

            _deckGPile     = new BaseDeckWPF <Pinochle2PlayerCardInformation, ts, DeckOfCardsWPF <Pinochle2PlayerCardInformation> >();
            _discardGPile  = new BasePileWPF <Pinochle2PlayerCardInformation, ts, DeckOfCardsWPF <Pinochle2PlayerCardInformation> >();
            _score         = new ScoreBoardWPF();
            _playerHandWPF = new BaseHandWPF <Pinochle2PlayerCardInformation, ts, DeckOfCardsWPF <Pinochle2PlayerCardInformation> >();

            _trick1 = new TwoPlayerTrickWPF <EnumSuitList, Pinochle2PlayerCardInformation, ts, DeckOfCardsWPF <Pinochle2PlayerCardInformation> >();

            _guide1       = new GuideUI();
            _deckStack    = new StackPanel();
            _yourMeld     = new BaseHandWPF <Pinochle2PlayerCardInformation, ts, DeckOfCardsWPF <Pinochle2PlayerCardInformation> >();
            _opponentMeld = new BaseHandWPF <Pinochle2PlayerCardInformation, ts, DeckOfCardsWPF <Pinochle2PlayerCardInformation> >();
            _tempG        = new TempRummySetsWPF <EnumSuitList, EnumColorList, Pinochle2PlayerCardInformation, ts, DeckOfCardsWPF <Pinochle2PlayerCardInformation> >();

            _trick1.Width          = 500; // i think.
            _yourMeld.Divider      = 1.5;
            _opponentMeld.Divider  = 1.5;
            _yourMeld.HandType     = HandObservable <Pinochle2PlayerCardInformation> .EnumHandList.Vertical;
            _opponentMeld.HandType = HandObservable <Pinochle2PlayerCardInformation> .EnumHandList.Vertical;
            _tempG.Height          = 250; //i think.

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

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


            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_deckStack);
            _deckStack.Children.Add(_discardGPile);
            otherStack.Children.Add(_trick1);
            otherStack.Children.Add(_tempG);
            mainStack.Children.Add(otherStack);
            _score.AddColumn("Cards Left", false, nameof(Pinochle2PlayerPlayerItem.ObjectCount)); //very common.
            _score.AddColumn("Tricks Won", false, nameof(Pinochle2PlayerPlayerItem.TricksWon));
            _score.AddColumn("Current Score", false, nameof(Pinochle2PlayerPlayerItem.CurrentScore));
            _score.AddColumn("Total Score", false, nameof(Pinochle2PlayerPlayerItem.TotalScore));
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(Pinochle2PlayerMainViewModel.NormalTurn));
            firstInfo.AddRow("Trump", nameof(Pinochle2PlayerMainViewModel.TrumpSuit));
            firstInfo.AddRow("Status", nameof(Pinochle2PlayerMainViewModel.Status));
            mainStack.Children.Add(_playerHandWPF);

            var endButton = GetGamingButton("End Turn", nameof(Pinochle2PlayerMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            var meldBut = GetGamingButton("Meld", nameof(Pinochle2PlayerMainViewModel.MeldAsync));

            otherStack             = new StackPanel();
            otherStack.Orientation = Orientation.Horizontal;
            StackPanel tempStack = new StackPanel();

            tempStack.Children.Add(meldBut);
            tempStack.Children.Add(endButton);
            otherStack.Children.Add(tempStack);
            otherStack.Children.Add(_yourMeld);
            otherStack.Children.Add(_opponentMeld);
            mainStack.Children.Add(otherStack);
            StackPanel scoreStack = new StackPanel();

            scoreStack.Children.Add(_score);
            scoreStack.Children.Add(firstInfo.GetContent);
            scoreStack.Children.Add(_guide1);
            Grid finalGrid = new Grid();

            AddLeftOverColumn(finalGrid, 70);
            AddLeftOverColumn(finalGrid, 30); // hopefully that works.
            AddControlToGrid(finalGrid, mainStack, 0, 0);
            AddControlToGrid(finalGrid, scoreStack, 0, 1);


            _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 = finalGrid;
        }