Exemplo n.º 1
0
        /// <summary>
        /// Update the item slot.
        /// </summary>
        public override void Update()
        {
            if (!PlayerInput.IgnoreMouseInterface)
            {
                bool intersectsTick = MouseUtils.Rectangle.Intersects(tickRect) && HasTick();
                bool intersectsRect = MouseUtils.Rectangle.Intersects(Rectangle);

                if (intersectsRect || intersectsTick)
                {
                    Main.player[Main.myPlayer].mouseInterface = true;
                }

                if (intersectsTick)
                {
                    Main.hoverItemName =
                        (ItemVisible ? Language.GetTextValue("LegacyInterface.59") : Language.GetTextValue("GameUI.Hidden"));

                    if (MouseUtils.JustPressed(MouseButtons.Left))
                    {
                        ToggleVisibility();
                    }
                }
                else if (intersectsRect)
                {
                    Main.HoverItem = Item;

                    if (Item.stack < 1)
                    {
                        Main.hoverItemName = HoverText;
                    }
                    else if (Item.stack > 0)
                    {
                        Main.hoverItemName = Item.Name;
                    }
                    else if (Item.stack > 1)
                    {
                        Main.hoverItemName = Item.Name + " (" + Item.stack + ")";
                    }
                }

                if (!intersectsTick)
                {
                    base.Update();
                }
            }
        }