Exemplo n.º 1
0
        public void OnFocusExit(FocusEventData eventData)
        {
            if (!CanInteract() && !HasFocus)
            {
                return;
            }

            SetFocus(pointers.Count > 0);
        }
Exemplo n.º 2
0
 public void OnFocusEnter(FocusEventData eventData)
 {
     Debug.Assert(focusingPointers.Count > 0,
                  "OnFocusEnter called but focusingPointers == 0. Most likely caused by the presence of a child object " +
                  "that is handling IMixedRealityFocusChangedHandler");
     if (CanInteract())
     {
         SetFocus(true);
     }
 }
Exemplo n.º 3
0
 public override void OnFocusEnter(FocusEventData e)
 {
     Debug.Log(gameObject.name + ": On focus enter");
     //EventSystem.current.SetSelectedGameObject(inputField.gameObject);
     //inputField.MoveTextEnd(false);
     //inputField.Select();
     GetComponentInChildren <MyInputField>().enabled = true;
     background.color = highLightColor;
     //StartCoroutine(CodeInput());
 }
Exemplo n.º 4
0
        public void OnFocusEnter(FocusEventData eventData)
        {
            if (!CanInteract())
            {
                return;
            }

            AddPointer(eventData.Pointer);
            SetFocus(pointers.Count > 0);
        }
Exemplo n.º 5
0
        public override void OnFocusExit(FocusEventData focusEvent)
        {
            base.OnFocusExit(focusEvent);

            if (delayFocus != null)
            {
                StopCoroutine(delayFocus);
            }

            delayFocus = StartCoroutine(DelayFocusExit(0f));
        }
    private void Awake()
    {
        if (IED == null)
        {
            IED = new MixedRealityPointerEventData(EventSystem.current);
        }

        if (FED == null)
        {
            FED = new FocusEventData(EventSystem.current);
        }
    }
Exemplo n.º 7
0
        /// <inheritdoc />
        void IMixedRealityFocusChangedHandler.OnBeforeFocusChange(FocusEventData eventData)
        {
            if (eventData.NewFocusedObject == gameObject)
            {
                eventData.Pointer.CursorModifier = this;
            }

            if (eventData.OldFocusedObject == gameObject)
            {
                eventData.Pointer.CursorModifier = null;
            }
        }
Exemplo n.º 8
0
    public override void OnFocusExit(FocusEventData eventData)
    {
        base.OnFocusExit(eventData);
        isFocused = false;

        /*foreach (var child in GetComponentsInChildren<Transform>())
         * {
         *  child.gameObject.layer = LayerMask.NameToLayer("Default");
         * }*/
        boundingBox?.SetActive(false);
        //if (onFocusExit != null) onFocusExit.Invoke();
    }
Exemplo n.º 9
0
        public void OnFocusExit(FocusEventData eventData)
        {
            bool isFar = !(eventData.Pointer is IMixedRealityNearPointer);

            if (isFar && !AllowFarManipulation)
            {
                return;
            }
            OnHoverExited.Invoke(new ManipulationEventData {
                IsNearInteraction = !isFar
            });
        }
Exemplo n.º 10
0
        public void OnFocusExit(FocusEventData eventData)
        {
            if (!eventData.used)
            {
                OnFocusExited?.Invoke(this, new FocusChangedArgs(eventData.Pointer));

                if (MarkEventAsUsed)
                {
                    eventData.Use();
                }
            }
        }
