예제 #1
0
 public override void performHoverAction(int x, int y)
 {
     descriptionText  = "";
     descriptionTitle = "";
     hoveredItem      = inventory.hover(x, y, heldItem);
     hoverText        = inventory.hoverText;
     hoverAmount      = 0;
     if (okButton != null)
     {
         if (okButton.containsPoint(x, y))
         {
             okButton.scale = Math.Min(1.1f, okButton.scale + 0.05f);
         }
         else
         {
             okButton.scale = Math.Max(1f, okButton.scale - 0.05f);
         }
     }
     if (trashCan == null)
     {
         return;
     }
     if (trashCan.containsPoint(x, y))
     {
         if (trashCanLidRotation <= 0f)
         {
             Game1.playSound("trashcanlid");
         }
         trashCanLidRotation = Math.Min(trashCanLidRotation + (float)Math.PI / 48f, (float)Math.PI / 2f);
         if (heldItem != null && Utility.getTrashReclamationPrice(heldItem, Game1.player) > 0)
         {
             hoverText   = Game1.content.LoadString("Strings\\UI:TrashCanSale");
             hoverAmount = Utility.getTrashReclamationPrice(heldItem, Game1.player);
         }
     }
     else
     {
         trashCanLidRotation = Math.Max(trashCanLidRotation - (float)Math.PI / 48f, 0f);
     }
 }
예제 #2
0
 public override void performHoverAction(int x, int y)
 {
     base.performHoverAction(x, y);
     ItemsToGrabMenu.hover(x, y, heldItem);
 }
예제 #3
0
 public override void performHoverAction(int x, int y)
 {
     base.performHoverAction(x, y);
     hoverTitle      = "";
     descriptionText = "";
     hoverText       = "";
     hoverRecipe     = null;
     hoverItem       = inventory.hover(x, y, hoverItem);
     hoverAmount     = -1;
     if (hoverItem != null)
     {
         hoverTitle = inventory.hoverTitle;
         hoverText  = inventory.hoverText;
     }
     foreach (ClickableTextureComponent c in pagesOfCraftingRecipes[currentCraftingPage].Keys)
     {
         if (c.containsPoint(x, y))
         {
             if (c.hoverText.Equals("ghosted"))
             {
                 hoverText = "???";
             }
             else
             {
                 hoverRecipe = pagesOfCraftingRecipes[currentCraftingPage][c];
                 if (lastCookingHover == null || !lastCookingHover.Name.Equals(hoverRecipe.name))
                 {
                     lastCookingHover = hoverRecipe.createItem();
                 }
                 c.scale = Math.Min(c.scale + 0.02f, c.baseScale + 0.1f);
             }
         }
         else
         {
             c.scale = Math.Max(c.scale - 0.02f, c.baseScale);
         }
     }
     if (upButton != null)
     {
         if (upButton.containsPoint(x, y))
         {
             upButton.scale = Math.Min(upButton.scale + 0.02f, upButton.baseScale + 0.1f);
         }
         else
         {
             upButton.scale = Math.Max(upButton.scale - 0.02f, upButton.baseScale);
         }
     }
     if (downButton != null)
     {
         if (downButton.containsPoint(x, y))
         {
             downButton.scale = Math.Min(downButton.scale + 0.02f, downButton.baseScale + 0.1f);
         }
         else
         {
             downButton.scale = Math.Max(downButton.scale - 0.02f, downButton.baseScale);
         }
     }
     if (trashCan == null)
     {
         return;
     }
     if (trashCan.containsPoint(x, y))
     {
         if (trashCanLidRotation <= 0f)
         {
             Game1.playSound("trashcanlid");
         }
         trashCanLidRotation = Math.Min(trashCanLidRotation + (float)Math.PI / 48f, (float)Math.PI / 2f);
         if (heldItem != null && Utility.getTrashReclamationPrice(heldItem, Game1.player) > 0)
         {
             hoverText   = Game1.content.LoadString("Strings\\UI:TrashCanSale");
             hoverAmount = Utility.getTrashReclamationPrice(heldItem, Game1.player);
         }
     }
     else
     {
         trashCanLidRotation = Math.Max(trashCanLidRotation - (float)Math.PI / 48f, 0f);
     }
 }
