Пример #1
0
 public static void unbind(KeyCodes keyCode)
 {
     if (InputList.Exists(i => i.KeyCode == keyCode))
     {
         KeyModel Input = InputList.Find(i => i.KeyCode == keyCode);
         InputList.Remove(Input);
     }
 }
Пример #2
0
 public static void bind(KeyCodes keyCode, KeyActions onPress, KeyActions onRelease = null)
 {
     if (InputList.Exists(i => i.KeyCode == keyCode))
     {
         KeyModel Input = InputList.Find(i => i.KeyCode == keyCode);
         Input.OnPress   += onPress;
         Input.OnRelease += onRelease;
     }
     else
     {
         InputList.Add(new KeyModel(keyCode, onPress, onRelease));
     }
 }
Пример #3
0
 private static void checkPressed()
 {
     InputList.ForEach(i =>
     {
         if (Input.IsDown((int)i.KeyCode))
         {
             Pressed = i;
             if (i.OnPress != null)
             {
                 i.OnPress.Invoke();
             }
             return;
         }
     });
 }
Пример #4
0
 private void handler(List <Events.TickNametagData> nametags)
 {
     if (Pressed.KeyCode == KeyCodes.released)
     {
         checkPressed();
     }
     else if (!Input.IsDown((int)Pressed.KeyCode))
     {
         if (Pressed.OnRelease != null)
         {
             Pressed.OnRelease.Invoke();
         }
         Pressed = Released;
     }
     ;
 }