Beispiel #1
0
        void IInputHandler.OnInputUp(InputEventData eventData)
        {
            if (IsEnabled && eventData.PressType == InteractionSourcePressInfo.Select)
            {
                ButtonPressed.RaiseEvent();
                eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.


                if (eventData.selectedObject.name == this.name)
                {
                    this.transform.parent.GetComponent <SingleConnectome>().DrawEdges(int.Parse(this.name));
                }
            }
        }
Beispiel #2
0
        public void OnInputDown(InputEventData eventData)
        {
            if (data.EditMode == true)
            {
                RemoveAnchor();
            }
            else
            {
                return;
            }


            if (isDragging)
            {
                // We're already handling drag input, so we can't start a new drag operation.
                return;
            }

#if UNITY_2017_2_OR_NEWER
            InteractionSourceInfo sourceKind;
            eventData.InputSource.TryGetSourceKind(eventData.SourceId, out sourceKind);
            if (sourceKind != InteractionSourceInfo.Hand)
            {
                if (!eventData.InputSource.SupportsInputInfo(eventData.SourceId, SupportedInputInfo.Position))
                {
                    // The input source must provide positional data for this script to be usable
                    return;
                }
            }
#else
            if (!eventData.InputSource.SupportsInputInfo(eventData.SourceId, SupportedInputInfo.Position))
            {
                // The input source must provide positional data for this script to be usable
                return;
            }
#endif

            eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.

            currentInputSource   = eventData.InputSource;
            currentInputSourceId = eventData.SourceId;

            FocusDetails?details = FocusManager.Instance.TryGetFocusDetails(eventData);

            Vector3 initialDraggingPosition = (details == null)
                ? HostTransform.position
                : details.Value.Point;

            StartDragging(initialDraggingPosition);
        }
Beispiel #3
0
        void IInputHandler.OnInputUp(InputEventData eventData)
        {
            if (IsEnabled && eventData.PressType == InteractionSourcePressInfo.Select)
            {
                ButtonPressed.RaiseEvent();
                eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.

                if (eventData.selectedObject.name == "ResetButton")
                {
                    //this.transform.parent.GetComponent<SingleConnectome>().DrawEdges
                    GameObject.Find("SceneManager").GetComponent <NSceneManager>().resetConnectomeBuilder();
                }
            }
        }
        public void OnInputUp(InputEventData eventData)
        {
            if (currentInputSource != null &&
                eventData.SourceId == currentInputSourceId)
            {
                eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.

                StopDragging();
            }
            for (int i = 0; i < guidList.Count; i++)
            {
                //Debug.Log("In List AFTER InputUP: " + guidList[i]);
            }
        }
        void IInputHandler.OnInputUp(InputEventData eventData)
        {
            if (IsEnabled && eventData.PressType == InteractionSourcePressInfo.Select)
            {
                ButtonPressed.RaiseEvent();
                eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.



                if (eventData.selectedObject.name == "StepParent")
                {
                    mode = 0;
                    step.GetComponent <TextMesh>().color = Color.red;
                    hr.GetComponent <TextMesh>().color   = new Color(1.0f, 1.0f, 1.0f);
                }
                else if (eventData.selectedObject.name == "HRParent")
                {
                    mode = 1;
                    step.GetComponent <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                    hr.GetComponent <TextMesh>().color   = Color.red;
                }

                if (eventData.selectedObject.name == "Week1Parent")
                {
                    weekID = 0;
                    week1.GetComponent <TextMesh>().color = Color.yellow;
                    week2.GetComponent <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                    week3.GetComponent <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                }
                else if (eventData.selectedObject.name == "Week2Parent")
                {
                    weekID = 1;
                    week1.GetComponent <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                    week2.GetComponent <TextMesh>().color = Color.yellow;
                    week3.GetComponent <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                }
                else if (eventData.selectedObject.name == "Week3Parent")
                {
                    weekID = 2;
                    week1.GetComponent <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                    week2.GetComponent <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                    week3.GetComponent <TextMesh>().color = Color.yellow;
                }


                smScript.visualize(mode, weekID);
            }
        }
        void IInputHandler.OnInputUp(InputEventData eventData)
        {
            Debug.Log("Inside Oninputup");
            if (IsEnabled && eventData.PressType == InteractionSourcePressInfo.Select)
            {
                ButtonPressed.RaiseEvent();
                eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.

                Debug.Log("Inside Oninputup");

                if (eventData.selectedObject.name == "Cube")
                {
                    Debug.Log("Click");
                }
            }
        }
