Ejemplo 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.
        }
 public void AnalyseSituation(StatsClass.stats stats1, StatsClass.stats stats2)
 {
     stats1.groundness=WhatToChange(stats1.groundness,stats2.groundness);
     stats1.obstacleness=WhatToChange(stats1.obstacleness,stats2.obstacleness);
     stats1.interaction=WhatToChange(stats1.interaction,stats2.interaction);
     stats1.maxInteraction=WhatToChange(stats1.maxInteraction,stats2.maxInteraction);
     stats1.hitted=WhatToChange(stats1.hitted,stats2.hitted);
     stats1.upness=WhatToChange(stats1.upness,stats2.upness);
     stats1.specialness=WhatToChange(stats1.specialness,stats2.specialness);
 }