Пример #1
0
		public void CreateRecipeNodeToSatisfyItemDemand(ProductionNode node, Item item, Recipe recipe)
		{
			RecipeNode newNode = RecipeNode.Create(recipe, this);
			NodeLink.Create(newNode, node, item, node.GetUnsatisfiedDemand(item));
		}
Пример #2
0
		public static RecipeNode Create(Recipe baseRecipe, ProductionGraph graph)
		{
			RecipeNode node = new RecipeNode(baseRecipe, graph);
			node.Graph.Nodes.Add(node);
			node.Graph.InvalidateCaches();
			return node;
		}
Пример #3
0
		public RecipeChooserControl(Recipe recipe, String text)
		{
			InitializeComponent();
			DisplayedRecipe = recipe;
			this.text = text;
		}
Пример #4
0
		protected RecipeNode(Recipe baseRecipe, ProductionGraph graph)
			: base(graph)
		{
			BaseRecipe = baseRecipe;
		}
Пример #5
0
		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);
		}