Example #1
0
        private SKPoint GetBottomLocation(PrivateBasicIndividualPileXF <CA, GC, GW> thisPile)
        {
            var thisHeight = thisPile !.CardSize.Height; //well see
            var thisLeft   = GetLeft(thisPile);

            return(new SKPoint(thisLeft, thisHeight));
        }
Example #2
0
        private float GetLeft(PrivateBasicIndividualPileXF <CA, GC, GW> thisPile)
        {
            var firstLocation = thisPile.CardLocation;

            firstLocation.X += Spacing;
            firstLocation.Y += Spacing;
            float thisLeft = 0;
            float pileWidth;

            pileWidth = thisPile.CardSize.Width;
            if (Grid.GetColumn(thisPile) == 0)
            {
                thisLeft = firstLocation.X;
            }
            else
            {
                var loopTo = _thisMod !.Columns - 1;
                for (var x = 1; x <= loopTo; x++)
                {
                    thisLeft += pileWidth + Spacing + Spacing;
                    if (Grid.GetColumn(thisPile) == x)
                    {
                        break;
                    }
                }
            }
            return(thisLeft);
        }
Example #3
0
        private SKPoint GetStartLocation(PrivateBasicIndividualPileXF <CA, GC, GW> thisPile) // i do because i need to know the height.
        {
            var thisHeight = thisPile.CardSize.Height;                                       // i think.   well see how that is done for xamarin forms (we seemed to do it successfully from xamarin forms
            var thisLeft   = GetLeft(thisPile);

            return(new SKPoint(thisLeft, thisHeight * -1.0f)); // i think
        }
Example #4
0
        private SKPoint GetObjectLocation(PrivateBasicIndividualPileXF <CA, GC, GW> thisPile)
        {
            var firstLocation = thisPile.CardLocation;

            firstLocation.X += Spacing;
            firstLocation.Y += Spacing;
            float pileHeight;

            pileHeight = thisPile.CardSize.Height;
            float pileWidth;

            pileWidth = thisPile.CardSize.Width;
            if (Grid.GetRow(thisPile) == 0 && Grid.GetColumn(thisPile) == 0)
            {
                return(firstLocation);// its that simple because its the first column and first row
            }
            float thisLeft = 0;
            float thisTop  = 0;
            int   x;

            if (Grid.GetRow(thisPile) == 0)
            {
                thisTop = firstLocation.Y;
            }
            else
            {
                var loopTo = _thisMod !.Rows - 1;
                for (x = 1; x <= loopTo; x++)
                {
                    thisTop += pileHeight + Spacing + Spacing; // not built in afterall.
                    if (Grid.GetRow(thisPile) == x)
                    {
                        break;
                    }
                }
            }
            if (Grid.GetColumn(thisPile) == 0)
            {
                thisLeft = firstLocation.X;
            }
            else
            {
                var loopTo1 = _thisMod !.Columns - 1;
                for (x = 1; x <= loopTo1; x++)
                {
                    thisLeft += pileWidth + Spacing + Spacing;
                    if (Grid.GetColumn(thisPile) == x)
                    {
                        break;
                    }
                }
            }
            return(new SKPoint(thisLeft, thisTop));
        }
Example #5
0
        public void Init(BasicMultiplePilesCP <CA> mod, string tagUsed)
        {
            _thisGrid   = new Grid();
            _parentGrid = new Grid();
            _parentGrid.Children.Add(_thisGrid);
            _thisMod       = mod;
            BindingContext = mod; // i think needs this as well.
            _tagUsed       = tagUsed;
            GW tempCard = new GW();

            tempCard.SendSize(tagUsed, new CA()); //for testing.
            SKSize size = tempCard.ObjectSize;

            if (_thisMod.PileList !.Count == 0)
            {
                throw new Exception("Must have at least one pile.  Otherwise, not worth even using this");
            }
            if (_thisMod.HasFrame)
            {
                GridHelper.AddAutoColumns(_thisGrid, _thisMod.Columns);
                GridHelper.AddAutoRows(_thisGrid, _thisMod.Rows);
            }
            else
            {
                _thisMod.Columns.Times(x =>
                {
                    GridHelper.AddPixelColumn(_thisGrid, size.Width);
                });
                _thisMod.Rows.Times(x =>
                {
                    GridHelper.AddPixelRow(_thisGrid, size.Height);
                });
            }
            _thisGrid.RowSpacing    = Spacing;
            _thisGrid.ColumnSpacing = Spacing;
            foreach (var pileMod in _thisMod.PileList)
            {
                PrivateBasicIndividualPileXF <CA, GC, GW> pileG = new PrivateBasicIndividualPileXF <CA, GC, GW>();
                pileG.MainMod  = _thisMod;
                pileG.ThisPile = pileMod;
                GridHelper.AddControlToGrid(_thisGrid, pileG, pileMod.Row - 1, pileMod.Column - 1);
                pileG.Init(tagUsed);
            }
            Content = _parentGrid;
        }