Пример #1
0
 public Phase10MainGameClass(IGamePackageResolver mainContainer,
                             IEventAggregator aggregator,
                             BasicData basicData,
                             TestOptions test,
                             Phase10VMData currentMod,
                             IMultiplayerSaveState state,
                             IAsyncDelayer delay,
                             ICardInfo <Phase10CardInformation> cardInfo,
                             CommandContainer command,
                             Phase10GameContainer gameContainer)
     : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer)
 {
     _model         = currentMod;
     _command       = command;
     _gameContainer = gameContainer;
     _rummys        = new RummyProcesses <EnumColorTypes, EnumColorTypes, Phase10CardInformation>();
 }
Пример #2
0
        private readonly Phase10GameContainer _gameContainer; //if not needed, delete.

        public Phase10MainViewModel(CommandContainer commandContainer,
                                    Phase10MainGameClass mainGame,
                                    Phase10VMData viewModel,
                                    BasicData basicData,
                                    TestOptions test,
                                    IGamePackageResolver resolver,
                                    Phase10GameContainer gameContainer
                                    )
            : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
        {
            _mainGame      = mainGame;
            _model         = viewModel;
            _gameContainer = gameContainer;
            _model.Deck1.NeverAutoDisable = true;
            _model.PlayerHand1.AutoSelect = HandObservable <Phase10CardInformation> .EnumAutoType.SelectAsMany;
            var player = _mainGame.PlayerList.GetSelf();

            mainGame.Aggregator.Subscribe(player); //hopefully this works now.
            _model.TempSets.Init(this);
            _model.TempSets.ClearBoard();          //try this too.
            _model.TempSets.SetClickedAsync += TempSets_SetClickedAsync;
            _model.MainSets.SetClickedAsync += MainSets_SetClickedAsync;
            _model.MainSets.SendEnableProcesses(this, () => _gameContainer !.AlreadyDrew);
        }
        public Phase10MainView(IEventAggregator aggregator,
                               TestOptions test,
                               Phase10VMData model
                               )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);

            _deckGPile     = new BaseDeckXF <Phase10CardInformation, Phase10GraphicsCP, CardGraphicsXF>();
            _discardGPile  = new BasePileXF <Phase10CardInformation, Phase10GraphicsCP, CardGraphicsXF>();
            _score         = new ScoreBoardXF();
            _playerHandWPF = new BaseHandXF <Phase10CardInformation, Phase10GraphicsCP, CardGraphicsXF>();
            _tempG         = new TempRummySetsXF <EnumColorTypes, EnumColorTypes, Phase10CardInformation, Phase10GraphicsCP, CardGraphicsXF>();
            _mainG         = new MainRummySetsXF <EnumColorTypes, EnumColorTypes, Phase10CardInformation, Phase10GraphicsCP, CardGraphicsXF, PhaseSet, SavedSet>();

            Grid finalGrid = new Grid();

            AddAutoRows(finalGrid, 1); // has to be this way because of scoreboard.
            AddLeftOverRow(finalGrid, 1);


            ParentSingleUIContainer?restoreP = null;

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

            StackLayout otherStack = new StackLayout();

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

            _score.AddColumn("Score", true, nameof(Phase10PlayerItem.TotalScore));
            _score.AddColumn("Cards Left", true, nameof(Phase10PlayerItem.ObjectCount));
            _score.AddColumn("Phase", true, nameof(Phase10PlayerItem.Phase));
            _score.AddColumn("Skipped", true, nameof(Phase10PlayerItem.MissNextTurn), useTrueFalse: true);
            _score.AddColumn("Completed", true, nameof(Phase10PlayerItem.Completed), useTrueFalse: true);

            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(Phase10MainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(Phase10MainViewModel.Status));
            firstInfo.AddRow("Phase", nameof(Phase10MainViewModel.CurrentPhase));


            Grid firstGrid = new Grid();

            AddLeftOverColumn(firstGrid, 40); // 50 was too much.  if there is scrolling, i guess okay.
            AddAutoColumns(firstGrid, 1);     // maybe 1 (well see)
            AddLeftOverColumn(firstGrid, 15); // for other details
            AddLeftOverColumn(firstGrid, 30); // for scoreboard
            AddControlToGrid(firstGrid, otherStack, 0, 1);
            StackLayout firstStack = new StackLayout();

            firstStack.Children.Add(_playerHandWPF);
            var thisBut = GetSmallerButton("Complete" + Constants.vbCrLf + "Phase", nameof(Phase10MainViewModel.CompletePhaseAsync));

            firstStack.Children.Add(thisBut);
            AddControlToGrid(firstGrid, firstStack, 0, 0);
            AddControlToGrid(firstGrid, firstInfo.GetContent, 0, 2);
            AddControlToGrid(firstGrid, _score, 0, 3);
            AddControlToGrid(finalGrid, firstGrid, 0, 0);
            _tempG.Divider = 1.1;
            StackLayout thirdStack = new StackLayout();

            thirdStack.Orientation = StackOrientation.Horizontal;
            thirdStack.Children.Add(_tempG);
            thirdStack.Children.Add(_mainG);
            AddControlToGrid(finalGrid, thirdStack, 1, 0);



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

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

            if (restoreP != null)
            {
                otherStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = finalGrid;
        }
