Exemplo n.º 1
0
 private void OnExitKey(RawKey key)
 {
     if (key == RawKey.Escape)
     {
         Quit();
     }
 }
Exemplo n.º 2
0
    private void HandleKeyDown(RawKey key)
    {
        if (capturingKeybind)
        {
            RawKey[] nonFuctionKeys = keybindKeys.FindAll(x => !functionKeys.Contains(x)).ToArray();

            if (nonFuctionKeys.Length > 0)                                                     //functionKeys.Contains(key) == false
            {
                if (functionKeys.Contains(key) == false && keybindKeys.Contains(key) == false) //nonFuctionKeys.Length <= 0
                {
                    keybindKeys.Add(key);
                }
            }
            else if (keybindKeys.Contains(key) == false)
            {
                keybindKeys.Add(key);
            }

            keybindInput.text = KeystrokesToString(keybindKeys);
        }
        else
        {
            inputKeyStrokes.Add(key);

            //Call Increase counter func
            string pressedKeys = KeystrokesToString(inputKeyStrokes);
            if (pressedKeys.Equals(keybind))
            {
                Debug.Log("Key Match");
                activeCounter.IncreaseCounter();
            }
        }
    }
 private void HandleKeyDown(RawKey key)
 {
     if (key.GetHashCode() == RawKey.F1.GetHashCode() + Constants.OnOffShortcut.GetHashCode() - 1)
     {
         _abjectAudioInputs.OnOff();
     }
 }
Exemplo n.º 4
0
 private void LogKeyDown(RawKey key)
 {
     if (key == RawKey.T)
     {
         NextProgress();
     }
 }
Exemplo n.º 5
0
 private void HandleKeyDown(RawKey key)
 {
     if (!isPressed.Contains(key.ToString()))
     {
         isPressed.Add(key.ToString());
         isPressed.Sort();
     }
 }
Exemplo n.º 6
0
 private void HandleKeyUp(RawKey key)
 {
     if (isPressed.Contains(key.ToString()))
     {
         isPressed.Remove(key.ToString());
         isPressed.Sort();
     }
 }
Exemplo n.º 7
0
 private static void HandleKeyUp(RawKey key)
 {
     pressedKeys.Remove(key);
     if (OnKeyUp != null)
     {
         OnKeyUp.Invoke(key);
     }
 }
Exemplo n.º 8
0
        private static void HandleKeyDown(RawKey key)
        {
            var added = pressedKeys.Add(key);

            if (added && OnKeyDown != null)
            {
                OnKeyDown.Invoke(key);
            }
        }
Exemplo n.º 9
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (RawKey != null ? RawKey.GetHashCode() : 0);
         result = (result * 397) ^ (Source != null ? Source.GetHashCode() : 0);
         result = (result * 397) ^ (RawValue != null ? RawValue.GetHashCode() : 0);
         return(result);
     }
 }
        private static bool CallListeners(List<Func<RawKey, bool>> listenerList, RawKey button)
        {
            var result = false;
            
            for (var i = 0; i < listenerList.Count; i++)
            {
                if (listenerList[i](button)) 
                    result = true;
            }

            return result;
        }
Exemplo n.º 11
0
 private void OnKeyDown(RawKey key)
 {
     a = (int)key - 112;
     try{
         if (RawKeyInput.IsKeyDown(key))
         {
             //Debug.Log("Key Down: "+(key-112)+a);
             on[a].SetActive(true);
             off[a].SetActive(false);
         }
     }
     catch {}
 }
 private static bool HandleKeyUp (RawKey key)
 {
     try
     {
         return pressedKeys.Remove(key) && CallListeners(onKeyUpListeners, key);
     }
     catch (Exception e)
     {
         Debug.Log(e);
     }
     
     return false;
 }
Exemplo n.º 13
0
 private void OnKeyUp(RawKey key)
 {
     a = (int)key - 112;//入力キーの番号識別(F1=112)細かいのはRawKey.cs(16進)かKeycord等参照
     //想定しているF1~F6以外だと異常値が出てUnityが強制終了するので対策としてtry,catchの実装。
     try{
         if (!(RawKeyInput.IsKeyDown(key)))//通常ifは使われてなかったので削除
         {
             off[a].SetActive(true);
             on[a].SetActive(false);
         }
     }
     catch {}
 }
Exemplo n.º 14
0
    /// <summary>
    /// Using Unity raw input open source project to track input outside of unity
    /// </summary>
    /// <param name="key"></param>
    private void TrackKeyInput(RawKey key)
    {
        keyboardClicks += 1;
        if (key == RawKey.Return)
        {
            enterHits++;
        }
        else if (key == RawKey.Space)
        {
            spaceHits++;
        }

        mostRecentKeystroke = Time.time;
    }
Exemplo n.º 15
0
    private void HandleKeyUp(RawKey key)
    {
        if (capturingKeybind)
        {
            RawKey[] nonFuctionKeys = keybindKeys.FindAll(x => !functionKeys.Contains(x)).ToArray();

            if (keybindKeys.Contains(key) && nonFuctionKeys.Length > 0)
            {
                SaveKeybinding();
            }
            else
            {
                keybindKeys.Clear();
                keybindInput.text = KeystrokesToString(keybindKeys);
            }
        }
        else
        {
            if (inputKeyStrokes.Contains(key))
            {
                inputKeyStrokes.Remove(key);
            }
        }
    }
Exemplo n.º 16
0
 private void LogKeyDown(RawKey key)
 {
     Debug.Log("Key Down: " + key);
 }
Exemplo n.º 17
0
 private void LogKeyUp(RawKey key)
 {
     Debug.Log("Key Up: " + key);
 }
Exemplo n.º 18
0
 void OnKeyDown(RawKey key)
 {
     UnityEngine.Debug.Log("Puress " + key);
 }
Exemplo n.º 19
0
 public static bool IsKeyDown(RawKey key)
 {
     return(pressedKeys.Contains(key));
 }