예제 #1
0
 /// <summary>
 /// Performs a raycast using the pointer object attached to this OVRRaycaster
 /// </summary>
 /// <param name="eventData"></param>
 /// <param name="resultAppendList"></param>
 public void RaycastPointer(UnityEngine.EventSystems.PointerEventData eventData, List <UnityEngine.EventSystems.RaycastResult> resultAppendList)
 {
 }
예제 #2
0
 private void OnEventPointerDown(UnityEngine.EventSystems.PointerEventData obj)
 {
     OnClickMove();
 }
예제 #3
0
 public override void OnPointerDown(UnityEngine.EventSystems.PointerEventData eventData)
 {
     base.OnPointerDown(eventData);
     IsDragging = true;
 }
예제 #4
0
 public override void OnPointerUp(UnityEngine.EventSystems.PointerEventData eventData)
 {
     base.OnPointerUp(eventData);
     this.IsPressedDown = false;
 }
예제 #5
0
 public void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
     luaAction(eventData.pointerCurrentRaycast.worldPosition);
 }
예제 #6
0
 public override void OnPointerDown(UnityEngine.EventSystems.PointerEventData eventData)
 {
     Run();
     base.OnPointerDown(eventData);
 }
예제 #7
0
 public void OnDrop(UnityEngine.EventSystems.PointerEventData data)
 {
 }
예제 #8
0
 public override void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
 }
예제 #9
0
 public override void OnPointerDown(UnityEngine.EventSystems.PointerEventData eventData)
 {
     Run(!isOn);
 }
예제 #10
0
 public override void OnEndDrag(UnityEngine.EventSystems.PointerEventData eventData)
 {
     //base.OnEndDrag (eventData);
 }
