Input widget - Check for duplicates in binding array before committing a mapping

This commit is contained in:
andres.delikat 2011-07-09 18:24:53 +00:00
parent 7c9d170248
commit 0407bb2e86
1 changed files with 18 additions and 4 deletions

View File

@ -78,13 +78,27 @@ namespace BizHawk.MultiClient
if (TempBindingStr == "Alt+F4")
return;
Bindings[pos] = TempBindingStr;
wasPressed = TempBindingStr;
UpdateLabel();
Increment();
if (!IsDuplicate(TempBindingStr))
{
Bindings[pos] = TempBindingStr;
wasPressed = TempBindingStr;
UpdateLabel();
Increment();
}
}
}
public bool IsDuplicate(string binding)
{
for (int x = 0; x < MaxBind; x++)
{
if (Bindings[x] == binding)
return true;
}
return false;
}
protected override void OnKeyUp(KeyEventArgs e)
{
if (e.KeyCode == Keys.F4 && e.Modifiers == Keys.Alt)