public void Start() { if (_checkDeviceAtRuntime) { _device = HeadsetChecker.CheckDeviceConnected(); } else if (_device == EDevice.NONE || _device == EDevice.ALL) { Debug.LogError("<b>[VRSF] :</b> Device to Load is not valid, Checking runtime device."); _device = HeadsetChecker.CheckDeviceConnected(); } VRSF_Components.DeviceLoaded = _device; VRSF_Components.CameraRig.transform.name = "[VRSF] " + _device.ToString(); // SteamVR Do not use any floor offset, so we reduce it of floorOffsetY meter * scale if this is the loaded SDK if (XRSettings.loadedDeviceName == "OpenVR" && _device != EDevice.SIMULATOR) { VRSF_Components.FloorOffset.transform.localPosition = CalculateNewFloorOffset(); } if (ForceSDKLoad) { TrySDKForcing(); } if (_device == EDevice.SIMULATOR) { RemoveVRStuffs(); } VRSF_Components.SetupVRIsReady = true; new OnSetupVRReady(); }
/**************************************************************** * Public Functions **/ public void UpdateStatus (EDevice p_status) { this.DeviceStatus = p_status; switch (p_status) { case EDevice.Status_Neutral: { this.Status = STATUS_NEUTRAL; this.FontWeight = FONT_NORMAL; } break; case EDevice.Status_Connecting: { this.Status = STATUS_CONNECTING; this.FontWeight = FONT_NORMAL; } break; case EDevice.Status_Connected: { this.Status = STATUS_CONNECTED; this.FontWeight = FONT_BOLD; } break; case EDevice.Status_Disconnected: { this.Status = STATUS_DISCONNECTED; this.FontWeight = FONT_NORMAL; } break; } }
/**************************************************************** * Public Functions **/ public void UpdateStatus(EDevice p_status) { this.DeviceStatus = p_status; switch (p_status) { case EDevice.Status_Neutral: { this.Status = STATUS_NEUTRAL; this.FontWeight = FONT_NORMAL; } break; case EDevice.Status_Connecting: { this.Status = STATUS_CONNECTING; this.FontWeight = FONT_NORMAL; } break; case EDevice.Status_Connected: { this.Status = STATUS_CONNECTED; this.FontWeight = FONT_BOLD; } break; case EDevice.Status_Disconnected: { this.Status = STATUS_DISCONNECTED; this.FontWeight = FONT_NORMAL; } break; } }
public IHttpActionResult Put(int id, EDevice eDevice) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eDevice.device_id) { return(BadRequest()); } db.Entry(eDevice).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EDeviceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public static ResourceRecord QueryDeviceResources(EDevice device) { var recs = DeviceRecords; string devName = device.ToString(); var hit = recs.device .Where(d => d.name == devName) .FirstOrDefault(); if (hit == null) { return(null); } var result = new ResourceRecord() { Device = device }; foreach (var resrec in hit.providedResources) { EDeviceResource res; if (DeviceResources.ResolveResourceType(resrec.name, out res)) { result.AssignResource(res, resrec.amount); } } return(result); }
private void Start() { EDevice device = (EDevice)photonView.Owner.CustomProperties[VRDFPlayer.DEVICE_USED]; if (photonView.IsMine) { if (device != EDevice.NONE && device != EDevice.SIMULATOR) { OnLaserWidthChanged.Listeners += UpdateLineRenderWidth; OnLaserLengthChanged.Listeners += UpdateLineRenderLength; Destroy(_lineRenderer); } else { Destroy(gameObject); } } else { if (device != EDevice.NONE && device != EDevice.SIMULATOR) { this._lineRenderer.SetPosition(0, Vector3.zero); } else { Destroy(gameObject); } } }
private void SendDeviceInfo(Player sender, EDevice deviceUsed) { // Security as this method is called OnSetupVRReady and OnPlayerEnteredRoom if (!_playersToSet.ContainsKey(sender)) { _playersToSet.Add(sender, deviceUsed); } }
public IHttpActionResult Get(int id) { EDevice eDevice = db.EDevices.Find(id); if (eDevice == null) { return(NotFound()); } return(Ok(eDevice)); }
public static IEnumerable <EPackage> GetPackages(this EDevice device) { FieldInfo field = typeof(EDevice) .GetFields(BindingFlags.Public | BindingFlags.Static) .Where(fi => (EDevice)fi.GetValue(null) == device) .Single(); return(field.GetCustomAttributes(typeof(DeclarePackage), false) .Cast <DeclarePackage>() .Select(dp => dp.Package)); }
public IHttpActionResult Post(EDevice eDevice) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.EDevices.Add(eDevice); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = eDevice.device_id }, eDevice)); }
public static EDeviceFamily GetFamily(this EDevice device) { FieldInfo field = typeof(EDevice) .GetFields(BindingFlags.Public | BindingFlags.Static) .Where(fi => (EDevice)fi.GetValue(null) == device) .Single(); DeclareFamily famAttr = (DeclareFamily)field .GetCustomAttributes(typeof(DeclareFamily), false) .Single(); return(famAttr.Family); }
public IHttpActionResult Delete(int id) { EDevice eDevice = db.EDevices.Find(id); if (eDevice == null) { return(NotFound()); } db.EDevices.Remove(eDevice); db.SaveChanges(); return(Ok(eDevice)); }
/// <summary> /// Will Instantiate and reference the SDK prefab to load thanks to the string field. /// </summary> void LoadCorrespondingSDK() { if (CheckDeviceAtRuntime) { DeviceToLoad = CheckDeviceConnected(); } switch (DeviceToLoad) { case (EDevice.OVR): XRSettings.enabled = true; _sdk = Instantiate(OVR_SDK); _sdk.transform.name = OVR_SDK.name; VRSF_Components.DeviceLoaded = EDevice.OVR; break; case (EDevice.OPENVR): XRSettings.enabled = true; _sdk = Instantiate(OpenVR_SDK); _sdk.transform.name = OpenVR_SDK.name; VRSF_Components.DeviceLoaded = EDevice.OPENVR; break; case (EDevice.SIMULATOR): XRSettings.enabled = false; _sdk = Instantiate(Simulator_SDK); _sdk.transform.name = Simulator_SDK.name; VRSF_Components.DeviceLoaded = EDevice.SIMULATOR; break; default: Debug.LogError("VRSF : Device is null, loading Simulator."); XRSettings.enabled = false; _sdk = Instantiate(Simulator_SDK); _sdk.transform.name = Simulator_SDK.name; VRSF_Components.DeviceLoaded = EDevice.SIMULATOR; break; } //Active SDK is set to the cameraRig, as it's the only object that will be moved VRSF_Components.CameraRig = _sdk.transform.gameObject; DontDestroyOnLoad(_sdk); _loaded = true; }
public static PerformanceRecord QueryIPCorePerformance(Component core, EDevice device, ESpeedGrade speedGrade, EISEVersion iseVersion) { string className = GetClassName(core); var coreData = LoadIPCoreData(className); if (coreData == null) { return(null); } var paramSet = ExtractPerformanceParameters(core); var coreVar = LookupVariant(coreData, device.ToString(), speedGrade.ToString(), iseVersion.ToString(), paramSet); if (coreVar == null) { return(null); } var result = new PerformanceRecord() { Device = device, SpeedGrade = speedGrade, ISEVersion = iseVersion, MinPeriod = new Time(coreVar.minPeriod, ETimeUnit.ns) }; foreach (var resrec in coreVar.consumedResources) { EDeviceResource res; if (DeviceResources.ResolveResourceType(resrec.name, out res)) { result.AssignResource(res, resrec.amount); } } return(result); }
//* ────────────-_______________________* //* constructor & destructor ───────────────────────* //* -----------------------------------------------------------------------* /// <summary>コンストラクタ。</summary> private CAIInupt() : base("入力機能の初期化") { assignKeyboard = new int[(int)EInputActionMap.__reserved]; assignGamePad = new int[(int)EInputActionMap.__reserved]; assignLegacyGamePad = new int[(int)EInputActionMap.__reserved]; assignKeyboard[(int)EInputActionMap.cursor] = (int)EKeyboardAxisButtons.arrow; assignKeyboard[(int)EInputActionMap.enter] = (int)Keys.Space; assignKeyboard[(int)EInputActionMap.cancel] = (int)Keys.Escape; assignGamePad[(int)EInputActionMap.cursor] = (int)EGamePadButtons.dPad; assignGamePad[(int)EInputActionMap.enter] = (int)EGamePadButtons.A; assignGamePad[(int)EInputActionMap.cancel] = (int)EGamePadButtons.back; assignLegacyGamePad[(int)EInputActionMap.cursor] = (int)ELegacyGamePadAxisButtons.analog; assignLegacyGamePad[(int)EInputActionMap.enter] = 0; assignLegacyGamePad[(int)EInputActionMap.cancel] = 1; activeDevice = EDevice.keyboard | EDevice.gamePad; #if WINDOWS if (CLegacyInputCollection.instance.inputList.Count > 0) { activeDevice |= EDevice.legacyGamePad; } #endif }
//* ────────────-_______________________* //* constructor & destructor ───────────────────────* //* -----------------------------------------------------------------------* /// <summary>コンストラクタ。</summary> public CInputHelper() { keyboard.lowerInput = CKeyboardInputCollection.instance.input; gamePad.lowerInput = CGamePadInputCollection.instance.inputList[0]; #if WINDOWS if (CLegacyInputCollection.instance.inputList.Count > 0) { legacy.lowerInput = CLegacyInputCollection.instance.inputList[0]; } #endif EDevice dev = EDevice.keyboard | EDevice.mouse | EDevice.gamePad; if (legacy.lowerInput != null) { dev |= EDevice.legacyGamePad; } else { legacy.nextState = CState.empty; } devices.Add(new KeyValuePair <EDevice, IInputAdapter>(EDevice.keyboard, keyboard)); devices.Add(new KeyValuePair <EDevice, IInputAdapter>(EDevice.mouse, mouse)); devices.Add(new KeyValuePair <EDevice, IInputAdapter>(EDevice.gamePad, gamePad)); devices.Add(new KeyValuePair <EDevice, IInputAdapter>(EDevice.legacyGamePad, legacy)); }
/// <summary> /// Callback for whenever one of the player had sent its device info /// Generate the corresponding mesh for the used controllers /// </summary> /// <param name="info"></param> private void InstantiateRemoteControllers() { EDevice deviceUsed = (EDevice)photonView.Owner.CustomProperties[VRDFPlayer.DEVICE_USED]; var controllersList = GetComponent <ControllerMeshesLister>().ControllersPerDevice; if (controllersList.ContainsKey(deviceUsed)) { // Instantiate the prefab from within the ControllersMeshLister script var toInstantiate = controllersList[deviceUsed]; var controllerInstance = GameObject.Instantiate(toInstantiate.ControllersMeshPrefab, transform.parent); controllerInstance.transform.localPosition = toInstantiate.LocalPosition; controllerInstance.transform.localRotation = Quaternion.Euler(toInstantiate.LocalRotation); controllerInstance.tag = "Untagged"; for (int i = 0; i < controllerInstance.transform.childCount; i++) { controllerInstance.transform.GetChild(i).tag = "Untagged"; } } else { Debug.LogFormat("<b>[VRDF] :</b> No mesh found for the Remote Player " + photonView.Owner.NickName + " with VR device " + deviceUsed + " in the ControllerMeshLister list.", gameObject); } }
/// <summary> /// Combines device, speed grade and package to a part name. /// </summary> public static string MakePartName(EDevice device, ESpeedGrade grade, EPackage package) { return device.ToString() + PropEnum.ToString(grade, EPropAssoc.ISE) + "-" + package.ToString(); }
public static ResourceRecord QueryDeviceResources(EDevice device) { var recs = DeviceRecords; string devName = device.ToString(); var hit = recs.device .Where(d => d.name == devName) .FirstOrDefault(); if (hit == null) return null; var result = new ResourceRecord() { Device = device }; foreach (var resrec in hit.providedResources) { EDeviceResource res; if (DeviceResources.ResolveResourceType(resrec.name, out res)) { result.AssignResource(res, resrec.amount); } } return result; }
public static PerformanceRecord QueryIPCorePerformance(Component core, EDevice device, ESpeedGrade speedGrade, EISEVersion iseVersion) { string className = GetClassName(core); var coreData = LoadIPCoreData(className); if (coreData == null) return null; var paramSet = ExtractPerformanceParameters(core); var coreVar = LookupVariant(coreData, device.ToString(), speedGrade.ToString(), iseVersion.ToString(), paramSet); if (coreVar == null) return null; var result = new PerformanceRecord() { Device = device, SpeedGrade = speedGrade, ISEVersion = iseVersion, MinPeriod = new Time(coreVar.minPeriod, ETimeUnit.ns) }; foreach (var resrec in coreVar.consumedResources) { EDeviceResource res; if (DeviceResources.ResolveResourceType(resrec.name, out res)) { result.AssignResource(res, resrec.amount); } } return result; }
public static bool FlagHasOculusDevice(EDevice flagToTest) { return(flagToTest.HasFlag(EDevice.OCULUS_GO) || flagToTest.HasFlag(EDevice.OCULUS_QUEST) || flagToTest.HasFlag(EDevice.OCULUS_RIFT) || flagToTest.HasFlag(EDevice.OCULUS_RIFT_S) || flagToTest.HasFlag(EDevice.SIMULATOR)); }
/// <summary> /// Sets the device. /// </summary> public void SetDevice(EDevice device) { _device = device; }
/// <summary> /// Combines device, speed grade and package to a part name. /// </summary> public static string MakePartName(EDevice device, ESpeedGrade grade, EPackage package) { return(device.ToString() + PropEnum.ToString(grade, EPropAssoc.ISE) + "-" + package.ToString()); }