예제 #11
0
    public UnityEngine.EventSystems.PointerEventData ExecuteTouchEvent(UnityEngine.Touch touch, UnityEngine.EventSystems.PointerEventData previousData = null)
    {
        if (UnityEngine.EventSystems.EventSystem.current != null)
        {
            UnityEngine.EventSystems.RaycastResult raycastResult;
            System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> raycastResults;
            switch (touch.phase)
            {
            case UnityEngine.TouchPhase.Began:
                UnityEngine.EventSystems.PointerEventData pointerEventData =
                    new UnityEngine.EventSystems.PointerEventData(UnityEngine.EventSystems.EventSystem.current)
                {
                    position  = touch.position,
                    delta     = touch.deltaPosition,
                    button    = UnityEngine.EventSystems.PointerEventData.InputButton.Left,
                    pointerId = touch.fingerId
                };
                raycastResults = new System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>();
                UnityEngine.EventSystems.EventSystem.current.RaycastAll(pointerEventData, raycastResults);
                raycastResult = UnityEngine.EventSystems.BaseInputModule.FindFirstRaycast(raycastResults);
                pointerEventData.pointerCurrentRaycast = raycastResult;
                pointerEventData.pointerPressRaycast   = pointerEventData.pointerCurrentRaycast;

                pointerEventData.pointerEnter = UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(pointerEventData.pointerCurrentRaycast.gameObject, pointerEventData,
                                                                                                        UnityEngine.EventSystems.ExecuteEvents.pointerEnterHandler);
                pointerEventData.pointerPress = UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(pointerEventData.pointerCurrentRaycast.gameObject, pointerEventData,
                                                                                                        UnityEngine.EventSystems.ExecuteEvents.pointerDownHandler);
                UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(pointerEventData.pointerCurrentRaycast.gameObject, pointerEventData,
                                                                        UnityEngine.EventSystems.ExecuteEvents.initializePotentialDrag);
                UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(pointerEventData.pointerCurrentRaycast.gameObject, pointerEventData,
                                                                        UnityEngine.EventSystems.ExecuteEvents.beginDragHandler);
                pointerEventData.pointerDrag = UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(pointerEventData.pointerCurrentRaycast.gameObject, pointerEventData,
                                                                                                       UnityEngine.EventSystems.ExecuteEvents.dragHandler);

                if (pointerEventData.pointerPress == null)
                {
                    pointerEventData.pointerPress = UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(pointerEventData.pointerCurrentRaycast.gameObject, pointerEventData,
                                                                                                            UnityEngine.EventSystems.ExecuteEvents.pointerClickHandler);
                }

                return(pointerEventData);

            case UnityEngine.TouchPhase.Moved:
                if (previousData != null)
                {
                    raycastResults = new System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>();
                    UnityEngine.EventSystems.EventSystem.current.RaycastAll(previousData, raycastResults);
                    raycastResult = UnityEngine.EventSystems.BaseInputModule.FindFirstRaycast(raycastResults);
                    previousData.pointerCurrentRaycast = raycastResult;
                    previousData.delta    = touch.deltaPosition;
                    previousData.position = touch.position;
                    raycastResults        = new System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>();
                    UnityEngine.EventSystems.EventSystem.current.RaycastAll(previousData, raycastResults);
                    raycastResult = UnityEngine.EventSystems.BaseInputModule.FindFirstRaycast(raycastResults);
                    previousData.pointerCurrentRaycast = raycastResult;
                    if (previousData.pointerEnter != previousData.pointerCurrentRaycast.gameObject)
                    {
                        UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(previousData.pointerEnter, previousData,
                                                                                UnityEngine.EventSystems.ExecuteEvents.pointerExitHandler);
                        UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(previousData.pointerCurrentRaycast.gameObject, previousData,
                                                                                UnityEngine.EventSystems.ExecuteEvents.pointerEnterHandler);
                        previousData.pointerEnter = previousData.pointerCurrentRaycast.gameObject;
                    }

                    if (previousData.delta != UnityEngine.Vector2.zero)
                    {
                        UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(previousData.pointerDrag, previousData, UnityEngine.EventSystems.ExecuteEvents.dragHandler);
                    }

                    return(previousData);
                }

                break;

            case UnityEngine.TouchPhase.Ended:
                if (previousData != null)
                {
                    raycastResults = new System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>();
                    UnityEngine.EventSystems.EventSystem.current.RaycastAll(previousData, raycastResults);
                    raycastResult = UnityEngine.EventSystems.BaseInputModule.FindFirstRaycast(raycastResults);
                    previousData.pointerCurrentRaycast = raycastResult;
                    UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(previousData.pointerPress, previousData,
                                                                            UnityEngine.EventSystems.ExecuteEvents.pointerUpHandler);
                    UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(previousData.pointerPress, previousData,
                                                                            UnityEngine.EventSystems.ExecuteEvents.pointerClickHandler);
                    UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(previousData.pointerDrag, previousData,
                                                                            UnityEngine.EventSystems.ExecuteEvents.endDragHandler);
                    UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(previousData.pointerCurrentRaycast.gameObject, previousData,
                                                                            UnityEngine.EventSystems.ExecuteEvents.dropHandler);
                    UnityEngine.EventSystems.ExecuteEvents.ExecuteHierarchy(previousData.pointerCurrentRaycast.gameObject, previousData,
                                                                            UnityEngine.EventSystems.ExecuteEvents.pointerExitHandler);
                    return(previousData);
                }
                break;
            }

            return(previousData);
        }

        return(null);
    }
예제 #12
0
 public override void OnScroll(UnityEngine.EventSystems.PointerEventData data)
 {
     //base.OnScroll (data);
 }
예제 #13
0
 static void set_hovered_0(ref object o, object v)
 {
     UnityEngine.EventSystems.PointerEventData _o = (UnityEngine.EventSystems.PointerEventData)o;
     _o.hovered = (System.Collections.Generic.List <UnityEngine.GameObject>)v;
 }
