/// <summary> /// Gets the long press state of the Key. /// </summary> public static bool UPvr_GetKeyLongPressed(int hand, Pvr_KeyCode key) { if (hand == 0) { switch (key) { case Pvr_KeyCode.APP: return(Pvr_ControllerManager.controllerlink.Controller0.AppKey.LongPressed); case Pvr_KeyCode.HOME: return(Pvr_ControllerManager.controllerlink.Controller0.HomeKey.LongPressed); case Pvr_KeyCode.TOUCHPAD: return(Pvr_ControllerManager.controllerlink.Controller0.TouchKey.LongPressed); case Pvr_KeyCode.VOLUMEUP: return(Pvr_ControllerManager.controllerlink.Controller0.VolumeUpKey.LongPressed); case Pvr_KeyCode.VOLUMEDOWN: return(Pvr_ControllerManager.controllerlink.Controller0.VolumeDownKey.LongPressed); case Pvr_KeyCode.TRIGGER: return(Pvr_ControllerManager.controllerlink.Controller0.TriggerKey.LongPressed); default: return(false); } } if (hand == 1) { switch (key) { case Pvr_KeyCode.APP: return(Pvr_ControllerManager.controllerlink.Controller1.AppKey.LongPressed); case Pvr_KeyCode.HOME: return(Pvr_ControllerManager.controllerlink.Controller1.HomeKey.LongPressed); case Pvr_KeyCode.TOUCHPAD: return(Pvr_ControllerManager.controllerlink.Controller1.TouchKey.LongPressed); case Pvr_KeyCode.VOLUMEUP: return(Pvr_ControllerManager.controllerlink.Controller1.VolumeUpKey.LongPressed); case Pvr_KeyCode.VOLUMEDOWN: return(Pvr_ControllerManager.controllerlink.Controller1.VolumeDownKey.LongPressed); case Pvr_KeyCode.TRIGGER: return(Pvr_ControllerManager.controllerlink.Controller1.TriggerKey.LongPressed); default: return(false); } } return(false); }
/// <summary> /// Gets the lift state of the touch. /// </summary> /// <param name="hand">0,1</param> /// <param name="key">Pvr_KeyCode</param> public static bool UPvr_GetTouchUp(int hand, Pvr_KeyCode key) { if (hand == 0) { switch (key) { case Pvr_KeyCode.TOUCHPAD: return(Pvr_ControllerManager.controllerlink.Controller0.Touch.TouchUp); case Pvr_KeyCode.TRIGGER: return(Pvr_ControllerManager.controllerlink.Controller0.Trigger.TouchUp); case Pvr_KeyCode.X: return(Pvr_ControllerManager.controllerlink.Controller0.X.TouchUp); case Pvr_KeyCode.Y: return(Pvr_ControllerManager.controllerlink.Controller0.Y.TouchUp); case Pvr_KeyCode.Thumbrest: return(Pvr_ControllerManager.controllerlink.Controller0.Thumbrest.TouchUp); default: return(false); } } if (hand == 1) { switch (key) { case Pvr_KeyCode.TOUCHPAD: return(Pvr_ControllerManager.controllerlink.Controller1.Touch.TouchUp); case Pvr_KeyCode.TRIGGER: return(Pvr_ControllerManager.controllerlink.Controller1.Trigger.TouchUp); case Pvr_KeyCode.A: return(Pvr_ControllerManager.controllerlink.Controller1.A.TouchUp); case Pvr_KeyCode.B: return(Pvr_ControllerManager.controllerlink.Controller1.B.TouchUp); case Pvr_KeyCode.Thumbrest: return(Pvr_ControllerManager.controllerlink.Controller1.Thumbrest.TouchUp); default: return(false); } } return(false); }
/// <summary> /// check检测那个手柄的Grip按钮 /// </summary> protected virtual void CheckGripEvents() { Pvr_KeyCode gkc = (gi.hid == 0) ? Pvr_KeyCode.Left : Pvr_KeyCode.Right; if (ControllerMsg.TouchingHandId == gi.hid) { if (Controller.UPvr_GetKeyDown(gi.hid, gkc) || Input.GetKey(KeyCode.X)) { //Debug.Log("按下开始抓取"); OnGripClicked(SetControllerEvent(gi.hid)); } if (Controller.UPvr_GetKeyUp(gi.hid, gkc) || Input.GetKey(KeyCode.X)) { //Debug.Log("松开开始释放"); OnGripUnclicked(SetControllerEvent(gi.hid)); } } }
/// <summary> /// 获取Key的状态,仅当长按2s时为true,一次性事件 /// </summary> public static bool UPvr_GetKeyLongPressed(Pvr_KeyCode key) { switch (key) { case Pvr_KeyCode.APP: return(APPKey.longPressed); case Pvr_KeyCode.HOME: return(HomeKey.longPressed); case Pvr_KeyCode.TOUCHPAD: return(TouchPadKey.longPressed); case Pvr_KeyCode.VOLUMEUP: return(VolumeUpKey.longPressed); case Pvr_KeyCode.VOLUMEDOWN: return(VolumeDownKey.longPressed); } return(false); }
public static float UPvr_GetAxis1D(int hand, Pvr_KeyCode key) { switch (hand) { case 0: { switch (key) { case Pvr_KeyCode.TRIGGER: { return(Pvr_ControllerManager.controllerlink.Controller0.TriggerNum / 255.0f); } case Pvr_KeyCode.Left: { return(Pvr_ControllerManager.controllerlink.Controller0.GripValue / 255.0f); } } return(0.0f); } case 1: { switch (key) { case Pvr_KeyCode.TRIGGER: { return(Pvr_ControllerManager.controllerlink.Controller1.TriggerNum / 255.0f); } case Pvr_KeyCode.Right: { return(Pvr_ControllerManager.controllerlink.Controller1.GripValue / 255.0f); } } return(0.0f); } } return(0.0f); }
/// <summary> /// Gets the long press state of the Key. /// </summary> /// <param name="hand">0,1</param> /// <param name="key">Pvr_KeyCode</param> public static bool UPvr_GetKeyLongPressed(int hand, Pvr_KeyCode key) { if (hand == 0) { switch (key) { case Pvr_KeyCode.APP: return(Pvr_ControllerManager.controllerlink.Controller0.App.LongPressed); case Pvr_KeyCode.HOME: return(Pvr_ControllerManager.controllerlink.Controller0.Home.LongPressed); case Pvr_KeyCode.TOUCHPAD: return(Pvr_ControllerManager.controllerlink.Controller0.Touch.LongPressed); case Pvr_KeyCode.VOLUMEUP: return(Pvr_ControllerManager.controllerlink.Controller0.VolumeUp.LongPressed); case Pvr_KeyCode.VOLUMEDOWN: return(Pvr_ControllerManager.controllerlink.Controller0.VolumeDown.LongPressed); case Pvr_KeyCode.TRIGGER: return(Pvr_ControllerManager.controllerlink.Controller0.Trigger.LongPressed); case Pvr_KeyCode.X: return(Pvr_ControllerManager.controllerlink.Controller0.X.LongPressed); case Pvr_KeyCode.Y: return(Pvr_ControllerManager.controllerlink.Controller0.Y.LongPressed); case Pvr_KeyCode.Left: return(Pvr_ControllerManager.controllerlink.Controller0.Left.LongPressed); default: return(false); } } if (hand == 1) { switch (key) { case Pvr_KeyCode.APP: return(Pvr_ControllerManager.controllerlink.Controller1.App.LongPressed); case Pvr_KeyCode.HOME: return(Pvr_ControllerManager.controllerlink.Controller1.Home.LongPressed); case Pvr_KeyCode.TOUCHPAD: return(Pvr_ControllerManager.controllerlink.Controller1.Touch.LongPressed); case Pvr_KeyCode.VOLUMEUP: return(Pvr_ControllerManager.controllerlink.Controller1.VolumeUp.LongPressed); case Pvr_KeyCode.VOLUMEDOWN: return(Pvr_ControllerManager.controllerlink.Controller1.VolumeDown.LongPressed); case Pvr_KeyCode.TRIGGER: return(Pvr_ControllerManager.controllerlink.Controller1.Trigger.LongPressed); case Pvr_KeyCode.A: return(Pvr_ControllerManager.controllerlink.Controller1.A.LongPressed); case Pvr_KeyCode.B: return(Pvr_ControllerManager.controllerlink.Controller1.B.LongPressed); case Pvr_KeyCode.Right: return(Pvr_ControllerManager.controllerlink.Controller1.Right.LongPressed); default: return(false); } } return(false); }