public TileRummyMainView(IEventAggregator aggregator,
                                 TileRummyVMData model
                                 )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);


            _score = new ScoreBoardWPF();
            _hand1 = new BaseHandWPF <TileInfo, TileCP, TileWPF>();
            _pool1 = new BoneYardWPF <TileInfo, TileCP, TileWPF, TileShuffler>();
            _tempG = new TempRummySetsWPF <EnumColorType, EnumColorType, TileInfo, TileCP, TileWPF>();
            _mainG = new MainRummySetsWPF <EnumColorType, EnumColorType, TileInfo, TileCP, TileWPF, TileSet, SavedSet>();


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

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            var firstButton = GetGamingButton("Create First Sets", nameof(TileRummyMainViewModel.CreateFirstSetsAsync));
            var otherButton = GetGamingButton("Create New Set", nameof(TileRummyMainViewModel.CreateNewSetAsync));
            var undoButton  = GetGamingButton("Reset Moves", nameof(TileRummyMainViewModel.UndoMoveAsync));

            _score.AddColumn("Tiles Left", true, nameof(TileRummyPlayerItem.ObjectCount));
            _score.AddColumn("Score", true, nameof(TileRummyPlayerItem.Score));

            _tempG.Height = 250;
            _pool1.Width  = 300; // well see.
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(TileRummyMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(TileRummyMainViewModel.Status));
            var  firstContent = firstInfo.GetContent;
            Grid completeGrid = new Grid();

            AddLeftOverRow(completeGrid, 50);
            AddAutoRows(completeGrid, 1);
            AddLeftOverRow(completeGrid, 50);
            StackPanel otherStack = new StackPanel();

            otherStack.Orientation = Orientation.Horizontal;
            otherStack.Children.Add(_pool1);
            StackPanel stack = new StackPanel();

            stack.Children.Add(firstButton);
            stack.Children.Add(otherButton);
            stack.Children.Add(undoButton);
            stack.Children.Add(endButton);
            otherStack.Children.Add(stack);
            stack = new StackPanel();
            stack.Children.Add(_tempG);
            stack.Children.Add(firstContent);
            stack.Children.Add(_score);
            otherStack.Children.Add(stack);
            AddControlToGrid(completeGrid, otherStack, 0, 0);
            AddControlToGrid(completeGrid, _hand1, 1, 0);
            _pool1.Margin = new Thickness(2, 2, 2, 2);
            AddControlToGrid(completeGrid, _mainG, 2, 0); // used the wrong one.
            Content = completeGrid;
        }
Ejemplo n.º 2
0
 public TileRummyMainGameClass(IGamePackageResolver resolver,
                               IEventAggregator aggregator,
                               BasicData basic,
                               TestOptions test,
                               TileRummyVMData model,
                               IMultiplayerSaveState state,
                               IAsyncDelayer delay,
                               CommandContainer command,
                               BasicGameContainer <TileRummyPlayerItem, TileRummySaveInfo> gameContainer
                               ) : base(resolver, aggregator, basic, test, model, state, delay, command, gameContainer)
 {
     _model   = model;
     _command = command;
     _rummys  = new RummyProcesses <EnumColorType, EnumColorType, TileInfo>(); //decided to create new one here.  hopefully i don't regret this
 }
Ejemplo n.º 3
0
 public TileRummyMainViewModel(CommandContainer commandContainer,
                               TileRummyMainGameClass mainGame,
                               TileRummyVMData viewModel,
                               BasicData basicData,
                               TestOptions test,
                               IGamePackageResolver resolver
                               )
     : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
 {
     _mainGame = mainGame;
     _model    = viewModel;
     _model.TempSets.Init(this);
     _model.TempSets.ClearBoard();
     _model.Pool1.DrewTileAsync  = DrewTileAsync;
     _model.MainSetsClickedAsync = MainSets1_SetClickedAsync;
     _model.TempSetsClickedAsync = TempSets_SetClickedAsync;
 }
        public TileRummyMainView(IEventAggregator aggregator,
                                 TileRummyVMData model,
                                 TestOptions test
                                 )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);


            _score = new ScoreBoardXF();
            _hand1 = new BaseHandXF <TileInfo, TileCP, TileXF>();
            _pool1 = new BoneYardXF <TileInfo, TileCP, TileXF, TileShuffler>();
            _tempG = new TempRummySetsXF <EnumColorType, EnumColorType, TileInfo, TileCP, TileXF>();
            _mainG = new MainRummySetsXF <EnumColorType, EnumColorType, TileInfo, TileCP, TileXF, TileSet, SavedSet>();

            var endButton = GetSmallerButton("End Turn", nameof(TileRummyMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;
            var firstButton = GetSmallerButton("Create First Sets", nameof(TileRummyMainViewModel.CreateFirstSetsAsync));
            var otherButton = GetSmallerButton("Create New Set", nameof(TileRummyMainViewModel.CreateNewSetAsync));
            var undoButton  = GetSmallerButton("Reset Moves", nameof(TileRummyMainViewModel.UndoMoveAsync));

            _score.AddColumn("Tiles Left", true, nameof(TileRummyPlayerItem.ObjectCount));
            _score.AddColumn("Score", true, nameof(TileRummyPlayerItem.Score));

            if (ScreenUsed == EnumScreen.SmallTablet)
            {
                _tempG.HeightRequest = 120;
            }
            else
            {
                _tempG.HeightRequest = 200;
            }
            _pool1.WidthRequest = 250;

            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(TileRummyMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(TileRummyMainViewModel.Status));
            var  firstContent = firstInfo.GetContent;
            Grid completeGrid = new Grid();

            AddLeftOverRow(completeGrid, 55);
            AddAutoRows(completeGrid, 1);
            AddLeftOverRow(completeGrid, 50);
            AddAutoRows(completeGrid, 1);
            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            otherStack.Children.Add(_pool1);
            StackLayout stack = new StackLayout();

            stack.Children.Add(firstButton);
            stack.Children.Add(otherButton);
            stack.Children.Add(undoButton);
            stack.Children.Add(endButton);
            otherStack.Children.Add(stack);
            stack = new StackLayout();
            stack.Children.Add(_tempG);
            stack.Children.Add(firstContent);
            stack.Children.Add(_score);
            otherStack.Children.Add(stack);
            AddControlToGrid(completeGrid, otherStack, 0, 0);
            AddControlToGrid(completeGrid, _hand1, 1, 0);
            _pool1.Margin = new Thickness(2, 2, 2, 2);
            AddControlToGrid(completeGrid, _mainG, 2, 0); // used the wrong one.

            ParentSingleUIContainer?restoreP = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(TileRummyMainViewModel.RestoreScreen));
            }
            if (restoreP != null)
            {
                AddControlToGrid(completeGrid, restoreP, 3, 0); //default add to grid but does not have to.
            }


            Content = completeGrid;
        }