예제 #14
0
        private void Raycast(UnityEngine.EventSystems.PointerEventData eventData, List <UnityEngine.EventSystems.RaycastResult> resultAppendList, Ray ray, bool checkForBlocking)
        {
            //This function is closely based on
            //void GraphicRaycaster.Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)

            if (canvas == null)
            {
                return;
            }

            float hitDistance = float.MaxValue;

            if (checkForBlocking && blockingObjects != BlockingObjects.None)
            {
                float dist = eventCamera.farClipPlane;

                if (blockingObjects == BlockingObjects.ThreeD || blockingObjects == BlockingObjects.All)
                {
                    var hits = Physics.RaycastAll(ray, dist, m_BlockingMask);

                    if (hits.Length > 0 && hits[0].distance < hitDistance)
                    {
                        hitDistance = hits[0].distance;
                    }
                }

                if (blockingObjects == BlockingObjects.TwoD || blockingObjects == BlockingObjects.All)
                {
                    var hits = Physics2D.GetRayIntersectionAll(ray, dist, m_BlockingMask);

                    if (hits.Length > 0 && hits[0].fraction * dist < hitDistance)
                    {
                        hitDistance = hits[0].fraction * dist;
                    }
                }
            }

            m_RaycastResults.Clear();

            GraphicRaycast(canvas, ray, m_RaycastResults);

            lastHitDistance   = 0;
            lastWorldHitPoint = Vector3.zero;
            if (m_RaycastResults.Count != 0)
            {
                lastHitDistance   = Vector3.Distance(ray.origin, m_RaycastResults[0].worldPos);
                lastWorldHitPoint = m_RaycastResults[0].worldPos;
            }

            for (var index = 0; index < m_RaycastResults.Count; index++)
            {
                var  go            = m_RaycastResults[index].graphic.gameObject;
                bool appendGraphic = true;

                if (ignoreReversedGraphics)
                {
                    // If we have a camera compare the direction against the cameras forward.
                    var cameraFoward = ray.direction;
                    var dir          = go.transform.rotation * Vector3.forward;
                    appendGraphic = Vector3.Dot(cameraFoward, dir) > 0;
                }

                // Ignore points behind us (can happen with a canvas pointer)
                if (eventCamera.transform.InverseTransformPoint(m_RaycastResults[index].worldPos).z <= 0)
                {
                    appendGraphic = false;
                }

                if (appendGraphic)
                {
                    float distance = Vector3.Distance(ray.origin, m_RaycastResults[index].worldPos);

                    if (distance >= hitDistance)
                    {
                        continue;
                    }

                    var castResult = new UnityEngine.EventSystems.RaycastResult {
                        gameObject = go,
                        module     = this,
                        distance   = distance,
                        index      = resultAppendList.Count,
                        depth      = m_RaycastResults[index].graphic.depth,

                        worldPosition = m_RaycastResults[index].worldPos
                    };
                    resultAppendList.Add(castResult);
                }
            }
        }
예제 #15
0
 // IPointerClickHandler
 // マウスボタンをクリックした時に呼び出されます
 public void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
     // CubeViewModelのClickCubeコマンドを実行する
     ExecuteClickCube();
 }
예제 #16
0
 public void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
     this.Controller.SendMessage("SkillIconClick", ViewModel.SkillId.Value);
 }
