public ChinazoMainViewModel(CommandContainer commandContainer,
                                    ChinazoMainGameClass mainGame,
                                    ChinazoVMData viewModel,
                                    BasicData basicData,
                                    TestOptions test,
                                    IGamePackageResolver resolver,
                                    ChinazoGameContainer gameContainer
                                    )
            : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
        {
            _mainGame      = mainGame;
            _model         = viewModel;
            _gameContainer = gameContainer;
            _model.Deck1.NeverAutoDisable = true;
            _model.PlayerHand1.AutoSelect = HandObservable <ChinazoCard> .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, () =>
            {
                if (_mainGame !.OtherTurn > 0)
                {
                    return(false);
                }
                return(_mainGame.SingleInfo !.LaidDown);
            });
Exemplo n.º 2
0
        private readonly ChinazoGameContainer _gameContainer; //if we don't need it, take it out.

        public ChinazoMainGameClass(IGamePackageResolver mainContainer,
                                    IEventAggregator aggregator,
                                    BasicData basicData,
                                    TestOptions test,
                                    ChinazoVMData currentMod,
                                    IMultiplayerSaveState state,
                                    IAsyncDelayer delay,
                                    ICardInfo <ChinazoCard> cardInfo,
                                    CommandContainer command,
                                    ChinazoGameContainer gameContainer,
                                    ChinazoDelegates delegates)
            : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer)
        {
            _model                     = currentMod;
            _command                   = command;
            _gameContainer             = gameContainer;
            _rummys                    = new RummyProcesses <EnumSuitList, EnumColorList, ChinazoCard>();
            delegates.CardsToPassOut   = (() => CardsToPassOut);
            _gameContainer.ModifyCards = ModifyCards;
        }