Пример #4
0
        public Phase10MainView(IEventAggregator aggregator,
                               TestOptions test,
                               Phase10VMData model
                               )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            _tempG         = new TempRummySetsWPF <EnumColorTypes, EnumColorTypes, Phase10CardInformation, Phase10GraphicsCP, CardGraphicsWPF>();
            _mainG         = new MainRummySetsWPF <EnumColorTypes, EnumColorTypes, Phase10CardInformation, Phase10GraphicsCP, CardGraphicsWPF, PhaseSet, SavedSet>();
            _deckGPile     = new BaseDeckWPF <Phase10CardInformation, Phase10GraphicsCP, CardGraphicsWPF>();
            _discardGPile  = new BasePileWPF <Phase10CardInformation, Phase10GraphicsCP, CardGraphicsWPF>();
            _score         = new ScoreBoardWPF();
            _playerHandWPF = new BaseHandWPF <Phase10CardInformation, Phase10GraphicsCP, CardGraphicsWPF>();

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

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

            AddLeftOverRow(finalGrid, 20); // has to be this way because of scoreboard.
            AddLeftOverRow(finalGrid, 80);
            mainStack.Children.Add(finalGrid);
            Grid firstGrid = new Grid();

            AddLeftOverColumn(firstGrid, 40); // 50 was too much.  if there is scrolling, i guess okay.
            AddLeftOverColumn(firstGrid, 10); // for buttons (can change if necessary)
            AddAutoColumns(firstGrid, 1);     // maybe 1 (well see)
            AddLeftOverColumn(firstGrid, 15); // for other details
            AddLeftOverColumn(firstGrid, 30); // for scoreboard
            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_deckGPile);
            otherStack.Children.Add(_discardGPile);            // can reposition or not even have as well.
            AddControlToGrid(firstGrid, otherStack, 0, 2);     // i think
            _playerHandWPF.HandType = HandObservable <Phase10CardInformation> .EnumHandList.Horizontal;
            AddControlToGrid(firstGrid, _playerHandWPF, 0, 0); // i think
            var thisBut = GetGamingButton("Complete" + Constants.vbCrLf + "Phase", nameof(Phase10MainViewModel.CompletePhaseAsync));

            AddControlToGrid(firstGrid, thisBut, 0, 1);
            _score.AddColumn("Score", true, nameof(Phase10PlayerItem.TotalScore));
            _score.AddColumn("Cards Left", true, nameof(Phase10PlayerItem.ObjectCount));
            _score.AddColumn("Phase", true, nameof(Phase10PlayerItem.Phase));
            _score.AddColumn("Skipped", true, nameof(Phase10PlayerItem.MissNextTurn), useTrueFalse: true);
            _score.AddColumn("Completed", true, nameof(Phase10PlayerItem.Completed), useTrueFalse: true);
            AddControlToGrid(firstGrid, _score, 0, 4);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(Phase10MainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(Phase10MainViewModel.Status));
            firstInfo.AddRow("Phase", nameof(Phase10MainViewModel.CurrentPhase));
            AddControlToGrid(firstGrid, firstInfo.GetContent, 0, 3);
            AddControlToGrid(finalGrid, firstGrid, 0, 0); // i think
            _tempG.Height  = 700;
            _tempG.Divider = 1.3;
            StackPanel thirdStack = new StackPanel();

            thirdStack.Orientation = Orientation.Horizontal;
            _mainG.Height          = 700; // try this way.
            thirdStack.Children.Add(_tempG);
            thirdStack.Children.Add(_mainG);
            AddControlToGrid(finalGrid, thirdStack, 1, 0); // i think

            _deckGPile.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.
            }
            Content = mainStack;
        }