コード例 #1
0
    void Update()
    {
#if UNITY_EDITOR
        if (Application.isEditor && !WaveVR.Instance.isSimulatorOn)
        {
            return;
        }
#endif

        bool ret = false;
        do
        {
            WVR_Event_t vrevent = new WVR_Event_t();
#if UNITY_EDITOR
            if (Application.isEditor)
            {
                ret = WaveVR_Utils.WVR_PollEventQueue_S(ref vrevent);
            }
            else
#endif
            {
                ret = Interop.WVR_PollEventQueue(ref vrevent);
            }
            if (ret)
            {
                processVREvent(vrevent);
            }
        } while (ret);
    }
コード例 #2
0
    void OnEvent(params object[] args)
    {
        WVR_Event_t _event = (WVR_Event_t)args[0];

        PrintDebugLog("OnEvent() " + _event.common.type);
        if (_event.common.type == WVR_EventType.WVR_EventType_RecenterSuccess)
        {
            PrintDebugLog("OnEvent() WVR_EventType_RecenterSuccess");
        }
    }
コード例 #3
0
    private void processVREvent(WVR_Event_t vrEvent)
    {
        // Process events used by plugin
        switch ((WVR_EventType)vrEvent.common.type)
        {
        case WVR_EventType.WVR_EventType_IpdChanged:
        {
            WaveVR_Utils.Event.Send("IpdChanged");
            if (WaveVR_Render.Instance != null)
            {
                WaveVR_Render.Expand(WaveVR_Render.Instance);
            }
        }
        break;

        case WVR_EventType.WVR_EventType_DeviceStatusUpdate:
        {
            WaveVR_Utils.Event.Send("TrackedDeviceUpdated", vrEvent.device.common.type);
        }
        break;

        case WVR_EventType.WVR_EventType_BatteryStatusUpdate:
        {
            WaveVR_Utils.Event.Send("BatteryStatusUpdate");
        }
        break;

        case WVR_EventType.WVR_EventType_LeftToRightSwipe:
        case WVR_EventType.WVR_EventType_RightToLeftSwipe:
        case WVR_EventType.WVR_EventType_DownToUpSwipe:
        case WVR_EventType.WVR_EventType_UpToDownSwipe:
            WaveVR_Utils.Event.Send("SWIPE_EVENT", vrEvent.common.type);
            break;

        case WVR_EventType.WVR_EventType_DeviceRoleChanged:
            if (WaveVR.Instance != null)
            {
                SetLeftHandedMode();
                ResetButtonStates();

                Log.i(LOG_TAG, "processVREvent() Resend connection notification after switching hand.");
                WaveVR.Instance.OnControllerRoleChange();
            }
            break;

        default:
            break;
        }

        // Send event to developer for all kind of event if developer don't want to add callbacks for every event.
        WaveVR_Utils.Event.Send(WaveVR_Utils.Event.ALL_VREVENT, vrEvent);

        // Send event to developer by name.
        WaveVR_Utils.Event.Send(vrEvent.common.type.ToString(), vrEvent);
    }
コード例 #4
0
    public bool PollEventQueue(ref WVR_Event_t e)
    {
        // Get current state
        bool ret = hasEvent;

        e = mEvent;
        // Clear current state after poll queue.
        clearEventQueue();

        return(ret);
    }
コード例 #5
0
    private void processVREvent(WVR_Event_t vrEvent)
    {
        // Process events used by plugin
        switch ((WVR_EventType)vrEvent.common.type)
        {
        case WVR_EventType.WVR_EventType_IpdUpdate:
        {
            WaveVR_Utils.Event.Send("IpdChanged");
            if (WaveVR_Render.Instance != null)
            {
                WaveVR_Render.Expand(WaveVR_Render.Instance);
            }
        }
        break;

        case WVR_EventType.WVR_EventType_DeviceStatusUpdate:
        {
            WaveVR_Utils.Event.Send("TrackedDeviceUpdated", vrEvent.device.common.type);
        }
        break;

        case WVR_EventType.WVR_EventType_BatteryStatus_Update:
        {
            WaveVR_Utils.Event.Send("BatteryStatus_Update");
        }
        break;

        case WVR_EventType.WVR_EventType_TouchpadSwipe_LeftToRight:
        case WVR_EventType.WVR_EventType_TouchpadSwipe_RightToLeft:
        case WVR_EventType.WVR_EventType_TouchpadSwipe_DownToUp:
        case WVR_EventType.WVR_EventType_TouchpadSwipe_UpToDown:
            WaveVR_Utils.Event.Send("SWIPE_EVENT", vrEvent.common.type);
            break;

        case WVR_EventType.WVR_EventType_Settings_Controller:
            if (WaveVR.Instance != null)
            {
                WaveVR_Controller.SetLeftHandedMode();
                Log.i(LOG_TAG, "Set left-handed mode to " + WaveVR_Controller.IsLeftHanded);
            }
            break;

        default:
            break;
        }

        // Send event to developer for all kind of event if developer don't want to add callbacks for every event.
        WaveVR_Utils.Event.Send(WaveVR_Utils.Event.ALL_VREVENT, vrEvent);

        // Send event to developer by name.
        WaveVR_Utils.Event.Send(vrEvent.common.type.ToString(), vrEvent);
    }
