private void updateTooltips()
    {
        OVRInput.Controller controller = grabbable?.grabbedBy?.Controller ?? OVRInput.Controller.None;

        if (grabbable.isGrabbed && controller != OVRInput.Controller.None)
        {
            string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetIndexTrigger(controller));
            string tooltip    = $"{buttonName} - Squeeze Ventilator";

            grabbedBy            = controller;
            setTooltipForSqueeze = true;

            if (!HandVRTooltipController.HasTooltipText(controller))
            {
                HandVRTooltipController.ShowTooltip(controller, tooltip);
                previousTooltip = tooltip;
            }
        }

        if (setTooltipForSqueeze && controller == OVRInput.Controller.None)
        {
            if (HandVRTooltipController.GetTooltipText(grabbedBy).Equals(previousTooltip))
            {
                HandVRTooltipController.HideTooltip(grabbedBy);
            }

            setTooltipForSqueeze = false;
            grabbedBy            = OVRInput.Controller.None;
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        Instance = this;

        LeftHandTextPanel.SetActive(false);
        RightHandTextPanel.SetActive(false);
    }
    private void ShowAttachTooltip()
    {
        string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetTopFaceButton(ControllerInCollider));
        string tooltip    = $"{buttonName} - Attach Ventilator";

        HandVRTooltipController.ShowTooltip(ControllerInCollider, tooltip);
    }
    private void setTooltips()
    {
        foreach (OVRInput.Controller controller in relevantInputControllers)
        {
            string tooltip    = "";
            string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetTopFaceButton(controller));

            if (gripButtonHeld(controller))
            {
                if (!AllowTogglingJawGrip)
                {
                    tooltip = $"{buttonName} (Hold) - Holding Jaw Grip";
                }
            }
            else
            {
                if (!AllowTogglingJawGrip)
                {
                    tooltip = $"{buttonName} (Hold) - Hold Jaw Grip";
                }
                else
                {
                    string info = HoldingGrip ? "Release Jaw Grip" : "Start Jaw Grip";

                    tooltip = $"{buttonName} - {info}";
                }
            }

            if (!String.IsNullOrEmpty(tooltip))
            {
                HandVRTooltipController.ShowTooltip(controller, tooltip);
            }
        }
    }
    private void showInteractionTooltip(OVRInput.Controller controller)
    {
        string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetHandTrigger(controller));
        string newStatus  = active ? "Reset Stopwatch" : "Stop Stopwatch";
        string tooltip    = $"{buttonName} - {newStatus}";

        HandVRTooltipController.ShowTooltip(controller, tooltip);
    }
示例#6
0
    private void showInteractionTooltip(OVRInput.Controller controller)
    {
        string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetTopFaceButton(controller));
        string newStatus  = LightState ? "Turn Off Heatlamp" : "Turn On Heatlamp";
        string tooltip    = $"{buttonName} - {newStatus}";

        HandVRTooltipController.ShowTooltip(controller, tooltip);
    }
    private void setTooltips()
    {
        foreach (OVRInput.Controller controller in controllersInCPRCollider)
        {
            string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetTopFaceButton(controller));
            string tooltip    = $"{buttonName} - Compress";

            HandVRTooltipController.ShowTooltip(controller, tooltip);
        }
    }
    void OnTriggerExit(Collider otherCollider)
    {
        ButtonInteracter interacter = otherCollider.GetComponentInParent <ButtonInteracter>();

        if (interacter != null)
        {
            OVRInput.Controller controller = interacter.Controller;

            HandVRTooltipController.HideTooltip(controller);
            controllersInCollider.Remove(controller);
        }
    }
