Add DisableKeyRepeat flag to ButtonWidget.

This commit is contained in:
Paul Chote
2017-06-04 13:54:26 +01:00
committed by Curtis Shmyr
parent 854dd75282
commit f1eb96b273

View File

@@ -27,6 +27,8 @@ namespace OpenRA.Mods.Common.Widgets
set { GetKey = _ => value; }
}
public bool DisableKeyRepeat = false;
[Translate] public string Text = "";
public string Background = "button";
public bool Depressed = false;
@@ -133,7 +135,7 @@ namespace OpenRA.Mods.Common.Widgets
public override bool HandleKeyPress(KeyInput e)
{
if (Hotkey.FromKeyInput(e) != Key || e.Event != KeyInputEvent.Down)
if (Hotkey.FromKeyInput(e) != Key || e.Event != KeyInputEvent.Down || (DisableKeyRepeat && e.IsRepeat))
return false;
if (!IsDisabled())