Skip to content

Commit ae94627

Browse files
authored
Merge pull request #29 from carmineos/arrows-navigation
Tweak navigation with left/right arrows
2 parents d8a71b5 + 9159cf9 commit ae94627

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

MenuAPI/Menu.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -998,10 +998,11 @@ public void GoLeft()
998998
SelectItem(checkbox);
999999
}
10001000
#endif
1001-
// If the item is enabled and it's not any of the above, just select it.
1002-
else if (item.Enabled)
1001+
// If the item is not any of the above, return to parent menu.
1002+
else if (MenuController.NavigateMenuUsingArrows)
10031003
{
1004-
SelectItem(item);
1004+
if (!MenuController.DisableBackButton && !(MenuController.PreventExitingMenu && ParentMenu == null))
1005+
GoBack();
10051006
}
10061007
}
10071008
}
@@ -1074,9 +1075,10 @@ public void GoRight()
10741075
}
10751076
#endif
10761077
// If the item is enabled and it's not any of the above, just select it.
1077-
else if (item.Enabled)
1078+
else if (MenuController.NavigateMenuUsingArrows)
10781079
{
1079-
SelectItem(item);
1080+
if(item.Enabled)
1081+
SelectItem(item);
10801082
}
10811083
}
10821084
}

MenuAPI/MenuController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public class MenuController : BaseScript
6363
!Call<bool>(IS_ENTITY_DEAD, PlayerPedId());
6464
#endif
6565

66+
public static bool NavigateMenuUsingArrows { get; set; } = true;
6667
public static bool EnableManualGCs { get; set; } = true;
6768
public static bool DontOpenAnyMenu { get; set; } = false;
6869
public static bool PreventExitingMenu { get; set; } = false;

0 commit comments

Comments
 (0)