コード例 #6
0
    void Update()
    {
#if UNITY_EDITOR
        if (Application.isEditor)
        {
            return;
        }
#endif

        bool ret = false;
        do
        {
            WVR_Event_t vrevent = new WVR_Event_t();
            ret = Interop.WVR_PollEventQueue(ref vrevent);
            if (ret)
            {
                processVREvent(vrevent);
            }
        } while (ret);
    }
コード例 #7
0
    void OnEvent(params object[] args)
    {
        WVR_Event_t event_t = (WVR_Event_t)args [0];

        switch (event_t.common.type)
        {
        case WVR_EventType.WVR_EventType_HandGesture_Abnormal:
            DEBUG("OnEvent() WVR_EventType_HandGesture_Abnormal, restart the hand gesture component.");
            RestartHandGesture();
            break;

        case WVR_EventType.WVR_EventType_HandTracking_Abnormal:
            DEBUG("OnEvent() WVR_EventType_HandTracking_Abnormal, restart the hand tracking component.");
            RestartHandTracking();
            break;

        default:
            break;
        }
    }
コード例 #8
0
    /// Event handling function
    void OnEvent(params object[] args)
    {
        WVR_Event_t _event = (WVR_Event_t)args[0];

        PrintDebugLog("OnEvent() event type=" + _event.common.type + ", inputId=" + (int)_event.input.inputId + ", device type=" + _event.device.type);
        switch (_event.common.type)
        {
        case WVR_EventType.WVR_EventType_ButtonPressed:
        case WVR_EventType.WVR_EventType_ButtonUnpressed:
            _ActionEvent(_event.device.type, _event.input.inputId, _event.common.type);
            break;

        case WVR_EventType.WVR_EventType_DeviceConnected:
            _UpdateCanvas(_event.device.type, true);
            break;

        case WVR_EventType.WVR_EventType_DeviceDisconnected:
            _UpdateCanvas(_event.device.type, false);
            break;
        }
    }
コード例 #9
0
    void OnEvent(params object[] args)
    {
        WVR_Event_t _event = (WVR_Event_t)args[0];

        PrintDebugLog("OnEvent() " + _event.common.type);
        switch (_event.common.type)
        {
        case WVR_EventType.WVR_EventType_ButtonPressed:
            // Get system key
            if (_event.input.inputId == WVR_InputId.WVR_InputId_Alias1_System)
            {
                PrintDebugLog("OnEvent() WVR_InputId_Alias1_System is pressed.");
            }
            break;

        case WVR_EventType.WVR_EventType_RecenterSuccess:
        case WVR_EventType.WVR_EventType_RecenterSuccess3DoF:
            PrintDebugLog("OnEvent() recentered.");
            break;
        }
    }
コード例 #10
0
    void OnEvent(params object[] args)
    {
        WVR_Event_t _event = (WVR_Event_t)args[0];

        Log.d(LOG_TAG, "OnEvent() " + _event.common.type + ",nSkipFrameCount=" + nSkipFrameCount);
        if (nSkipFrameCount < NUM_SKIP_FRAMES)
        {
            return;
        }

        switch (_event.common.type)
        {
        case WVR_EventType.WVR_EventType_ButtonPressed:
//		case WVR_EventType.WVR_EventType_ButtonUnpressed:
            // Get system key
//			if (_event.input.inputId == WVR_InputId.WVR_InputId_Alias1_System) //any Button Unpress
        {
            Log.d(LOG_TAG, "OnEvent() WVR_InputId_Alias1_System is pressed.");
            GoBackSelectItemOrExitGame();
        }
        break;

        case WVR_EventType.WVR_EventType_RecenterSuccess:
        case WVR_EventType.WVR_EventType_RecenterSuccess3DoF:
            Log.d(LOG_TAG, "OnEvent() recentered.");
            break;

        case WVR_EventType.WVR_EventType_DeviceConnected:
            if ((0 == g_typeDevice) && (WVR_DeviceType.WVR_DeviceType_HMD != _event.device.type))
            {
                g_typeDevice = _event.device.type;
            }
            break;

        case WVR_EventType.WVR_EventType_DeviceDisconnected:
            break;
        }
    }
