private void AddItem(CraftingInterface interfaceToAdd) { // This gets the currently used page and adds to it. // Unfortunately, we need to add extra code to check if the latest page is full. if (pages.Count > 0) { for (int i = 0; i < pages.Count; i++) { if (pages[i].Count < ITEMS_PER_PAGE) { pages[i].Add(interfaceToAdd); return; } } // If we made it this far, then we need a new page pages.Add(new List <CraftingInterface>() { interfaceToAdd }); } else // pages.Count <= 0 { pages.Add(new List <CraftingInterface>()); pages[0].Add(interfaceToAdd); } }
public CraftingInterface Clone() { CraftingInterface clone = new CraftingInterface(new CraftingRecipe(materials, materialCounts, Output.Type), Output, font, X, Y, Width, Height, onCraft, graphics); clone.Visible = this.Visible; return(clone); }