public void CreateRecipeNodeToSatisfyItemDemand(ProductionNode node, Item item, Recipe recipe) { RecipeNode newNode = RecipeNode.Create(recipe, this); NodeLink.Create(newNode, node, item, node.GetUnsatisfiedDemand(item)); }
public static RecipeNode Create(Recipe baseRecipe, ProductionGraph graph) { RecipeNode node = new RecipeNode(baseRecipe, graph); node.Graph.Nodes.Add(node); node.Graph.InvalidateCaches(); return node; }
public RecipeChooserControl(Recipe recipe, String text) { InitializeComponent(); DisplayedRecipe = recipe; this.text = text; }
protected RecipeNode(Recipe baseRecipe, ProductionGraph graph) : base(graph) { BaseRecipe = baseRecipe; }
private static void InterpretLuaRecipe(String name, LuaTable values) { float time = Convert.ToSingle(values["energy_required"]); Dictionary<Item, float> ingredients = extractIngredientsFromLuaRecipe(values); Dictionary<Item, float> results = extractResultsFromLuaRecipe(values); Recipe newRecipe = new Recipe(name, time == 0.0f ? defaultRecipeTime : time, ingredients, results); newRecipe.Category = values["category"] as String ?? "crafting"; String iconFile = values["icon"] as String; if (iconFile != null) { Bitmap icon = LoadImage(iconFile); newRecipe.Icon = icon; } foreach (Item result in results.Keys) { result.Recipes.Add(newRecipe); } Recipes.Add(newRecipe.Name, newRecipe); }