public static void ShowWindowsMRControllerList(bool active, TBInput.ControlType control) { #if TB_WINDOWS_MR EditorGUILayout.BeginVertical(); EditorGUI.BeginDisabledGroup(!active); switch (control) { case TBInput.ControlType.HandControllers: if (GUILayout.Button("WMR Motion Controller", TBEditorStyles.controllerSelectButton)) { TBEditorInputSettings.LoadController <TBWindowsMRInput.Button>(ref controllers, TBController_WindowsMR_MotionControllerLeft.instance.GetName(), TBController_WindowsMR_MotionControllerLeft.instance.GetDefaultDefs(), TBController_WindowsMR_MotionControllerLeft.instance.GetFileName()); TBEditorInputSettings.LoadController <TBWindowsMRInput.Button>(ref controllers, TBController_WindowsMR_MotionControllerRight.instance.GetName(), TBController_WindowsMR_MotionControllerRight.instance.GetDefaultDefs(), TBController_WindowsMR_MotionControllerRight.instance.GetFileName()); WindowsMRMotionControllerConfigWindow.ShowWindow("Windows Mixed Reality Motion Controller"); } break; case TBInput.ControlType.Mobile3DOFController: break; case TBInput.ControlType.Gamepad: TBEditorInputSettings.GetControllerButton <TBXInput.TBXInputButton, XInputGamepadConfigWindow>(TBController_XInput_Gamepad.instance, ref TBEditorInputXInput.controllers, active); break; case TBInput.ControlType.ClickRemote: break; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); #endif }
public static void ShowGoogleControllerList(bool active, TBInput.ControlType control) { #if TB_GOOGLE EditorGUILayout.BeginVertical(); EditorGUI.BeginDisabledGroup(!active); switch (control) { case TBInput.ControlType.HandControllers: if (GUILayout.Button("Daydream 6DOF Controller", TBEditorStyles.controllerSelectButton)) { TBEditorInputSettings.LoadController <GvrControllerButton>(ref controllers, TBController_Google_Daydream6DOFLeft.instance.GetName(), TBController_Google_Daydream6DOFLeft.instance.GetDefaultDefs(), TBController_Google_Daydream6DOFLeft.instance.GetFileName()); TBEditorInputSettings.LoadController <GvrControllerButton>(ref controllers, TBController_Google_Daydream6DOFRight.instance.GetName(), TBController_Google_Daydream6DOFRight.instance.GetDefaultDefs(), TBController_Google_Daydream6DOFRight.instance.GetFileName()); GoogleDaydream6DOFControllerConfigWindow.ShowWindow("Daydream 6DOF Controller (Experimental)"); } break; case TBInput.ControlType.Mobile3DOFController: TBEditorInputSettings.GetControllerButton <GvrControllerButton, GoogleDaydreamControllerConfigWindow>(TBController_Google_Daydream.instance, ref controllers, active); break; case TBInput.ControlType.Gamepad: break; case TBInput.ControlType.ClickRemote: break; } #endif EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); }
private IEnumerator Start() { if (TBInput.GetControllerModel(controller) == VRController.None) { Debug.Log("Input chart was disabled because no controller was found for " + controller + ". This means that the associated ControlType is disabled in TButt's Input Settings, or no compatible controller exists for the current platform."); gameObject.SetActive(false); yield break; } controllerLabel.text = controller.ToString() + " | " + TBInput.GetControllerModel(controller).ToString(); _rect = GetComponent <RectTransform>(); for (int i = 0; i < buttons.Count; i++) { if (TBInput.SupportsVirtualButton(buttons[i], controller)) { CreateDisplayRow(buttons[i]); } } ConformHeights(); TBInput.ControlType assocaitedControlType = TBInput.ControlType.None; switch (controller) { case TBInput.Controller.LHandController: case TBInput.Controller.RHandController: assocaitedControlType = TBInput.ControlType.HandControllers; break; case TBInput.Controller.Mobile3DOFController: assocaitedControlType = TBInput.ControlType.Mobile3DOFController; break; case TBInput.Controller.Gamepad: assocaitedControlType = TBInput.ControlType.Gamepad; break; case TBInput.Controller.ClickRemote: assocaitedControlType = TBInput.ControlType.ClickRemote; break; } if (assocaitedControlType != TBInput.GetActiveControlType()) { gameObject.GetComponent <Canvas>().enabled = false; while (TBInput.GetActiveControlType() == TBInput.ControlType.None) { yield return(null); } if (assocaitedControlType == TBInput.GetActiveControlType()) { gameObject.GetComponent <Canvas>().enabled = true; } } }
/// <summary> /// Displays the column of controllers for the Oculus SDK in TBEditorInputSettings. /// </summary> /// <param name="active"></param> /// <param name="control"></param> public static void ShowOculusControllerList(bool active, TBInput.ControlType control) { #if TB_OCULUS EditorGUILayout.BeginVertical(); EditorGUI.BeginDisabledGroup(!active); // For each controller, we need to load the button defs before the window is opened. switch (control) { case TBInput.ControlType.HandControllers: if (GUILayout.Button("Oculus Touch", TBEditorStyles.controllerSelectButton)) { // Oculus Touch has two controllers (left and right) with different buttons, but we show them simulaneously, so we are overriding the normal behavior for buttons. TBEditorInputSettings.LoadController <OVRInput.RawButton>(ref controllers, TBController_Oculus_TouchLeft.instance.GetName(), TBController_Oculus_TouchLeft.instance.GetDefaultDefs(), TBController_Oculus_TouchLeft.instance.GetFileName()); TBEditorInputSettings.LoadController <OVRInput.RawButton>(ref controllers, TBController_Oculus_TouchRight.instance.GetName(), TBController_Oculus_TouchRight.instance.GetDefaultDefs(), TBController_Oculus_TouchRight.instance.GetFileName()); OculusTouchConfigWindow.ShowWindow("Oculus Touch"); } if (GUILayout.Button("Oculus Quest", TBEditorStyles.controllerSelectButton)) { // Oculus Quest / Santa Cruz has a prototype controller with a touchpad that differs from the final controller design. TBEditorInputSettings.LoadController <OVRInput.RawButton>(ref controllers, TBController_Oculus_QuestLeft.instance.GetName(), TBController_Oculus_QuestLeft.instance.GetDefaultDefs(), TBController_Oculus_QuestLeft.instance.GetFileName()); TBEditorInputSettings.LoadController <OVRInput.RawButton>(ref controllers, TBController_Oculus_QuestRight.instance.GetName(), TBController_Oculus_QuestRight.instance.GetDefaultDefs(), TBController_Oculus_QuestRight.instance.GetFileName()); OculusQuestConfigWindow.ShowWindow("Oculus Quest"); } EditorGUI.BeginDisabledGroup(!Settings.TBOculusSettings.LoadOculusSettings(Settings.TBOculusSettings.OculusDeviceFamily.Rift).allowViveEmulation); { if (GUILayout.Button("Vive Controller", TBEditorStyles.controllerSelectButton)) { // Oculus Touch has two controllers (left and right) with different buttons, but we show them simulaneously, so we are overriding the normal behavior for buttons. TBEditorInputSettings.LoadController <OVRInput.RawButton>(ref controllers, TBController_Oculus_ViveControllerLeft.instance.GetName(), TBController_Oculus_ViveControllerLeft.instance.GetDefaultDefs(), TBController_Oculus_ViveControllerLeft.instance.GetFileName()); TBEditorInputSettings.LoadController <OVRInput.RawButton>(ref controllers, TBController_Oculus_ViveControllerRight.instance.GetName(), TBController_Oculus_ViveControllerRight.instance.GetDefaultDefs(), TBController_Oculus_ViveControllerRight.instance.GetFileName()); OculusViveControllerConfigWindow.ShowWindow("Vive Controller"); } } EditorGUI.EndDisabledGroup(); break; case TBInput.ControlType.Mobile3DOFController: TBEditorInputSettings.GetControllerButton <OVRInput.RawButton, OculusGearVRControllerConfigWindow>(TBController_Oculus_GearVRController.instance, ref controllers, active, "Oculus Go / Gear VR Controller"); break; case TBInput.ControlType.Gamepad: TBEditorInputSettings.GetControllerButton <OVRInput.RawButton, OculusGamepadConfigWindow>(TBController_Oculus_Gamepad.instance, ref controllers, active); break; case TBInput.ControlType.ClickRemote: TBEditorInputSettings.GetControllerButton <OVRInput.RawButton, OculusGearVRTouchpadConfigWindow>(TBController_Oculus_GearVRTouchpad.instance, ref controllers, active); TBEditorInputSettings.GetControllerButton <OVRInput.RawButton, OculusRemoteConfigWindow>(TBController_Oculus_Remote.instance, ref controllers, active); break; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); #endif }
public static void SetActiveControlType(TBInput.ControlType controlType) { if (_activeControlType == controlType) { return; } _activeControlType = controlType; Events.Internal.UpdateControlType(_activeControlType); TBLogging.LogMessage("Control type changed to " + controlType.ToString()); }
public static void ShowSteamVRControllerList(bool active, TBInput.ControlType control) { #if TB_STEAM_VR EditorGUILayout.BeginVertical(); EditorGUI.BeginDisabledGroup(!active); switch (control) { case TBInput.ControlType.HandControllers: if (GUILayout.Button("Vive Controller", TBEditorStyles.controllerSelectButton)) { TBEditorInputSettings.LoadController <EVRButtonId>(ref controllers, TBController_SteamVR_ViveControllerLeft.instance.GetName(), TBController_SteamVR_ViveControllerLeft.instance.GetDefaultDefs(), TBController_SteamVR_ViveControllerLeft.instance.GetFileName()); TBEditorInputSettings.LoadController <EVRButtonId>(ref controllers, TBController_SteamVR_ViveControllerRight.instance.GetName(), TBController_SteamVR_ViveControllerRight.instance.GetDefaultDefs(), TBController_SteamVR_ViveControllerRight.instance.GetFileName()); SteamVRViveConfigWindow.ShowWindow("Vive Controller"); } if (GUILayout.Button("Oculus Touch", TBEditorStyles.controllerSelectButton)) { TBEditorInputSettings.LoadController <EVRButtonId>(ref controllers, TBController_SteamVR_OculusTouchLeft.instance.GetName(), TBController_SteamVR_OculusTouchLeft.instance.GetDefaultDefs(), TBController_SteamVR_OculusTouchLeft.instance.GetFileName()); TBEditorInputSettings.LoadController <EVRButtonId>(ref controllers, TBController_SteamVR_OculusTouchRight.instance.GetName(), TBController_SteamVR_OculusTouchRight.instance.GetDefaultDefs(), TBController_SteamVR_OculusTouchRight.instance.GetFileName()); SteamVROculusTouchConfigWindow.ShowWindow("Oculus Touch"); } if (GUILayout.Button("WMR Motion Controller", TBEditorStyles.controllerSelectButton)) { TBEditorInputSettings.LoadController <EVRButtonId>(ref controllers, TBController_SteamVR_WindowsMixedRealityLeft.instance.GetName(), TBController_SteamVR_WindowsMixedRealityLeft.instance.GetDefaultDefs(), TBController_SteamVR_WindowsMixedRealityLeft.instance.GetFileName()); TBEditorInputSettings.LoadController <EVRButtonId>(ref controllers, TBController_SteamVR_WindowsMixedRealityRight.instance.GetName(), TBController_SteamVR_WindowsMixedRealityRight.instance.GetDefaultDefs(), TBController_SteamVR_WindowsMixedRealityRight.instance.GetFileName()); SteamVRWindowsMixedRealityConfigWindow.ShowWindow("Windows Mixed Reality Motion Controller"); } break; case TBInput.ControlType.Mobile3DOFController: break; case TBInput.ControlType.Gamepad: TBEditorInputSettings.GetControllerButton <TBXInput.TBXInputButton, XInputGamepadConfigWindow>(TBController_XInput_Gamepad.instance, ref TBEditorInputXInput.controllers, active); break; case TBInput.ControlType.ClickRemote: break; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); #endif }
public static void ShowControllerGroup(bool active, TBInput.ControlType controlType) { EditorGUILayout.BeginVertical(); switch (controlType) { case TBInput.ControlType.HandControllers: ShowControllerGroupLabel("Hand Controllers", ref controlSettings.supportsHandControllers); break; case TBInput.ControlType.Mobile3DOFController: ShowControllerGroupLabel("3DOF Controllers", ref controlSettings.supports3DOFControllers); break; case TBInput.ControlType.Gamepad: ShowControllerGroupLabel("Gamepads", ref controlSettings.supportsGamepad); break; case TBInput.ControlType.ClickRemote: ShowControllerGroupLabel("Click Remotes", ref controlSettings.supportsClickRemote); break; } GUI.contentColor = Color.white; EditorGUILayout.EndVertical(); if (TBEditorSDKSettings.GetActiveSDKs().oculus) { EditorGUILayout.BeginVertical(TBEditorStyles.sectionOverlayOculus, new GUILayoutOption[2] { GUILayout.Width(controllerColumnWidth), GUILayout.ExpandHeight(true) }); GUI.backgroundColor = TBEditorStyles.solidOculus; TBEditorInputOculus.ShowOculusControllerList(active, controlType); GUI.backgroundColor = Color.white; EditorGUILayout.EndVertical(); } if (TBEditorSDKSettings.GetActiveSDKs().steamVR) { EditorGUILayout.BeginVertical(TBEditorStyles.sectionOverlaySteam, new GUILayoutOption[2] { GUILayout.Width(controllerColumnWidth), GUILayout.ExpandHeight(true) }); GUI.backgroundColor = TBEditorStyles.solidSteam; TBEditorInputSteamVR.ShowSteamVRControllerList(active, controlType); GUI.backgroundColor = Color.white; EditorGUILayout.EndVertical(); } if (TBEditorSDKSettings.GetActiveSDKs().googleVR) { EditorGUILayout.BeginVertical(TBEditorStyles.sectionOverlayGoogle, new GUILayoutOption[2] { GUILayout.Width(controllerColumnWidth), GUILayout.ExpandHeight(true) }); GUI.backgroundColor = TBEditorStyles.solidGoogle; TBEditorInputGoogle.ShowGoogleControllerList(active, controlType); GUI.backgroundColor = Color.white; EditorGUILayout.EndVertical(); } if (TBEditorSDKSettings.GetActiveSDKs().psvr) { EditorGUILayout.BeginVertical(TBEditorStyles.sectionOverlayPSVR, new GUILayoutOption[2] { GUILayout.Width(controllerColumnWidth), GUILayout.ExpandHeight(true) }); GUI.backgroundColor = TBEditorStyles.solidPSVR; #if UNITY_PS4 TBEditorInputPSVR.ShowPSVRControllerList(active, controlType); #else EditorGUILayout.HelpBox("PSVR settings are only available when Unity platform is set to PS4 and the PS4 module is installed.", MessageType.Info); #endif GUI.backgroundColor = Color.white; EditorGUILayout.EndVertical(); } if (TBEditorSDKSettings.GetActiveSDKs().windows) { EditorGUILayout.BeginVertical(TBEditorStyles.sectionOverlayWindows, new GUILayoutOption[2] { GUILayout.Width(controllerColumnWidth), GUILayout.ExpandHeight(true) }); GUI.backgroundColor = TBEditorStyles.solidWindows; TBEditorInputWindowsMR.ShowWindowsMRControllerList(active, controlType); GUI.backgroundColor = Color.white; EditorGUILayout.EndVertical(); } }
private void OnControlTypeChanged(TBInput.ControlType type) { gameObject.SetActive(false); }