Esempio n. 1
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            float oldScale = Main.inventoryScale;

            Main.inventoryScale = _scale;
            Rectangle rectangle = GetDimensions().ToRectangle();

            if (ContainsPoint(Main.MouseScreen) && !PlayerInput.IgnoreMouseInterface)
            {
                Main.LocalPlayer.mouseInterface = true;
                if (ValidItemFunc == null || ValidItemFunc(Main.mouseItem, this.Item))
                {
                    ItemChangedEventArgs args = new ItemChangedEventArgs();
                    args.Old = this.Item;

                    ItemSlot.Handle(ref this.Item, _context);

                    args.New = this.Item;
                    if (args.New != args.Old)
                    {
                        OnItemChangedEvent(args);
                    }
                }
            }
            ItemSlot.Draw(spriteBatch, ref Item, _context, rectangle.TopLeft());
            Main.inventoryScale = oldScale;
        }
Esempio n. 2
0
        protected virtual void OnItemChangedEvent(ItemChangedEventArgs e)
        {
            EventHandler <ItemChangedEventArgs> handler = OnItemChanged;

            handler?.Invoke(this, e);
        }