Ejemplo n.º 1
0
        private readonly MillebournesGameContainer _gameContainer; //if not needed, delete.

        public MillebournesMainViewModel(CommandContainer commandContainer,
                                         MillebournesMainGameClass mainGame,
                                         MillebournesVMData viewModel,
                                         BasicData basicData,
                                         TestOptions test,
                                         IGamePackageResolver resolver,
                                         MillebournesGameContainer gameContainer
                                         )
            : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
        {
            _mainGame      = mainGame;
            _model         = viewModel;
            _resolver      = resolver;
            _gameContainer = gameContainer;
            _model.Deck1.NeverAutoDisable        = false;
            _model.Pile2 !.PileClickedAsync     += Pile2_PileClickedAsync;
            CommandContainer !.ExecutingChanged += CommandContainer_ExecutingChanged;
            _model.Pile1.Text    = "New Card";
            _model.Pile1.Visible = false;
            _model.Pile2.Text    = "Throw Away";
            _model.Pile2.FirstLoad(new MillebournesCardInformation());
            _model.PlayerHand1.AutoSelect  = HandObservable <MillebournesCardInformation> .EnumAutoType.None;
            _model.PlayerHand1.Maximum     = 6;
            _gameContainer.TeamClickAsync  = ProcessTeamClickAsync;
            _gameContainer.LoadCoupeAsync  = LoadCoupeAsync;
            _gameContainer.CloseCoupeAsync = CloseCoupeAsync;
        }
Ejemplo n.º 2
0
 public CoupeViewModel(CommandContainer commandContainer, MillebournesVMData model, MillebournesGameContainer gameContainer, MillebournesMainGameClass mainGame)
 {
     CommandContainer     = commandContainer;
     _model               = model;
     _gameContainer       = gameContainer;
     _mainGame            = mainGame;
     _model.Stops.TimeUp += Stops_TimeUp;
 }
 public MillebournesMainGameClass(IGamePackageResolver mainContainer,
                                  IEventAggregator aggregator,
                                  BasicData basicData,
                                  TestOptions test,
                                  MillebournesVMData currentMod,
                                  IMultiplayerSaveState state,
                                  IAsyncDelayer delay,
                                  ICardInfo <MillebournesCardInformation> cardInfo,
                                  CommandContainer command,
                                  MillebournesGameContainer gameContainer,
                                  ComputerAI ai
                                  )
     : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer)
 {
     _model         = currentMod;
     _command       = command;
     _gameContainer = gameContainer;
     _ai            = ai;
 }
Ejemplo n.º 4
0
        public TeamCP(int team, MillebournesGameContainer gameContainer, MillebournesVMData model)
        {
            CardPiles          = new BasicMultiplePilesCP <MillebournesCardInformation>(gameContainer.Command, gameContainer.Aggregator);
            CardPiles.Rows     = 1;
            CardPiles.Columns  = 3;
            CardPiles.HasFrame = true;
            CardPiles.Style    = BasicMultiplePilesCP <MillebournesCardInformation> .EnumStyleList.HasList;
            CardPiles.HasText  = true;
            CardPiles.LoadBoard();
            TeamNumber     = team; //i think has to be here.
            _gameContainer = gameContainer;
            _model         = model;
            //risk without extra command.  hopefully that works.  if i am wrong, rethink.
            //could require controlcommand (hopefully i don't).

            CardPiles.PileClickedAsync += CardPiles_PileClickedAsync;
            Init();
            MillebournesPlayerItem thisPlayer = _gameContainer.PlayerList !.GetSelf();

            _selfPlayer = thisPlayer.Id;
        }
 public ComputerAI(MillebournesVMData model, MillebournesGameContainer gameContainer)
 {
     _model         = model;
     _gameContainer = gameContainer;
 }
        public MillebournesMainView(IEventAggregator aggregator,
                                    MillebournesVMData model,
                                    MillebournesMainGameClass mainGame,
                                    MillebournesGameContainer gameContainer,
                                    TestOptions test
                                    )
        {
            _aggregator    = aggregator;
            _model         = model;
            _mainGame      = mainGame;
            _gameContainer = gameContainer;
            _aggregator.Subscribe(this);

            _deckGPile     = new BaseDeckWPF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsWPF>();
            _discardGPile  = new BasePileWPF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsWPF>();
            _score         = new ScoreBoardWPF();
            _playerHandWPF = new BaseHandWPF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsWPF>();
            StackPanel mainStack = new StackPanel();

            _newCard   = new BasePileWPF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsWPF>();
            _pileStack = new StackPanel();
            StackPanel summaryStack = new StackPanel();

            summaryStack.Orientation = Orientation.Horizontal;
            summaryStack.Children.Add(mainStack);
            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_discardGPile); // can reposition or not even have as well.
            otherStack.Children.Add(_deckGPile);
            otherStack.Children.Add(_newCard);
            //var thisBut = GetGamingButton("Coupe Foure", nameof(MillebournesViewModel.CoupeCommand));
            // var thisBind = GetVisibleBinding(nameof(MillebournesViewModel.CoupeVisible));
            //thisBut.SetBinding(VisibilityProperty, thisBind);

            ParentSingleUIContainer parent = new ParentSingleUIContainer()
            {
                Name = nameof(MillebournesMainViewModel.CoupeScreen)
            };

            parent.HorizontalAlignment = HorizontalAlignment.Left;
            parent.VerticalAlignment   = VerticalAlignment.Top;
            otherStack.Children.Add(parent);
            mainStack.Children.Add(otherStack);
            _score.AddColumn("Team", true, nameof(MillebournesPlayerItem.Team), rightMargin: 10);
            _score.AddColumn("Miles", true, nameof(MillebournesPlayerItem.Miles), rightMargin: 10);
            _score.AddColumn("Other Points", true, nameof(MillebournesPlayerItem.OtherPoints), rightMargin: 10);
            _score.AddColumn("Total Points", true, nameof(MillebournesPlayerItem.TotalPoints), rightMargin: 10);
            _score.AddColumn("# 200s", true, nameof(MillebournesPlayerItem.Number200s), rightMargin: 10);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(MillebournesMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(MillebournesMainViewModel.Status));
            mainStack.Children.Add(_playerHandWPF);
            mainStack.Children.Add(firstInfo.GetContent);
            mainStack.Children.Add(_score);
            summaryStack.Children.Add(_pileStack);

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

            _discardGPile.Margin = new Thickness(5, 5, 5, 5);
            _newCard.Margin      = new Thickness(5, 5, 5, 5);
            ParentSingleUIContainer?restoreP = null;

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

            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 = summaryStack;
        }
