예제 #1
0
 public override void receiveRightClick(int x, int y, bool playSound = true)
 {
     heldItem = inventory.rightClick(x, y, heldItem);
     foreach (ClickableTextureComponent c in pagesOfCraftingRecipes[currentCraftingPage].Keys)
     {
         if (c.containsPoint(x, y) && !c.hoverText.Equals("ghosted") && pagesOfCraftingRecipes[currentCraftingPage][c].doesFarmerHaveIngredientsInInventory(getContainerContents()))
         {
             clickCraftingRecipe(c);
         }
     }
 }
예제 #2
0
 public override void receiveRightClick(int x, int y, bool playSound = true)
 {
     if (placingStructure)
     {
         placingStructure = false;
         upgrading        = false;
         demolishing      = false;
         parent.invisible = false;
     }
     else
     {
         heldItem = inventory.rightClick(x, y, heldItem);
     }
 }
예제 #3
0
 public override void receiveRightClick(int x, int y, bool playSound = true)
 {
     heldItem = inventory.rightClick(x, y, heldItem, playSound);
 }
예제 #4
0
        public override void receiveRightClick(int x, int y, bool playSound = true)
        {
            int  oldStack = (heldItem != null) ? heldItem.Stack : 0;
            Item old      = heldItem;

            if (isWithinBounds(x, y))
            {
                base.receiveRightClick(x, y, playSound: true);
                if (itemChangeBehavior == null && old == null && heldItem != null && Game1.oldKBState.IsKeyDown(Keys.LeftShift))
                {
                    heldItem = ItemsToGrabMenu.tryToAddItem(heldItem, "Ship");
                }
            }
            if (!ItemsToGrabMenu.isWithinBounds(x, y))
            {
                return;
            }
            heldItem = ItemsToGrabMenu.rightClick(x, y, heldItem, playSound: false);
            if ((heldItem != null && old == null) || (heldItem != null && old != null && !heldItem.Equals(old)) || (heldItem != null && old != null && heldItem.Equals(old) && heldItem.Stack != oldStack))
            {
                if (itemChangeBehavior != null)
                {
                    itemChangeBehavior(heldItem, ItemsToGrabMenu.getInventoryPositionOfClick(x, y), old, this, onRemoval: true);
                }
                Game1.playSound("dwop");
            }
            if ((heldItem == null && old != null) || (heldItem != null && old != null && !heldItem.Equals(old)))
            {
                if (itemChangeBehavior != null)
                {
                    itemChangeBehavior(old, ItemsToGrabMenu.getInventoryPositionOfClick(x, y), heldItem, this);
                }
                Game1.playSound("Ship");
            }
            if (heldItem is Object && (bool)(heldItem as Object).isRecipe)
            {
                string recipeName = heldItem.Name.Substring(0, heldItem.Name.IndexOf("Recipe") - 1);
                try
                {
                    if ((heldItem as Object).Category == -7)
                    {
                        Game1.player.cookingRecipes.Add(recipeName, 0);
                    }
                    else
                    {
                        Game1.player.craftingRecipes.Add(recipeName, 0);
                    }
                    poof = new TemporaryAnimatedSprite("TileSheets\\animations", new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2(x - x % 64 + 16, y - y % 64 + 16), flicker: false, flipped: false);
                    Game1.playSound("newRecipe");
                }
                catch (Exception)
                {
                }
                heldItem = null;
            }
            else if (Game1.oldKBState.IsKeyDown(Keys.LeftShift) && Game1.player.addItemToInventoryBool(heldItem))
            {
                heldItem = null;
                Game1.playSound("coin");
                if (itemChangeBehavior != null)
                {
                    itemChangeBehavior(heldItem, ItemsToGrabMenu.getInventoryPositionOfClick(x, y), old, this, onRemoval: true);
                }
            }
        }
예제 #5
0
 public override void receiveRightClick(int x, int y, bool playSound = true)
 {
     setHeldItem(inventory.rightClick(x, y, takeHeldItem()));
 }