Add DisableKeyRepeat flag to ButtonWidget.
This commit is contained in:
@@ -27,6 +27,8 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
set { GetKey = _ => value; }
|
set { GetKey = _ => value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DisableKeyRepeat = false;
|
||||||
|
|
||||||
[Translate] public string Text = "";
|
[Translate] public string Text = "";
|
||||||
public string Background = "button";
|
public string Background = "button";
|
||||||
public bool Depressed = false;
|
public bool Depressed = false;
|
||||||
@@ -133,7 +135,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
public override bool HandleKeyPress(KeyInput e)
|
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;
|
return false;
|
||||||
|
|
||||||
if (!IsDisabled())
|
if (!IsDisabled())
|
||||||
|
|||||||
Reference in New Issue
Block a user