Beispiel #1
0
        /// <summary>
        /// 获取inputKeyDic列表中某个按键状态
        /// </summary>
        /// <param name="inputKeyCode"></param>
        /// <returns></returns>
        public InputKeyState GetKeyCurrentState(InputKeyCode inputKeyCode)
        {
            InputKeyState inputKeyState;

            inputKeyDic.TryGetValue(inputKeyCode, out inputKeyState);
            return(inputKeyState);
        }
Beispiel #2
0
 ///API-No.112
 /// <summary>
 /// 给Head发送一个按键,注意,发送按键至少需发送一个Down,然后再发送一个Up,此API模拟按键按下动作
 /// </summary>
 /// <param name="inputKeyCode">具体按键</param>
 /// <param name="inputKeyState">按键的状态</param>
 public static void HeadAddKey(InputKeyCode inputKeyCode, InputKeyState inputKeyState)
 {
     if (Head)
     {
         Head.inputDataBase.InputDataAddKey(inputKeyCode, inputKeyState);
     }
 }
Beispiel #3
0
        IEnumerator AddKey(InputKeyCode keycode, InputKeyState state, SCPointEventData scData, float time)
        {
            yield return(new WaitForSeconds(time));

            scData.inputDevicePartBase.inputDataBase.inputKeys.InputDataAddKey(keycode, state);
            isAddKeyFinish = true;
        }
Beispiel #4
0
 ///API-No.108
 /// <summary>
 /// Head某个按键是否按下,当前帧有效,下帧复位,参考Input.GetKeyDown
 /// </summary>
 /// <param name="inputKeyCode">具体按键,Head支持Enter/Back</param>
 /// <returns></returns>
 public static bool IsHeadKeyDown(InputKeyCode inputKeyCode)
 {
     if (Head)
     {
         return(Head.inputDataHead.inputKeys.GetKeyDown(inputKeyCode));
     }
     return(false);
 }
Beispiel #5
0
 ///API-No.109
 /// <summary>
 /// Head某个按键是否按下后松开,当前帧有效,下帧复位,参考Input.GetKeyUp
 /// </summary>
 /// <param name="inputKeyCode">具体按键,Head支持Enter/Back</param>
 /// <returns></returns>
 public static bool IsHeadKeyUp(InputKeyCode inputKeyCode)
 {
     if (Head)
     {
         return(Head.inputDataBase.GetKeyUp(inputKeyCode));
     }
     return(false);
 }
Beispiel #6
0
 ///API-No.111
 /// <summary>
 /// Head某个按键的实时状态,参考Input.GetKey
 /// </summary>
 /// <param name="inputKeyCode">具体按键,Head支持Enter/Back</param>
 /// <returns></returns>
 public static InputKeyState HeadKeyCurrentState(InputKeyCode inputKeyCode)
 {
     if (Head)
     {
         return(Head.inputDataBase.GetKeyCurrentState(inputKeyCode));
     }
     return(InputKeyState.Null);
 }
Beispiel #7
0
 public virtual void onUp(InputKeyCode keyCode)
 {
     //  ApplyMaterialToAllRenderers(boxDisplay, boxMaterial);
     ShowBoxEdit();
     tw.Kill(false);
     //     InputDeviceEventBase.anyKeyUpDelegate -= onUp;
     isMove = false;
 }
 protected override void partAnyKeyDownDelegate(InputKeyCode keyCode, InputDevicePartBase part)
 {
     base.partAnyKeyDownDelegate(keyCode, part);
     try {
         GetComponent <MeshRenderer>().material.color = new Color(UnityEngine.Random.Range(0, 1f), UnityEngine.Random.Range(0, 1f), UnityEngine.Random.Range(0, 1f));
     } catch (Exception e) {
         Debug.Log(e);
     }
 }
