Exemple #1
0
 public DominosMexicanTrainMainGameClass(IGamePackageResolver resolver,
                                         IEventAggregator aggregator,
                                         BasicData basic,
                                         TestOptions test,
                                         DominosMexicanTrainVMData model,
                                         IMultiplayerSaveState state,
                                         IAsyncDelayer delay,
                                         CommandContainer command,
                                         GlobalClass global,
                                         BasicGameContainer <DominosMexicanTrainPlayerItem, DominosMexicanTrainSaveInfo> gameContainer
                                         ) : base(resolver, aggregator, basic, test, model, state, delay, command, gameContainer)
 {
     _model           = model;
     _global          = global;
     DominosToPassOut = 12;
 }
        public DominosMexicanTrainMainViewModel(
            CommandContainer commandContainer,
            DominosMexicanTrainMainGameClass mainGame,
            DominosMexicanTrainVMData viewModel,
            BasicData basicData,
            TestOptions test,

            IGamePackageResolver resolver) : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
        {
            _mainGame  = mainGame;
            _viewModel = viewModel;
            _test      = test;
            GlobalClass.TrainClickedAsync             = TrainClickedAsync;
            _viewModel.PrivateTrainObjectClickedAsync = PrivateTrain1_ObjectClickedAsync;
            _viewModel.PrivateTrainBoardClickedAsync  = PrivateTrain1_BoardClickedAsync;
            commandContainer !.ExecutingChanged      += CommandContainer_ExecutingChanged;
        }
Exemple #3
0
        private readonly TrainStationWPF _trainG = new TrainStationWPF(); //has to be new because of linking issues.
        public DominosMexicanTrainMainView(IEventAggregator aggregator,
                                           TestOptions test,
                                           DominosMexicanTrainVMData model,
                                           IGamePackageRegister register,
                                           TrainStationGraphicsCP graphics
                                           )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);
            StackPanel mainStack = new StackPanel();

            register.RegisterControl(_trainG.Element, "");
            graphics.LinkBoard();
            ParentSingleUIContainer?restoreP = null;

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


            _bone          = new BoneYardWPF <MexicanDomino, ts, DominosWPF <MexicanDomino>, DominosBasicShuffler <MexicanDomino> >();
            _playerHandWPF = new BaseHandWPF <MexicanDomino, ts, DominosWPF <MexicanDomino> >();
            _score         = new ScoreBoardWPF();
            _playerTrain   = new BaseHandWPF <MexicanDomino, ts, DominosWPF <MexicanDomino> >();
            _bone.Height   = 500;
            _bone.Width    = 1050; //can adjust as needed.

            mainStack.Children.Add(_playerHandWPF);


            Grid otherGrid = new Grid();

            AddLeftOverColumn(otherGrid, 1);
            AddAutoColumns(otherGrid, 1);
            mainStack.Children.Add(otherGrid);
            StackPanel finalStack = new StackPanel();

            AddControlToGrid(otherGrid, finalStack, 0, 0);
            _trainG.Margin = new Thickness(5, 5, 5, 5);
            _trainG.HorizontalAlignment = HorizontalAlignment.Left;
            _trainG.VerticalAlignment   = VerticalAlignment.Top;
            AddControlToGrid(otherGrid, _trainG, 0, 1);
            finalStack.Children.Add(_bone);
            _playerTrain.HorizontalAlignment = HorizontalAlignment.Left;
            finalStack.Children.Add(_playerTrain);
            StackPanel tempstack = new StackPanel();

            tempstack.Orientation = Orientation.Horizontal;
            finalStack.Children.Add(tempstack);
            Button endbutton = GetGamingButton("End Turn", nameof(DominosMexicanTrainMainViewModel.EndTurnAsync));

            endbutton.HorizontalAlignment = HorizontalAlignment.Left;
            tempstack.Children.Add(endbutton);
            Button thisButton = GetGamingButton("Longest Train", nameof(DominosMexicanTrainMainViewModel.LongestTrain));

            tempstack.Children.Add(thisButton);
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(DominosMexicanTrainMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(DominosMexicanTrainMainViewModel.Status));
            _score.AddColumn("Dominos Left", true, nameof(DominosMexicanTrainPlayerItem.ObjectCount));
            _score.AddColumn("Total Score", true, nameof(DominosMexicanTrainPlayerItem.TotalScore));
            _score.AddColumn("Previous Score", true, nameof(DominosMexicanTrainPlayerItem.PreviousScore));
            _score.AddColumn("# Previous", true, nameof(DominosMexicanTrainPlayerItem.PreviousLeft));
            finalStack.Children.Add(_score);
            finalStack.Children.Add(firstInfo.GetContent);



            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 = mainStack; //hopefully this is still it (?)
        }