public HiddenCards(GolfCardGameGameContainer gameContainer) : base(gameContainer.Command, gameContainer.Aggregator)
        {
            _gameContainer = gameContainer;
            Rows           = 1;
            Columns        = 2;
            HasFrame       = true;
            Style          = EnumStyleList.SingleCard;
            HasText        = true;
            //no visible.  hopefully works properly (?)
            //Visible = false;
            LoadBoard();
            IsEnabled = false; //try this too (?)
            if (PileList !.Count != 2)
            {
                throw new BasicBlankException("Must have 2 piles");
            }
            PileClickedAsync += HiddenCards_PileClickedAsync;
            int x = 0;

            PileList.ForEach(thisPile =>
            {
                x++;
                thisPile.Text = $"Card {x}";
            });
        }
 public GolfHand(GolfCardGameGameContainer gameContainer) : base(gameContainer.Command)
 {
     IsEnabled      = false;
     Text           = "Your Hand";
     Rows           = 1;
     Columns        = 2;
     HasFrame       = true;
     _gameContainer = gameContainer;
     Visible        = false; //i think.  if i am wrong, rethink.
 }
 public FirstViewModel(
     CommandContainer commandContainer,
     GolfCardGameVMData model,
     GolfCardGameGameContainer gameContainer,
     IBeginningProcesses processes
     )
 {
     CommandContainer = commandContainer;
     _model           = model;
     _gameContainer   = gameContainer;
     _processes       = processes;
     Instructions     = "Choose the 2 cards to put into your hand";
     //well see what this will do for the clicking.
 }
        public GolfCardGameMainViewModel(CommandContainer commandContainer,
                                         GolfCardGameMainGameClass mainGame,
                                         GolfCardGameVMData viewModel,
                                         BasicData basicData,
                                         TestOptions test,
                                         IGamePackageResolver resolver,
                                         GolfCardGameGameContainer gameContainer
                                         )
            : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
        {
            _mainGame      = mainGame;
            _model         = viewModel;
            _gameContainer = gameContainer;
            _model.Deck1.NeverAutoDisable = true;

            _model.OtherPile !.PileClickedAsync += OtherPile_PileClickedAsync;
            _model.OtherPile.SendEnableProcesses(this, (() => gameContainer.AlreadyDrew));
            _model.GolfHand1.SendEnableProcesses(this, () => gameContainer.AlreadyDrew);
            _model.HiddenCards1.SendEnableProcesses(this, () => gameContainer.AlreadyDrew);
        }
Exemple #5
0
 public GolfCardGameMainGameClass(IGamePackageResolver mainContainer,
                                  IEventAggregator aggregator,
                                  BasicData basicData,
                                  TestOptions test,
                                  GolfCardGameVMData currentMod,
                                  IMultiplayerSaveState state,
                                  IAsyncDelayer delay,
                                  ICardInfo <RegularSimpleCard> cardInfo,
                                  CommandContainer command,
                                  GolfCardGameGameContainer gameContainer,
                                  IBeginningProcesses processes
                                  )
     : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer)
 {
     _model         = currentMod;
     _command       = command;
     _gameContainer = gameContainer;
     _processes     = processes;
     _gameContainer.ChangeHandAsync    = ChangeHandAsync;
     _gameContainer.ChangeUnknownAsync = ChangeUnknownAsync;
 }
Exemple #6
0
        public GolfCardGameMainView(IEventAggregator aggregator,
                                    TestOptions test,
                                    GolfCardGameVMData model,
                                    GolfCardGameGameContainer gameContainer
                                    )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            _deckGPile    = new BaseDeckXF <RegularSimpleCard, ts, DeckOfCardsXF <RegularSimpleCard> >();
            _discardGPile = new BasePileXF <RegularSimpleCard, ts, DeckOfCardsXF <RegularSimpleCard> >();
            _score        = new ScoreBoardXF();

            _hiddenWPF    = new BasicMultiplePilesXF <RegularSimpleCard, ts, DeckOfCardsXF <RegularSimpleCard> >();
            _otherPileWPF = new BasePileXF <RegularSimpleCard, ts, DeckOfCardsXF <RegularSimpleCard> >();
            _golfWPF      = new CardBoardXF <RegularSimpleCard, ts, DeckOfCardsXF <RegularSimpleCard> >();
            ParentSingleUIContainer?restoreP  = null;
            StackLayout             mainStack = new StackLayout();

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

            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            otherStack.Children.Add(_deckGPile);
            otherStack.Children.Add(_discardGPile); // can reposition or not even have as well.
            var button = GetGamingButton("Knock", nameof(GolfCardGameMainViewModel.KnockAsync));

            otherStack.Children.Add(button);
            mainStack.Children.Add(otherStack);
            _score.UseAbbreviationForTrueFalse = true;
            mainStack.Children.Add(_hiddenWPF);
            otherStack             = new StackLayout();
            otherStack.Orientation = StackOrientation.Horizontal;
            otherStack.Children.Add(_golfWPF);
            otherStack.Children.Add(_otherPileWPF);
            mainStack.Children.Add(otherStack);
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(GolfCardGameMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(GolfCardGameMainViewModel.Status));
            Grid finalGrid = new Grid();

            AddLeftOverColumn(finalGrid, 40);
            AddLeftOverColumn(finalGrid, 60);                                                               // this is for scoreboard
            _score.AddColumn("Knocked", false, nameof(GolfCardGamePlayerItem.Knocked), useTrueFalse: true); // well see how this work.  hopefully this simple.
            _score.AddColumn("1 Changed", false, nameof(GolfCardGamePlayerItem.FirstChanged), useTrueFalse: true);
            _score.AddColumn("2 Changed", false, nameof(GolfCardGamePlayerItem.SecondChanged), useTrueFalse: true);
            _score.AddColumn("Previous Score", false, nameof(GolfCardGamePlayerItem.PreviousScore), rightMargin: 20);
            _score.AddColumn("Total Score", false, nameof(GolfCardGamePlayerItem.TotalScore), rightMargin: 20);
            firstInfo.AddRow("Round", nameof(GolfCardGameMainViewModel.Round));
            firstInfo.AddRow("Instructions", nameof(GolfCardGameMainViewModel.Instructions));
            mainStack.Children.Add(finalGrid);
            AddControlToGrid(finalGrid, firstInfo.GetContent, 0, 0);
            AddControlToGrid(finalGrid, _score, 0, 1);

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

            _discardGPile.Margin = new Thickness(5, 5, 5, 5);
            _score !.LoadLists(gameContainer.SaveRoot.PlayerList);


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



            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
 public BeginningProcesses(GolfCardGameGameContainer gameContainer, GolfDelegates delegates, GolfCardGameVMData model)
 {
     _gameContainer = gameContainer;
     _delegates     = delegates;
     _model         = model;
 }