Beispiel #9
0
        public virtual void InvokeButtonActions()
        {
            Assert.IsNotNull(_sourceButton, "Source Button is NULL");
            Assert.IsNotNull(_sourceButton.onClick, "Source Button -> 'onClick' field is NULL");

            _sourceButton.onClick.Invoke();

            Debug.LogFormat("Trigger '{0}' -> '{1}' action on button '{2}'", InputTrigger,
                            InputButtonName ?? InputKeyCode.ToString(), _sourceButton);
        }
 ///API-No.212
 /// <summary>
 /// GTLeft/GTRight发送一个按键,注意,发送按键至少需发送一个Down,然后再发送一个Up,此API模拟按键按下动作
 /// </summary>
 /// <param name="inputKeyCode">具体按键</param>
 /// <param name="inputKeyState">按键的状态</param>
 public static void GTKeyAddKey(InputKeyCode inputKeyCode, InputKeyState inputKeyState, GestureType type = GestureType.Right)
 {
     if (GTLeft && type == GestureType.Left)
     {
         GTLeft.inputDataBase.InputDataAddKey(inputKeyCode, inputKeyState);
     }
     else if (GTRight && type == GestureType.Right)
     {
         GTRight.inputDataBase.InputDataAddKey(inputKeyCode, inputKeyState);
     }
 }
 ///API-No.166
 /// <summary>
 /// BTRight/BTLeft发送一个按键,注意,发送按键至少需发送一个Down,然后再发送一个Up,此API模拟按键按下动作
 /// </summary>
 /// <param name="inputKeyCode">具体按键</param>
 /// <param name="inputKeyState">按键的状态</param>
 public static void BTKeyAddKey(InputKeyCode inputKeyCode, InputKeyState inputKeyState, BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         BTRight.inputDataBT3Dof.inputKeys.InputDataAddKey(inputKeyCode, inputKeyState);
     }
     else if (BTLeft && type == BTType.Left)
     {
         BTLeft.inputDataBT3Dof.inputKeys.InputDataAddKey(inputKeyCode, inputKeyState);
     }
 }
Beispiel #12
0
        /// <summary>
        /// 获取inputKeyPressDic列表中的某个按键状态
        /// </summary>
        /// <param name="inputKeyCode"> 按键KeyCode </param>
        /// <returns></returns>
        public bool GetKeyUp(InputKeyCode inputKeyCode)
        {
            InputKeyState inputKeyState;

            inputKeyPressDic.TryGetValue(inputKeyCode, out inputKeyState);
            if (inputKeyState == InputKeyState.UP)
            {
                return(true);
            }
            return(false);
        }
Beispiel #13
0
 ///API-No.262
 /// <summary>
 /// GGTLeft/GGTRight发送一个按键,注意,发送按键至少需发送一个Down,然后再发送一个Up,此API模拟按键按下动作
 /// </summary>
 /// <param name="inputKeyCode">具体按键</param>
 /// <param name="inputKeyState">按键的状态</param>
 public static void GGTKeyAddKey(InputKeyCode inputKeyCode, InputKeyState inputKeyState, GGestureType type = GGestureType.Right)
 {
     if (GGTLeft && type == GGestureType.Left)
     {
         GGTLeft.inputDataGGT26Dof.inputKeys.InputDataAddKey(inputKeyCode, inputKeyState);
     }
     else if (GGTRight && type == GGestureType.Right)
     {
         GGTRight.inputDataGGT26Dof.inputKeys.InputDataAddKey(inputKeyCode, inputKeyState);
     }
 }
 ///API-No.165
 /// <summary>
 /// BTRight/BTLeft某个按键的实时状态,参考Input.GetKey
 /// </summary>
 /// <param name="inputKeyCode">具体按键,BTRight/BTLeft支持Enter/Back/Function</param>
 /// <returns></returns>
 public static InputKeyState BTKeyCurrentState(InputKeyCode inputKeyCode, BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataBT3Dof.inputKeys.GetKeyCurrentState(inputKeyCode));
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataBT3Dof.inputKeys.GetKeyCurrentState(inputKeyCode));
     }
     return(InputKeyState.Null);
 }
 ///API-No.163
 /// <summary>
 /// BTRight/BTLeft某个按键是否按下后松开,当前帧有效,下帧复位,参考Input.GetKeyUp
 /// </summary>
 /// <param name="inputKeyCode">具体按键,BTRight/BTLeft支持Enter/Back/Function</param>
 /// <returns></returns>
 public static bool IsBTKeyUp(InputKeyCode inputKeyCode, BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataBT3Dof.inputKeys.GetKeyUp(inputKeyCode));
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataBT3Dof.inputKeys.GetKeyUp(inputKeyCode));
     }
     return(false);
 }
 ///API-No.208
 /// <summary>
 /// GTLeft/GTRight某个按键是否按下,当前帧有效,下帧复位,参考Input.GetKeyDown
 /// </summary>
 /// <param name="inputKeyCode">具体按键,GTLeft/GTRight支持Enter/Back/Function</param>
 /// <returns></returns>
 public static bool IsGTKeyDown(InputKeyCode inputKeyCode, GestureType type = GestureType.Right)
 {
     if (GTLeft && type == GestureType.Left)
     {
         return(GTLeft.inputDataBase.GetKeyDown(inputKeyCode));
     }
     else if (GTRight && type == GestureType.Right)
     {
         return(GTRight.inputDataBase.GetKeyDown(inputKeyCode));
     }
     return(false);
 }
 ///API-No.210
 /// <summary>
 /// GTLeft/GTRight某个按键的状态信息,当前帧有效,下帧复位
 /// </summary>
 /// <param name="inputKeyCode">具体按键,GTLeft/GTRight支持Enter/Back/Function</param>
 /// <returns></returns>
 public static InputKeyState GTKeyState(InputKeyCode inputKeyCode, GestureType type = GestureType.Right)
 {
     if (GTLeft && type == GestureType.Left)
     {
         return(GTLeft.inputDataBase.GetKeyState(inputKeyCode));
     }
     else if (GTRight && type == GestureType.Right)
     {
         return(GTRight.inputDataBase.GetKeyState(inputKeyCode));
     }
     return(InputKeyState.Null);
 }
