Example #1
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            Main.hidePlayerCraftingMenu = true;

            KeybladeBase keyblade = (KeybladeBase)item.Item.ModItem;

            if (keyblade != null)
            {
                if (text == null)
                {
                    text        = new UIText("Keyblade level: " + (keyblade.keyLevel).ToString());
                    text.HAlign = 0.56f;
                    text.VAlign = 0.54f;
                    Append(text);
                }
                else
                {
                    text.SetText("Keyblade level: " + (keyblade.keyLevel).ToString());
                }


                bool hoveringOnLevelButton = Main.mouseX > slotX && Main.mouseX <slotX && Main.mouseY> slotY && Main.mouseY > slotY && !PlayerInput.IgnoreMouseInterface;

                if (hoveringOnLevelButton)
                {
                    if (!tickPlayed)
                    {
                        SoundEngine.PlaySound(SoundID.MenuTick, -1, -1, 1, 1f, 0f);
                    }
                    tickPlayed = true;


                    if (Main.mouseLeftRelease && Main.mouseLeft)
                    {
                        if (keyblade.keyLevel < 10000)
                        {
                            keyblade.keyLevel++;
                            SoundEngine.PlaySound(SoundID.Item37, -1, -1);
                        }
                    }
                }
            }
            else
            {
                if (text != null)
                {
                    text.Deactivate();
                    text.Remove();
                    text = null;
                }
            }
        }