Esempio n. 1
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. 2
0
        public PokerMainViewModel(IEventAggregator aggregator,
                                  CommandContainer commandContainer,
                                  IGamePackageResolver resolver
                                  )
        {
            GlobalClass.PokerList.Clear(); //can't be brand new  that could cause the connection to break too.
            _aggregator      = aggregator; //this time no new game.  just close out when you are done now.
            Round            = 1;
            CommandContainer = commandContainer;
            CommandContainer.ExecutingChanged += CommandContainer_ExecutingChanged; //hopefully no problem (?)
            DeckPile = resolver.ReplaceObject <DeckObservablePile <PokerCardInfo> >();
            DeckPile.DeckClickedAsync += DeckPile_DeckClickedAsync;
            DeckPile.NeverAutoDisable  = true;
            DeckPile.SendEnableProcesses(this, () =>
            {
                return(!IsRoundOver);
            });

            Bet1 = new NumberPicker(commandContainer, resolver);
            Bet1.SendEnableProcesses(this, () =>
            {
                return(!BetPlaced);
            });
            Bet1.LoadNumberList(new CustomBasicList <int>()
            {
                5, 10, 25
            });
            Bet1.SelectNumberValue(5); //something else has to set to large (?)
            Bet1.ChangedNumberValueAsync += Bet1_ChangedNumberValueAsync;

            _mainGame = resolver.ReplaceObject <PokerMainGameClass>(); //hopefully this works.  means you have to really rethink.
        }
Esempio n. 3
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.
        }
 public PokerMainGameClass(ISaveSinglePlayerClass thisState,
                           IEventAggregator aggregator,
                           IGamePackageResolver container
                           )
 {
     _thisState = thisState;
     Aggregator = aggregator;
     _saveRoot  = container.ReplaceObject <PokerSaveInfo>(); //can't create new one.  because if doing that, then anything that needs it won't have it.
 }
Esempio n. 5
0
        protected override SolitaireGameClass <VegasSolitaireSaveInfo> GetGame(IGamePackageResolver resolver)
        {
            VegasSolitaireMainGameClass game;

            game            = resolver.ReplaceObject <VegasSolitaireMainGameClass>();
            game.AddMoney   = (() => Money += 5);
            game.ResetMoney = (() => Money -= 52);
            return(game);
        }
Esempio n. 6
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. 7
0
 public ClockSolitaireMainGameClass(ISaveSinglePlayerClass thisState,
                                    IEventAggregator aggregator,
                                    IGamePackageResolver container
                                    )
 {
     _thisState = thisState;
     Aggregator = aggregator;
     SaveRoot   = container.ReplaceObject <ClockSolitaireSaveInfo>(); //can't create new one.  because if doing that, then anything that needs it won't have it.
     SaveRoot.LoadMod(aggregator);
 }
Esempio n. 8
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;
        }
 public SolitaireBoardGameMainGameClass(ISaveSinglePlayerClass thisState, IEventAggregator aggregator,
                                        ISolitaireBoardEvents solitaireBoard,
                                        IGamePackageResolver mainContainer
                                        )
 {
     _thisState      = thisState;
     Aggregator      = aggregator;
     MainContainer   = mainContainer;
     _solitaireBoard = solitaireBoard;
     _saveRoot       = mainContainer.ReplaceObject <SolitaireBoardGameSaveInfo>(); //i think should be this way for now just in case.
     LoadBoard();
 }
        //will never show game over.

        public FroggiesMainViewModel(IEventAggregator aggregator,
                                     CommandContainer commandContainer,
                                     IGamePackageResolver resolver,
                                     LevelClass level
                                     )
        {
            _aggregator      = aggregator;
            StartingFrogs    = level.NumberOfFrogs;
            NumberOfFrogs    = level.NumberOfFrogs;
            CommandContainer = commandContainer;
            _mainGame        = resolver.ReplaceObject <FroggiesMainGameClass>(); //hopefully this works.  means you have to really rethink.
        }