예제 #17
0
        /// <summary>
        /// Retrieve a cached TabAssets for a specific window in the tab system - or
        /// create and store a new one if none currently exist.
        /// </summary>
        /// <param name="tabbedWin">The window to retrive the assets for.</param>
        /// <param name="rt">The RectTransform to put parent the assets in if they're being created. </param>
        /// <param name="props">The properties used to give the assets if they're being created.</param>
        /// <returns></returns>
        public TabsAssets GetTabAssets(Dock tabbedWin, RectTransform parent, DockProps props)
        {
            TabsAssets ret;

            if (this.assetLookup.TryGetValue(tabbedWin, out ret) == true)
            {
                return(ret);
            }

            ret = new TabsAssets();

            GameObject goTab = new GameObject("Tab asset");

            goTab.transform.SetParent(parent);
            ret.notebookTab        = goTab.AddComponent <UnityEngine.UI.Image>();
            ret.notebookTab.sprite = props.tabs.tabPlate;
            ret.notebookTab.type   = UnityEngine.UI.Image.Type.Sliced;
            RectTransform rtTab = ret.notebookTab.rectTransform;

            rtTab.anchorMin = new Vector2(0.0f, 1.0f);
            rtTab.anchorMax = new Vector2(0.0f, 1.0f);
            rtTab.pivot     = new Vector2(0.0f, 1.0f);
            goTab.AddComponent <UnityEngine.UI.Mask>();

            ret.notebookButton = goTab.AddComponent <UnityEngine.UI.Button>();
            ret.notebookButton.onClick.AddListener(
                () =>
            {
                this.dock.activeTab = tabbedWin;
                this.HandleDock();
            });

            // Prevent locked windows from being ripped from the tab system. The issue here is
            // that if it's ripped, then it should turn to a floating window, which locked windows
            // can't.
            if (tabbedWin.window.Locked == false)
            {
                // If the tag is being dragged, redirect it to the window to
                // initiate a pull-off.
                UnityEngine.EventSystems.EventTrigger etTab = goTab.AddComponent <UnityEngine.EventSystems.EventTrigger>();
                etTab.triggers = new List <UnityEngine.EventSystems.EventTrigger.Entry>();
                UnityEngine.EventSystems.EventTrigger.Entry dragEnt = new UnityEngine.EventSystems.EventTrigger.Entry();
                dragEnt.eventID = UnityEngine.EventSystems.EventTriggerType.BeginDrag;
                dragEnt.callback.AddListener(
                    (x) =>
                {
                    UnityEngine.EventSystems.PointerEventData evt =
                        x as UnityEngine.EventSystems.PointerEventData;

                    // Transform the point from the tab, to the window about to be ripped.
                    Vector2 mouseInTab = goTab.transform.worldToLocalMatrix.MultiplyPoint(evt.position);
                    evt.position       = tabbedWin.window.transform.localToWorldMatrix.MultiplyPoint(mouseInTab);

                    // Make sure it's active before handoff. Will be inactive if not the main tab.
                    tabbedWin.window.gameObject.SetActive(true);

                    // Do handoff
                    evt.dragging    = true;
                    evt.pointerDrag = tabbedWin.window.gameObject;

                    // Force titlebar drag state
                    Window._StartOutsideDrag(Window.FrameDrag.Position, tabbedWin.window, Vector2.zero);

                    // Make sure it handles OnBeginDrag - certain important drag things are
                    // initialized there.
                    UnityEngine.EventSystems.IBeginDragHandler dragBegin = tabbedWin.window;
                    dragBegin.OnBeginDrag(evt);
                    // Reset styles + shadow
                    this.root.UndockWindow(tabbedWin.window);
                });
                etTab.triggers.Add(dragEnt);
            }

            if (tabbedWin.window.Closable == true &&
                tabbedWin.window.Locked == false)
            {
                GameObject goCloseBtn = new GameObject("CloseButton");
                goCloseBtn.transform.SetParent(rtTab);
                ret.closeButton        = goCloseBtn.AddComponent <UnityEngine.UI.Image>();
                ret.closeButton.sprite = props.tabs.innerTabBtn;
                ret.closeButton.type   = UnityEngine.UI.Image.Type.Sliced;
                RectTransform rtCloseBtn = ret.closeButton.rectTransform;
                rtCloseBtn.anchorMin = new Vector2(1.0f, 0.0f);
                rtCloseBtn.anchorMax = new Vector2(1.0f, 1.0f);
                rtCloseBtn.offsetMin =
                    new Vector2(
                        -this.root.props.tabs.closeBorderRight - this.root.props.tabs.closeWidth,
                        this.root.props.tabs.closeBorderVert);
                rtCloseBtn.offsetMax =
                    new Vector2(
                        -this.root.props.tabs.closeBorderRight,
                        -this.root.props.tabs.closeBorderVert);

                UnityEngine.UI.Button closeBtn = goCloseBtn.AddComponent <UnityEngine.UI.Button>();
                closeBtn.onClick.AddListener(
                    () =>
                {
                    this.root.CloseWindow(tabbedWin.window);
                });

                if (props.tabs.closeWindowIcon != null)
                {
                    GameObject goCloseIco = new GameObject("Close");
                    goCloseIco.transform.SetParent(rtCloseBtn);
                    UnityEngine.UI.Image imgCloseIco = goCloseIco.AddComponent <UnityEngine.UI.Image>();
                    RectTransform        rtClIco     = imgCloseIco.rectTransform;
                    imgCloseIco.sprite       = props.tabs.closeWindowIcon;
                    rtClIco.anchorMin        = new Vector2(0.5f, 0.5f);
                    rtClIco.anchorMax        = new Vector2(0.5f, 0.5f);
                    rtClIco.pivot            = new Vector2(0.5f, 0.5f);
                    rtClIco.anchoredPosition = Vector2.zero;
                    rtClIco.sizeDelta        = props.tabs.closeWindowIcon.rect.size;
                }
            }

            GameObject goText = new GameObject("Text");

            goText.transform.SetParent(rtTab);
            ret.label                    = goText.AddComponent <UnityEngine.UI.Text>();
            ret.label.text               = tabbedWin.window.TitlebarText;
            ret.label.color              = props.tabs.tabFontColor;
            ret.label.fontSize           = props.tabs.tabFontSize;
            ret.label.verticalOverflow   = VerticalWrapMode.Truncate;
            ret.label.horizontalOverflow = HorizontalWrapMode.Wrap;
            ret.label.alignment          = TextAnchor.MiddleCenter;
            ret.label.font               = props.tabs.tabFont;
            RectTransform rtLabel = ret.label.rectTransform;

            rtLabel.anchorMin = Vector2.zero;
            rtLabel.anchorMax = Vector2.one;
            rtLabel.offsetMin = Vector2.zero;
            rtLabel.offsetMax = new Vector2(-this.root.props.tabs.closeBorderRight - this.root.props.tabs.closeWidth, 0.0f);
            rtLabel.pivot     = new Vector2(0.5f, 0.5f);

            this.assetLookup.Add(tabbedWin, ret);
            return(ret);
        }
