示例#1
0
    private bool EventListener(vrEvent iEvent)
    {
        vrInteractionEvent evt = vrInteractionEvent.Cast(iEvent);

        if (evt == null)
        {
            return(false);
        }

        vrInteraction evtInteraction = evt.GetInteraction();

        if (m_Interaction != null && evtInteraction != null && evt != null &&
            evtInteraction.GetId() == m_Interaction.GetId())
        {
            var eventType = evt.GetEventType();

            if (eventType == (int)VRInteractionEventEnum.VRInteractionEvent_Activated)
            {
                Activate();
            }
            else if (eventType == (int)VRInteractionEventEnum.VRInteractionEvent_Deactivated)
            {
                Deactivate();
            }
        }

        return(true);
    }
示例#2
0
    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);
    }
示例#3
0
文件: VRMenu.cs 项目: nhurman/avalon
    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);
    }