Esempio n. 1
0
 void RemoveRecipe(Recipe recipe)
 {
     if (Recipes.Contains(recipe))
     {
         Recipes.Remove(recipe);
     }
 }
Esempio n. 2
0
 public void AddRecipe(Recipe recipe)
 {
     if (Recipes.Contains(recipe))
     {
         return;
     }
     Recipes.Add(recipe);
 }
Esempio n. 3
0
        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());
        }
Esempio n. 5
0
 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"));
     }
 }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
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);
        }
    }
Esempio n. 8
0
 public bool IsRegistered(Recipe recipe) =>
 Recipes.Contains(recipe) && ProductionRoutines.ContainsKey(recipe) && ProductionPercentages.ContainsKey(recipe);