Esempio n. 1
0
        /// <param name="InventorySource">Typically this is <see cref="Game1.player.Items"/> if this menu should display the player's inventory.</param>
        /// <param name="ActualCapacity">The maximum # of items that can be stored in the Source list. Use <see cref="Game1.player.MaxItems"/> if moving to/from the inventory.</param>
        /// <param name="InventoryColumns">The number of columns to use when rendering the user's inventory at the bottom-half of the menu. Recommended = 12 to mimic the default inventory of the main GameMenu</param>
        /// <param name="InventorySlotSize">The size, in pixels, to use when rendering each slot of the user's inventory at the bottom-half of the menu. Recommended = <see cref="BagInventoryMenu.DefaultInventoryIconSize"/></param>
        public ItemBagMenu(ItemBag Bag, IList <Item> InventorySource, int ActualCapacity, int InventoryColumns, int InventorySlotSize = BagInventoryMenu.DefaultInventoryIconSize)
            : base(1, 1, 1, 1, true)
        {
            this.BorderColor     = new Color(220, 123, 5, 255);
            this.BackgroundColor = new Color(255, 201, 121);

            this.Bag = Bag;
            this.IsLeftSidebarVisible  = Bag is BoundedBag || Bag is Rucksack;
            this.IsRightSidebarVisible = true;

            this.InventorySource         = InventorySource;
            this.ActualInventoryCapacity = Math.Max(ActualCapacity, InventorySource.Count);
            this.InventoryMenu           = new BagInventoryMenu(this, Bag, InventorySource, ActualCapacity, InventoryColumns, InventorySlotSize);
            InventoryMenu.MenuNeighbors[NavigationDirection.Left]  = this;
            InventoryMenu.MenuNeighbors[NavigationDirection.Right] = this;

            this.exitFunction += () => { Bag.CloseContents(); };
        }