Exemplo n.º 3
0
        public ChinazoMainView(IEventAggregator aggregator,
                               TestOptions test,
                               ChinazoVMData model
                               )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);

            _deckGPile     = new BaseDeckWPF <ChinazoCard, ts, DeckOfCardsWPF <ChinazoCard> >();
            _discardGPile  = new BasePileWPF <ChinazoCard, ts, DeckOfCardsWPF <ChinazoCard> >();
            _score         = new ScoreBoardWPF();
            _playerHandWPF = new BaseHandWPF <ChinazoCard, ts, DeckOfCardsWPF <ChinazoCard> >();
            _tempG         = new TempRummySetsWPF <EnumSuitList, EnumColorList, ChinazoCard, ts, DeckOfCardsWPF <ChinazoCard> >();
            _mainG         = new MainRummySetsWPF <EnumSuitList, EnumColorList, ChinazoCard, ts, DeckOfCardsWPF <ChinazoCard>, PhaseSet, SavedSet>();



            StackPanel mainStack = new StackPanel();

            Grid finalGrid = new Grid();

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

            ParentSingleUIContainer?restoreP = null;

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

            Grid firstGrid = new Grid();

            AddLeftOverColumn(firstGrid, 50); // 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, 20); // for other details
            AddLeftOverColumn(firstGrid, 20); // for scoreboard
            _deckGPile.HorizontalAlignment    = HorizontalAlignment.Left;
            _deckGPile.VerticalAlignment      = VerticalAlignment.Top;
            _discardGPile.HorizontalAlignment = HorizontalAlignment.Left;
            _discardGPile.VerticalAlignment   = VerticalAlignment.Top;

            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);
            AddControlToGrid(firstGrid, _playerHandWPF, 0, 0);
            StackPanel firstStack  = new StackPanel();
            StackPanel secondStack = new StackPanel();

            secondStack.Orientation = Orientation.Horizontal;
            firstStack.Children.Add(secondStack);
            var button = GetGamingButton("Pass", nameof(ChinazoMainViewModel.PassAsync));

            secondStack.Children.Add(button);
            button = GetGamingButton("Take", nameof(ChinazoMainViewModel.TakeAsync));
            secondStack.Children.Add(button);
            button = GetGamingButton("Lay Down Sets", nameof(ChinazoMainViewModel.FirstSetsAsync));
            firstStack.Children.Add(button);
            AddControlToGrid(firstGrid, firstStack, 0, 1);
            _score.AddColumn("Cards Left", false, nameof(ChinazoPlayerItem.ObjectCount)); //very common.
            _score.AddColumn("Current Score", false, nameof(ChinazoPlayerItem.CurrentScore), rightMargin: 5);
            _score.AddColumn("Total Score", false, nameof(ChinazoPlayerItem.TotalScore));
            AddControlToGrid(firstGrid, _score, 0, 4);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(ChinazoMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(ChinazoMainViewModel.Status));
            firstInfo.AddRow("Other Turn", nameof(ChinazoMainViewModel.OtherLabel));
            firstInfo.AddRow("Phase", nameof(ChinazoMainViewModel.PhaseData));
            AddControlToGrid(firstGrid, firstInfo.GetContent, 0, 3);
            AddControlToGrid(finalGrid, firstGrid, 0, 0); // i think
            _tempG.Height = 700;
            StackPanel thirdStack = new StackPanel();

            thirdStack.Orientation = Orientation.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)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
        public ChinazoMainView(IEventAggregator aggregator,
                               TestOptions test,
                               ChinazoVMData model
                               )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);

            _deckGPile     = new BaseDeckXF <ChinazoCard, ts, DeckOfCardsXF <ChinazoCard> >();
            _discardGPile  = new BasePileXF <ChinazoCard, ts, DeckOfCardsXF <ChinazoCard> >();
            _score         = new ScoreBoardXF();
            _playerHandWPF = new BaseHandXF <ChinazoCard, ts, DeckOfCardsXF <ChinazoCard> >();
            _tempG         = new TempRummySetsXF <EnumSuitList, EnumColorList, ChinazoCard, ts, DeckOfCardsXF <ChinazoCard> >();
            _mainG         = new MainRummySetsXF <EnumSuitList, EnumColorList, ChinazoCard, ts, DeckOfCardsXF <ChinazoCard>, PhaseSet, SavedSet>();
            ParentSingleUIContainer?restoreP = null;

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

            Grid finalGrid = new Grid();

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

            Grid firstGrid = new Grid();

            AddLeftOverColumn(firstGrid, 60);
            AddAutoColumns(firstGrid, 1);
            AddLeftOverColumn(firstGrid, 30);
            AddLeftOverColumn(firstGrid, 20);


            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            otherStack.Children.Add(_deckGPile);
            otherStack.Children.Add(_discardGPile); // can reposition or not even have as well.
            AddControlToGrid(firstGrid, otherStack, 0, 1);
            StackLayout firstStack = new StackLayout();

            firstStack.Children.Add(_playerHandWPF);
            StackLayout secondStack = new StackLayout();

            secondStack.Orientation = StackOrientation.Horizontal;
            firstStack.Children.Add(secondStack);

            var button = GetSmallerButton("Pass", nameof(ChinazoMainViewModel.PassAsync));

            secondStack.Children.Add(button);
            button = GetSmallerButton("Take", nameof(ChinazoMainViewModel.TakeAsync));
            secondStack.Children.Add(button);
            button = GetSmallerButton("Lay Down Sets", nameof(ChinazoMainViewModel.FirstSetsAsync));
            firstStack.Children.Add(button);
            AddControlToGrid(firstGrid, firstStack, 0, 0);

            _score.AddColumn("Cards Left", false, nameof(ChinazoPlayerItem.ObjectCount)); //very common.
            _score.AddColumn("Current Score", false, nameof(ChinazoPlayerItem.CurrentScore), rightMargin: 5);
            _score.AddColumn("Total Score", false, nameof(ChinazoPlayerItem.TotalScore));
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(ChinazoMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(ChinazoMainViewModel.Status));
            firstInfo.AddRow("Other Turn", nameof(ChinazoMainViewModel.OtherLabel));
            firstInfo.AddRow("Phase", nameof(ChinazoMainViewModel.PhaseData));


            AddControlToGrid(firstGrid, firstInfo.GetContent, 0, 2);
            AddControlToGrid(firstGrid, _score, 0, 3);
            AddControlToGrid(finalGrid, firstGrid, 0, 0);
            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;
        }