예제 #18
0
 public void OnPointerDown(UnityEngine.EventSystems.PointerEventData eventData)
 {
     this.Controller.SendMessage("ShowPreview", ViewModel.SkillId.Value);
 }
예제 #19
0
 public override void OnPointerUp(UnityEngine.EventSystems.PointerEventData eventData)
 {
     base.OnPointerUp(eventData);
     _text.transform.position += _text.transform.up * _move;
 }
예제 #20
0
 public void OnPointerUp(UnityEngine.EventSystems.PointerEventData eventData)
 {
     this.Controller.SendMessage("HidePreview");
 }
예제 #21
0
        public override void OnDrag(UnityEngine.EventSystems.PointerEventData eventData)
        {
            base.OnDrag(eventData);

            this.UpdateMinMax(eventData.position, eventData.pressEventCamera, false);
        }
예제 #22
0
 public void OnPointerUp(UnityEngine.EventSystems.PointerEventData eventData)
 {
     //隐藏特效
     PointerUp.SafeInvoke();
 }
예제 #23
0
 void OnPanelDrag(UnityEngine.EventSystems.PointerEventData eventData)
 {
     m_panelDeltasSum += eventData.delta;
 }
예제 #24
0
 public void OnPointerExit(UnityEngine.EventSystems.PointerEventData eventData)
 {
 }
예제 #25
0
 /// <summary>
 /// Convenience function for cloning PointerEventData
 /// </summary>
 /// <param name="from">Copy this value</param>
 /// <param name="to">to this object</param>
 protected new void CopyFromTo(UnityEngine.EventSystems.PointerEventData @from, UnityEngine.EventSystems.PointerEventData @to)
 {
     @to.position              = @from.position;
     @to.delta                 = @from.delta;
     @to.scrollDelta           = @from.scrollDelta;
     @to.pointerCurrentRaycast = @from.pointerCurrentRaycast;
     @to.pointerEnter          = @from.pointerEnter;
 }
