예제 #1
0
        /// <summary>
        /// Raises the tooltip event.
        /// </summary>
        /// <param name="show">If set to <c>true</c> show.</param>
        public override void OnTooltip(bool show)
        {
            // Make sure we have spell info, otherwise game might crash
            if (this.m_SpellInfo == null)
            {
                return;
            }

            // If we are showing the tooltip
            if (show)
            {
                UITooltip.InstantiateIfNecessary(this.gameObject);

                // Prepare the tooltip lines
                UISpellSlot.PrepareTooltip(this.m_SpellInfo);

                // Anchor to this slot
                UITooltip.AnchorToRect(this.transform as RectTransform);

                // Show the tooltip
                UITooltip.Show();
            }
            else
            {
                // Hide the tooltip
                UITooltip.Hide();
            }
        }
예제 #2
0
        /// <summary>
        /// Raises the tooltip event.
        /// </summary>
        /// <param name="show">If set to <c>true</c> show.</param>
        public virtual void OnTooltip(bool show)
        {
            if (!this.enabled || !this.IsActive())
            {
                return;
            }

            // If we are showing the tooltip
            if (show)
            {
                UITooltip.InstantiateIfNecessary(this.gameObject);

                for (int i = 0; i < this.m_ContentLines.Length; i++)
                {
                    UITooltipLineContent line = this.m_ContentLines[i];

                    if (line.IsSpacer)
                    {
                        UITooltip.AddSpacer();
                    }
                    else
                    {
                        if (line.LineStyle != UITooltipLines.LineStyle.Custom)
                        {
                            UITooltip.AddLine(line.Content, line.LineStyle);
                        }
                        else
                        {
                            UITooltip.AddLine(line.Content, line.CustomLineStyle);
                        }
                    }
                }

                if (this.m_WidthMode == WidthMode.Preferred)
                {
                    UITooltip.SetHorizontalFitMode(ContentSizeFitter.FitMode.PreferredSize);
                }

                // Anchor to this slot
                if (this.m_Position == Position.Anchored)
                {
                    UITooltip.AnchorToRect(this.transform as RectTransform);
                }

                // Handle offset override
                if (this.m_OverrideOffset)
                {
                    UITooltip.OverrideOffset(this.m_Offset);
                    UITooltip.OverrideAnchoredOffset(this.m_Offset);
                }

                // Show the tooltip
                UITooltip.Show();
            }
            else
            {
                // Hide the tooltip
                UITooltip.Hide();
            }
        }
예제 #3
0
        /// <summary>
        /// Raises the pointer enter event.
        /// </summary>
        /// <param name="eventData">Event data.</param>
        public virtual void OnPointerEnter(PointerEventData eventData)
        {
            // Check if tooltip is enabled
            if (this.enabled && this.IsActive())
            {
                // Instantiate the tooltip now
                UITooltip.InstantiateIfNecessary(this.gameObject);

                // Start the tooltip delayed show coroutine
                // If delay is set at all
                if (this.m_Delay > 0f)
                {
                    this.StartCoroutine("DelayedShow");
                }
                else
                {
                    this.InternalShowTooltip();
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Raises the tooltip event.
        /// </summary>
        /// <param name="show">If set to <c>true</c> show.</param>
        public override void OnTooltip(bool show)
        {
            UITooltip.InstantiateIfNecessary(this.gameObject);

            // Handle unassigned
            if (!this.IsAssigned())
            {
                // If we are showing the tooltip
                if (show)
                {
                    UITooltip.AddTitle(UIEquipSlot.EquipTypeToString(this.m_EquipType));
                    UITooltip.SetHorizontalFitMode(ContentSizeFitter.FitMode.PreferredSize);
                    UITooltip.AnchorToRect(this.transform as RectTransform);
                    UITooltip.Show();
                }
                else
                {
                    UITooltip.Hide();
                }
            }
            else
            {
                // Make sure we have spell info, otherwise game might crash
                if (this.m_ItemInfo == null)
                {
                    return;
                }

                // If we are showing the tooltip
                if (show)
                {
                    UIItemSlot.PrepareTooltip(this.m_ItemInfo);
                    UITooltip.AnchorToRect(this.transform as RectTransform);
                    UITooltip.Show();
                }
                else
                {
                    UITooltip.Hide();
                }
            }
        }