public ThinkTwiceMainGameClass(IGamePackageResolver mainContainer,
                                IEventAggregator aggregator,
                                BasicData basicData,
                                TestOptions test,
                                ThinkTwiceVMData currentMod,
                                IMultiplayerSaveState state,
                                IAsyncDelayer delay,
                                CommandContainer command,
                                ThinkTwiceGameContainer gameContainer,
                                StandardRollProcesses <SimpleDice, ThinkTwicePlayerItem> roller,
                                ScoreLogic scoreLogic,
                                CategoriesDice categoriesDice,
                                Multiplier multiplier
                                ) :
     base(mainContainer, aggregator, basicData, test, currentMod, state, delay, command, gameContainer, roller)
 {
     _model                        = currentMod; //if not needed, take this out and the _model variable.
     _scoreLogic                   = scoreLogic;
     _categoriesDice               = categoriesDice;
     _multiplier                   = multiplier;
     roller.BeforeRollingAsync     = BeforeRollingAsync;
     roller.CanRollAsync           = CanRollAsync;
     gameContainer.ScoreClickAsync = ScoreClickedAsync;
     gameContainer.CategoryClicked = CategoryClickedAsync;
 }
Esempio n. 2
0
        }         // hopefully its this simple (?)

        public ScoreViewModel(ThinkTwiceVMData model, ThinkTwiceGameContainer gameContainer)
        {
            _model         = model;
            _gameContainer = gameContainer;
            _gameContainer.Command.ExecutingChanged += Command_ExecutingChanged;
            _model.PropertyChanged += PropertyChange;
            CommandContainer        = _gameContainer.Command;
            ItemSelected            = _model.ItemSelected;
        }
Esempio n. 3
0
        //public BasicGameCommand? CategoryClickCommand { get; set; }
        public CategoriesDice(ThinkTwiceGameContainer gameContainer)
        {
            _gameContainer = gameContainer;
            MainContainer  = _gameContainer.Resolver;

            //categoryclickedcommand is iffy now.


            //CategoryClickCommand = new BasicGameCommand(thisMod, async items => await mainGame.CategoryClickedAsync(),
            //    Items => Visible, thisMod, thisMod.CommandContainer!);
        }
        public void SendDiceInfo(CategoriesDice thisDice, ThinkTwiceGameContainer gameContainer) //it did send dice
        {
            _gameContainer = gameContainer;
            IGamePackageResolver thisR = (IGamePackageResolver)cons !;
            IProportionImage     thisP = thisR.Resolve <IProportionImage>(GetDiceTag);

            _mains                    = new ButtonDiceGraphicsCP();
            _mains.PaintUI            = this;
            _mains.MinimumWidthHeight = thisDice.HeightWidth;
            SetBinding(TextProperty, new Binding(nameof(CategoriesDice.Value)));
            SetBinding(HoldProperty, new Binding(nameof(CategoriesDice.Hold)));
            SetBinding(IsVisibleProperty, new Binding(nameof(CategoriesDice.Visible)));
            SKSize tempSize = new SKSize(thisDice.HeightWidth, thisDice.HeightWidth);

            DiceSize       = tempSize.GetSizeUsed(thisP.Proportion * 1.3f);
            HeightRequest  = DiceSize.Height;
            WidthRequest   = DiceSize.Width;
            BindingContext = thisDice;
            Init();
        }
Esempio n. 5
0
        public static string GetDiceTag => "StandardDice";                                       //same as other dice.
        //private ICommand? Command;
        public void SendDiceInfo(CategoriesDice thisDice, ThinkTwiceGameContainer gameContainer) //it did send dice
        {
            IGamePackageResolver thisR = (IGamePackageResolver)cons !;
            IProportionImage     thisP = thisR.Resolve <IProportionImage>(GetDiceTag);

            _gameContainer            = gameContainer;
            _mains                    = new ButtonDiceGraphicsCP();
            _mains.PaintUI            = this;
            _mains.MinimumWidthHeight = thisDice.HeightWidth;
            SetBinding(TextProperty, nameof(CategoriesDice.Value));
            SetBinding(HoldProperty, nameof(CategoriesDice.Hold));
            SetBinding(VisibilityProperty, GetVisibleBinding(nameof(CategoriesDice.Visible)));
            SKSize TempSize = new SKSize(thisDice.HeightWidth, thisDice.HeightWidth);

            DiceSize = TempSize.GetSizeUsed(thisP.Proportion);
            //Command = thisDice.CategoryClickCommand!;
            Height      = DiceSize.Height;
            Width       = DiceSize.Width;
            DataContext = thisDice;
            Init();
        }
        public ThinkTwiceMainView(IEventAggregator aggregator,
                                  TestOptions test, ThinkTwiceVMData model,
                                  IGamePackageResolver resolver,
                                  ThinkTwiceGameContainer gameContainer
                                  )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            _model         = model;
            _resolver      = resolver;
            _gameContainer = gameContainer;
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer parent    = new ParentSingleUIContainer(nameof(ThinkTwiceMainViewModel.ScoreScreen));

            _multStack = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };

            if (ScreenUsed != EnumScreen.SmallPhone)
            {
                mainStack.Children.Add(parent);
                mainStack.Children.Add(_multStack);
            }
            else
            {
                StackLayout tempStack = new StackLayout();
                _multStack.VerticalOptions = LayoutOptions.End;
                tempStack.Orientation      = StackOrientation.Horizontal;
                tempStack.Children.Add(parent);
                tempStack.Children.Add(_multStack);
                mainStack.Children.Add(tempStack);
                _multStack.Spacing = 2;
            }
            StackLayout firsts = new StackLayout();

            ParentSingleUIContainer?restoreP = null;

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


            var         thisRoll   = GetSmallerButton("Roll Dice", nameof(ThinkTwiceMainViewModel.RollDiceAsync));
            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            _diceControl           = new DiceListControlXF <SimpleDice>();
            mainStack.Children.Add(_diceControl);
            otherStack.Children.Add(thisRoll);
            var endButton = GetSmallerButton("End Turn", nameof(ThinkTwiceMainViewModel.EndTurnAsync));

            endButton.HorizontalOptions = LayoutOptions.Start;
            otherStack.Children.Add(endButton);
            var thisBut = GetSmallerButton("Roll Multiplier Dice", nameof(ThinkTwiceMainViewModel.RollMultAsync));

            otherStack.Children.Add(thisBut);

            mainStack.Children.Add(otherStack);
            _score = new ScoreBoardXF();
            _score.AddColumn("Score Round", true, nameof(ThinkTwicePlayerItem.ScoreRound));
            _score.AddColumn("Score Game", true, nameof(ThinkTwicePlayerItem.ScoreGame));


            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("Turn", nameof(ThinkTwiceMainViewModel.NormalTurn)); // there is no roll number needed for this game.
            firstInfo.AddRow("Roll", nameof(ThinkTwiceMainViewModel.RollNumber)); //if you don't need, it comment it out.
            firstInfo.AddRow("Category", nameof(ThinkTwiceMainViewModel.CategoryChosen));
            firstInfo.AddRow("Score", nameof(ThinkTwiceMainViewModel.Score));


            mainStack.Children.Add(firstInfo.GetContent);
            mainStack.Children.Add(_score);

            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;
        }
