///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); } }
IEnumerator AddKey(InputKeyCode keycode, InputKeyState state, SCPointEventData scData, float time) { yield return(new WaitForSeconds(time)); scData.inputDevicePartBase.inputDataBase.inputKeys.InputDataAddKey(keycode, state); isAddKeyFinish = true; }
public override void OnSCDisable() { base.OnSCDisable(); inputKeyDic.Clear(); inputKeyPressDic.Clear(); inputDataPreviousKeyDic.Clear(); state = InputKeyState.Null; }
public ControlInputPackage(int clickedObjectId, InputKeyState ctrl, InputKeyState shift, InputKeyState alt) { MovementKey = MovementKey.None; ClickedObjectId = clickedObjectId; CtrlKeyState = ctrl; ShiftKeyState = shift; AltKeyState = alt; }
///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); } }
///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.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); } }
/// <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(); } }
public void OnNextFrame() { InputKeyState ctrl = Keyboard.IsKeyPressed(Keyboard.Key.LControl) ? InputKeyState.KeyDown : InputKeyState.KeyUp; InputKeyState shift = Keyboard.IsKeyPressed(Keyboard.Key.LShift) ? InputKeyState.KeyDown : InputKeyState.KeyUp; InputKeyState alt = Keyboard.IsKeyPressed(Keyboard.Key.LAlt) ? InputKeyState.KeyDown : InputKeyState.KeyUp; /* * InputKeyState up = Keyboard.IsKeyPressed(Keyboard.Key.W) ? InputKeyState.KeyDown : InputKeyState.KeyUp; * InputKeyState right = Keyboard.IsKeyPressed(Keyboard.Key.D) ? InputKeyState.KeyDown : InputKeyState.KeyUp; * InputKeyState down = Keyboard.IsKeyPressed(Keyboard.Key.S) ? InputKeyState.KeyDown : InputKeyState.KeyUp; * InputKeyState left = Keyboard.IsKeyPressed(Keyboard.Key.A) ? InputKeyState.KeyDown : InputKeyState.KeyUp; */ MovementKey movementKey = MovementKey.None; if (Keyboard.IsKeyPressed(Keyboard.Key.W)) { movementKey = MovementKey.Up; } else if (Keyboard.IsKeyPressed(Keyboard.Key.D)) { movementKey = MovementKey.Right; } else if (Keyboard.IsKeyPressed(Keyboard.Key.S)) { movementKey = MovementKey.Down; } else if (Keyboard.IsKeyPressed(Keyboard.Key.A)) { movementKey = MovementKey.Left; } if (movementKey != MovementKey.None) { ControlInputPackage updatePackage = new ControlInputPackage(movementKey); ClientNetworkManager.Instance?.SendUserInput(updatePackage, Reliability.Unreliable); } }
private void Update() { if (_last == InputKeyState.JustReleased && _current == InputKeyState.JustReleased) _current = InputKeyState.Released; else if (_last == InputKeyState.JustPressed && _current == InputKeyState.JustPressed) _current = InputKeyState.Pressed; _last = _current; }
public void Reset() { _current = InputKeyState.Released; _last = InputKeyState.Released; Enabled = true; }
public void Release() { _last = _current; _current = Pressed ? InputKeyState.JustReleased : InputKeyState.Released; Update(); }
public void Press() { _last = _current; _current = Pressed ? InputKeyState.Pressed : InputKeyState.JustPressed; Update(); }