Beispiel #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;
                }
            }
        }
Beispiel #2
0
        public override void Update(GameTime gameTime)
        {
            if (Main.LocalPlayer.talkNPC != -1)
            {
                KingdomTerrahearts.instance.HideLevelUpUI();
            }

            if (item != null)
            {
                KeybladeBase keyblade = (KeybladeBase)item.Item.ModItem;

                if (keyblade == null)
                {
                    // QuickSpawnClonedItem will preserve mod data of the item. QuickSpawnItem will just spawn a fresh version of the item, losing the prefix.
                    Main.LocalPlayer.QuickSpawnClonedItem(item.Item, item.Item.stack);
                    // Now that we've spawned the item back onto the player, we reset the item by turning it into air.
                    item.Item.TurnToAir();
                }
            }
        }