コード例 #11
0
    /// Event handling function
    void OnEvent(params object[] args)
    {
        WVR_Event_t _event = (WVR_Event_t)args[0];

        PrintDebugLog("OnEvent() event type=" + _event.common.type + ", inputId=" + (int)_event.input.inputId + ", device type=" + _event.device.type);
        switch (_event.common.type)
        {
        case WVR_EventType.WVR_EventType_ButtonPressed:
            // Get system key
            if (_event.input.inputId == WVR_InputId.WVR_InputId_Alias1_System)
            {
                PrintDebugLog("OnEvent() WVR_InputId_Alias1_System is pressed.");
            }
            break;

        case WVR_EventType.WVR_EventType_DeviceConnected:
            _UpdateCanvas(_event.device.type, true);
            break;

        case WVR_EventType.WVR_EventType_DeviceDisconnected:
            _UpdateCanvas(_event.device.type, false);
            break;
        }
    }
コード例 #12
0
 public static extern bool WVR_PollEventQueue_HVR(ref WVR_Event_t e);
コード例 #13
0
 //[return : MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.SysInt , SizeConst = 10)]
 public static extern bool WVR_PollEventQueue_S(ref WVR_Event_t t);
コード例 #14
0
 public override bool PollEventQueue(ref WVR_Event_t e)
 {
     return(WVR_PollEventQueue_Android(ref e));
 }
コード例 #15
0
 public static extern bool WVR_PollEventQueue_Android(ref WVR_Event_t e);