Beispiel #7
0
        private void HandleInputAction(InputEventData eventData)
        {
            // TODO: robertes: Investigate how this feels. Since "Down" will often be followed by "Click", is
            //       marking the event as used actually effective in preventing unintended app input during a
            //       pointer change?

            bool pointerWasChanged;

            if (SupportsPointingRay(eventData))
            {
                if (IsInputSourcePointerActive && inputSourcePointer.InputIsFromSource(eventData))
                {
                    pointerWasChanged = false;
                }
                else
                {
                    AttachInputSourcePointer(eventData);
                    SetPointer(inputSourcePointer);
                    pointerWasChanged = true;
                }
            }
            else
            {
                if (IsGazePointerActive)
                {
                    pointerWasChanged = false;
                }
                else
                {
                    // TODO: robertes: see if we can treat voice separately from the other simple committers,
                    //       so voice doesn't steal from a pointing controller. I think input Kind would need
                    //       to come through with the event data.

                    SetPointer(GazeManager.Instance);
                    pointerWasChanged = true;
                }
            }

            if (pointerWasChanged)
            {
                // Since this input resulted in a pointer change, we mark the event as used to
                // prevent it from falling through to other handlers to prevent potentially
                // unintended input from reaching handlers that aren't being pointed at by
                // the new pointer.
                eventData.Use();
            }
        }
Beispiel #8
0
        public void OnInputDown(InputEventData eventData)
        {
            if (isDragging)
            {
                // すでにドラッグの入力を受け取って処理しているので、新しいドラッグ操作は開始しない
                return;
            }

#if UNITY_2017_2_OR_NEWER
            InteractionSourceInfo sourceKind;
            eventData.InputSource.TryGetSourceKind(eventData.SourceId, out sourceKind);
            if (sourceKind != InteractionSourceInfo.Hand)
            {
                if (!eventData.InputSource.SupportsInputInfo(eventData.SourceId, SupportedInputInfo.Position))
                {
                    // The input source must provide positional data for this script to be usable
                    return;
                }
            }
#else
            if (!eventData.InputSource.SupportsInputInfo(eventData.SourceId, SupportedInputInfo.Position))
            {
                // The input source must provide positional data for this script to be usable
                return;
            }
#endif

            eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.

            currentInputSource   = eventData.InputSource;
            currentInputSourceId = eventData.SourceId;

            /* コメントアウト
             * FocusDetails? details = FocusManager.Instance.TryGetFocusDetails(eventData);
             *
             * Vector3 initialDraggingPosition = (details == null)
             *  ? HostTransform.position
             *  : details.Value.Point;
             */
            // 追加
            Vector3 initialDraggingPosition = HostTransform.position;

            StartDragging(initialDraggingPosition);
        }
        public void OnInputDown(InputEventData eventData)
        {
            if (isDragging)
            {
                // すでにドラッグの入力を受け取って処理しているので、新しいドラッグ操作は開始しない
                return;
            }

#if UNITY_2017_2_OR_NEWER
            InteractionSourceInfo sourceKind;
            eventData.InputSource.TryGetSourceKind(eventData.SourceId, out sourceKind);
            if (sourceKind != InteractionSourceInfo.Hand)
            {
                if (!eventData.InputSource.SupportsInputInfo(eventData.SourceId, SupportedInputInfo.Position))
                {
                    // 入力元はこのスクリプトに必要な位置情報を提供しなければならない
                    return;
                }
            }
#else
            if (!eventData.InputSource.SupportsInputInfo(eventData.SourceId, SupportedInputInfo.Position))
            {
                // The input source must provide positional data for this script to be usable
                return;
            }
#endif

            // イベントが使われたことを記録して、他の処理に受け取られるのを防ぐ
            eventData.Use();

            currentInputSource   = eventData.InputSource;
            currentInputSourceId = eventData.SourceId;

            FocusDetails?details = FocusManager.Instance.TryGetFocusDetails(eventData);

            Vector3 initialDraggingPosition = (details == null)
                ? HostTransform.position
                : details.Value.Point;

            StartDragging(initialDraggingPosition);
        }
