Пример #1
0
        public void LoadList(RummyDiceHandVM thisMod, RummyDiceMainGameClass mainGame)
        {
            _thisMod                     = thisMod;
            _mainGame                    = mainGame;
            BindingContext               = thisMod;
            HorizontalOptions            = LayoutOptions.FillAndExpand; //hopefully this works too.
            _handList                    = thisMod.HandList;
            _handList.CollectionChanged += HandList_CollectionChanged;
            Text = $"Temp Set {thisMod.Index}";
            SetBinding(IsEnabledProperty, new Binding(nameof(RummyDiceHandVM.IsEnabled)));
            RummyDiceInfo firstDice = new RummyDiceInfo();

            if (firstDice.HeightWidth == 0)
            {
                throw new BasicBlankException("You must specify the height/width of the dice");
            }
            IProportionImage thisI     = new CustomProportionXF();
            SKSize           firstSize = new SKSize(firstDice.HeightWidth, firstDice.HeightWidth);
            var sizeUsed = firstSize.GetSizeUsed(thisI.Proportion);

            Margin                 = new Thickness(3, 3, 3, 3);
            _thisStack             = new StackLayout();
            _thisStack.Orientation = StackOrientation.Horizontal;
            _thisStack.Spacing     = 0;
            Button thisBut = GetSmallerButton("Place Tiles", "");

            thisBut.Command = thisMod.BoardCommand; //i think this way this time.
            StackLayout finalStack = new StackLayout();

            finalStack.Orientation = StackOrientation.Horizontal;
            finalStack.Children.Add(thisBut);
            finalStack.Spacing = 2;
            finalStack.Children.Add(_thisStack);
            thisBut.HorizontalOptions    = LayoutOptions.Start;
            thisBut.VerticalOptions      = LayoutOptions.Start;
            _thisStack.HorizontalOptions = LayoutOptions.FillAndExpand;
            thisBut.FontSize            *= .7f;
            _thisGrid = new Grid();
            _thisGrid.Children.Add(ThisDraw);
            _thisGrid.Children.Add(finalStack);
            var thisRect = ThisFrame.GetControlArea();

            thisBut.Margin    = new Thickness(thisRect.Left + 3, thisRect.Top + 10, 3, 3);
            _thisStack.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 10, 3, 3);
            PopulateControls(); //just in case there is something to start with.
            Content = _thisGrid;
        }
Пример #2
0
        public void SendDiceInfo(RummyDiceInfo thisDice, RummyBoardCP board)
        {
            _board = board;
            _mains = new RummyDiceGraphicsCP(this);
            _mains.MinimumWidthHeight = thisDice.HeightWidth;
            SetBinding(IsSelectedProperty, new Binding(nameof(RummyDiceInfo.IsSelected))); //maybe i forgot this too.
            SetBinding(IsVisibleProperty, new Binding(nameof(RummyDiceInfo.Visible)));     //i think.
            SetBinding(ColorProperty, new Binding(nameof(RummyDiceInfo.Color)));
            SetBinding(ValueProperty, new Binding(nameof(RummyDiceInfo.Display)));         //decided to bind to display now.
            SKSize           tempSize = new SKSize(thisDice.HeightWidth, thisDice.HeightWidth);
            IProportionImage thisP    = new CustomProportionXF();
            SKSize           diceSize = tempSize.GetSizeUsed(thisP.Proportion);

            BindingContext = thisDice;
            HeightRequest  = diceSize.Height;
            WidthRequest   = diceSize.Width;
            Init();
        }