Ejemplo n.º 7
0
        public MillebournesMainView(IEventAggregator aggregator,
                                    TestOptions test,
                                    MillebournesVMData model,
                                    MillebournesMainGameClass mainGame,
                                    MillebournesGameContainer gameContainer
                                    )
        {
            _aggregator    = aggregator;
            _model         = model;
            _mainGame      = mainGame;
            _gameContainer = gameContainer;
            _aggregator.Subscribe(this);

            _deckGPile     = new BaseDeckXF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsXF>();
            _discardGPile  = new BasePileXF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsXF>();
            _score         = new ScoreBoardXF();
            _playerHandWPF = new BaseHandXF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsXF>();
            _newCard       = new BasePileXF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsXF>();
            _pileGrid      = new Grid();

            ScrollView thisScroll = new ScrollView();

            thisScroll.Orientation = ScrollOrientation.Vertical;

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

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

            StackLayout summaryStack = new StackLayout();

            summaryStack.Orientation = StackOrientation.Horizontal;
            if (ScreenUsed == EnumScreen.SmallPhone)
            {
                thisScroll.Content = summaryStack;
            }
            summaryStack.Children.Add(mainStack);


            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            otherStack.Children.Add(_deckGPile);
            otherStack.Children.Add(_discardGPile); // can reposition or not even have as well.
            otherStack.Children.Add(_newCard);
            ParentSingleUIContainer parent = new ParentSingleUIContainer(nameof(MillebournesMainViewModel.CoupeScreen));

            parent.HorizontalOptions = LayoutOptions.Start;
            parent.VerticalOptions   = LayoutOptions.Start;
            otherStack.Children.Add(parent);
            mainStack.Children.Add(otherStack);
            _score.AddColumn("Team", true, nameof(MillebournesPlayerItem.Team), rightMargin: 10);
            _score.AddColumn("Miles", true, nameof(MillebournesPlayerItem.Miles), rightMargin: 10);
            _score.AddColumn("Other Points", true, nameof(MillebournesPlayerItem.OtherPoints), rightMargin: 10);
            _score.AddColumn("Total Points", true, nameof(MillebournesPlayerItem.TotalPoints), rightMargin: 10);
            _score.AddColumn("# 200s", true, nameof(MillebournesPlayerItem.Number200s), rightMargin: 10);
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(MillebournesMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(MillebournesMainViewModel.Status));

            mainStack.Children.Add(_playerHandWPF);
            mainStack.Children.Add(firstInfo.GetContent);
            mainStack.Children.Add(_score);
            _pileGrid = new Grid();
            AddAutoColumns(_pileGrid, 1);
            3.Times(x =>
            {
                AddLeftOverRow(_pileGrid, 1);
            });
            summaryStack.Children.Add(_pileGrid);



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

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

            if (ScreenUsed == EnumScreen.SmallPhone)
            {
                Content = thisScroll;
            }
            else
            {
                Content = summaryStack;
            }
        }