Exemplo n.º 1
0
    // This handles disabling VR in the event that the HMD has been disconnected
    bool onDeviceEvent(PlayStationVR.deviceEventType eventType, int value)
    {
        Debug.LogFormat("onDeviceEvent: {0}, {1}", eventType, value);
        bool handledEvent = false;

        switch (eventType)
        {
        case PlayStationVR.deviceEventType.deviceStopped:
            PlayStationVR.setOutputModeHMD(false);
            handledEvent = true;
            break;

        case PlayStationVR.deviceEventType.StatusChanged:       // e.g. HMD unplugged
            VRDeviceStatus devstatus = (VRDeviceStatus)value;
            Debug.LogFormat("DeviceStatus: {0}", devstatus);
            if (devstatus != VRDeviceStatus.Ready)
            {
                HmdSetupDialog.OpenAsync(0, null);
            }
            handledEvent = true;
            break;

        case PlayStationVR.deviceEventType.MountChanged:
            VRHmdMountStatus status = (VRHmdMountStatus)value;
            Debug.LogFormat("VRHmdMountStatus: {0}", status);
            handledEvent = true;
            break;
        }

        return(handledEvent);
    }
Exemplo n.º 2
0
    // This handles disabling VR in the event that the HMD has been disconnected
    bool onDeviceEvent(PlayStationVR.deviceEventType eventType, int value)
    {
        Debug.LogFormat("### onDeviceEvent: {0}, {1}", eventType, value);
        bool handledEvent = false;

        switch (eventType)
        {
        case PlayStationVR.deviceEventType.deviceStopped:
            BeginShutdownVR();
            handledEvent = true;
            break;

        case PlayStationVR.deviceEventType.StatusChanged:       // e.g. HMD unplugged
            VRDeviceStatus devstatus = (VRDeviceStatus)value;
            Debug.LogFormat("DeviceStatus: {0}", devstatus);
            if (devstatus != VRDeviceStatus.Ready)
            {
                // TRC R4026 suggests showing the HMD Setup Dialog if the device status becomes non-ready
                if (VRSettings.loadedDeviceName == VRDeviceNames.None)
                {
                    SetupHMDDevice();
                }
                else
                {
                    BeginShutdownVR();
                }
            }
            handledEvent = true;
            break;

        case PlayStationVR.deviceEventType.MountChanged:
            VRHmdMountStatus status = (VRHmdMountStatus)value;
            Debug.LogFormat("VRHmdMountStatus: {0}", status);
            handledEvent = true;
            break;
        }

        return(handledEvent);
    }