public CraftingInformationPage(int x, int y, int width, int height, Color BackgroundColor, CraftingRecipeButton ItemToDisplay, ref IList <Item> Inventory, ref IList <Item> OutputInventory, bool IsPlayerInventory, Machine Machine) : base(x, y, width, height, false)
        {
            this.backgroundColor     = BackgroundColor;
            this.infoButton          = ItemToDisplay;
            this.itemDisplayLocation = new Vector2(this.xPositionOnScreen + (this.width / 2) - 32, this.yPositionOnScreen + (128));
            this.inventory           = Inventory;
            this.isPlayerInventory   = IsPlayerInventory;

            this.requiredItems = new Dictionary <ItemDisplayButton, int>();
            for (int i = 0; i < this.infoButton.recipe.ingredients.Count; i++)
            {
                ItemDisplayButton b = new ItemDisplayButton(this.infoButton.recipe.ingredients.ElementAt(i).item, null, new Vector2(this.xPositionOnScreen + 64 + this.width, this.yPositionOnScreen + (i * 64) + 128), new Rectangle(0, 0, 64, 64), 2f, true, Color.White);
                this.requiredItems.Add(b, this.infoButton.recipe.ingredients.ElementAt(i).requiredAmount);
            }
            this.craftingButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("CraftingButton", new Vector2(this.xPositionOnScreen + this.width / 2 - 96, this.getCraftingButtonHeight()), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "CraftingMenu", "CraftButton"), new StardustCore.Animations.Animation(0, 0, 48, 16)), Color.White), new Rectangle(0, 0, 48, 16), 4f);

            if (OutputInventory == null)
            {
                this.outputInventory = this.inventory;
            }
            if (this.infoButton.recipe.statCost != null)
            {
                if (this.infoButton.recipe.statCost.gold > 0)
                {
                    this.goldButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("GoldButton", this.getMoneyRequiredOffset(), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "CraftingMenu", "GoldButton"), new StardustCore.Animations.Animation(0, 0, 16, 16)), Color.White), new Rectangle(0, 0, 16, 16), 2f);
                }
            }
            this.outputInventory = OutputInventory;
            this.machine         = Machine;
        }
 public InventoryTransferMenu(int x, int y, int width, int height, IList <Item> OtherItems, int OtherCapacity, int OtherRows = 6, int OtherCollumns = 6) : base(x, y, width, height, true)
 {
     this.playerInventory   = new InventoryMenu(x, y, width, height, 6, 6, true, Game1.player.Items, Game1.player.MaxItems, Color.SandyBrown);
     this.otherItems        = OtherItems;
     this.otherInventory    = new InventoryMenu(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 128, y, width, height, OtherRows, OtherCollumns, true, this.otherItems, OtherCapacity, Color.SandyBrown);
     this.isPlayerInventory = true;
     this.currentMode       = CurrentMode.TransferItems;
     this.transferButton    = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Transfer Button", new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f)), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "ItemTransferButton"), new Animation(0, 0, 32, 32)), Color.White), new Rectangle(0, 0, 32, 32), 2f);
     this.trashButton       = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Trash Button", new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f) + 96), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "TrashButton"), new Animation(0, 0, 32, 32)), Color.White), new Rectangle(0, 0, 32, 32), 2f);
     this.trashedItem       = new ItemDisplayButton(null, new StardustCore.Animations.AnimatedSprite("ItemBackground", new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f) + 180), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "ItemBackground"), new Animation(0, 0, 32, 32)), Color.White), new Vector2(this.playerInventory.xPositionOnScreen + this.playerInventory.width + 64, this.playerInventory.yPositionOnScreen + (this.playerInventory.height * .3f) + 180), new Rectangle(0, 0, 32, 32), 2f, true, Color.White);
 }
Example #3
0
        /// <summary>
        /// Populates the menu with all of the items on display.
        /// </summary>
        /// <param name="rows"></param>
        /// <param name="collums"></param>
        /// <param name="xPosition"></param>
        /// <param name="yPosition"></param>
        public void populateClickableItems(int rows, int collums, int xPosition, int yPosition)
        {
            this.pages.Clear();
            int size = this.capacity;
            //ModCore.log("Hello World! SIZE IS: " + size);

            int maxPages = ((size) / (this.rows * this.collumns)) + 1;

            for (int i = 0; i < maxPages; i++)
            {
                int amount = Math.Min(rows * collums, size);
                this.pages.Add(i, new InventoryMenuPage(i, new List <ItemDisplayButton>(), amount));
                //ModCore.log("Added in a new page with size: " + size);
                size -= amount;
                for (int y = 0; y < collums; y++)
                {
                    for (int x = 0; x < rows; x++)
                    {
                        int index = ((y * rows) + x) + (rows * collums * i);
                        if (index >= this.pages[i].amountToDisplay + (rows * collums * i))
                        {
                            //ModCore.log("Break page creation.");
                            //ModCore.log("Index is: " + index);
                            //ModCore.log("Max display is: " + this.pages[i].amountToDisplay);
                            break;
                        }

                        if (index > this.items.Count)
                        {
                            Vector2           pos2 = new Vector2(x * 64 + xPosition, y * 64 + yPosition);
                            ItemDisplayButton b2   = new ItemDisplayButton(null, new StardustCore.Animations.AnimatedSprite("ItemBackground", pos2, new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "ItemBackground"), new Animation(0, 0, 32, 32)), Color.White), pos2, new Rectangle(0, 0, 32, 32), 2f, true, Color.White);
                            this.pages[i].storageDisplay.Add(b2);
                            continue;
                        }

                        Item              item = this.getItemFromList(index);
                        Vector2           pos  = new Vector2(x * 64 + xPosition, y * 64 + yPosition);
                        ItemDisplayButton b    = new ItemDisplayButton(item, new StardustCore.Animations.AnimatedSprite("ItemBackground", pos, new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "ItemBackground"), new Animation(0, 0, 32, 32)), Color.White), pos, new Rectangle(0, 0, 32, 32), 2f, true, Color.White);
                        this.pages[i].storageDisplay.Add(b);
                    }
                }
            }
        }
Example #4
0
 public CraftingRecipeButton(Recipe RecipeToCraft, StardustCore.Animations.AnimatedSprite Background, Vector2 Position, Rectangle BoundingBox, float Scale, bool DrawStackNumber, Color DrawColor)
 {
     this.recipe      = RecipeToCraft;
     this.displayItem = new ItemDisplayButton(this.recipe.DisplayItem, Background, Position, BoundingBox, Scale, DrawStackNumber, DrawColor);
 }