Exemplo n.º 11
0
    public void OnFocusEnter(FocusEventData eventData)
    {
        if (tapping == true)
        {
            // Debug.Log("Selected" + eventData.selectedObject.name);
            // Debug.Log("Color" + eventData.selectedObject.GetComponent<Renderer>().material.color.ToString());

            //Find the gazed object, get the material and change the color to "CurrentColor"
            //eventData.selectedObject.GetComponent<Renderer>().material.color = currentColor;
            eventData.selectedObject.GetComponent <CubeColor>().Color = currentColor;
        }
    }
        public void OnFocusChanged(FocusEventData eventData)
        {
            if (eventData.NewFocusedObject == gameObject &&
                eventData.Pointer.InputSourceParent.SourceType == dwellProfile.DwellPointerType)
            {
                if (!HasFocus)
                {
                    HasFocus = true;

                    // check intent to resume
                    if (CurrentDwellState == DwellStateType.DwellCanceled &&
                        (DateTime.UtcNow - focusExitTime) <= dwellProfile.TimeToAllowDwellResume)
                    {
                        // Add the time duration focus was away since this is a dwell resume and we need to account for the time that focus was lost for the target.
                        // Assigning this the current time would restart computation for dwell progress.
                        focusEnterTime    = focusEnterTime.AddSeconds((DateTime.UtcNow - focusExitTime).TotalSeconds);
                        CurrentDwellState = DwellStateType.DwellStarted;
                        DwellStarted.Invoke(pointer);
                    }
                    // dwell state machine re-starts
                    else if (CurrentDwellState <= DwellStateType.DwellIntended)
                    {
                        focusEnterTime    = DateTime.UtcNow;
                        CurrentDwellState = DwellStateType.FocusGained;
                        pointer           = eventData.Pointer;
                        FillTimer         = 0;
                    }
                }
                pointerCount++;
            }
            else if (eventData.OldFocusedObject == gameObject &&
                     eventData.Pointer.InputSourceParent.SourceType == dwellProfile.DwellPointerType)
            {
                pointerCount--;
                if (pointerCount == 0)
                {
                    HasFocus = false;

                    if (CurrentDwellState == DwellStateType.DwellStarted)
                    {
                        DwellCanceled.Invoke(eventData.Pointer);
                        CurrentDwellState = DwellStateType.DwellCanceled;
                        focusExitTime     = DateTime.UtcNow;
                    }
                    else
                    {
                        CurrentDwellState = DwellStateType.None;
                        focusExitTime     = DateTime.MaxValue;
                    }
                }
            }
        }
Exemplo n.º 13
0
    public override void OnFocusEnter(FocusEventData eventData)
    {
        base.OnFocusEnter(eventData);

        /*foreach (var child in GetComponentsInChildren<Transform>())
         * {
         *  child.gameObject.layer = LayerMask.NameToLayer("Highlight");
         *  //Debug.Log(child.name);
         * }*/
        isFocused = true;
        boundingBox?.SetActive(true);
        //if (onFocusEnter != null) onFocusEnter.Invoke();
    }
Exemplo n.º 14
0
    private void Awake()
    {
        if (IED == null)
        {
            IED = new MixedRealityPointerEventData(EventSystem.current);
        }

        if (FED == null)
        {
            FED = new FocusEventData(EventSystem.current);
        }

        ShareStateTypes.RegisterCustomTypes();
    }
Exemplo n.º 15
0
        public void OnBeforeFocusChange(FocusEventData eventData)
        {
            if (!CanInteract())
            {
                return;
            }

            if (eventData.NewFocusedObject == gameObject)
            {
                AddPointer(eventData.Pointer);
            }
            else if (eventData.OldFocusedObject == gameObject)
            {
                RemovePointer(eventData.Pointer);
            }
        }
Exemplo n.º 16
0
        /// <inheritdoc />
        public override void OnFocusEnter(FocusEventData eventData)
        {
            base.OnFocusEnter(eventData);

            focusEnterTime = Time.unscaledTime;

            if (toolTip == null || !toolTip.gameObject.activeSelf)
            {
                switch (appearType)
                {
                case AppearType.AppearOnFocusEnter:
                    ShowToolTip();
                    break;
                }
            }
        }
        /// <inheritdoc />
        public override void OnBeforeFocusChange(FocusEventData eventData)
        {
            base.OnBeforeFocusChange(eventData);
            if (!(eventData.Pointer is IMixedRealityTeleportPointer teleportPointer) || teleportPointer.IsNull())
            {
                return;
            }

            if (eventData.NewFocusedObject == gameObject)
            {
                teleportPointer.TeleportHotspot = this;
            }
            else if (eventData.OldFocusedObject == gameObject)
            {
                teleportPointer.TeleportHotspot = null;
            }
        }
    void IMixedRealityFocusHandler.OnFocusExit(FocusEventData eventData)
    {
        if (ScrewSceneController.AddingScrewFirstIndicator == false && ScrewSceneController.AddingScrewSecondIndicator == false && onfocus == true)
        {
            // Debug.Log("Leaving Bone Focus");
            create  = true;
            onfocus = false;
            ScrewVisualizer.SetActive(false);
        }
        else
        {
            onfocus = false;
            // ScrewVisualizer.SetActive(false);
        }

        // ScrewVisualizer.SetActive(false);
    }
