private void DrawInventory() { inventory?.Dispose(); hotbar?.Dispose(); inventory = new SlotGroup(new RenderedSlot[3 * 9], SlotGroupType.inventory, player.status.containers.inventory); hotbar = new SlotGroup(new RenderedSlot[9], SlotGroupType.hotbar, player.status.containers.inventory); // Draw inventory grid. if (yoff != 0) { yoff += 20 + SIZE; } else { yoff = Y_OFFSET; } for (int y = 0; y < inventory.slots.Length / 9; y++) { for (int x = 0; x < 9; x++) { inventory.Add(CreateSlot(x * SIZE, yoff + y * SIZE, (byte)(y * 9 + x + 9))); } } yoff += (inventory.slots.Length / 9 - 1) * SIZE + 20; // Draw hotbar grid. for (int x = 0; x < 9; x++) { hotbar.Add(CreateSlot(x * SIZE, yoff + SIZE, (byte)(9 * 3 + 9 + x))); } this.Size = new Size(this.Size.Width, yoff + SIZE * 2 + 50); }
private void DrawContainer() { // Dispose of old information. container?.Dispose(); container = new SlotGroup(new RenderedSlot[selectedWinow.slotCount], SlotGroupType.chest, selectedWinow); // Draw grid. for (int y = 0; y < selectedWinow.slotCount / 9; y++) { for (int x = 0; x < 9; x++) { yoff = Y_OFFSET + y * SIZE; container.Add(CreateSlot(x * SIZE, yoff, (byte)(y * 9 + x))); } } }