示例#9
0
    private void showInteractionTooltip(OVRInput.Controller controller)
    {
        string tooltip;
        string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetHandTrigger(controller));

        if (rotating)
        {
            tooltip = $"{buttonName} (Hold) - Turn Knob";
        }
        else
        {
            tooltip = $"{buttonName} (Hold) - Grab Knob";
        }

        HandVRTooltipController.ShowTooltip(controller, tooltip);
    }
    private void setTooltips()
    {
        foreach (OVRInput.Controller controller in controllersInCollider)
        {
            string tooltip;
            string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetTopFaceButton(controller));

            if (checkTopFaceButton(controller))
            {
                tooltip = $"{buttonName} (Hold) - Move Controller to Stimulate";
            }
            else
            {
                tooltip = $"{buttonName} (Hold) - Stimulate Baby";
            }


            HandVRTooltipController.ShowTooltip(controller, tooltip);
        }
    }
    void OnTriggerExit(Collider otherCollider)
    {
        ButtonInteracter interacter = otherCollider.GetComponentInParent <ButtonInteracter>();

        if (interacter != null)
        {
            OVRInput.Controller controller = interacter.Controller;

            HandVRTooltipController.HideTooltip(controller);
            controllersInCPRCollider.Remove(controller);

            if (controllersInCPRCollider.Count == 0)
            {
                // TODO - Check if removing hands from area stopping CPR is intuitive or not
                if (StopCompressionWhenNoHands)
                {
                    CPR.StopCompressions();
                }
            }
        }
    }
    private void interactionDone(OVRInput.Controller controller)
    {
        HandVRTooltipController.HideTooltip(controller);

        GameObject hand          = controllerToGameObject.GetOrDefault(controller, null);
        Vector3    startPosition = interactionStartPosition.GetOrDefault(controller, Vector3.zero);
        Vector3    handPosition  = hand?.transform?.position ?? Vector3.zero;

        float startTime = interactionStartTime.GetOrDefault(controller, -1);

        if (startPosition != Vector3.zero && handPosition != Vector3.zero && startTime != -1)
        {
            float distance = Vector3.Distance(startPosition, handPosition);
            float duration = Time.time - startTime;

            Rub rub = new Rub(distance, duration, startTime, LocationName);

            babyRubController.Rubs.Enqueue(rub);
        }

        interactionStartPosition.Remove(controller);
        interactionStartTime.Remove(controller);
    }
    void updateControllerTooltip(GameObject hand, OVRGrabber grabber)
    {
        // Grabbing tooltips should have lowest priority

        OVRInput.Controller controller = grabber.Controller;
        string buttonName  = VRButtonHelper.HumanizeButton(VRButtonHelper.GetHandTrigger(controller));
        string grabTooltip = $"{buttonName} (Hold) - Grab";

        if (grabber.grabbedObject == null && grabber.grabbingCandidates.Count > 0)
        {
            if (!HandVRTooltipController.HasTooltipText(controller))
            {
                HandVRTooltipController.ShowTooltip(controller, grabTooltip);
            }
        }
        else
        {
            if (HandVRTooltipController.GetTooltipText(controller).Equals(grabTooltip))
            {
                HandVRTooltipController.HideTooltip(controller);
            }
        }
    }
    // Keep controllers that are relevant to the jawgrip
    // This includes controllers that initally held the button within the collider if not using toggle mode
    private void updateRelevantControllers()
    {
        HashSet <OVRInput.Controller> newRelevantControllers = new HashSet <OVRInput.Controller>();

        foreach (OVRInput.Controller controller in relevantInputControllers)
        {
            if (!ForceHandInCollider && gripButtonHeld(controller))
            {
                newRelevantControllers.Add(controller);
            }
            else
            {
                HandVRTooltipController.HideTooltip(controller);
            }
        }

        foreach (OVRInput.Controller controller in controllersInCollider)
        {
            newRelevantControllers.Add(controller);
        }

        relevantInputControllers.Clear();
        relevantInputControllers.UnionWith(newRelevantControllers);
    }
示例#15
0
 public void hideInteractionTooltip(OVRInput.Controller controller)
 {
     HandVRTooltipController.HideTooltip(controller);
 }
 private void HideTooltip()
 {
     HandVRTooltipController.HideTooltip(ControllerInCollider);
 }