void RemoveRecipe(Recipe recipe) { if (Recipes.Contains(recipe)) { Recipes.Remove(recipe); } }
public void AddRecipe(Recipe recipe) { if (Recipes.Contains(recipe)) { return; } Recipes.Add(recipe); }
private void AfterNewRecipeAdded(NewRecipeAddedEventArgs obj) { Recipe newRecipe = obj.NewRecipe; if (Recipes != null && !Recipes.Contains(newRecipe)) { Recipes.Add(newRecipe); } }
public string SolveSecondPart() { var recipes = new Recipes(input.Length + 1); while (!recipes.Contains(input)) { recipes.Iterate(); } return(recipes.Scores.ToString().IndexOf(input, StringComparison.Ordinal).ToString()); }
public void AddRecipe(Recipe recipe) { if (!Recipes.Contains(recipe)) { Recipes.Add(recipe); BusinessLayer.AddRecipe(recipe); Soups = new ObservableCollection <Recipe>(Recipes.Where(r => r.Type.Name == "Leves")); MainCourses = new ObservableCollection <Recipe>(Recipes.Where(r => r.Type.Name == "Főétel")); Desserts = new ObservableCollection <Recipe>(Recipes.Where(r => r.Type.Name == "Desszert")); } }
public void Register(Recipe recipe) { this.Log($"Production registry registering {recipe}"); if (!Recipes.Contains(recipe)) { Recipes.Add(recipe); } if (!ProductionRoutines.ContainsKey(recipe)) { ProductionRoutines.Add(recipe, null); } if (!ProductionPercentages.ContainsKey(recipe)) { ProductionPercentages.Add(recipe, 0); } }
// not sure whether to put Work() in Job or Entity class public void Work(Entity entity, Recipe recipe) { if (!Recipes.Contains(recipe)) { Debug.LogErrorFormat("{0} tried to make {1}, but is a {2}", entity, recipe, this); return; } foreach (var input in recipe.InputInfo) { entity.RemoveItem(input.Key, input.Value); } foreach (var output in recipe.OutputInfo) { entity.AddItem(output.Key, output.Value); } }
public bool IsRegistered(Recipe recipe) => Recipes.Contains(recipe) && ProductionRoutines.ContainsKey(recipe) && ProductionPercentages.ContainsKey(recipe);