예제 #1
0
        public bool TryNavigateEnter(NavigationDirection StartingSide, Rectangle?ClosestTo)
        {
            IsGamepadFocused        = true;
            IsNavigatingWithGamepad = true;

            if (ClosestTo.HasValue)
            {
                List <Rectangle> AllSlots = SlotBounds.Select(x => x.Value).SelectMany(x => x.OrderBy(y => y.Key).Select(z => z.Value)).ToList();
                HoveredSlot = AllSlots.OrderBy(x => x.SquaredDistanceBetweenCenters(ClosestTo.Value)).First();
            }
            else
            {
                if (StartingSide == NavigationDirection.Right)
                {
                    while (TryNavigate(NavigationDirection.Right, NavigationWrappingMode.NoWrap, NavigationWrappingMode.NoWrap))
                    {
                    }
                }
                if (StartingSide == NavigationDirection.Down)
                {
                    while (TryNavigate(NavigationDirection.Down, NavigationWrappingMode.NoWrap, NavigationWrappingMode.NoWrap))
                    {
                    }
                }
            }

            return(true);
        }
예제 #2
0
        public bool TryGetSlotNeighbor(Rectangle?ItemSlot, NavigationDirection Direction, NavigationWrappingMode HorizontalWrapping, NavigationWrappingMode VerticalWrapping, out Rectangle?Neighbor)
        {
            List <Rectangle> AllSlots = SlotBounds.Select(x => x.Value).SelectMany(x => x.OrderBy(y => y.Key).Select(z => z.Value)).ToList();

            return(GamepadControls.TryGetSlotNeighbor(AllSlots, ItemSlot, GroupsPerRow * ColumnsPerGroup, Direction, HorizontalWrapping, VerticalWrapping, out Neighbor));
        }