Ejemplo n.º 1
0
        public override List <SnapPoint> GetSnapPoints()
        {
            List <SnapPoint> list = new List <SnapPoint>();

            GetGridParameters(out int startX, out int startY, out int startItemIndex, out int endItemIndex);
            _ = _itemsPerLine;
            Rectangle viewCullingArea = base.Parent.GetViewCullingArea();
            int       num             = endItemIndex - startItemIndex;

            while (_dummySnapPoints.Count < num)
            {
                _dummySnapPoints.Add(new SnapPoint("CreativeInfinitesSlot", 0, Vector2.Zero, Vector2.Zero));
            }
            int     num2  = 0;
            Vector2 value = GetDimensions().Position();

            for (int i = startItemIndex; i < endItemIndex; i++)
            {
                Point center = GetItemSlotHitbox(startX, startY, startItemIndex, i).Center;
                if (viewCullingArea.Contains(center))
                {
                    SnapPoint snapPoint = _dummySnapPoints[num2];
                    snapPoint.ThisIsAHackThatChangesTheSnapPointsInfo(Vector2.Zero, center.ToVector2() - value, num2);
                    snapPoint.Calculate(this);
                    num2++;
                    list.Add(snapPoint);
                }
            }
            foreach (UIElement element in Elements)
            {
                list.AddRange(element.GetSnapPoints());
            }
            return(list);
        }
Ejemplo n.º 2
0
        public override List <SnapPoint> GetSnapPoints()
        {
            List <SnapPoint> snapPointList = new List <SnapPoint>();
            int startX;
            int startY;
            int startItemIndex;
            int endItemIndex;

            this.GetGridParameters(out startX, out startY, out startItemIndex, out endItemIndex);
            int       itemsPerLine    = this._itemsPerLine;
            Rectangle viewCullingArea = this.Parent.GetViewCullingArea();
            int       num             = endItemIndex - startItemIndex;

            while (this._dummySnapPoints.Count < num)
            {
                this._dummySnapPoints.Add(new SnapPoint("CreativeInfinitesSlot", 0, Vector2.Zero, Vector2.Zero));
            }
            int     id      = 0;
            Vector2 vector2 = this.GetDimensions().Position();

            for (int i = startItemIndex; i < endItemIndex; ++i)
            {
                Point center = this.GetItemSlotHitbox(startX, startY, startItemIndex, i).Center;
                if (viewCullingArea.Contains(center))
                {
                    SnapPoint dummySnapPoint = this._dummySnapPoints[id];
                    dummySnapPoint.ThisIsAHackThatChangesTheSnapPointsInfo(Vector2.Zero, center.ToVector2() - vector2, id);
                    dummySnapPoint.Calculate((UIElement)this);
                    ++id;
                    snapPointList.Add(dummySnapPoint);
                }
            }
            foreach (UIElement element in this.Elements)
            {
                snapPointList.AddRange((IEnumerable <SnapPoint>)element.GetSnapPoints());
            }
            return(snapPointList);
        }