Beispiel #18
0
 ///API-No.259
 /// <summary>
 /// GGTLeft/GGTRight某个按键是否按下后松开,当前帧有效,下帧复位,参考Input.GetKeyUp
 /// </summary>
 /// <param name="inputKeyCode">具体按键,GGTLeft/GGTRight支持Enter/Back/Function</param>
 /// <returns></returns>
 public static bool IsGGTKeyUp(InputKeyCode inputKeyCode, GGestureType type = GGestureType.Right)
 {
     if (GGTLeft && type == GGestureType.Left)
     {
         return(GGTLeft.inputDataGGT26Dof.inputKeys.GetKeyUp(inputKeyCode));
     }
     else if (GGTRight && type == GGestureType.Right)
     {
         return(GGTRight.inputDataGGT26Dof.inputKeys.GetKeyUp(inputKeyCode));
     }
     return(false);
 }
Beispiel #19
0
 ///API-No.261
 /// <summary>
 /// GGTLeft/GGTRight某个按键的实时状态,参考Input.GetKey
 /// </summary>
 /// <param name="inputKeyCode">具体按键,GGTLeft/GGTRight支持Enter/Back/Function</param>
 /// <returns></returns>
 public static InputKeyState GGTKeyCurrentState(InputKeyCode inputKeyCode, GGestureType type = GGestureType.Right)
 {
     if (GGTLeft && type == GGestureType.Left)
     {
         return(GGTLeft.inputDataGGT26Dof.inputKeys.GetKeyCurrentState(inputKeyCode));
     }
     else if (GGTRight && type == GGestureType.Right)
     {
         return(GGTRight.inputDataGGT26Dof.inputKeys.GetKeyCurrentState(inputKeyCode));
     }
     return(InputKeyState.Null);
 }
Beispiel #20
0
        /// <summary>
        /// 向inputKeyDic列表增加按键信息
        /// </summary>
        /// <param name="inputKeyCode"> 按键KeyCode</param>
        /// <param name="inputKeyState"> 按键状态 </param>
        public void InputDataAddKey(InputKeyCode inputKeyCode, InputKeyState inputKeyState)
        {
            lock (inputKeyDic) {
                DebugMy.Log("InputDataAddKey: " + inputKeyCode + "=" + inputKeyState, this);
                if (!inputKeyDic.ContainsKey(inputKeyCode))
                {
                    inputKeyDic.Add(inputKeyCode, InputKeyState.Null);
                }
                inputKeyDic[inputKeyCode] = inputKeyState;

                //UpdateKeyEvent();
            }
        }
    protected override void partAnyKeyDownDelegate(InputKeyCode keyCode, InputDevicePartBase part)
    {
        base.partAnyKeyDownDelegate(keyCode, part);

        if (keyCode != InputKeyCode.Back)
        {
            return;
        }

        if (BackKeyCallBack != null)
        {
            BackKeyCallBack();
        }
    }
Beispiel #22
0
 public static void KeyLongDelegateInvoke(InputKeyCode keyCode, InputDevicePartBase inputDevicePart)
 {
     AnyKeyLongDelegate?.Invoke(keyCode, inputDevicePart);
 }