예제 #1
0
 public InventoryMenu(int xPosition, int yPosition, bool playerInventory, IList <Item> actualInventory = null, highlightThisItem highlightMethod = null, int capacity = -1, int rows = 3, int horizontalGap = 0, int verticalGap = 0, bool drawSlots = true)
     : base(xPosition, yPosition, 64 * (((capacity == -1) ? 36 : capacity) / rows), 64 * rows + 16)
 {
     this.drawSlots       = drawSlots;
     this.horizontalGap   = horizontalGap;
     this.verticalGap     = verticalGap;
     this.rows            = rows;
     this.capacity        = ((capacity == -1) ? 36 : capacity);
     this.playerInventory = playerInventory;
     this.actualInventory = actualInventory;
     if (actualInventory == null)
     {
         this.actualInventory = Game1.player.items;
     }
     for (int j = 0; j < (int)Game1.player.maxItems; j++)
     {
         if (Game1.player.items.Count <= j)
         {
             Game1.player.items.Add(null);
         }
     }
     for (int i = 0; i < this.capacity; i++)
     {
         inventory.Add(new ClickableComponent(new Rectangle(xPosition + i % (this.capacity / rows) * 64 + horizontalGap * (i % (this.capacity / rows)), yPositionOnScreen + i / (this.capacity / rows) * (64 + verticalGap) + (i / (this.capacity / rows) - 1) * 4 - ((i <= this.capacity / rows && playerInventory && verticalGap == 0) ? 12 : 0), 64, 64), string.Concat(i))
         {
             myID                   = i,
             leftNeighborID         = ((i % (this.capacity / rows) != 0) ? (i - 1) : 107),
             rightNeighborID        = (((i + 1) % (this.capacity / rows) != 0) ? (i + 1) : 106),
             downNeighborID         = ((i >= this.actualInventory.Count - this.capacity / rows) ? 102 : (i + this.capacity / rows)),
             upNeighborID           = ((i < this.capacity / rows) ? (12340 + i) : (i - this.capacity / rows)),
             region                 = 9000,
             upNeighborImmutable    = true,
             downNeighborImmutable  = true,
             leftNeighborImmutable  = true,
             rightNeighborImmutable = true
         });
     }
     this.highlightMethod = highlightMethod;
     if (highlightMethod == null)
     {
         this.highlightMethod = highlightAllItems;
     }
     dropItemInvisibleButton = new ClickableComponent(new Rectangle(xPosition - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - 128, yPositionOnScreen - 12, 64, 64), "")
     {
         myID            = (playerInventory ? 107 : (-500)),
         rightNeighborID = 0
     };
     foreach (ClickableComponent item in GetBorder(BorderSide.Top))
     {
         item.upNeighborImmutable = false;
     }
     foreach (ClickableComponent item2 in GetBorder(BorderSide.Bottom))
     {
         item2.downNeighborImmutable = false;
     }
     foreach (ClickableComponent item3 in GetBorder(BorderSide.Left))
     {
         item3.leftNeighborImmutable = false;
     }
     foreach (ClickableComponent item4 in GetBorder(BorderSide.Right))
     {
         item4.rightNeighborImmutable = false;
     }
 }
예제 #2
0
 public InventoryMenuMethods(int xPosition, int yPosition, bool playerInventory, IList <Item> actualInventory = null, highlightThisItem highlightMethod = null,
                             int capacity = -1, int rows = 3, int horizontalGap = 0, int verticalGap = 0, bool drawSlots = true)
     : base(xPosition, yPosition, playerInventory, actualInventory, highlightMethod, capacity, rows, horizontalGap, verticalGap, drawSlots)
 {
 }