Skip to content

Commit

Permalink
Merge pull request #30 from manups4e/master
Browse files Browse the repository at this point in the history
Added delay on key pressing navigating menu
  • Loading branch information
manups4e authored Dec 3, 2020
2 parents 4b6ae0e + 0b53662 commit aa88a2d
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions NativeUI/UIMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ public class UIMenu
internal readonly static string _selectTextLocalized = Game.GetGXTEntry("HUD_INPUT2");
internal readonly static string _backTextLocalized = Game.GetGXTEntry("HUD_INPUT3");
protected readonly SizeF Resolution = ScreenTools.ResolutionMaintainRatio;
protected internal int _pressingTimer = 0;
#endregion

#region Public Fields
Expand Down Expand Up @@ -2128,30 +2129,46 @@ public void ProcessControl(Keys key = Keys.None)
if (MenuItems.Count == 0) return;
if (IsControlBeingPressed(MenuControls.Up, key) && API.UpdateOnscreenKeyboard() != 0 && !API.IsWarningMessageActive())
{
if (Size > MaxItemsOnScreen + 1)
GoUpOverflow();
else
GoUp();
UpdateScaleform();
if (API.GetGameTimer() - _pressingTimer > 175)
{
if (Size > MaxItemsOnScreen + 1)
GoUpOverflow();
else
GoUp();
UpdateScaleform();
_pressingTimer = API.GetGameTimer();
}
}

else if (IsControlBeingPressed(MenuControls.Down, key) && API.UpdateOnscreenKeyboard() != 0 && !API.IsWarningMessageActive())
{
if (Size > MaxItemsOnScreen + 1)
GoDownOverflow();
else
GoDown();
UpdateScaleform();
if (API.GetGameTimer() - _pressingTimer > 175)
{
if (Size > MaxItemsOnScreen + 1)
GoDownOverflow();
else
GoDown();
UpdateScaleform();
_pressingTimer = API.GetGameTimer();
}
}

else if (IsControlBeingPressed(MenuControls.Left, key) && API.UpdateOnscreenKeyboard() != 0 && !API.IsWarningMessageActive())
{
GoLeft();
if (API.GetGameTimer() - _pressingTimer > 175)
{
GoLeft();
_pressingTimer = API.GetGameTimer();
}
}

else if (IsControlBeingPressed(MenuControls.Right, key) && API.UpdateOnscreenKeyboard() != 0 && !API.IsWarningMessageActive())
{
GoRight();
if (API.GetGameTimer() - _pressingTimer > 175)
{
GoRight();
_pressingTimer = API.GetGameTimer();
}
}

else if (HasControlJustBeenPressed(MenuControls.Select, key) && API.UpdateOnscreenKeyboard() != 0 && !API.IsWarningMessageActive())
Expand Down

0 comments on commit aa88a2d

Please sign in to comment.