Beispiel #10
0
 public void OnInputUp(InputEventData eventData)
 {
     RemoveSourceIdFromHandMap(eventData.SourceId);
     UpdateStateMachine();
     eventData.Use();
 }
        public void OnInputDown(InputEventData eventData)
        {
            for (int i = 0; i < guidList.Count; i++)
            {
                if (guidList[i] == grabbedGuid.ToString())
                {
                    isAvailable = true;
                    break;
                }
                else
                {
                    isAvailable = false;
                }
            }

            if (isDragging)
            {
                // We're already handling drag input, so we can't start a new drag operation.
                return;
            }



#if UNITY_2017_2_OR_NEWER
            InteractionSourceInfo sourceKind;
            eventData.InputSource.TryGetSourceKind(eventData.SourceId, out sourceKind);
            if (sourceKind != InteractionSourceInfo.Hand)
            {
                if (!eventData.InputSource.SupportsInputInfo(eventData.SourceId, SupportedInputInfo.GripPosition))
                {
                    // The input source must provide grip positional data for this script to be usable
                    return;
                }
            }
#else
            if (!eventData.InputSource.SupportsInputInfo(eventData.SourceId, SupportedInputInfo.PointerPosition))
            {
                // The input source must provide positional data for this script to be usable
                return;
            }
#endif // UNITY_2017_2_OR_NEWER

            eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.

            currentInputSource   = eventData.InputSource;
            currentInputSourceId = eventData.SourceId;

            FocusDetails?details = FocusManager.Instance.TryGetFocusDetails(eventData);

            Vector3 initialDraggingPosition = (details == null)
                ? HostTransform.position
                : details.Value.Point;

            if (isAvailable)
            {
                for (int i = 0; i < guidList.Count; i++)
                {
                    //Debug.Log("In List before Fire: " + guidList[i]);
                }
                StartDragging(initialDraggingPosition);
                gameObject.GetComponent <NodeLink>().Fire("LockItem", grabbedGuid);
                //Debug.Log("Message sent " + grabbedGuid);
            }
            else
            {
                return;
            }
        }
