Ejemplo n.º 1
0
        public void OnGamepadButtonsPressed(Buttons GamepadButtons)
        {
            if (IsGamepadFocused && !RecentlyGainedFocus)
            {
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.RucksackCycleSortOrder))
                {
                    CycleSortOrder();
                }
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.RucksackCycleSortProperty))
                {
                    CycleSortProperty();
                }

                if (!GamepadControls.HandleNavigationButtons(this, GamepadButtons, HoveredSlot))
                {
                    this.IsGamepadFocused = false;
                }

                //  Handle action buttons
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.PrimaryAction))
                {
                    HandlePrimaryAction(GetHoveredItem());
                }
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.SecondaryAction))
                {
                    HandleSecondaryAction(GetHoveredItem());
                    SecondaryActionButtonPressedLocation = HoveredSlot;
                    SecondaryActionButtonPressedTime     = DateTime.Now;
                }
            }
        }
Ejemplo n.º 2
0
        public bool TryGetSlotNeighbor(Rectangle?ItemSlot, NavigationDirection Direction, NavigationWrappingMode HorizontalWrapping, NavigationWrappingMode VerticalWrapping, out Rectangle?Neighbor)
        {
            List <Rectangle> AllSlots = TaskHeaderPositions.Select(x => x.Value).Union(ItemSlotPositions.Select(x => x.Value)).Union(LockedSlotPositions)
                                        .OrderBy(x => x.Top).ThenBy(x => x.Left).ToList();

            return(GamepadControls.TryGetSlotNeighbor(AllSlots, ItemSlot, ColumnCount, Direction, HorizontalWrapping, VerticalWrapping, out Neighbor));
        }
Ejemplo n.º 3
0
        public void OnGamepadButtonsPressed(Buttons GamepadButtons)
        {
            //  Handle closing the menu
            if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.CloseBag))
            {
                if (IsShowingModalMenu && CustomizeIconBounds != null)
                {
                    CloseModalMenu();
                }
                else
                {
                    Bag.CloseContents();
                }
                return;
            }

            //  Handle modifier buttons
            if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.TransferMultipleModifier))
            {
                IsTransferMultipleModifierHeld = true;
            }
            if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.TransferHalfModifier))
            {
                IsTransferHalfModifierHeld = true;
            }

            if (!IsGamepadFocused && !InventoryMenu.IsGamepadFocused && !Content.IsGamepadFocused)
            {
                InventoryMenu.IsGamepadFocused = true;
            }

            if (IsGamepadFocused && !RecentlyGainedFocus)
            {
                if (!GamepadControls.HandleNavigationButtons(this, GamepadButtons, HoveredButtonBounds))
                {
                    this.IsGamepadFocused = false;
                }

                //  Handle action buttons
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.PrimaryAction))
                {
                    HandlePrimaryAction();
                }
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.SecondaryAction))
                {
                    HandleSecondaryAction();
                }
            }

            if (IsShowingModalMenu && CustomizeIconMenu != null)
            {
                //TODO
            }

            InventoryMenu.OnGamepadButtonsPressed(GamepadButtons);
            Content.OnGamepadButtonsPressed(GamepadButtons);
        }
Ejemplo n.º 4
0
 public void OnGamepadButtonsReleased(Buttons GamepadButtons)
 {
     if (IsGamepadFocused && !RecentlyGainedFocus)
     {
         //  Handle action buttons
         if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.SecondaryAction))
         {
         }
     }
 }
Ejemplo n.º 5
0
 public void OnGamepadButtonsReleased(Buttons GamepadButtons)
 {
     if (IsGamepadFocused && !RecentlyGainedFocus)
     {
         //  Handle action buttons
         if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.SecondaryAction))
         {
             SecondaryActionButtonPressedLocation = null;
             SecondaryActionButtonPressedTime     = null;
         }
     }
 }
