public virtual string ToString()
 {
   StringBuilder stringBuilder = new StringBuilder();
   stringBuilder.AppendLine(!this.UseFakeInput() ? "Input: Touch" : "Input: Faked");
   if (this.UseFakeInput())
   {
     PointerEventData pointerEventData1 = this.GetLastPointerEventData(-1);
     if (pointerEventData1 != null)
       stringBuilder.AppendLine(pointerEventData1.ToString());
     PointerEventData pointerEventData2 = this.GetLastPointerEventData(-2);
     if (pointerEventData2 != null)
       stringBuilder.AppendLine(pointerEventData2.ToString());
     PointerEventData pointerEventData3 = this.GetLastPointerEventData(-3);
     if (pointerEventData3 != null)
       stringBuilder.AppendLine(pointerEventData3.ToString());
   }
   else
   {
     using (Dictionary<int, PointerEventData>.Enumerator enumerator = ((Dictionary<int, PointerEventData>) this.m_PointerData).GetEnumerator())
     {
       while (enumerator.MoveNext())
       {
         KeyValuePair<int, PointerEventData> current = enumerator.Current;
         stringBuilder.AppendLine(current.ToString());
       }
     }
   }
   return stringBuilder.ToString();
 }
Beispiel #2
0
        public void OnBeginDrag(PointerEventData eventData)
        {
            Debug.Log("Drag begin.");
            Debug.Log(eventData.ToString());

            _labelPress.SetActive(false);
        }
Beispiel #3
0
    public override void OnBeginDrag(PointerEventData eventData)
    {
        base.OnBeginDrag(eventData);
        m_RotateDragOffset = GetMousePos() - RectTransformUtility.WorldToScreenPoint(UICameraControl.Instance.GetCamera(), transform.position);

        print("OnBeginDrag " + eventData.ToString());
    }
Beispiel #4
0
        public void OnPointerUp(PointerEventData eventData)
        {
            Debug.Log("Pointer up.");
            Debug.Log(eventData.ToString());

            _labelPress.SetActive(false);
            _labelRelease.SetActive(true);
            _labelHold.SetActive(false);
        }
    static int ToString(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        PointerEventData obj = LuaScriptMgr.GetNetObject <PointerEventData>(L, 1);
        string           o   = obj.ToString();

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Beispiel #6
0
        public void OnPointerDown(PointerEventData eventData)
        {
            Debug.Log("Pointer down.");
            Debug.Log("clickCount:" + eventData.clickCount);

            Debug.Log(eventData.ToString());

            _labelPress.SetActive(true);
            _labelRelease.SetActive(false);
        }
    public void OnPointerClick(PointerEventData eventData)
    {
        if (!animateOnClick)
        {
            return;
        }

        if (isRunningI || isRunningD)
        {
            return;
        }

        Debug.Log(eventData.ToString());
        StartCoroutine(clickEffect());
    }
        public override string ToString()
        {
            var sb = new StringBuilder("<b>Pointer Input Module of type: </b>" + GetType());

            sb.AppendLine();
            if (pointerData != null)
            {
                sb.AppendLine(pointerData.ToString());
            }
            else
            {
                sb.AppendLine("pointerData = null .");
            }
            return(sb.ToString());
        }
Beispiel #9
0
        public void OnDrop(PointerEventData eventData)
        {
            print(eventData.ToString());

            RaycastHit raycasthit = new RaycastHit();

            if (Physics.Raycast(transform.position, Vector3.forward, out raycasthit))
            {
                GameObject colliderGameObject = raycasthit.collider.gameObject;
                if (colliderGameObject.name == "Cell")
                {
                    transform.parent = colliderGameObject.transform;
                }
            }
            else
            {
                transform.parent = oldParent;
            }

            transform.localPosition = new Vector3(0f, -0.1f, 0f);
            oldParent = null;
        }
Beispiel #10
0
 public void OnEndDrag(PointerEventData eventData)
 {
     Debug.Log("Drag end.");
     Debug.Log(eventData.ToString());
 }
 public void OnPointerClick(PointerEventData eventData)
 {
     // 사진 클릭 시 이벤트
     action();
     Debug.Log(eventData.ToString());
 }
Beispiel #12
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     print(eventData.ToString());
 }
Beispiel #13
0
 public void OnPointerClick(PointerEventData eventData)
 {
     Debug.Log(eventData.ToString());
     Debug.Log("click img");
 }
