Example #1
0
 public void Refresh()
 {
     if (m_tooltip != null)
     {
         DestroyImmediate(m_tooltip.gameObject);
         m_tooltip = null;
         ShowToolTip();
     }
 }
Example #2
0
        private void Awake()
        {
            if (m_prefab == null)
            {
                m_prefab = Resources.Load <TooltipUI>("TooltipUI");
            }

            if (m_target == null)
            {
                m_target = GetComponent <RectTransform>();
            }

            Text = m_text;
        }
Example #3
0
        private void ShowToolTip()
        {
            if (m_prefab != null)
            {
                m_tooltip      = Instantiate(m_prefab, m_target);
                m_tooltip.Text = m_text;
                m_tooltip.RectTransform.SetInsetAndSizeFromParentEdge(m_location, -3, 0);

                if (m_layer != null)
                {
                    m_tooltip.transform.SetParent(m_layer, true);
                }

                m_tooltip.Show();
            }
        }
Example #4
0
        public void OnPointerEnter(PointerEventData eventData)
        {
            if (m_tooltip != null)
            {
                m_tooltip.Show();
            }
            else
            {
                if (m_prefab != null)
                {
                    m_tooltip      = Instantiate(m_prefab, m_target);
                    m_tooltip.Text = m_text;
                    m_tooltip.RectTransform.SetInsetAndSizeFromParentEdge(m_location, -3, 0);

                    if (m_layer != null)
                    {
                        m_tooltip.transform.SetParent(m_layer, true);
                    }

                    m_tooltip.Show();
                }
            }
        }