示例#1
0
 public void RemoveKeyCode(int keyCode, bool removeAll)
 {
     if (KeyCodes.Contains(keyCode))
     {
         if (!removeAll)
         {
             KeyCodes.Remove(keyCode);
         }
         else
         {
             int startCount = KeyCodes.Count;
             for (int i = startCount - 1; i >= 0; i--)
             {
                 if (KeyCodes[i] == keyCode)
                 {
                     KeyCodes.RemoveAt(i);
                 }
             }
         }
     }
     else
     {
         Debug.LogWarning("Can't remove key code '" + keyCode +
                          "' because it doesn't exist.");
     }
 }
 public void AddKeyCodes(KeyCode[] keycodes)
 {
     foreach (KeyCode keycode in keycodes)
     {
         if (!KeyCodes.Contains(keycode))
         {
             KeyCodes.Add(keycode);
         }
     }
 }
示例#3
0
 public bool CheckKeyCode(int keyCode)
 {
     return(KeyCodes.Contains(keyCode));
 }
示例#4
0
 /// <summary>
 /// Apply the filter logic the the given <see cref="KeyData"/>.
 /// </summary>
 /// <param name="data">The data to wich the filter logic must be applied.</param>
 /// <returns>True if the <paramref name="data"/> satisfy the filter logic, false otherwise.</returns>
 public bool Apply(KeyData data)
 {
     return(KeyCodes.Contains(data.KeyCode));
 }