Exemplo n.º 19
0
    //void Update()
    //{

    //}

    /// <summary>
    /// Activate speech recognition only when the user looks straight at the bot
    /// </summary>
    public void OnFocusEnter(FocusEventData eventData)
    {
        // Don't activate speech recognition if the SpeechManager is not initialized
        // properly or if it's already actively listening for user speech (i.e. recognizing)
        if (SpeechManager.IsReady)
        {
            // Don't activate speech recognition if the speech synthesizer's audio source
            // is still in active playback mode
            if (!SpeechManager.speechTTS.IsSpeaking())
            {
                if (audioSrcPing != null)
                {
                    audioSrcPing.Play();
                }
                //animator.Play("Idle");
                StartListening();
            }
        }
    }
Exemplo n.º 20
0
            void IMixedRealityFocusChangedHandler.OnBeforeFocusChange(FocusEventData eventData)
            {
                Assert.AreNotSame(eventData.OldFocusedObject, eventData.NewFocusedObject);
                Assert.AreEqual(state.numFocusChanged, state.numBeforeFocusChange);

                // Uncomment to help debugging issues
                // var controllerPointer = eventData.Pointer as BaseControllerPointer;
                // Debug.Log($"Pointer '{eventData.Pointer}' Game Object '{controllerPointer?.gameObject}' Old '{eventData.OldFocusedObject}' New '{eventData.NewFocusedObject}'");

                state.numBeforeFocusChange++;

                if (eventData.OldFocusedObject == gameObject)
                {
                    numFocusing--;
                }
                else if (eventData.NewFocusedObject == gameObject)
                {
                    numFocusing++;
                }
            }
Exemplo n.º 21
0
 /// <summary>
 /// Activate speech recognition only when the user looks straight at the bot
 /// </summary>
 public void OnFocusEnter(FocusEventData eventData)
 {
     // Don't activate speech recognition if the recognizer is already running
     if (dictationRecognizer != null && dictationRecognizer.Status != SpeechSystemStatus.Running)
     {
         // Don't activate speech recognition if the speech synthesizer's audio source
         // is still in active playback mode
         if (!ttsAudioSrc.isPlaying)
         {
             //captionsManager.ToggleKeywordRecognizer(false);
             if (selectedSource != null)
             {
                 selectedSource.Play();
             }
             //animator.Play("Idle");
             //StartCoroutine(CoStartRecording());
             StartRecording();
         }
     }
 }
        /// <summary>
        /// Override to set the cursor animation trigger.
        /// </summary>
        public override void OnFocusChanged(FocusEventData eventData)
        {
            base.OnFocusChanged(eventData);

            if (Pointer.CursorModifier != null)
            {
                if ((Pointer.CursorModifier.CursorParameters != null) && (Pointer.CursorModifier.CursorParameters.Length > 0))
                {
                    OnCursorStateChange(CursorStateEnum.Contextual);

                    for (var i = 0; i < Pointer.CursorModifier.CursorParameters.Length; i++)
                    {
                        SetAnimatorParameter(Pointer.CursorModifier.CursorParameters[i]);
                    }
                }
            }
            else
            {
                OnCursorStateChange(CursorStateEnum.None);
            }
        }
        private bool DoesActivationMatchFocus(FocusEventData eventData)
        {
            switch (activation)
            {
            case BoundsControlActivationType.ActivateOnStart:
            case BoundsControlActivationType.ActivateManually:
                return(false);

            case BoundsControlActivationType.ActivateByProximity:
                return(eventData.Pointer is IMixedRealityNearPointer);

            case BoundsControlActivationType.ActivateByPointer:
                return(eventData.Pointer is IMixedRealityPointer);

            case BoundsControlActivationType.ActivateByProximityAndPointer:
                return(true);

            default:
                return(false);
            }
        }