예제 #26
0
 public void OnClick(UnityEngine.EventSystems.PointerEventData data)
 {
     Debug.LogWarning("Click!");
 }
 public virtual void OnDragEnd(UnityEngine.EventSystems.PointerEventData data)
 {
 }
예제 #28
0
        /// <summary>
        /// Determines whether this instance can be dragged.
        /// </summary>
        /// <returns><c>true</c> if this instance can be dragged; otherwise, <c>false</c>.</returns>
        /// <param name="eventData">Current event data.</param>
        public override bool CanDrag(UnityEngine.EventSystems.PointerEventData eventData)
        {
            var component = GetComponent <ListViewComponentPlaylistItem>();

            return(!component.Accordion.DataSource[0].Open);
        }
예제 #29
0
 public override void OnPointerUp(UnityEngine.EventSystems.PointerEventData eventData)
 {
     base.OnPointerUp(eventData);
     IsDragging = false;
 }
예제 #30
0
        void UnityEngine.EventSystems.IDragHandler.OnDrag(UnityEngine.EventSystems.PointerEventData eventData)
        {
            Vector2 delta = eventData.delta;

            if (this.grain == Grain.Horizontal)
            {
                if (delta.x == 0.0f)
                {
                    return;
                }

                float moveAmt = 0.0f;
                if (delta.x < 0.0f)
                {
                    if (this.dockA.minSize.x >= this.dockA.cachedPlace.width)
                    {
                        return;
                    }

                    float endSize = this.dockA.cachedPlace.width + delta.x;
                    endSize = Mathf.Max(endSize, this.dockA.minSize.x);
                    moveAmt = Mathf.Min(0.0f, endSize - this.dockA.cachedPlace.width);
                }
                else
                {
                    if (this.dockB.minSize.x >= this.dockB.cachedPlace.width)
                    {
                        return;
                    }

                    float endSize = this.dockB.cachedPlace.width - delta.x;
                    endSize = Mathf.Max(endSize, this.dockB.minSize.x);
                    moveAmt = Mathf.Max(0.0f, this.dockB.cachedPlace.width - endSize);
                }

                if (moveAmt == 0.0f)
                {
                    return;
                }

                this.dockA.cachedPlace.width += moveAmt;
                this.dockB.cachedPlace.width -= moveAmt;
                this.dockB.cachedPlace.x     += moveAmt;
                this.system.UpdateDockedBranch(this.dockA);
                this.system.UpdateDockedBranch(this.dockB);

                this.system.RealignSashes();
            }
            else if (this.grain == Grain.Vertical)
            {
                if (delta.y == 0.0)
                {
                    return;
                }

                float moveAmt = 0.0f;
                if (delta.y > 0.0f)
                {
                    if (this.dockA.minSize.y >= this.dockA.cachedPlace.height)
                    {
                        return;
                    }

                    float endSize = this.dockA.cachedPlace.height - delta.y;
                    endSize = Mathf.Max(endSize, this.dockA.minSize.y);
                    moveAmt = Mathf.Min(0.0f, endSize - this.dockA.cachedPlace.height);
                }
                else
                {
                    if (this.dockB.minSize.y >= this.dockB.cachedPlace.height)
                    {
                        return;
                    }

                    float endSize = this.dockB.cachedPlace.height + delta.y;
                    endSize = Mathf.Max(endSize, this.dockB.minSize.y);
                    moveAmt = Mathf.Max(0.0f, this.dockB.cachedPlace.height - endSize);
                }

                if (moveAmt == 0.0f)
                {
                    return;
                }

                this.dockA.cachedPlace.height += moveAmt;
                this.dockB.cachedPlace.height -= moveAmt;
                this.dockB.cachedPlace.y      += moveAmt;
                this.system.UpdateDockedBranch(this.dockA);
                this.system.UpdateDockedBranch(this.dockB);

                this.system.RealignSashes();
            }
        }