Ejemplo n.º 1
0
        public OldMaidMainView(IEventAggregator aggregator,
                               TestOptions test,
                               OldMaidVMData model
                               )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);

            _discardGPile          = new BasePileWPF <RegularSimpleCard, ts, DeckOfCardsWPF <RegularSimpleCard> >();
            _playerHandWPF         = new BaseHandWPF <RegularSimpleCard, ts, DeckOfCardsWPF <RegularSimpleCard> >();
            _playerHandWPF.Divider = 2;

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

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


            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_discardGPile); // can reposition or not even have as well.
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(OldMaidMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(OldMaidMainViewModel.Status));
            var endButton = GetGamingButton("End Turn", nameof(OldMaidMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            otherStack.Children.Add(endButton);


            ParentSingleUIContainer opponent = new ParentSingleUIContainer()
            {
                Name = nameof(OldMaidMainViewModel.OpponentScreen)
            };

            mainStack.Children.Add(opponent);
            mainStack.Children.Add(_playerHandWPF);
            mainStack.Children.Add(otherStack);
            mainStack.Children.Add(firstInfo.GetContent);


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


            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
        public OpponentCardsView(OldMaidVMData model)
        {
            BaseHandWPF <RegularSimpleCard, ts, DeckOfCardsWPF <RegularSimpleCard> > hand = new BaseHandWPF <RegularSimpleCard, ts, DeckOfCardsWPF <RegularSimpleCard> >();

            hand.Divider = 2;
            hand.LoadList(model.OpponentCards1, ts.TagUsed);
            Content = hand;
        }
 public OpponentCardsViewModel(CommandContainer commandContainer, OldMaidGameContainer gameContainer, OldMaidVMData model, IOtherPlayerProcess process)
 {
     CommandContainer = commandContainer;
     _model           = model;
     _process         = process;
     _model.OpponentCards1.SendEnableProcesses(this, () => gameContainer.SaveRoot.RemovePairs == false && gameContainer.SaveRoot.AlreadyChoseOne == false);
     _model.OpponentCards1.ObjectClickedAsync += OpponentCards1_ObjectClickedAsync;
 }
Ejemplo n.º 4
0
        public OldMaidMainView(IEventAggregator aggregator,
                               TestOptions test,
                               OldMaidVMData model
                               )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);

            _discardGPile          = new BasePileXF <RegularSimpleCard, ts, DeckOfCardsXF <RegularSimpleCard> >();
            _playerHandWPF         = new BaseHandXF <RegularSimpleCard, ts, DeckOfCardsXF <RegularSimpleCard> >();
            _playerHandWPF.Divider = 2;
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

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

            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            otherStack.Children.Add(_discardGPile); // can reposition or not even have as well.
            mainStack.Children.Add(otherStack);
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

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

            var endButton = GetGamingButton("End Turn", nameof(OldMaidMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;
            otherStack.Children.Add(endButton);

            ParentSingleUIContainer opponent = new ParentSingleUIContainer(nameof(OldMaidMainViewModel.OpponentScreen));

            mainStack.Children.Add(opponent);
            mainStack.Children.Add(_playerHandWPF);
            mainStack.Children.Add(otherStack);
            mainStack.Children.Add(firstInfo.GetContent);

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

            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP);                        //default add to grid but does not have to.
            }
            GamePackageViewModelBinder.ManuelElements.Clear();           //often times i have to add manually.
            _playerHandWPF !.LoadList(_model.PlayerHand1 !, ts.TagUsed); // i think
            _discardGPile !.Init(_model.Pile1 !, ts.TagUsed);            // may have to be here (well see)
            _discardGPile.StartListeningDiscardPile();                   // its the main one.
            Content = mainStack;
        }
Ejemplo n.º 5
0
 public OldMaidMainViewModel(CommandContainer commandContainer,
                             OldMaidMainGameClass mainGame,
                             OldMaidVMData viewModel,
                             BasicData basicData,
                             TestOptions test,
                             IGamePackageResolver resolver,
                             OldMaidGameContainer gameContainer
                             )
     : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
 {
     _mainGame = mainGame;
     _model    = viewModel;
     _resolver = resolver;
     _model.Deck1.NeverAutoDisable     = false;
     _model.PlayerHand1.AutoSelect     = HandObservable <RegularSimpleCard> .EnumAutoType.SelectAsMany;
     gameContainer.ShowOtherCardsAsync = LoadOpponentScreenAsync;
 }
 public OldMaidMainGameClass(IGamePackageResolver mainContainer,
     IEventAggregator aggregator,
     BasicData basicData,
     TestOptions test,
     OldMaidVMData currentMod,
     IMultiplayerSaveState state,
     IAsyncDelayer delay,
     ICardInfo<RegularSimpleCard> cardInfo,
     CommandContainer command,
     OldMaidGameContainer gameContainer, IOtherPlayerProcess process)
     : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer)
 {
     _model = currentMod;
     _command = command;
     _gameContainer = gameContainer;
     _process = process;
     _gameContainer.SortCards = SortCards;
 }
 public OtherPlayerProcess(OldMaidGameContainer gameContainer, OldMaidVMData model)
 {
     _gameContainer = gameContainer;
     _model         = model;
 }