Exemplo n.º 24
0
        public void OnFocusExit(FocusEventData eventData)
        {
            if (eventData.OldFocusedObject == gameObject &&
                eventData.Pointer.InputSourceParent.SourceType == dwellProfile.DwellPointerType &&
                pointer.InputSourceParent.SourceId == eventData.Pointer.InputSourceParent.SourceId)
            {
                HasFocus = false;

                if (CurrentDwellState == DwellStateType.DwellStarted)
                {
                    DwellCanceled.Invoke(eventData.Pointer);
                    CurrentDwellState = DwellStateType.DwellCanceled;
                    focusExitTime     = DateTime.UtcNow;
                }
                else
                {
                    CurrentDwellState = DwellStateType.None;
                    focusExitTime     = DateTime.MaxValue;
                }
            }
        }
Exemplo n.º 25
0
        public void OnBeforeFocusChange(FocusEventData eventData)
        {
            if (!CanInteract())
            {
                return;
            }

            if (eventData.NewFocusedObject == null)
            {
                focusingPointers.Remove(eventData.Pointer);
            }
            else if (eventData.NewFocusedObject.transform.IsChildOf(gameObject.transform))
            {
                if (!focusingPointers.Contains(eventData.Pointer))
                {
                    focusingPointers.Add(eventData.Pointer);
                }
            }
            else if (eventData.OldFocusedObject.transform.IsChildOf(gameObject.transform))
            {
                focusingPointers.Remove(eventData.Pointer);
            }
        }
Exemplo n.º 26
0
        /// <inheritdoc />
        public virtual void OnBeforeFocusChange(FocusEventData eventData)
        {
            // If we're the new target object,
            // add the pointer to the list of focusers.
            if (eventData.NewFocusedObject == gameObject)
            {
                eventData.Pointer.FocusTarget = this;
                Focusers.Add(eventData.Pointer);
            }
            // If we're the old focused target object,
            // remove the pointer from our list.
            else if (eventData.OldFocusedObject == gameObject)
            {
                Focusers.Remove(eventData.Pointer);

                // If there is no new focused target
                // clear the FocusTarget field from the Pointer.
                if (eventData.NewFocusedObject == null)
                {
                    eventData.Pointer.FocusTarget = null;
                }
            }
        }
Exemplo n.º 27
0
        /// <inheritdoc />
        public override void OnBeforeFocusChange(FocusEventData eventData)
        {
            base.OnBeforeFocusChange(eventData);

            if (!(eventData.Pointer is TeleportPointer))
            {
                return;
            }

            IMixedRealityTeleportPointer teleportPointer = eventData.Pointer as IMixedRealityTeleportPointer;

            if (teleportPointer == null)
            {
                return;
            }

            if (eventData.NewFocusedObject == gameObject)
            {
                teleportPointer.TeleportHotSpot = this;

                if (teleportPointer.IsInteractionEnabled)
                {
                    MixedRealityToolkit.TeleportSystem?.RaiseTeleportCanceled(eventData.Pointer, this);
                    MixedRealityToolkit.TeleportSystem?.RaiseTeleportRequest(eventData.Pointer, this);
                }
            }
            else if (eventData.OldFocusedObject == gameObject)
            {
                teleportPointer.TeleportHotSpot = null;

                if (teleportPointer.IsInteractionEnabled)
                {
                    MixedRealityToolkit.TeleportSystem?.RaiseTeleportCanceled(eventData.Pointer, this);
                }
            }
        }
Exemplo n.º 28
0
 public void OnFocusChanged(FocusEventData eventData)
 {
     //do nothing
 }
Exemplo n.º 29
0
 public void OnBeforeFocusChange(FocusEventData eventData)
 {
     //do nothing
 }
        /// <inheritdoc />
        public override void OnFocusExit(FocusEventData eventData)
        {
            base.OnFocusExit(eventData);

            Highlight = false;
        }