Esempio n. 11
0
        private async Task ReloadGameAsync(Func <BuncoDiceGameSaveInfo, bool, DiceCup <SimpleDice> > loadCup)
        {
            _saveRoot = await _thisState.RetrieveSinglePlayerGameAsync <BuncoDiceGameSaveInfo>();

            _container.ReplaceObject(_saveRoot);                     //this is now the new object.
            _saveRoot.PlayerList.MainContainer = _container;         //has to redo that part.
            _saveRoot.PlayerList.AutoSaved(_saveRoot !.PlayOrder !); //i think this is needed too.
            _cup = loadCup.Invoke(_saveRoot, true);
            await Aggregator.SendLoadAsync();                        //still needed.

            await NewTurnAsync();
        }
Esempio n. 12
0
 public MinesweeperMainViewModel(IEventAggregator aggregator,
                                 CommandContainer commandContainer,
                                 IGamePackageResolver resolver,
                                 LevelClass level
                                 )
 {
     _aggregator = aggregator;
     LevelChosen = level.Level; //at this point, can't choose level because its already chosen.
     this.PopulateMinesNeeded();
     CommandContainer = commandContainer;
     _mainGame        = resolver.ReplaceObject <MinesweeperMainGameClass>(); //hopefully this works.  means you have to really rethink.
 }
Esempio n. 13
0
        public HeapSolitaireMainViewModel(IEventAggregator aggregator,
                                          CommandContainer commandContainer,
                                          IGamePackageResolver resolver
                                          )
        {
            _aggregator      = aggregator;
            CommandContainer = commandContainer;
            CommandContainer.ExecutingChanged += CommandContainer_ExecutingChanged; //hopefully no problem (?)
            DeckPile = resolver.ReplaceObject <DeckObservablePile <HeapSolitaireCardInfo> >();
            DeckPile.DeckClickedAsync += DeckPile_DeckClickedAsync;
            DeckPile.NeverAutoDisable  = true;
            _aggregator.Subscribe(this);
            DeckPile.SendEnableProcesses(this, () =>
            {
                return(false);
            });
            _mainGame = resolver.ReplaceObject <HeapSolitaireMainGameClass>(); //hopefully this works.  means you have to really rethink.

            Waste1 = new WastePiles(CommandContainer, _aggregator, _mainGame);
            Waste1.PileClickedAsync += Waste1_PileClickedAsync;
            Main1 = new MainPiles(CommandContainer, _aggregator, _mainGame);
            Main1.PileClickedAsync += Main1_PileClickedAsync;
        }
        public MastermindMainViewModel(IEventAggregator aggregator, CommandContainer commandContainer,
                                       IGamePackageResolver resolver,
                                       LevelClass level
                                       )
        {
            _aggregator = aggregator;
            //looks like can't just ask for the mainboard.  because if you do, then when i change the global class, they have the old one (wrong)
            LevelChosen      = level.LevelChosen;
            CommandContainer = commandContainer;
            _global          = resolver.ReplaceObject <GlobalClass>(); //looks like global has to be replaced before game.  otherwise, reference is broken.
            CustomColorClass colorClass = new CustomColorClass(_global);

            //hopefully won't cause another problem (?)
            _mainGame = resolver.ReplaceObject <MastermindMainGameClass>(); //hopefully this works.  means you have to really rethink.



            MainBoard = resolver.Resolve <GameBoardViewModel>(); //by this time, it will have the proper global class.
            //ActiveViewModel = MainBoard;
            Color1 = new SimpleEnumPickerVM <EnumColorPossibilities, CirclePieceCP <EnumColorPossibilities> >(commandContainer, colorClass);
            Color1.AutoSelectCategory = EnumAutoSelectCategory.AutoEvent;
            Color1.IsEnabled          = true;
            Color1.ItemClickedAsync  += Color1_ItemClickedAsync;
        }