Exemple #8
0
        public GolfCardGameMainView(IEventAggregator aggregator,
                                    TestOptions test,
                                    GolfCardGameVMData model,
                                    GolfCardGameGameContainer gameContainer
                                    )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);

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

            _hiddenWPF    = new BasicMultiplePilesWPF <RegularSimpleCard, ts, DeckOfCardsWPF <RegularSimpleCard> >();
            _otherPileWPF = new BasePileWPF <RegularSimpleCard, ts, DeckOfCardsWPF <RegularSimpleCard> >();
            _golfWPF      = new CardBoardWPF <RegularSimpleCard, ts, DeckOfCardsWPF <RegularSimpleCard> >();


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

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


            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_deckGPile);
            otherStack.Children.Add(_discardGPile); // can reposition or not even have as well.
            var button = GetGamingButton("Knock", nameof(GolfCardGameMainViewModel.KnockAsync));

            otherStack.Children.Add(button);
            mainStack.Children.Add(otherStack);
            _score.UseAbbreviationForTrueFalse = true;
            mainStack.Children.Add(_hiddenWPF);
            otherStack             = new StackPanel();
            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_golfWPF);
            otherStack.Children.Add(_otherPileWPF);
            mainStack.Children.Add(otherStack);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(GolfCardGameMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(GolfCardGameMainViewModel.Status));
            Grid finalGrid = new Grid();

            AddLeftOverColumn(finalGrid, 40);
            AddLeftOverColumn(finalGrid, 60);                                                               // this is for scoreboard
            _score.AddColumn("Knocked", false, nameof(GolfCardGamePlayerItem.Knocked), useTrueFalse: true); // well see how this work.  hopefully this simple.
            _score.AddColumn("1 Changed", false, nameof(GolfCardGamePlayerItem.FirstChanged), useTrueFalse: true);
            _score.AddColumn("2 Changed", false, nameof(GolfCardGamePlayerItem.SecondChanged), useTrueFalse: true);
            _score.AddColumn("Previous Score", false, nameof(GolfCardGamePlayerItem.PreviousScore), rightMargin: 20);
            _score.AddColumn("Total Score", false, nameof(GolfCardGamePlayerItem.TotalScore), rightMargin: 20);
            firstInfo.AddRow("Round", nameof(GolfCardGameMainViewModel.Round));
            firstInfo.AddRow("Instructions", nameof(GolfCardGameMainViewModel.Instructions));
            mainStack.Children.Add(finalGrid);
            AddControlToGrid(finalGrid, firstInfo.GetContent, 0, 0);
            AddControlToGrid(finalGrid, _score, 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.
            }

            _score !.LoadLists(gameContainer.SaveRoot.PlayerList);
            _discardGPile !.Init(_model.Pile1 !, ts.TagUsed); // may have to be here (well see)
            _discardGPile.StartListeningDiscardPile();        // its the main one.

            _deckGPile !.Init(_model.Deck1 !, ts.TagUsed);    // try here.  may have to do something else as well (?)
            _deckGPile.StartListeningMainDeck();


            _otherPileWPF !.Init(_model.OtherPile !, ts.TagUsed);
            _hiddenWPF !.Init(_model.HiddenCards1 !, ts.TagUsed);
            _golfWPF !.LoadList(_model.GolfHand1 !, ts.TagUsed);

            Content = mainStack;
        }