private void Start() { // Create commands m_ButtonCommand = new vrCommand("GUIMenuSample.ButtonCommand", ButtonHandler); m_CheckboxCommand = new vrCommand("GUIMenuSample.CheckboxCommand", CheckboxHandler); m_RadioCommand = new vrCommand("GUIMenuSample.RadioCommand", RadioHandler); m_ColorPickerCommand = new vrCommand("GUIMenuSample.ColorPickerCommand", ColorPickerHandler); m_SliderCommand = new vrCommand("GUIMenuSample.SliderCommand", SliderHandler); m_ListCommand = new vrCommand("GUIMenuSample.ListCommand", ListHandler); // Create GUI m_GUIRendererWeb = null; VRWebView webViewScript = GetComponent <VRWebView>(); if (webViewScript == null) { MVRTools.Log(0, "[X] VRGUIMenuSample does not have a WebView."); enabled = false; return; } m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView); m_Menu = new vrWidgetMenu("GUIMenuSample.MainMenu", m_GUIRendererWeb); m_Button1 = new vrWidgetButton("GUIMenuSample.Button1", m_Menu, "Button", m_ButtonCommand); new vrWidgetSeparator("GUIMenuSample.Separator1", m_Menu); m_Checkbox = new vrWidgetToggleButton("GUIMenuSample.Checkbox", m_Menu, "Toggle Button", m_CheckboxCommand, true); m_Submenu = new vrWidgetMenu("GUIMenuSample.SubMenu", m_Menu, "Sub Menu"); m_Submenu.SetVisible(true); m_Radio1 = new vrWidgetRadioButton("GUIMenuSample.Radio1", m_Submenu, "Huey", m_RadioCommand, "Huey"); m_Radio2 = new vrWidgetRadioButton("GUIMenuSample.Radio2", m_Submenu, "Dewey", m_RadioCommand, "Dewey"); m_Radio3 = new vrWidgetRadioButton("GUIMenuSample.Radio3", m_Submenu, "Louie", m_RadioCommand, "Louie"); m_Picker = new vrWidgetColorPicker("GUIMenuSample.ColorPicker", m_Menu, "Color Picker", m_ColorPickerCommand, new vrVec4(0, 0, 0, 0)); m_Slider = new vrWidgetSlider("GUIMenuSample.Slider", m_Menu, "Slider", m_SliderCommand, 50.0f, 0.0f, 100.0f, 1.0f); vrValue listContents = vrValue.CreateList(); listContents.AddListItem("Item 1"); listContents.AddListItem("Item 2"); m_List = new vrWidgetList("GUIMenuSample.List", m_Menu, "List", m_ListCommand, listContents, 0); }
private void Start() { // Create commands m_ButtonCommand = new vrCommand("GUIMenuSample.ButtonCommand", ButtonHandler); m_CheckboxCommand = new vrCommand("GUIMenuSample.CheckboxCommand", CheckboxHandler); m_RadioCommand = new vrCommand("GUIMenuSample.RadioCommand", RadioHandler); m_ColorPickerCommand = new vrCommand("GUIMenuSample.ColorPickerCommand", ColorPickerHandler); m_SliderCommand = new vrCommand("GUIMenuSample.SliderCommand", SliderHandler); m_ListCommand = new vrCommand("GUIMenuSample.ListCommand", ListHandler); // Create GUI m_GUIRendererWeb = null; VRWebView webViewScript = GetComponent<VRWebView>(); if (webViewScript == null) { MVRTools.Log(0, "[X] VRGUIMenuSample does not have a WebView."); enabled = false; return; } m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView); m_Menu = new vrWidgetMenu("GUIMenuSample.MainMenu", m_GUIRendererWeb); m_Button1 = new vrWidgetButton("GUIMenuSample.Button1", m_Menu, "Button", m_ButtonCommand); new vrWidgetSeparator("GUIMenuSample.Separator1", m_Menu); m_Checkbox = new vrWidgetToggleButton("GUIMenuSample.Checkbox", m_Menu, "Toggle Button", m_CheckboxCommand, true); m_Submenu = new vrWidgetMenu("GUIMenuSample.SubMenu", m_Menu, "Sub Menu"); m_Submenu.SetVisible(true); m_Radio1 = new vrWidgetRadioButton("GUIMenuSample.Radio1", m_Submenu, "Huey", m_RadioCommand, "Huey"); m_Radio2 = new vrWidgetRadioButton("GUIMenuSample.Radio2", m_Submenu, "Dewey", m_RadioCommand, "Dewey"); m_Radio3 = new vrWidgetRadioButton("GUIMenuSample.Radio3", m_Submenu, "Louie", m_RadioCommand, "Louie"); m_Picker = new vrWidgetColorPicker("GUIMenuSample.ColorPicker", m_Menu, "Color Picker", m_ColorPickerCommand, new vrVec4(0, 0, 0, 0)); m_Slider = new vrWidgetSlider("GUIMenuSample.Slider", m_Menu, "Slider", m_SliderCommand, 50.0f, 0.0f, 100.0f, 1.0f); vrValue listContents = vrValue.CreateList(); listContents.AddListItem( "Item 1" ); listContents.AddListItem( "Item 2" ); m_List = new vrWidgetList("GUIMenuSample.List", m_Menu, "List", m_ListCommand, listContents, 0); }
protected void Start() { // Retrieve the VRManager VRManagerScript[] foundVRManager = FindObjectsOfType(typeof(VRManagerScript)) as VRManagerScript[]; if (foundVRManager.Length != 0) { m_VRManager = foundVRManager[0]; } else { MVRTools.Log("[X] VRMenu: impossible to retrieve the VRManager."); return; } // Start listening to MiddleVR events m_Listener = new vrEventListener(EventListener); MiddleVR.VRInteractionMgr.AddEventListener(m_Listener); // Create commands // General m_ResetCurrentButtonCommand = new vrCommand("VRMenu.ResetCurrentButtonCommand", ResetCurrentButtonHandler); m_ResetZeroButtonCommand = new vrCommand("VRMenu.ResetZeroButtonCommand", ResetZeroButtonHandler); m_ExitButtonCommand = new vrCommand("VRMenu.ExitButtonCommand", ExitButtonHandler); m_FramerateCheckboxCommand = new vrCommand("VRMenu.FramerateCheckboxCommand", FramerateCheckboxHandler); m_ProxiWarningCheckboxCommand = new vrCommand("VRMenu.ProxiWarningCheckboxCommand", ProxiWarningCheckboxHandler); // Navigation m_FlyCheckboxCommand = new vrCommand("VRMenu.FlyCheckboxCommand", FlyCheckboxHandler); m_CollisionsCheckboxCommand = new vrCommand("VRMenu.CollisionsCheckboxCommand", CollisionsCheckboxHandler); // Manipulation m_ReturnObjectsCheckboxCommand = new vrCommand("VRMenu.ReturnObjectsCheckboxCommand", ReturnObjectsCheckboxHandler); // Create GUI m_GUIRendererWeb = null; VRWebView webViewScript = GetComponent <VRWebView>(); if (webViewScript == null) { MVRTools.Log(1, "[X] VRMenu does not have a WebView."); return; } m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView); m_Menu = new vrWidgetMenu("VRMenu.VRManagerMenu", m_GUIRendererWeb); // Navigation m_NavigationOptions = new vrWidgetMenu("VRMenu.NavigationOptions", m_Menu, "Navigation"); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationWandJoystick"), "Joystick", m_NavigationOptions, NavigationJoystickHandler); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationElastic"), "Elastic", m_NavigationOptions, NavigationElasticHandler); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationGrabWorld"), "Grab The World", m_NavigationOptions, NavigationGrabWorldHandler); m_NavigationSeparator = new vrWidgetSeparator("VRMenu.NavigationSeparator", m_NavigationOptions); m_FlyCheckbox = new vrWidgetToggleButton("VRMenu.FlyCheckbox", m_NavigationOptions, "Fly", m_FlyCheckboxCommand, m_VRManager.Fly); m_CollisionsCheckbox = new vrWidgetToggleButton("VRMenu.CollisionsCheckbox", m_NavigationOptions, "Navigation Collisions", m_CollisionsCheckboxCommand, m_VRManager.NavigationCollisions); // Manipulation m_ManipulationOptions = new vrWidgetMenu("VRMenu.ManipulationOptions", m_Menu, "Manipulation"); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionManipulationRay"), "Ray", m_ManipulationOptions, ManipulationRayHandler); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionManipulationHomer"), "Homer", m_ManipulationOptions, ManipulationHomerHandler); m_ManipulationSeparator = new vrWidgetSeparator("VRMenu.ManipulationSeparator", m_ManipulationOptions); m_ReturnObjectsCheckbox = new vrWidgetToggleButton("VRMenu.ReturnObjectsCheckbox", m_ManipulationOptions, "Return Objects", m_ReturnObjectsCheckboxCommand, m_VRManager.ManipulationReturnObjects); // Virtual Hand m_VirtualHandOptions = new vrWidgetMenu("VRMenu.VirtualHandOptions", m_Menu, "Virtual Hand"); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionVirtualHandGogo"), "Gogo", m_VirtualHandOptions, VirtualHandGogoButtonHandler); // General m_GeneralSeparator = new vrWidgetSeparator("VRMenu.GeneralSeparator", m_Menu); m_GeneralOptions = new vrWidgetMenu("VRMenu.GeneralOptions", m_Menu, "General Options"); m_FramerateCheckbox = new vrWidgetToggleButton("VRMenu.FramerateCheckbox", m_GeneralOptions, "Show Frame Rate", m_FramerateCheckboxCommand, m_VRManager.ShowFPS); m_ProxiWarningCheckbox = new vrWidgetToggleButton("VRMenu.ProxiWarningCheckbox", m_GeneralOptions, "Show Proximity Warning", m_ProxiWarningCheckboxCommand, m_VRManager.ShowScreenProximityWarnings); // Reset and Exit m_ResetButtonMenu = new vrWidgetMenu("VRMenu.ResetButtonMenu", m_Menu, "Reset Simulation"); m_ResetCurrentButton = new vrWidgetButton("VRMenu.ResetCurrentButton", m_ResetButtonMenu, "Reload current level", m_ResetCurrentButtonCommand); m_ResetZeroButton = new vrWidgetButton("VRMenu.ResetZeroButton", m_ResetButtonMenu, "Reload level zero", m_ResetZeroButtonCommand); m_ExitButtonMenu = new vrWidgetMenu("VRMenu.ExitButtonMenu", m_Menu, "Exit Simulation"); m_ExitButton = new vrWidgetButton("VRMenu.ExitButton", m_ExitButtonMenu, "Yes, Exit Simulation", m_ExitButtonCommand); }
protected void Start() { // Retrieve the VRManager VRManagerScript[] foundVRManager = FindObjectsOfType(typeof(VRManagerScript)) as VRManagerScript[]; if (foundVRManager.Length != 0) { m_VRManager = foundVRManager[0]; } else { MVRTools.Log("[X] VRMenu: impossible to retrieve the VRManager."); return; } // Start listening to MiddleVR events m_Listener = new vrEventListener(EventListener); MiddleVR.VRInteractionMgr.AddEventListener(m_Listener); // Create commands // General m_ResetCurrentButtonCommand = new vrCommand("VRMenu.ResetCurrentButtonCommand", ResetCurrentButtonHandler); m_ResetZeroButtonCommand = new vrCommand("VRMenu.ResetZeroButtonCommand", ResetZeroButtonHandler); m_ExitButtonCommand = new vrCommand("VRMenu.ExitButtonCommand", ExitButtonHandler); m_FramerateCheckboxCommand = new vrCommand("VRMenu.FramerateCheckboxCommand", FramerateCheckboxHandler); m_ProxiWarningCheckboxCommand = new vrCommand("VRMenu.ProxiWarningCheckboxCommand", ProxiWarningCheckboxHandler); // Navigation m_FlyCheckboxCommand = new vrCommand("VRMenu.FlyCheckboxCommand", FlyCheckboxHandler); m_CollisionsCheckboxCommand = new vrCommand("VRMenu.CollisionsCheckboxCommand", CollisionsCheckboxHandler); // Manipulation m_ReturnObjectsCheckboxCommand = new vrCommand("VRMenu.ReturnObjectsCheckboxCommand", ReturnObjectsCheckboxHandler); // Create GUI m_GUIRendererWeb = null; VRWebView webViewScript = GetComponent<VRWebView>(); if (webViewScript == null) { MVRTools.Log(1, "[X] VRMenu does not have a WebView."); return; } m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView); m_Menu = new vrWidgetMenu("VRMenu.VRManagerMenu", m_GUIRendererWeb); // Navigation m_NavigationOptions = new vrWidgetMenu("VRMenu.NavigationOptions", m_Menu, "Navigation"); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationWandJoystick"), "Joystick", m_NavigationOptions, NavigationJoystickHandler); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationElastic"), "Elastic", m_NavigationOptions, NavigationElasticHandler); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationGrabWorld"), "Grab The World", m_NavigationOptions, NavigationGrabWorldHandler); m_NavigationSeparator = new vrWidgetSeparator("VRMenu.NavigationSeparator", m_NavigationOptions); m_FlyCheckbox = new vrWidgetToggleButton("VRMenu.FlyCheckbox", m_NavigationOptions, "Fly", m_FlyCheckboxCommand, m_VRManager.Fly); m_CollisionsCheckbox = new vrWidgetToggleButton("VRMenu.CollisionsCheckbox", m_NavigationOptions, "Navigation Collisions", m_CollisionsCheckboxCommand, m_VRManager.NavigationCollisions); // Manipulation m_ManipulationOptions = new vrWidgetMenu("VRMenu.ManipulationOptions", m_Menu, "Manipulation"); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionManipulationRay"), "Ray", m_ManipulationOptions, ManipulationRayHandler); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionManipulationHomer"), "Homer", m_ManipulationOptions, ManipulationHomerHandler); m_ManipulationSeparator = new vrWidgetSeparator("VRMenu.ManipulationSeparator", m_ManipulationOptions); m_ReturnObjectsCheckbox = new vrWidgetToggleButton("VRMenu.ReturnObjectsCheckbox", m_ManipulationOptions, "Return Objects", m_ReturnObjectsCheckboxCommand, m_VRManager.ManipulationReturnObjects); // Virtual Hand m_VirtualHandOptions = new vrWidgetMenu("VRMenu.VirtualHandOptions", m_Menu, "Virtual Hand"); CreateInteractionToggleButton(MiddleVR.VRInteractionMgr.GetInteraction("InteractionVirtualHandGogo"), "Gogo", m_VirtualHandOptions, VirtualHandGogoButtonHandler); // General m_GeneralSeparator = new vrWidgetSeparator("VRMenu.GeneralSeparator", m_Menu); m_GeneralOptions = new vrWidgetMenu("VRMenu.GeneralOptions", m_Menu, "General Options"); m_FramerateCheckbox = new vrWidgetToggleButton("VRMenu.FramerateCheckbox", m_GeneralOptions, "Show Frame Rate", m_FramerateCheckboxCommand, m_VRManager.ShowFPS); m_ProxiWarningCheckbox = new vrWidgetToggleButton("VRMenu.ProxiWarningCheckbox", m_GeneralOptions, "Show Proximity Warning", m_ProxiWarningCheckboxCommand, m_VRManager.ShowScreenProximityWarnings); // Reset and Exit m_ResetButtonMenu = new vrWidgetMenu("VRMenu.ResetButtonMenu", m_Menu, "Reset Simulation"); m_ResetCurrentButton = new vrWidgetButton("VRMenu.ResetCurrentButton", m_ResetButtonMenu, "Reload current level", m_ResetCurrentButtonCommand); m_ResetZeroButton = new vrWidgetButton("VRMenu.ResetZeroButton", m_ResetButtonMenu, "Reload level zero", m_ResetZeroButtonCommand); m_ExitButtonMenu = new vrWidgetMenu("VRMenu.ExitButtonMenu", m_Menu, "Exit Simulation"); m_ExitButton = new vrWidgetButton("VRMenu.ExitButton", m_ExitButtonMenu, "Yes, Exit Simulation", m_ExitButtonCommand); }
void Start() { gameManager = GameObject.Find("GameManager").GetComponent <Modelisation.GameManager>(); menuManager = GameObject.Find("Utilisateur").GetComponent <MenuManager>(); // Retrieve the VRManager VRManagerScript[] foundVRManager = FindObjectsOfType(typeof(VRManagerScript)) as VRManagerScript[]; if (foundVRManager.Length != 0) { m_VRManager = foundVRManager[0]; } else { MVRTools.Log("[X] VRMenu: impossible to retrieve the VRManager."); return; } // Start listening to MiddleVR events m_Listener = new vrEventListener(EventListener); MiddleVR.VRKernel.AddEventListener(m_Listener); // Create commands // General m_ResetButtonCommand = new vrCommand("VRMenu.ResetButtonCommand", ResetButtonHandler); m_ExitButtonCommand = new vrCommand("VRMenu.ExitButtonCommand", ExitButtonHandler); // Mode modeAssisteCommand = new vrCommand("VRMenu.modeAssisteCommand", ModeAssisteHandler); modeLibreCommand = new vrCommand("VRMenu.modeLibreCommand", ModeLibreHandler); // Scenario scenarioAppelCommand = new vrCommand("VRMenu.ScenarioAppelCommand", ScenarioAppelHandler); scenarioInfirmierCommand = new vrCommand("VRMenu.ScenarioInfirmierCommand", ScenarioInfirmierHandler); scenarioInconnuCommand = new vrCommand("VRMenu.ScenarioInconnuCommand", ScenarioInconnuHandler); // Create GUI m_GUIRendererWeb = null; VRWebView webViewScript = GetComponent <VRWebView>(); if (webViewScript == null) { MVRTools.Log(1, "[X] VRMenu does not have a WebView."); return; } m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView); m_Menu = new vrWidgetMenu("VRMenu.VRManagerMenu", m_GUIRendererWeb); // Mode menuChoixMode = new vrWidgetMenu("VRMenu.ChoixMode", m_Menu, "Modes"); modeAssiste = new vrWidgetButton("VRMenu.ModeAssisteButton", menuChoixMode, "Passer en mode assisté", modeAssisteCommand); modeLibre = new vrWidgetButton("VRMenu.ModeLibreButton", menuChoixMode, "Passer en mode libre", modeLibreCommand); // Scénario menuChoixScenar = new vrWidgetMenu("VRMenu.ChoixScenario", m_Menu, "Scenarios"); scenarAppel = new vrWidgetButton("VRMenu.ScenarAppelButton", menuChoixScenar, "Appel téléphonique", scenarioAppelCommand); scenarInfirmier = new vrWidgetButton("VRMenu.ScenarInfirmierButton", menuChoixScenar, "Infirmier à l'entrée", scenarioInfirmierCommand); scenarInconnu = new vrWidgetButton("VRMenu.ScenarInconnuButton", menuChoixScenar, "Inconnu à l'entrée", scenarioInconnuCommand); // Reset and Exit m_ResetButton = new vrWidgetButton("VRMenu.ResetCurrentButton", m_Menu, "Reload simulation", m_ResetButtonCommand); m_ExitButton = new vrWidgetButton("VRMenu.ExitButton", m_Menu, "Exit simulation", m_ExitButtonCommand); }
private void Start() { // Automatically register all methods with the [VRCommand] attribute MVRTools.RegisterCommands(this); // Create GUI VRWebView webViewScript = GetComponent <VRWebView>(); if (webViewScript == null) { MVRTools.Log(0, "[X] VRGUIMenuSample does not have a WebView."); enabled = false; return; } var GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView); // Register the object so the garbage collector does not collect it after this method. // The object will be disposed when the GameObject is destroyed. MVRTools.RegisterObject(this, GUIRendererWeb); var menu = new vrWidgetMenu("GUIMenuSample.MainMenu", GUIRendererWeb); MVRTools.RegisterObject(this, menu); var button1 = new vrWidgetButton("GUIMenuSample.Button1", menu, "Button", MVRTools.GetCommand("ButtonHandler")); MVRTools.RegisterObject(this, button1); var separator = new vrWidgetSeparator("GUIMenuSample.Separator1", menu); MVRTools.RegisterObject(this, separator); m_Checkbox = new vrWidgetToggleButton("GUIMenuSample.Checkbox", menu, "Toggle Button", MVRTools.GetCommand("CheckboxHandler"), true); MVRTools.RegisterObject(this, m_Checkbox); var submenu = new vrWidgetMenu("GUIMenuSample.SubMenu", menu, "Sub Menu"); submenu.SetVisible(true); MVRTools.RegisterObject(this, submenu); var radio1 = new vrWidgetRadioButton("GUIMenuSample.Radio1", submenu, "Huey", MVRTools.GetCommand("RadioHandler"), "Huey"); MVRTools.RegisterObject(this, radio1); var radio2 = new vrWidgetRadioButton("GUIMenuSample.Radio2", submenu, "Dewey", MVRTools.GetCommand("RadioHandler"), "Dewey"); MVRTools.RegisterObject(this, radio2); var radio3 = new vrWidgetRadioButton("GUIMenuSample.Radio3", submenu, "Louie", MVRTools.GetCommand("RadioHandler"), "Louie"); MVRTools.RegisterObject(this, radio3); var picker = new vrWidgetColorPicker("GUIMenuSample.ColorPicker", menu, "Color Picker", MVRTools.GetCommand("ColorPickerHandler"), new vrVec4(0, 0, 0, 0)); MVRTools.RegisterObject(this, picker); var slider = new vrWidgetSlider("GUIMenuSample.Slider", menu, "Slider", MVRTools.GetCommand("SliderHandler"), 50.0f, 0.0f, 100.0f, 1.0f); MVRTools.RegisterObject(this, slider); vrValue listContents = vrValue.CreateList(); listContents.AddListItem("Item 1"); listContents.AddListItem("Item 2"); var list = new vrWidgetList("GUIMenuSample.List", menu, "List", MVRTools.GetCommand("ListHandler"), listContents, 0); MVRTools.RegisterObject(this, list); }