Esempio n. 15
0
        public PyramidSolitaireMainViewModel(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;
            aggregator.Subscribe(this);
            DeckPile.SendEnableProcesses(this, () =>
            {
                if (_mainGame.GameGoing == false)
                {
                    return(false);
                }
                return(true);                                                     //if other logic is needed for deck, put here.
            });
            _mainGame = resolver.ReplaceObject <PyramidSolitaireMainGameClass>(); //hopefully this works.  means you have to really rethink.

            CurrentPile = new PileObservable <SolitaireCard>(_aggregator, commandContainer);
            CurrentPile.SendEnableProcesses(this, () => CurrentPile.PileEmpty() == false);
            CurrentPile.Text              = "Current";
            CurrentPile.CurrentOnly       = true;
            CurrentPile.PileClickedAsync += CurrentPile_PileClickedAsync;
            Discard = new PileObservable <SolitaireCard>(_aggregator, CommandContainer);
            Discard.SendEnableProcesses(this, () => Discard.PileEmpty() == false);
            Discard.Text              = "Discard";
            Discard.PileClickedAsync += Discard_PileClickedAsync;
            PlayList1 = new PlayList(CommandContainer, aggregator);
            PlayList1.SendEnableProcesses(this, () => PlayList1.HasChosenCards());
            PlayList1.Visible = true;
            GameBoard1        = new TriangleBoard(this, CommandContainer, resolver, _mainGame);
        }
Esempio n. 16
0
 public BuncoDiceGameMainGameClass(ISaveSinglePlayerClass thisState,
                                   IEventAggregator aggregator,
                                   IGamePackageResolver container,
                                   RandomGenerator rs,
                                   CommandContainer command,
                                   GlobalClass global
                                   )
 {
     _thisState = thisState;
     Aggregator = aggregator;
     _container = container;
     _rs        = rs;
     _command   = command;
     _global    = global;
     _saveRoot  = container.ReplaceObject <BuncoDiceGameSaveInfo>(); //can't create new one.  because if doing that, then anything that needs it won't have it.
 }
 public BuncoDiceGameMainViewModel(IEventAggregator aggregator,
                                   CommandContainer commandContainer,
                                   IGamePackageResolver resolver,
                                   ISaveSinglePlayerClass state,
                                   GlobalClass global
                                   )
 {
     _aggregator = aggregator;
     _aggregator.Subscribe(this);
     CommandContainer = commandContainer;
     _resolver        = resolver;
     _state           = state;
     _global          = global;
     CommandContainer.ManuelFinish = true;
     CommandContainer.IsExecuting  = true;                              //not sure.
     _mainGame = resolver.ReplaceObject <BuncoDiceGameMainGameClass>(); //hopefully this works.  means you have to really rethink.
 }
Esempio n. 18
0
 protected override SolitaireGameClass <BeleaguredCastleSaveInfo> GetGame(IGamePackageResolver resolver)
 {
     return(resolver.ReplaceObject <BeleaguredCastleMainGameClass>());
 }
 protected override SolitaireGameClass <EasyGoSolitaireSaveInfo> GetGame(IGamePackageResolver resolver)
 {
     return(resolver.ReplaceObject <EasyGoSolitaireMainGameClass>());
 }
Esempio n. 20
0
 public SolitaireBoardGameMainViewModel(IEventAggregator aggregator, CommandContainer commandContainer, IGamePackageResolver resolver)
 {
     _aggregator      = aggregator;
     CommandContainer = commandContainer;
     _mainGame        = resolver.ReplaceObject <SolitaireBoardGameMainGameClass>();
 }
 protected override SolitaireGameClass<RaglanSolitaireSaveInfo> GetGame(IGamePackageResolver resolver)
 {
     return resolver.ReplaceObject<RaglanSolitaireMainGameClass>();
 }
 protected override SolitaireGameClass <GrandfathersClockSaveInfo> GetGame(IGamePackageResolver resolver)
 {
     return(resolver.ReplaceObject <GrandfathersClockMainGameClass>());
 }
Esempio n. 23
0
 protected override SolitaireGameClass <EightOffSolitaireSaveInfo> GetGame(IGamePackageResolver resolver)
 {
     _mainGame = resolver.ReplaceObject <EightOffSolitaireMainGameClass>();
     return(_mainGame);
 }