Beispiel #12
0
        void IInputHandler.OnInputUp(InputEventData eventData)
        {
            if (IsEnabled && eventData.PressType == InteractionSourcePressInfo.Select)
            {
                ButtonPressed.RaiseEvent();
                eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.

                if (eventData.selectedObject == Anatomy)
                {
                    this.transform.parent.GetComponentInChildren <SingleConnectome>()._representationType = SingleConnectome.representationTypes.Anatomy;
                    Anatomy.GetComponentInChildren <TextMesh>().color = Color.red;
                    Tsne.GetComponentInChildren <TextMesh>().color    = new Color(1.0f, 1.0f, 1.0f);
                    Mds.GetComponentInChildren <TextMesh>().color     = new Color(1.0f, 1.0f, 1.0f);
                    Isomap.GetComponentInChildren <TextMesh>().color  = new Color(1.0f, 1.0f, 1.0f);
                }
                else if (eventData.selectedObject == Tsne)
                {
                    this.transform.parent.GetComponentInChildren <SingleConnectome>()._representationType = SingleConnectome.representationTypes.Tsne;
                    Anatomy.GetComponentInChildren <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                    Tsne.GetComponentInChildren <TextMesh>().color    = Color.red;
                    Mds.GetComponentInChildren <TextMesh>().color     = new Color(1.0f, 1.0f, 1.0f);
                    Isomap.GetComponentInChildren <TextMesh>().color  = new Color(1.0f, 1.0f, 1.0f);
                }
                else if (eventData.selectedObject == Mds)
                {
                    this.transform.parent.GetComponentInChildren <SingleConnectome>()._representationType = SingleConnectome.representationTypes.MDS;
                    Anatomy.GetComponentInChildren <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                    Tsne.GetComponentInChildren <TextMesh>().color    = new Color(1.0f, 1.0f, 1.0f);
                    Mds.GetComponentInChildren <TextMesh>().color     = Color.red;
                    Isomap.GetComponentInChildren <TextMesh>().color  = new Color(1.0f, 1.0f, 1.0f);
                }
                else if (eventData.selectedObject == Isomap)
                {
                    this.transform.parent.GetComponentInChildren <SingleConnectome>()._representationType = SingleConnectome.representationTypes.Isomap;
                    Anatomy.GetComponentInChildren <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                    Tsne.GetComponentInChildren <TextMesh>().color    = new Color(1.0f, 1.0f, 1.0f);
                    Mds.GetComponentInChildren <TextMesh>().color     = new Color(1.0f, 1.0f, 1.0f);
                    Isomap.GetComponentInChildren <TextMesh>().color  = Color.red;
                }

                if (eventData.selectedObject == CAnatomy)
                {
                    this.transform.parent.GetComponentInChildren <SingleConnectome>()._classificationType = SingleConnectome.classificationTypes.Anatomy;
                    CAnatomy.GetComponentInChildren <TextMesh>().color   = Color.red;
                    Embeddness.GetComponentInChildren <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                    RichClub.GetComponentInChildren <TextMesh>().color   = new Color(1.0f, 1.0f, 1.0f);
                }
                else if (eventData.selectedObject == Embeddness)
                {
                    this.transform.parent.GetComponentInChildren <SingleConnectome>()._classificationType = SingleConnectome.classificationTypes.Embeddness;
                    CAnatomy.GetComponentInChildren <TextMesh>().color   = new Color(1.0f, 1.0f, 1.0f);
                    Embeddness.GetComponentInChildren <TextMesh>().color = Color.red;
                    RichClub.GetComponentInChildren <TextMesh>().color   = new Color(1.0f, 1.0f, 1.0f);
                }
                else if (eventData.selectedObject == RichClub)
                {
                    this.transform.parent.GetComponentInChildren <SingleConnectome>()._classificationType = SingleConnectome.classificationTypes.RichClub;
                    CAnatomy.GetComponentInChildren <TextMesh>().color   = new Color(1.0f, 1.0f, 1.0f);
                    Embeddness.GetComponentInChildren <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                    RichClub.GetComponentInChildren <TextMesh>().color   = Color.red;
                }


                if (eventData.selectedObject == EdgeOn)
                {
                    this.transform.parent.GetComponentInChildren <BoxCollider>().enabled = false;
                    EdgeOn.GetComponentInChildren <TextMesh>().color  = Color.red;
                    EdgeOff.GetComponentInChildren <TextMesh>().color = new Color(1.0f, 1.0f, 1.0f);
                }
                else if (eventData.selectedObject == EdgeOff)
                {
                    this.transform.parent.GetComponentInChildren <BoxCollider>().enabled = true;
                    EdgeOn.GetComponentInChildren <TextMesh>().color  = new Color(1.0f, 1.0f, 1.0f);
                    EdgeOff.GetComponentInChildren <TextMesh>().color = Color.red;
                }
            }
        }