Esempio n. 7
0
        public ThinkTwiceMainView(IEventAggregator aggregator,
                                  TestOptions test, ThinkTwiceVMData model,
                                  IGamePackageResolver resolver,
                                  ThinkTwiceGameContainer gameContainer
                                  )
        {
            _aggregator    = aggregator;
            _model         = model;
            _resolver      = resolver;
            _gameContainer = gameContainer;
            _aggregator.Subscribe(this);
            StackPanel mainStack = new StackPanel();

            _multStack = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };
            StackPanel firsts     = new StackPanel();
            StackPanel otherStack = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            _diceControl = new DiceListControlWPF <SimpleDice>();
            firsts.Children.Add(_multStack);
            firsts.Children.Add(_diceControl);
            Grid       grid        = new Grid();
            StackPanel columnStack = new StackPanel();

            AddControlToGrid(grid, columnStack, 0, 0);
            AddLeftOverColumn(grid, 70);
            AddLeftOverColumn(grid, 30);
            mainStack.Children.Add(grid);
            ParentSingleUIContainer?restoreP = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer()
                {
                    Name = nameof(ThinkTwiceMainViewModel.RestoreScreen)
                };
            }
            var thisRoll  = GetGamingButton("Roll Dice", nameof(ThinkTwiceMainViewModel.RollDiceAsync));
            var endButton = GetGamingButton("End Turn", nameof(ThinkTwiceMainViewModel.EndTurnAsync));

            endButton.HorizontalAlignment = HorizontalAlignment.Left;
            _score = new ScoreBoardWPF();

            ParentSingleUIContainer parent = new ParentSingleUIContainer()
            {
                Name = nameof(ThinkTwiceMainViewModel.ScoreScreen)
            };

            AddControlToGrid(grid, parent, 0, 1);


            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(ThinkTwiceMainViewModel.NormalTurn)); // there is no roll number needed for this game.
            firstInfo.AddRow("Roll", nameof(ThinkTwiceMainViewModel.RollNumber)); //if you don't need, it comment it out.
            firstInfo.AddRow("Category", nameof(ThinkTwiceMainViewModel.CategoryChosen));
            firstInfo.AddRow("Score", nameof(ThinkTwiceMainViewModel.Score));
            firstInfo.AddRow("Status", nameof(ThinkTwiceMainViewModel.Status));

            firsts.Children.Add(firstInfo.GetContent);
            otherStack.Children.Add(firsts);

            StackPanel seconds = new StackPanel();
            var        thisBut = GetGamingButton("Roll Multiplier Dice", nameof(ThinkTwiceMainViewModel.RollMultAsync));

            seconds.Children.Add(thisBut);
            seconds.Children.Add(thisRoll);
            seconds.Children.Add(endButton);
            otherStack.Children.Add(seconds);
            columnStack.Children.Add(otherStack);
            columnStack.Children.Add(_score);
            _score.AddColumn("Score Round", true, nameof(ThinkTwicePlayerItem.ScoreRound));
            _score.AddColumn("Score Game", true, nameof(ThinkTwicePlayerItem.ScoreGame));

            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP); //default add to grid but does not have to.
            }
            Content = mainStack;
        }
Esempio n. 8
0
 public ScoreLogic(ThinkTwiceVMData model, ThinkTwiceGameContainer gameContainer)
 {
     _model         = model;
     _gameContainer = gameContainer;
 }
Esempio n. 9
0
 public Multiplier(ThinkTwiceGameContainer gameContainer)
 {
     MainContainer  = gameContainer.Resolver;
     _gameContainer = gameContainer;
 }