Ejemplo n.º 6
0
        public void Update(UpdateTickedEventArgs e)
        {
            RecentlyGainedFocus = false;

            if (e.IsMultipleOf(GamepadControls.Current.NavigationRepeatFrequency) && IsGamepadFocused && IsNavigatingWithGamepad)
            {
                if (!GamepadControls.HandleNavigationButtons(this, null, HoveredSlot))
                {
                    this.IsGamepadFocused = false;
                }
            }
        }
Ejemplo n.º 7
0
        public void OnGamepadButtonsPressed(Buttons GamepadButtons)
        {
            if (IsGamepadFocused && !RecentlyGainedFocus)
            {
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.BoundedBagToggleAutofill))
                {
                    TryHandlePrimaryAction(false);
                }

                if (!GroupedOptions.IsEmptyMenu)
                {
                    GroupedOptions.OnGamepadButtonsPressed(GamepadButtons);
                }
                if (!UngroupedOptions.IsEmptyMenu)
                {
                    UngroupedOptions.OnGamepadButtonsPressed(GamepadButtons);
                }
            }
        }
Ejemplo n.º 8
0
        public void OnGamepadButtonsPressed(Buttons GamepadButtons)
        {
            if (IsGamepadFocused && !RecentlyGainedFocus)
            {
                if (!GamepadControls.HandleNavigationButtons(this, GamepadButtons, HoveredSlot))
                {
                    this.IsGamepadFocused = false;
                }

                //  Handle action buttons
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.PrimaryAction))
                {
                    HandlePrimaryAction(GetHoveredBag());
                }
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.SecondaryAction))
                {
                    HandleSecondaryAction(GetHoveredBag());
                }
            }
        }
Ejemplo n.º 9
0
 public bool TryGetSlotNeighbor(Rectangle?ItemSlot, NavigationDirection Direction, NavigationWrappingMode HorizontalWrapping, NavigationWrappingMode VerticalWrapping, out Rectangle?Neighbor)
 {
     if (!ItemSlot.HasValue)
     {
         Neighbor = null;
         return(false);
     }
     else if (IsLeftSidebarVisible && LeftSidebarButtonBounds.Contains(ItemSlot.Value))
     {
         return(GamepadControls.TryGetSlotNeighbor(LeftSidebarButtonBounds, ItemSlot, 1, Direction, HorizontalWrapping, VerticalWrapping, out Neighbor));
     }
     else if (IsRightSidebarVisible && RightSidebarButtonBounds.Contains(ItemSlot.Value))
     {
         return(GamepadControls.TryGetSlotNeighbor(RightSidebarButtonBounds, ItemSlot, 1, Direction, HorizontalWrapping, VerticalWrapping, out Neighbor));
     }
     else
     {
         Neighbor = null;
         return(false);
     }
 }
Ejemplo n.º 10
0
        public void Update(UpdateTickedEventArgs e)
        {
            RecentlyGainedFocus = false;

            if (e.IsMultipleOf(ItemBagMenu.TransferRepeatFrequency) && HoveredSlot.HasValue)
            {
                if (IsSecondaryActionButtonHeld && SecondaryActionButtonPressedLocation.HasValue && HoveredSlot.Value == SecondaryActionButtonPressedLocation.Value &&
                    SecondaryActionButtonPressedTime.HasValue && DateTime.Now.Subtract(SecondaryActionButtonPressedTime.Value).TotalMilliseconds >= 500)
                {
                    HandleSecondaryAction(GetHoveredItem());
                }
            }

            if (e.IsMultipleOf(GamepadControls.Current.NavigationRepeatFrequency) && IsGamepadFocused && IsNavigatingWithGamepad)
            {
                if (!GamepadControls.HandleNavigationButtons(this, null, HoveredSlot))
                {
                    this.IsGamepadFocused = false;
                }
            }
        }
