/// <summary> /// Determines if given combo is equivalent to any existing binds. /// </summary> private bool DoesComboConflict(IControl[] newCombo, IKeyBind exception = null) { int matchCount; for (int n = 0; n < keyBinds.Length; n++) { if (keyBinds[n] != exception && keyBinds[n].Count == newCombo.Length) { matchCount = 0; foreach (Control con in newCombo) { if (BindUsesControl(n, con)) { matchCount++; } else { break; } } if (matchCount == newCombo.Length) { return(true); } } } return(false); }
/// <summary> /// Initializes binds class. Generates control dictionary, list and key binds array. /// </summary> private Binds() { if (controls == null) { controlList = new List <Control>(220); controls = new Dictionary <string, Control>(); GetControls(); } keyBinds = new KeyBind[] { new KeyBind("open"), new KeyBind("close"), new KeyBind("select"), new KeyBind("scrollup"), new KeyBind("scrolldown"), new KeyBind("multx"), new KeyBind("multy"), new KeyBind("multz") }; open = keyBinds[0]; close = keyBinds[1]; select = keyBinds[2]; scrollUp = keyBinds[3]; scrollDown = keyBinds[4]; multX = keyBinds[5]; multY = keyBinds[6]; multZ = keyBinds[7]; bindHits = new int[keyBinds.Length]; usedControls = new List <Control>(11); controlBindMap = new bool[usedControls.Count, keyBinds.Length]; }