private WaveVR() { #if UNITY_EDITOR if (Application.isEditor) { try { string ipaddr = ""; //WaveVR_Utils.SIM_ConnectType type = WaveVR_Utils.SIM_ConnectType.SIM_ConnectType_USB; System.IntPtr ptrIPaddr = Marshal.StringToHGlobalAnsi(ipaddr); WaveVR_Utils.WVR_SetPrintCallback_S(WaveVR_Utils.PrintLog); WaveVR_Utils.SIM_InitError error = WaveVR_Utils.WVR_Init_S(0, ptrIPaddr); if (error != 0) { WaveVR_Utils.WVR_Quit_S(); return; } isSimulatorOn = true; } catch (Exception e) { return; } } else #endif { Log.d(LOG_TAG, "WaveVR()+"); WVR_InitError error = Interop.WVR_Init(WVR_AppType.WVR_AppType_VRContent); if (error != WVR_InitError.WVR_InitError_None) { ReportError(error); Interop.WVR_Quit(); return; } WaveVR_Utils.notifyActivityUnityStarted(); } for (int i = 0; i < 3; i++) { poses[i] = new WVR_DevicePosePair_t(); connected[i] = false; // force update connection status to all listener. deviceIndexMap[i] = 0; // use hmd's id as default. } hmd = new Device(WVR_DeviceType.WVR_DeviceType_HMD); controllerLeft = new Device(WVR_DeviceType.WVR_DeviceType_Controller_Left); controllerRight = new Device(WVR_DeviceType.WVR_DeviceType_Controller_Right); #if UNITY_EDITOR if (Application.isEditor) { } else #endif { } }
private WaveVR() { PrintInfoLog("WaveVR()+ commit: " + WaveVR_COMMITINFO.wavevr_version); #if UNITY_EDITOR if (Application.isEditor) { this.EnableSimulator = EditorPrefs.GetBool(MENU_NAME, false); if (this.EnableSimulator) { try { string ipaddr = ""; //WaveVR_Utils.SIM_ConnectType type = WaveVR_Utils.SIM_ConnectType.SIM_ConnectType_USB; System.IntPtr ptrIPaddr = Marshal.StringToHGlobalAnsi(ipaddr); WaveVR_Utils.WVR_SetPrintCallback_S(WaveVR_Utils.PrintLog); WaveVR_Utils.SIM_InitError error = WaveVR_Utils.WVR_Init_S(0, ptrIPaddr); PrintInfoLog("WaveVR() WVR_Init_S = " + error); if (error != 0) { WaveVR_Utils.WVR_Quit_S(); PrintErrorLog("WaveVR() initialize simulator failed, WVR_Quit_S()"); return; } isSimulatorOn = true; } catch (Exception e) { PrintErrorLog("WaveVR() initialize simulator failed, exception: " + e); return; } } } else #endif { WVR_InitError error = Interop.WVR_Init(WVR_AppType.WVR_AppType_VRContent); if (error != WVR_InitError.WVR_InitError_None) { ReportError(error); Interop.WVR_Quit(); PrintErrorLog("WaveVR() initialize simulator failed, WVR_Quit()"); return; } WaveVR_Utils.notifyActivityUnityStarted(); } this.Initialized = true; PrintInfoLog("WaveVR() initialization succeeded."); for (int i = 0; i < 3; i++) { poses[i] = new WVR_DevicePosePair_t(); connected[i] = false; // force update connection status to all listener. deviceIndexMap[i] = 0; // use hmd's id as default. } hmd = new Device(WVR_DeviceType.WVR_DeviceType_HMD); controllerLeft = new Device(WVR_DeviceType.WVR_DeviceType_Controller_Left); controllerRight = new Device(WVR_DeviceType.WVR_DeviceType_Controller_Right); // Check left-handed mode first, then set connection status according to left-handed mode. SetLeftHandedMode(); SetConnectionStatus(); SetDefaultButtons(); PrintInfoLog("WaveVR()-"); }