示例#1
0
        public virtual void OnPointerHover(RaycastHit hitInfo)
        {
            //#if UNITY_EDITOR
            //        Debug.LogFormat("Pointer Hover: {0}", hitInfo.collider.gameObject.name);
            //#endif
            if (m_OnPointerHoverAction != null)
            {
                m_OnPointerHoverAction(hitInfo);
            }
            GameObject highlightGO = hitInfo.collider.transform.gameObject;
            Hotspot    hotspot     = null;

            if (highlightGO.GetComponent <Hotspot>())
            {
                hotspot = highlightGO.GetComponent <Hotspot>();
            }

            if (!hotspot)
            {
                if (highlightGO.transform.parent != null)
                {
                    hotspot = highlightGO.transform.parent.GetComponent <Hotspot>();
                }
            }

            if (!hotspot)
            {
                return;
            }

            //HighlightManager.Instance.FlashOutlineOn(hotspot.m_model, m_outLineColor1, m_outLineColor2);
            // 显示名称标签
        }
示例#2
0
        public virtual void OnPointerExit(GameObject exitGameObject)
        {
            if (!exitGameObject)
            {
                return;
            }

#if UNITY_EDITOR
            Debug.LogFormat("Pointer exit: {0}", exitGameObject.name);
#endif

            if (m_OnPointerExitAction != null)
            {
                m_OnPointerExitAction();
            }

            //HighlightManager.Instance.ClearHighlight();

            GameObject highlightGO = exitGameObject;
            Hotspot    hotspot     = null;
            if (highlightGO.GetComponent <Hotspot>())
            {
                hotspot = highlightGO.GetComponent <Hotspot>();
            }

            if (!hotspot)
            {
                if (highlightGO.transform.parent != null)
                {
                    hotspot = highlightGO.transform.parent.GetComponent <Hotspot>();
                }
            }

            if (!hotspot)
            {
                return;
            }

            if (hotspot.m_highlightType == Hotspot.HighlightType.PointClick)
            {
                if (hotspot.m_isFreeHighlight)
                {
                    //HighlightManager.Instance.FlashOutlineOff(hotspot.m_model);
                }
            }
            else
            {
                //HighlightManager.Instance.FlashOutlineOff(hotspot.m_model);
            }
        }
示例#3
0
        public virtual void OnPointerUp(RaycastHit hitInfo, int button)
        {
#if UNITY_EDITOR
            Debug.LogFormat("Pointer [{0}] up on: {1}", button, hitInfo.collider.gameObject.name);
#endif

            if (m_OnPointerUpAction != null)
            {
                m_OnPointerUpAction(hitInfo, button);
            }

            GameObject highlightGO = hitInfo.collider.transform.gameObject;
            Hotspot    hotspot     = null;
            if (highlightGO.GetComponent <Hotspot>())
            {
                hotspot = highlightGO.GetComponent <Hotspot>();
            }
            if (!hotspot)
            {
                if (highlightGO.transform.parent != null)
                {
                    hotspot = hitInfo.transform.parent.GetComponent <Hotspot>();
                }
            }

            if (!hotspot)
            {
                return;
            }

            if (hotspot.m_highlightType == Hotspot.HighlightType.PointClick)
            {
                //HighlightManager.Instance.FlashOutlineOff(hotspot.m_model);
            }
            // 判断鼠标是否处于拖动状态
            Vector3 deltaVec = Input.mousePosition - m_mouseDownPos;
            if (deltaVec.sqrMagnitude >= 4)
            {
                if (m_OnPointerEndDragAction != null)
                {
                    m_OnPointerEndDragAction(hitInfo, button);
                }
#if UNITY_EDITOR
                Debug.LogFormat("Pointer [{0}] up with dragged.", button);
#endif
                return;
            }
        }
示例#4
0
        public virtual void OnPointerDown(RaycastHit hitInfo, int button)
        {
#if UNITY_EDITOR
            Debug.LogFormat("Pointer [{0}] down on: {1}", button, hitInfo.collider.gameObject.name);
#endif
            if (m_OnPointerDownAction != null)
            {
                m_OnPointerDownAction(hitInfo, button);
            }

            GameObject highlightGO = hitInfo.collider.transform.gameObject;
            Hotspot    hotspot     = null;
            if (highlightGO.GetComponent <Hotspot>())
            {
                hotspot = highlightGO.GetComponent <Hotspot>();
            }
            else if (highlightGO.transform.parent.GetComponent <Hotspot>())
            {
                hotspot = hitInfo.transform.parent.GetComponent <Hotspot>();
            }
            if (button == 0 && hotspot != null)
            {
                if (hotspot)
                {
                    //不参与流程的热点
                    if (hotspot.m_type == Hotspot.DeviceType.Device)
                    {
                        hotspot.Operate();
                    }
                    else
                    {
                        //TaskManager.Instance.OperateHotspot(hotspot);
                    }
                }
            }
        }