예제 #4
0
        public override void performHoverAction(int x, int y)
        {
            hoverAmount      = -1;
            descriptionText  = "";
            descriptionTitle = "";
            hoveredItem      = inventory.hover(x, y, Game1.player.CursorSlotItem);
            hoverText        = inventory.hoverText;
            hoverTitle       = inventory.hoverTitle;
            foreach (ClickableComponent c in equipmentIcons)
            {
                if (c.containsPoint(x, y))
                {
                    switch (c.name)
                    {
                    case "Hat":
                        if (Game1.player.hat.Value != null)
                        {
                            hoveredItem = (Hat)Game1.player.hat;
                            hoverText   = Game1.player.hat.Value.getDescription();
                            hoverTitle  = Game1.player.hat.Value.DisplayName;
                        }
                        break;

                    case "Right Ring":
                        if (Game1.player.rightRing.Value != null)
                        {
                            hoveredItem = (Ring)Game1.player.rightRing;
                            hoverText   = Game1.player.rightRing.Value.getDescription();
                            hoverTitle  = Game1.player.rightRing.Value.DisplayName;
                        }
                        break;

                    case "Left Ring":
                        if (Game1.player.leftRing.Value != null)
                        {
                            hoveredItem = (Ring)Game1.player.leftRing;
                            hoverText   = Game1.player.leftRing.Value.getDescription();
                            hoverTitle  = Game1.player.leftRing.Value.DisplayName;
                        }
                        break;

                    case "Boots":
                        if (Game1.player.boots.Value != null)
                        {
                            hoveredItem = (Boots)Game1.player.boots;
                            hoverText   = Game1.player.boots.Value.getDescription();
                            hoverTitle  = Game1.player.boots.Value.DisplayName;
                        }
                        break;

                    case "Shirt":
                        if (Game1.player.shirtItem.Value != null)
                        {
                            hoveredItem = (Clothing)Game1.player.shirtItem;
                            hoverText   = Game1.player.shirtItem.Value.getDescription();
                            hoverTitle  = Game1.player.shirtItem.Value.DisplayName;
                        }
                        break;

                    case "Pants":
                        if (Game1.player.pantsItem.Value != null)
                        {
                            hoveredItem = (Clothing)Game1.player.pantsItem;
                            hoverText   = Game1.player.pantsItem.Value.getDescription();
                            hoverTitle  = Game1.player.pantsItem.Value.DisplayName;
                        }
                        break;
                    }
                    c.scale = Math.Min(c.scale + 0.05f, 1.1f);
                }
                c.scale = Math.Max(1f, c.scale - 0.025f);
            }
            if (portrait.containsPoint(x, y))
            {
                portrait.scale += 0.2f;
                hoverText       = Game1.content.LoadString("Strings\\UI:Inventory_PortraitHover_Level", Game1.player.Level) + Environment.NewLine + Game1.player.getTitle();
            }
            else
            {
                portrait.scale = 0f;
            }
            if (trashCan.containsPoint(x, y))
            {
                if (trashCanLidRotation <= 0f)
                {
                    Game1.playSound("trashcanlid");
                }
                trashCanLidRotation = Math.Min(trashCanLidRotation + (float)Math.PI / 48f, (float)Math.PI / 2f);
                if (checkHeldItem() && Utility.getTrashReclamationPrice(Game1.player.CursorSlotItem, Game1.player) > 0)
                {
                    hoverText   = Game1.content.LoadString("Strings\\UI:TrashCanSale");
                    hoverAmount = Utility.getTrashReclamationPrice(Game1.player.CursorSlotItem, Game1.player);
                }
            }
            else if (trashCanLidRotation != 0f)
            {
                trashCanLidRotation = Math.Max(trashCanLidRotation - (float)Math.PI / 24f, 0f);
                if (trashCanLidRotation == 0f)
                {
                    Game1.playSound("thudStep");
                }
            }
            if (organizeButton != null)
            {
                organizeButton.tryHover(x, y);
                if (organizeButton.containsPoint(x, y))
                {
                    hoverText = organizeButton.hoverText;
                }
            }
            if (junimoNoteIcon != null)
            {
                junimoNoteIcon.tryHover(x, y);
                if (junimoNoteIcon.containsPoint(x, y))
                {
                    hoverText = junimoNoteIcon.hoverText;
                }
                if (GameMenu.bundleItemHovered)
                {
                    junimoNoteIcon.scale = junimoNoteIcon.baseScale + (float)Math.Sin((float)junimoNotePulser / 100f) / 4f;
                    junimoNotePulser    += (int)Game1.currentGameTime.ElapsedGameTime.TotalMilliseconds;
                }
                else
                {
                    junimoNotePulser     = 0;
                    junimoNoteIcon.scale = junimoNoteIcon.baseScale;
                }
            }
        }