Esempio n. 1
0
        public BlackjackMainViewModel(IEventAggregator aggregator,
                                      CommandContainer commandContainer,
                                      IGamePackageResolver resolver,
                                      StatsClass stats
                                      )
        {
            //i got around the deckpile by doing resolve.  i think this way is better.
            _aggregator      = aggregator;
            CommandContainer = commandContainer;
            CommandContainer.ExecutingChanged += CommandContainer_ExecutingChanged; //hopefully no problem (?)
            //this means i can no longer ask for it because it needs a new one.  otherwise, causes problems.

            DeckPile = resolver.ReplaceObject <DeckObservablePile <BlackjackCardInfo> >();
            DeckPile.DeckClickedAsync += DeckPile_DeckClickedAsync;
            _stats        = stats;
            IsNotifying   = false;
            HumanStack    = new PlayerStack(commandContainer);
            ComputerStack = new PlayerStack(commandContainer);
            HumanStack.ProcessLabel(false);
            HumanStack.CardSelectedAsync += HumanStack_CardSelectedAsync;
            ComputerStack.ProcessLabel(true);
            ComputerStack.AlwaysDisabled = true;
            HumanStack.SendFunction(() => NeedsAceChoice == false && SelectedYet == false);
            Wins        = stats.Wins;
            Losses      = stats.Losses;
            Draws       = stats.Draws;
            IsNotifying = true;
            DeckPile.NeverAutoDisable = true;
            DeckPile.IsEnabled        = false;
            DeckPile.SendEnableProcesses(this, () =>
            {
                return(false);                                             //false this time.
            });
            _mainGame = resolver.ReplaceObject <BlackjackMainGameClass>(); //hopefully this works.  means you have to really rethink.
        }
Esempio n. 2
0
        public TriangleSolitaireMainViewModel(IEventAggregator aggregator,
                                              CommandContainer commandContainer,
                                              IGamePackageResolver resolver
                                              )
        {
            _aggregator      = aggregator;
            CommandContainer = commandContainer;
            CommandContainer.ExecutingChanged += CommandContainer_ExecutingChanged; //hopefully no problem (?)
            DeckPile = resolver.ReplaceObject <DeckObservablePile <SolitaireCard> >();
            DeckPile.DeckClickedAsync += DeckPile_DeckClickedAsync;
            DeckPile.NeverAutoDisable  = true;
            DeckPile.SendEnableProcesses(this, () =>
            {
                if (_mainGame.GameGoing == false)
                {
                    return(false);
                }
                return(true);                                                      //if other logic is needed for deck, put here.
            });
            _mainGame = resolver.ReplaceObject <TriangleSolitaireMainGameClass>(); //hopefully this works.  means you have to really rethink.

            Pile1      = new PileObservable <SolitaireCard>(aggregator, commandContainer);
            Triangle1  = new TriangleBoard(this, CommandContainer, resolver);
            Pile1.Text = "Discard";
            Pile1.SendEnableProcesses(this, () => false);
        }
Esempio n. 3
0
 public EagleWingsSolitaireMainViewModel(IEventAggregator aggregator,
                                         CommandContainer command,
                                         IGamePackageResolver resolver
                                         )
     : base(aggregator, command, resolver)
 {
     GlobalClass.MainModel = this;
     Heel1 = new DeckObservablePile <SolitaireCard>(aggregator, command);
     Heel1.DeckClickedAsync += Heel1_DeckClickedAsync;
     Heel1.SendEnableProcesses(this, () => Heel1.CardsLeft() == 1);
 }
Esempio n. 4
0
 public DemonSolitaireMainViewModel(IEventAggregator aggregator,
                                    CommandContainer command,
                                    IGamePackageResolver resolver
                                    )
     : base(aggregator, command, resolver)
 {
     GlobalClass.MainModel = this;
     Heel1 = new DeckObservablePile <SolitaireCard>(aggregator, command);
     Heel1.SendEnableProcesses(this, () => false);
     Heel1.DeckStyle = DeckObservablePile <SolitaireCard> .EnumStyleType.AlwaysKnown;
 }
Esempio n. 5
0
 public ClockSolitaireMainViewModel(IEventAggregator aggregator,
                                    CommandContainer commandContainer,
                                    IGamePackageResolver resolver
                                    )
 {
     _aggregator      = aggregator;
     CommandContainer = commandContainer;
     CommandContainer.ExecutingChanged += CommandContainer_ExecutingChanged; //hopefully no problem (?)
     DeckPile = resolver.ReplaceObject <DeckObservablePile <SolitaireCard> >();
     DeckPile.DeckClickedAsync += DeckPile_DeckClickedAsync;
     DeckPile.NeverAutoDisable  = true;
     DeckPile.SendEnableProcesses(this, () =>
     {
         return(false);                                                  //i think.
     });
     _mainGame = resolver.ReplaceObject <ClockSolitaireMainGameClass>(); //hopefully this works.  means you have to really rethink.
     Clock1    = new ClockBoard(this, _mainGame, commandContainer, resolver, _aggregator);
     _aggregator.Subscribe(this);
 }
Esempio n. 6
0
        public CribbagePatienceMainViewModel(IEventAggregator aggregator,
                                             CommandContainer commandContainer,
                                             IGamePackageResolver resolver
                                             )
        {
            _aggregator      = aggregator;
            CommandContainer = commandContainer;
            CommandContainer.ExecutingChanged += CommandContainer_ExecutingChanged; //hopefully no problem (?)
            DeckPile = resolver.ReplaceObject <DeckObservablePile <CribbageCard> >();
            DeckPile.DeckClickedAsync += DeckPile_DeckClickedAsync;
            DeckPile.NeverAutoDisable  = false;
            DeckPile.SendEnableProcesses(this, () =>
            {
                return(false);
            });

            Hand1            = new HandObservable <CribbageCard>(commandContainer);
            Hand1.Visible    = false; //has to be proven true.
            Hand1.Maximum    = 6;
            Hand1.AutoSelect = HandObservable <CribbageCard> .EnumAutoType.SelectAsMany;



            _mainGame = resolver.ReplaceObject <CribbagePatienceMainGameClass>(); //hopefully this works.  means you have to really rethink.
            _aggregator.Subscribe(this);
            _mainGame._saveRoot.HandScores = new CustomBasicList <ScoreHandCP>();
            3.Times(x =>
            {
                var tempHand          = new ScoreHandCP();
                tempHand.HandCategory = (EnumHandCategory)x;
                _mainGame._saveRoot.HandScores.Add(tempHand);
            });
            StartPile             = new PileObservable <CribbageCard>(_aggregator, CommandContainer);
            StartPile.Text        = "Start Card";
            StartPile.CurrentOnly = true;
            StartPile.SendEnableProcesses(this, () => false);
            Scores           = new ScoreSummaryCP();
            TempCrib         = new HandObservable <CribbageCard>(CommandContainer);
            TempCrib.Visible = false;
            TempCrib.Text    = "Crib So Far";
            TempCrib.Maximum = 4;
        }