コード例 #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)
        {
            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();
                }
            }
        }