コード例 #16
0
    private void processVREvent(WVR_Event_t vrEvent)
    {
        WVR_DeviceType _type = vrEvent.device.type;
        WVR_InputId    _btn  = vrEvent.input.inputId;

        // Process events used by plugin
        switch ((WVR_EventType)vrEvent.common.type)
        {
        case WVR_EventType.WVR_EventType_IpdChanged:
        {
            WaveVR_Utils.Event.Send("IpdChanged");
            if (WaveVR_Render.Instance != null)
            {
                WaveVR_Render.Expand(WaveVR_Render.Instance);
            }
        }
        break;

        case WVR_EventType.WVR_EventType_DeviceStatusUpdate:
        {
            WaveVR_Utils.Event.Send("TrackedDeviceUpdated", vrEvent.device.common.type);
        }
        break;

        case WVR_EventType.WVR_EventType_BatteryStatusUpdate:
        {
            WaveVR_Utils.Event.Send("BatteryStatusUpdate");
        }
        break;

        case WVR_EventType.WVR_EventType_LeftToRightSwipe:
        case WVR_EventType.WVR_EventType_RightToLeftSwipe:
        case WVR_EventType.WVR_EventType_DownToUpSwipe:
        case WVR_EventType.WVR_EventType_UpToDownSwipe:
            Log.i(LOG_TAG, "Swipe event: " + (WVR_EventType)vrEvent.common.type);
            WaveVR_Utils.Event.Send(WaveVR_Utils.Event.SWIPE_EVENT, vrEvent.common.type, _type);
            break;

        case WVR_EventType.WVR_EventType_DeviceRoleChanged:
            Log.i(LOG_TAG, "WVR_EventType_DeviceRoleChanged() " + _type + ", " + _btn + ", Resend connection notification after switching hand.");
            WaveVR.Instance.SetConnectionStatus();
            if (WaveVR.Instance.SetLeftHandedMode())
            {
                WaveVR_Utils.Event.Send(WaveVR_Utils.Event.DEVICE_ROLE_CHANGED);
                WaveVR.Instance.ResetAllButtonStates();
            }
            break;

        case WVR_EventType.WVR_EventType_ButtonPressed:
            Log.d(LOG_TAG, "WVR_EventType_ButtonPressed() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance != null)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Press(_btn, true);
            break;

        case WVR_EventType.WVR_EventType_ButtonUnpressed:
            Log.d(LOG_TAG, "WVR_EventType_ButtonUnpressed() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance != null)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Press(_btn, false);
            break;

        case WVR_EventType.WVR_EventType_TouchTapped:
            Log.d(LOG_TAG, "WVR_EventType_TouchTapped() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance != null)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Touch(_btn, true);
            break;

        case WVR_EventType.WVR_EventType_TouchUntapped:
            Log.d(LOG_TAG, "WVR_EventType_TouchUntapped() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance != null)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Touch(_btn, false);
            break;

        case WVR_EventType.WVR_EventType_DeviceConnected:
            Log.d(LOG_TAG, "WVR_EventType_DeviceConnected() " + _type + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            WaveVR.Instance.SetConnectionStatus(_type, true);
            break;

        case WVR_EventType.WVR_EventType_DeviceDisconnected:
            Log.d(LOG_TAG, "WVR_EventType_DeviceDisconnected() " + _type + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            WaveVR.Instance.SetConnectionStatus(_type, false);
            break;

        default:
            break;
        }

        // Send event to developer for all kind of event if developer don't want to add callbacks for every event.
        WaveVR_Utils.Event.Send(WaveVR_Utils.Event.ALL_VREVENT, vrEvent);

        // Send event to developer by name.
        WaveVR_Utils.Event.Send(vrEvent.common.type.ToString(), vrEvent);
    }
コード例 #17
0
    private void processVREvent(WVR_Event_t vrEvent)
    {
        WVR_DeviceType _type = vrEvent.device.type;
        WVR_InputId    _btn  = vrEvent.input.inputId;

        // Process events used by plugin
        switch ((WVR_EventType)vrEvent.common.type)
        {
        case WVR_EventType.WVR_EventType_IpdChanged:
            WaveVR_Utils.Event.Send(WaveVR_Utils.Event.IPD_CHANGED);
            if (WaveVR_Render.Instance != null)
            {
                WaveVR_Render.Expand(WaveVR_Render.Instance);
            }
            break;

        case WVR_EventType.WVR_EventType_DeviceStatusUpdate:
            WaveVR_Utils.Event.Send(WaveVR_Utils.Event.DEVICE_STATUS_UPDATE, vrEvent.device.common.type);
            break;

        case WVR_EventType.WVR_EventType_BatteryStatusUpdate:
            WaveVR_Utils.Event.Send(WaveVR_Utils.Event.BATTERY_STATUS_UPDATE);
            break;

        case WVR_EventType.WVR_EventType_LeftToRightSwipe:
        case WVR_EventType.WVR_EventType_RightToLeftSwipe:
        case WVR_EventType.WVR_EventType_DownToUpSwipe:
        case WVR_EventType.WVR_EventType_UpToDownSwipe:
            PrintDebugLog("Swipe event: " + (WVR_EventType)vrEvent.common.type);
            WaveVR_Utils.Event.Send(WaveVR_Utils.Event.SWIPE_EVENT, vrEvent.common.type, _type);
            break;

        case WVR_EventType.WVR_EventType_DeviceRoleChanged:
            PrintDebugLog("WVR_EventType_DeviceRoleChanged() " + _type + ", " + _btn + ", Resend connection notification after switching hand.");
            WaveVR.Instance.UpdateAllConnection();
            if (WaveVR.Instance.SetLeftHandedMode())
            {
                // Due to connected, valid pose and role change are not synchronized, DEVICE_ROLE_CHANGED will be obseleted.
                WaveVR_Utils.Event.Send(WaveVR_Utils.Event.DEVICE_ROLE_CHANGED);
                WaveVR.Instance.ResetAllButtonStates();
            }
            break;

        case WVR_EventType.WVR_EventType_ButtonPressed:
            PrintDebugLog("WVR_EventType_ButtonPressed() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance.Initialized)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Press(_btn, true);
            break;

        case WVR_EventType.WVR_EventType_ButtonUnpressed:
            PrintDebugLog("WVR_EventType_ButtonUnpressed() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance.Initialized)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Press(_btn, false);
            break;

        case WVR_EventType.WVR_EventType_TouchTapped:
            PrintDebugLog("WVR_EventType_TouchTapped() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance.Initialized)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Touch(_btn, true);
            break;

        case WVR_EventType.WVR_EventType_TouchUntapped:
            PrintDebugLog("WVR_EventType_TouchUntapped() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance.Initialized)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Touch(_btn, false);
            break;

        case WVR_EventType.WVR_EventType_DeviceConnected:
            PrintDebugLog("WVR_EventType_DeviceConnected() " + _type + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            WaveVR.Instance.SetConnectionStatus(_type, true);
            break;

        case WVR_EventType.WVR_EventType_DeviceDisconnected:
            PrintDebugLog("WVR_EventType_DeviceDisconnected() " + _type + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            WaveVR.Instance.SetConnectionStatus(_type, false);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid)
            {
                _type = WaveVR_Controller.Input(_type).DeviceType;
                WaveVR_Controller.Input(_type).ResetButtonEvents();
            }
            break;

        default:
            break;
        }

        // Send event to developer for all kind of event if developer don't want to add callbacks for every event.
        WaveVR_Utils.Event.Send(WaveVR_Utils.Event.ALL_VREVENT, vrEvent);

        // Send event to developer by name.
        WaveVR_Utils.Event.Send(vrEvent.common.type.ToString(), vrEvent);
    }
コード例 #18
0
 public override bool PollEventQueue(ref WVR_Event_t e)
 {
     return(system.PollEventQueue(ref e));
 }