Пример #1
0
 public Buttons GetBound(InfiniminerShared.MouseButton theButton)
 {
     if (mouseBinds.ContainsKey(theButton))
     {
         return(mouseBinds[theButton]);
     }
     return(Buttons.None);
 }
Пример #2
0
 public bool IsBound(Buttons button, InfiniminerShared.MouseButton mb)
 {
     if (mouseBinds.ContainsKey(mb) && mouseBinds[mb] == button)
     {
         return(true);
     }
     return(false);
 }
Пример #3
0
 //If overwrite is true then the previous entry for that button will be removed
 public bool BindKey(Buttons button, string key, bool overwrite)
 {
     try
     {
         //Key bind
         Keys actualKey = (Keys)Enum.Parse(typeof(Keys), key, true);
         if (Enum.IsDefined(typeof(Keys), actualKey))
         {
             keyBinds.Add(actualKey, (Buttons)button);
             return(true);
         }
     }
     catch { }
     try
     {
         //Mouse bind
         InfiniminerShared.MouseButton actualMB = (InfiniminerShared.MouseButton)Enum.Parse(typeof(InfiniminerShared.MouseButton), key, true);
         if (Enum.IsDefined(typeof(InfiniminerShared.MouseButton), actualMB))
         {
             mouseBinds.Add(actualMB, (Buttons)button);
             return(true);
         }
     }
     catch { }
     //Special cases
     if (key.Equals("control", StringComparison.OrdinalIgnoreCase) || key.Equals("ctrl", StringComparison.OrdinalIgnoreCase))
     {
         specialKeyBinds.Add(SpecialKeys.Control, (Buttons)button);
         return(true);
     }
     if (key.Equals("shift", StringComparison.OrdinalIgnoreCase))
     {
         specialKeyBinds.Add(SpecialKeys.Shift, (Buttons)button);
         return(true);
     }
     if (key.Equals("alt", StringComparison.OrdinalIgnoreCase))
     {
         specialKeyBinds.Add(SpecialKeys.Alt, (Buttons)button);
         return(true);
     }
     return(false);
 }