Beispiel #14
0
        /// <summary>
        /// 更新UIEventData
        /// </summary>
        /// <param name="eventData"></param>
        /// <param name="resultAppendList"></param>
        public void UpdateUIEventData(GameBoxGraphicRaycaster t_Raycaster, PointerEventData t_EventData, List <RaycastResult> t_ResultAppendList)
        {
            //Debug.Log(t_EventData.ToString());

            #region 更新事件参数
            UIEventData.pointerEnter     = t_EventData.pointerEnter;
            UIEventData.pointerPress     = t_EventData.pointerPress;
            UIEventData.rawPointerPress  = t_EventData.rawPointerPress;
            UIEventData.pointerDrag      = t_EventData.pointerDrag;
            UIEventData.hovered          = t_EventData.hovered;
            UIEventData.isPointerMoving  = t_EventData.IsPointerMoving();
            UIEventData.isScrolling      = t_EventData.IsScrolling();
            UIEventData.clickCount       = t_EventData.clickCount;
            UIEventData.lastPress        = t_EventData.lastPress;
            UIEventData.selectedObject   = t_EventData.selectedObject;
            UIEventData.eligibleForClick = t_EventData.eligibleForClick;
            UIEventData.dragging         = t_EventData.dragging;
            UIEventData.useDragThreshold = t_EventData.useDragThreshold;
            UIEventData.enterEventCamera = t_EventData.enterEventCamera;
            UIEventData.pressEventCamera = t_EventData.pressEventCamera;
            UIEventData.position         = t_EventData.position;
            UIEventData.pressPosition    = t_EventData.pressPosition;
            UIEventData.clickTime        = t_EventData.clickTime;
            #endregion

            #region 悬停处理
            if (null == t_EventData.pointerPress && null != t_EventData.pointerEnter && !hoverOnceControl) //悬停进入处理
            {
                //Debug.Log("悬停进入");
                if (null != OnEnterEventHandler)
                {
                    OnEnterEventHandler(t_EventData.pointerEnter, UIEventData);
                }
                UIEventData.lastEnter = t_EventData.pointerEnter;
                hoverOnceControl      = true;
            }

            if (null == t_EventData.pointerPress && null != t_EventData.pointerEnter) //悬停停留处理
            {
                //Debug.Log("悬停停留");
                if (null != OnHoverEventHandler)
                {
                    OnHoverEventHandler(t_EventData.pointerEnter, UIEventData);
                }
            }

            if (null == t_EventData.pointerPress && null == t_EventData.pointerEnter && hoverOnceControl) //悬停移出处理
            {
                //Debug.Log("悬停移出");
                if (null != OnExitEventHandler)
                {
                    OnExitEventHandler(UIEventData.lastEnter, UIEventData);
                }
                hoverOnceControl = false;
            }

            #endregion

            #region  键处理

#if UNITY_STANDALONE_WIN || UNITY_EDITOR
            if (null != t_EventData.pointerPress && !clickOnceControl) //按下和点击处理
            {
                //Debug.Log("按下");
                if (null != OnDownEventHandler)
                {
                    OnDownEventHandler(t_EventData.pointerPress, UIEventData);
                }
                //Debug.Log("点击");
                if (null != OnClickEventHandler)
                {
                    OnClickEventHandler(t_EventData.pointerPress, UIEventData);
                }
                clickOnceControl = true;
            }

            if (null != t_EventData.pointerPress) //按住处理
            {
                //Debug.Log("按住");
                if (null != OnPressEventHandler)
                {
                    OnPressEventHandler(t_EventData.pointerPress, UIEventData);
                }
            }

            if (null != t_EventData.lastPress && clickOnceControl) //抬起处理
            {
                //Debug.Log("抬起");
                if (null != OnUpEventHandler)
                {
                    OnUpEventHandler(t_EventData.lastPress, UIEventData);
                }
                clickOnceControl = false;
            }
#endif

#if (UNITY_ANDROID || UNITY_IPHONE) && !UNITY_EDITOR
            if (0 < Input.touchCount && null != t_EventData.pointerPress && !clickOnceControl) //屏幕有触摸点 && 按下和点击处理
            {
                //Debug.Log("按下");
                if (null != OnDownEventHandler)
                {
                    OnDownEventHandler(t_EventData.pointerPress, UIEventData);
                }
                //Debug.Log("点击");
                if (null != OnClickEventHandler)
                {
                    OnClickEventHandler(t_EventData.pointerPress, UIEventData);
                }
                m_OnPressTouchCount = Input.touchCount; //按下的那一刻的触屏数目
                clickOnceControl    = true;
                info1 = "按下" + Time.deltaTime;
            }

            //按下的时候 可以 其他手指 也可以触摸屏幕
            if (m_OnPressTouchCount <= Input.touchCount && null != t_EventData.pointerPress) //按住处理
            {
                //Debug.Log("按住");
                if (null != OnPressEventHandler)
                {
                    OnPressEventHandler(t_EventData.pointerPress, UIEventData);
                }
                info2           = "按住" + Time.deltaTime + "  " + (Time.realtimeSinceStartup - m_PressRealTime);
                m_PressRealTime = Time.realtimeSinceStartup;
            }

            if (0.01f < (Time.realtimeSinceStartup - m_PressRealTime) && clickOnceControl) //抬起处理
            {
                //Debug.Log("抬起");
                clickOnceControl = false;
                info3            = "抬起" + Time.deltaTime;
                if (null != OnUpEventHandler)
                {
                    OnUpEventHandler(UIEventData.lastPress, UIEventData);
                }
                UIEventData.lastPress = t_EventData.pointerPress; //保存上一次的按下 刷新
                m_OnPressTouchCount   = 0;
            }

            info4 = t_EventData.ToString() + "   \n" + Time.deltaTime.ToString();
#endif


            #endregion

            #region 滑动处理
            if (null != t_EventData.pointerDrag && !dragOnceControl) //开始滑动处理
            {
                //Debug.Log("开始滑动处理");
                if (null != OnBeginDragEventHandler)
                {
                    OnBeginDragEventHandler(t_EventData.pointerDrag, UIEventData);
                }
                UIEventData.lastDrag = t_EventData.pointerDrag;
                dragOnceControl      = true;
            }

            if (null != t_EventData.pointerDrag) //滑动中处理
            {
                //Debug.Log("滑动中处理");
                if (null != OnDragEventHandler)
                {
                    OnDragEventHandler(t_EventData.pointerDrag, UIEventData);
                }
            }

            if (null == t_EventData.pointerDrag && dragOnceControl) //结束滑动处理
            {
                //Debug.Log("结束滑动处理");
                if (null != OnEndDragEventHandler)
                {
                    OnEndDragEventHandler(UIEventData.lastDrag, UIEventData);
                }
                dragOnceControl = false;
            }
            #endregion
        }
 public void OnPointerClick(PointerEventData eventData)
 {
     Debug.Log("Child OnPointerClick" + eventData.ToString());
 }
 public void OnPointerUp(PointerEventData eventData)
 {
     Debug.Log("Parent OnPointerUp" + eventData.ToString());
 }