Exemple #1
0
 protected virtual void DrawTooltip(SpriteBatchUI spritebatch, Point position)
 {
     if (m_UserInterface.IsMouseOverUI && m_UserInterface.MouseOverControl != null && m_UserInterface.MouseOverControl.HasTooltip)
     {
         if (m_Tooltip != null && m_Tooltip.Caption != m_UserInterface.MouseOverControl.Tooltip)
         {
             m_Tooltip.Dispose();
             m_Tooltip = null;
         }
         if (m_Tooltip == null)
         {
             m_Tooltip = new Tooltip(m_UserInterface.MouseOverControl.Tooltip);
         }
         m_Tooltip.Draw(spritebatch, position.X, position.Y + 24);
     }
     else
     {
         if (m_Tooltip != null)
         {
             m_Tooltip.Dispose();
             m_Tooltip = null;
         }
     }
 }
 protected override void DrawTooltip(SpriteBatchUI spritebatch, Point position)
 {
     // Do not draw tooltips if:
     // 1. Holding an item.
     // Draw tooltips for items:
     // 1. Items in the world (MouseOverItem)
     // 2. ItemGumplings (both in paperdoll and in containers)
     // 3. the Backpack icon (in paperdolls).
     if (IsHoldingItem)
     {
         if (m_Tooltip != null)
         {
             m_Tooltip.Dispose();
             m_Tooltip = null;
         }
     }
     else if (MouseOverItem != null && MouseOverItem.PropertyList.HasProperties)
     {
         if (m_Tooltip == null)
             m_Tooltip = new Tooltip(MouseOverItem);
         else
             m_Tooltip.UpdateEntity(MouseOverItem);
         m_Tooltip.Draw(spritebatch, position.X, position.Y + 24);
     }
     else if (m_World.Input.MousePick.MouseOverObject != null && m_World.Input.MousePick.MouseOverObject is Mobile && m_World.Input.MousePick.MouseOverObject.PropertyList.HasProperties)
     {
         AEntity entity = m_World.Input.MousePick.MouseOverObject;
         if (m_Tooltip == null)
             m_Tooltip = new Tooltip(entity);
         else
             m_Tooltip.UpdateEntity(entity);
         m_Tooltip.Draw(spritebatch, position.X, position.Y + 24);
     }
     else if (m_UserInterface.IsMouseOverUI && m_UserInterface.MouseOverControl != null &&
         m_UserInterface.MouseOverControl is ItemGumpling && (m_UserInterface.MouseOverControl as ItemGumpling).Item.PropertyList.HasProperties)
     {
         AEntity entity = (m_UserInterface.MouseOverControl as ItemGumpling).Item;
         if (m_Tooltip == null)
             m_Tooltip = new Tooltip(entity);
         else
             m_Tooltip.UpdateEntity(entity);
         m_Tooltip.Draw(spritebatch, position.X, position.Y + 24);
     }
     else if (m_UserInterface.IsMouseOverUI && m_UserInterface.MouseOverControl != null &&
         m_UserInterface.MouseOverControl is GumpPicBackpack && (m_UserInterface.MouseOverControl as GumpPicBackpack).BackpackItem.PropertyList.HasProperties)
     {
         AEntity entity = (m_UserInterface.MouseOverControl as GumpPicBackpack).BackpackItem;
         if (m_Tooltip == null)
             m_Tooltip = new Tooltip(entity);
         else
             m_Tooltip.UpdateEntity(entity);
         m_Tooltip.Draw(spritebatch, position.X, position.Y + 24);
     }
     else
     {
         base.DrawTooltip(spritebatch, position);
     }
 }
        public void Draw(SpriteBatchUI spritebatch, Point position)
        {
            BeforeDraw(spritebatch, position);

            if (m_CursorSprite != null)
            {
                m_CursorSprite.Hue = CursorHue;
                m_CursorSprite.Offset = CursorOffset;
                m_CursorSprite.Draw(spritebatch, position);
            }

            if (m_UserInterface.IsMouseOverUI && m_UserInterface.MouseOverControl != null && m_UserInterface.MouseOverControl.HasTooltip)
            {
                if (m_Tooltip != null && m_Tooltip.Caption != m_UserInterface.MouseOverControl.Tooltip)
                {
                    m_Tooltip.Dispose();
                    m_Tooltip = null;
                }
                if (m_Tooltip == null)
                {
                    m_Tooltip = new Tooltip(m_UserInterface.MouseOverControl.Tooltip);
                }
                m_Tooltip.Draw(spritebatch, position.X, position.Y + 24);
            }
            else
            {
                if (m_Tooltip != null)
                {
                    m_Tooltip.Dispose();
                    m_Tooltip = null;
                }
            }
        }