Got crafting recipes page to sort itself.
This commit is contained in:
parent
cbf2efc690
commit
010e705b6a
|
@ -17,6 +17,9 @@ namespace Revitalize.Framework.Menus
|
|||
|
||||
/// <summary>
|
||||
/// All the different pages for crafting.
|
||||
///
|
||||
/// Sort recipes by recipe name.
|
||||
/// Add in search box
|
||||
/// </summary>
|
||||
public Dictionary<string, AnimatedButton> CraftingTabs;
|
||||
|
||||
|
@ -138,6 +141,23 @@ namespace Revitalize.Framework.Menus
|
|||
this.rightButton = new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Right Button", new Vector2(this.xPositionOnScreen + this.width, this.yPositionOnScreen), new StardustCore.Animations.AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "InventoryMenu", "NextPageButton"), new StardustCore.Animations.Animation(0, 0, 32, 32)), Color.White), new Rectangle(0, 0, 32, 32), 2f);
|
||||
}
|
||||
|
||||
public void sortRecipes()
|
||||
{
|
||||
foreach(KeyValuePair<string,List<CraftingRecipeButton>> pair in this.craftingItemsToDisplay)
|
||||
{
|
||||
List<CraftingRecipeButton> copy = pair.Value.ToList();
|
||||
pair.Value.Clear();
|
||||
|
||||
copy=copy.OrderBy(x => x.displayItem.item.DisplayName).ToList();
|
||||
foreach(CraftingRecipeButton b in copy)
|
||||
{
|
||||
this.addInCraftingRecipe(b, pair.Key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void addInCraftingPageTab(string name, AnimatedButton Button)
|
||||
{
|
||||
int count = this.CraftingTabs.Count;
|
||||
|
|
|
@ -335,7 +335,12 @@ namespace Revitalize
|
|||
{
|
||||
//Inputs here
|
||||
{new StardewValley.Object((int)Enums.SDVObject.Coal,1),1 },
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.PrismaticShard, 1), 1)), null, new Vector2(), new Rectangle(0,0,16,16), 4f, true, Color.White),"Default");
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.Wool, 1), 1)), null, new Vector2(), new Rectangle(0,0,16,16), 4f, true, Color.White),"Default");
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new Dictionary<Item, int>()
|
||||
{
|
||||
//Inputs here
|
||||
{new StardewValley.Object((int)Enums.SDVObject.Coal,1),1 },
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.FairyRose, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new Dictionary<Item, int>()
|
||||
{
|
||||
//Inputs here
|
||||
|
@ -345,45 +350,41 @@ namespace Revitalize
|
|||
{
|
||||
//Inputs here
|
||||
{new StardewValley.Object((int)Enums.SDVObject.Coal,1),1 },
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.PrismaticShard, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.OakResin, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new Dictionary<Item, int>()
|
||||
{
|
||||
//Inputs here
|
||||
{new StardewValley.Object((int)Enums.SDVObject.Coal,1),1 },
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.PrismaticShard, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.ChocolateCake, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new Dictionary<Item, int>()
|
||||
{
|
||||
//Inputs here
|
||||
{new StardewValley.Object((int)Enums.SDVObject.Coal,1),1 },
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.PrismaticShard, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.QualitySprinkler, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new Dictionary<Item, int>()
|
||||
{
|
||||
//Inputs here
|
||||
{new StardewValley.Object((int)Enums.SDVObject.Coal,1),1 },
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.PrismaticShard, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.JackOLantern, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new Dictionary<Item, int>()
|
||||
{
|
||||
//Inputs here
|
||||
{new StardewValley.Object((int)Enums.SDVObject.Coal,1),1 },
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.PrismaticShard, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.WildPlum, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new Dictionary<Item, int>()
|
||||
{
|
||||
//Inputs here
|
||||
{new StardewValley.Object((int)Enums.SDVObject.Coal,1),1 },
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.PrismaticShard, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.Egg, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new Dictionary<Item, int>()
|
||||
{
|
||||
//Inputs here
|
||||
{new StardewValley.Object((int)Enums.SDVObject.Coal,1),1 },
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.PrismaticShard, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(new Recipe(new Dictionary<Item, int>()
|
||||
{
|
||||
//Inputs here
|
||||
{new StardewValley.Object((int)Enums.SDVObject.Coal,1),1 },
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.PrismaticShard, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
}, new KeyValuePair<Item, int>(new StardewValley.Object((int)Enums.SDVObject.BakedFish, 1), 1)), null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), "Default");
|
||||
|
||||
|
||||
menu.currentTab = "Default";
|
||||
menu.sortRecipes();
|
||||
|
||||
if (Game1.activeClickableMenu == null) Game1.activeClickableMenu = menu;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue