public void Init(TeamCP mod, MillebournesMainGameClass mainGame, CommandContainer commandContainer)
        {
            _safetyMod                     = mod;
            _commandContainer              = commandContainer;
            _safetyList                    = _safetyMod.SafetyList;
            _safetyList.CollectionChanged += SafetyList_CollectionChanged;
            StackLayout thisStack = new StackLayout();

            thisStack.Margin     = new Thickness(3, 0, 3, 0);
            _safetyStack         = new StackLayout();
            _safetyStack.Spacing = 0;
            StackLayout tempStack = new StackLayout();

            tempStack.Orientation = StackOrientation.Horizontal;
            var thisBut = GetButton("Safety", nameof(TeamCP.SafetyClickAsync), nameof(TeamCP.SafetyEnabled), mainGame);

            tempStack.Children.Add(thisBut);
            thisStack.Children.Add(_safetyStack);
            thisStack.Children.Add(tempStack);
            _safetyMod.SafetyList.ForEach(thisSafe =>
            {
                AddLabel(thisSafe);
            });
            Content = thisStack;
        }
Esempio n. 2
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;
        }
Esempio n. 3
0
 public CoupeViewModel(CommandContainer commandContainer, MillebournesVMData model, MillebournesGameContainer gameContainer, MillebournesMainGameClass mainGame)
 {
     CommandContainer     = commandContainer;
     _model               = model;
     _gameContainer       = gameContainer;
     _mainGame            = mainGame;
     _model.Stops.TimeUp += Stops_TimeUp;
 }
        private Button GetButton(string text, string commandName, string visible, MillebournesMainGameClass mainGame)
        {
            var output = GetGamingButton(text, "");

            if (mainGame.SingleInfo !.Team == _safetyMod !.TeamNumber)
            {
                Binding binding = new Binding(visible);
                output.SetBinding(IsVisibleProperty, binding);
            }
        private Button GetButton(string text, string commandName, string visible, MillebournesMainGameClass mainGame)
        {
            var output = GetGamingButton(text, "");

            if (mainGame.SingleInfo !.Team == _safetyMod !.TeamNumber)
            {
                Binding binding = GetVisibleBinding(visible);
                output.SetBinding(VisibilityProperty, binding); //may have to be manually done if it does not work.
            }
        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;
        }
Esempio 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;
            }
        }