private void _RefreshVirtualHandMenuName() { vrInteraction interaction = MiddleVR.VRInteractionMgr.GetActiveInteractionByTag("VirtualHand"); if (interaction != null) { switch (interaction.GetName()) { case "InteractionVirtualHandGogo": { m_VirtualHandOptions.SetLabel("Virtual Hand (Gogo)"); break; } default: { m_VirtualHandOptions.SetLabel("Virtual Hand (" + interaction.GetName() + ")"); break; } } } else { m_VirtualHandOptions.SetLabel("Virtual Hand"); } }
private void _RefreshNavigationMenuName() { vrInteraction interaction = MiddleVR.VRInteractionMgr.GetActiveInteractionByTag("ContinuousNavigation"); if (interaction != null) { switch (interaction.GetName()) { case "InteractionNavigationWandJoystick": { m_NavigationOptions.SetLabel("Navigation (Joystick)"); break; } case "InteractionNavigationElastic": { m_NavigationOptions.SetLabel("Navigation (Elastic)"); break; } case "InteractionNavigationGrabWorld": { m_NavigationOptions.SetLabel("Navigation (Grab The World)"); break; } default: { m_NavigationOptions.SetLabel("Navigation (" + interaction.GetName() + ")"); break; } } } else { m_NavigationOptions.SetLabel("Navigation"); } }
private void _RefreshManipulationMenuName() { vrInteraction interaction = MiddleVR.VRInteractionMgr.GetActiveInteractionByTag("ContinuousManipulation"); if (interaction != null) { switch (interaction.GetName()) { case "InteractionManipulationRay": { m_ManipulationOptions.SetLabel("Manipulation (Ray)"); break; } case "InteractionManipulationHomer": { m_ManipulationOptions.SetLabel("Manipulation (Homer)"); break; } default: { m_ManipulationOptions.SetLabel("Manipulation (" + interaction.GetName() + ")"); break; } } } else { m_ManipulationOptions.SetLabel("Manipulation"); } }
private bool EventListener(vrEvent iEvent) { // Catch interaction events vrInteractionEvent interactionEvt = vrInteractionEvent.Cast(iEvent); if (interactionEvt != null) { vrInteraction interaction = interactionEvt.GetInteraction(); bool needLabelRefresh = false; // Identify interaction // If existing in the Menu, update the menu if (interactionEvt.GetEventType() == (int)VRInteractionEventEnum.VRInteractionEvent_Activated) { vrWidgetToggleButton interactionButton; if (m_Buttons.TryGetValue(interaction.GetName(), out interactionButton)) { interactionButton.SetChecked(true); } needLabelRefresh = true; } else if (interactionEvt.GetEventType() == (int)VRInteractionEventEnum.VRInteractionEvent_Deactivated) { vrWidgetToggleButton interactionButton; if (m_Buttons.TryGetValue(interaction.GetName(), out interactionButton)) { interactionButton.SetChecked(false); } needLabelRefresh = true; } // Refresh interaction menu label if activated or deactivated if (needLabelRefresh) { if (interaction.TagsContain("ContinuousNavigation")) { _RefreshNavigationMenuName(); } else if (interaction.TagsContain("ContinuousManipulation")) { _RefreshManipulationMenuName(); } else if (interaction.TagsContain("VirtualHand")) { _RefreshVirtualHandMenuName(); } } } return(true); }
public void CreateInteractionToggleButton(vrInteraction iInteraction, string iButtonName, vrWidgetMenu iParentMenu, string iButtonHandlerName) { string itName = iInteraction.GetName(); vrWidgetToggleButton button = new vrWidgetToggleButton("VRMenu." + itName + "ToggleButton", iParentMenu, iButtonName, MVRTools.GetCommand(iButtonHandlerName), iInteraction.IsActive()); m_Buttons.Add(itName, button); MVRTools.RegisterObject(this, button); }
public void CreateInteractionToggleButton(vrInteraction iInteraction, string iButtonName, vrWidgetMenu iParentMenu, vrCommand.Delegate iButtonHandler) { string itName = iInteraction.GetName(); vrCommand newCommand = new vrCommand("VRMenu." + itName + "ToggleCommand", iButtonHandler); m_Commands.Add(itName, newCommand); vrWidgetToggleButton button = new vrWidgetToggleButton("VRMenu." + itName + "ToggleButton", iParentMenu, iButtonName, newCommand, iInteraction.IsActive()); m_Buttons.Add(itName, button); }
private bool EventListener(vrEvent iEvent) { // Catch interaction events vrInteractionEvent interactionEvt = vrInteractionEvent.Cast(iEvent); if (interactionEvt != null) { vrInteraction interaction = interactionEvt.GetInteraction(); bool needLabelRefresh = false; // Identify interaction // If existing in the Menu, update the menu if (interactionEvt.GetEventType() == (int)VRInteractionEventEnum.VRInteractionEvent_Activated) { vrWidgetToggleButton interactionButton; if (m_Buttons.TryGetValue(interaction.GetName(), out interactionButton)) { interactionButton.SetChecked(true); } needLabelRefresh = true; } else if (interactionEvt.GetEventType() == (int)VRInteractionEventEnum.VRInteractionEvent_Deactivated) { vrWidgetToggleButton interactionButton; if (m_Buttons.TryGetValue(interaction.GetName(), out interactionButton)) { interactionButton.SetChecked(false); } needLabelRefresh = true; } } return(true); }
protected virtual void OnActivate() { MVRTools.Log(3, "[ ] VRInteraction: Activating '" + m_Interaction.GetName() + "'."); }