Ejemplo n.º 11
0
        public void Update(UpdateTickedEventArgs e)
        {
            RecentlyGainedFocus = false;

            if (IsShowingModalMenu && CustomizeIconMenu != null)
            {
                CustomizeIconMenu.Update(e);
            }
            else
            {
                if (e.IsMultipleOf(GamepadControls.Current.NavigationRepeatFrequency) && IsGamepadFocused && IsNavigatingWithGamepad)
                {
                    if (!GamepadControls.HandleNavigationButtons(this, null, HoveredButtonBounds))
                    {
                        this.IsGamepadFocused = false;
                    }
                }

                InventoryMenu.Update(e);
                Content.Update(e);
            }
        }
Ejemplo n.º 12
0
        public void OnGamepadButtonsPressed(Buttons GamepadButtons)
        {
            if (IsGamepadFocused && !RecentlyGainedFocus)
            {
                if (!GamepadControls.HandleNavigationButtons(this, GamepadButtons, GetHoveredSlot(true)))
                {
                    this.IsGamepadFocused = false;
                }

                //  Handle action buttons
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.PrimaryAction))
                {
                    HandlePrimaryAction(GetHoveredItem());
                }
                if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.SecondaryAction))
                {
                    HandleSecondaryAction(GetHoveredItem());
                    SecondaryActionButtonPressedItem = HoveredBundleItem;
                    SecondaryActionButtonPressedTime = DateTime.Now;
                }
            }
        }
Ejemplo n.º 13
0
        public void Update(UpdateTickedEventArgs e)
        {
            RecentlyGainedFocus = false;

            if (e.IsMultipleOf(ItemBagMenu.TransferRepeatFrequency) && HoveredSlot.HasValue)
            {
                if (IsSecondaryActionButtonHeld && SecondaryActionButtonPressedLocation.HasValue && HoveredSlot.Value == SecondaryActionButtonPressedLocation.Value &&
                    SecondaryActionButtonPressedTime.HasValue && DateTime.Now.Subtract(SecondaryActionButtonPressedTime.Value).TotalMilliseconds >= 500
                    // Disallow Hold-to-repeat if sorting is set to a property that will cause the items to be dynamically re-ordered as items are removed
                    && Rucksack.SortProperty != SortingProperty.StackValue && Rucksack.SortProperty != SortingProperty.Quantity)
                {
                    HandleSecondaryAction(GetHoveredItem());
                }
            }

            if (e.IsMultipleOf(GamepadControls.Current.NavigationRepeatFrequency) && IsGamepadFocused && IsNavigatingWithGamepad)
            {
                if (!GamepadControls.HandleNavigationButtons(this, null, HoveredSlot))
                {
                    this.IsGamepadFocused = false;
                }
            }
        }
Ejemplo n.º 14
0
        public void OnGamepadButtonsReleased(Buttons GamepadButtons)
        {
            //  Handle modifier buttons
            if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.TransferMultipleModifier))
            {
                IsTransferMultipleModifierHeld = false;
            }
            if (GamepadControls.IsMatch(GamepadButtons, GamepadControls.Current.TransferHalfModifier))
            {
                IsTransferHalfModifierHeld = false;
            }

            if (IsShowingModalMenu && CustomizeIconMenu != null)
            {
                //TODO
            }

            if (IsGamepadFocused && !RecentlyGainedFocus)
            {
            }

            InventoryMenu.OnGamepadButtonsReleased(GamepadButtons);
            Content.OnGamepadButtonsReleased(GamepadButtons);
        }
Ejemplo n.º 15
0
 public bool TryGetSlotNeighbor(Rectangle?ItemSlot, NavigationDirection Direction, NavigationWrappingMode HorizontalWrapping, NavigationWrappingMode VerticalWrapping, out Rectangle?Neighbor)
 {
     return(GamepadControls.TryGetSlotNeighbor(InventorySlotBounds, ItemSlot, InventoryColumns, Direction, HorizontalWrapping, VerticalWrapping, out Neighbor));
 }
Ejemplo n.º 16
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));
        }