public IngredientBuilderView AddIngredientBuilderView() { // make a new ingredient builder item IngredientBuilderView ingredientView = Instantiate(ingedientBuilderPrefab, ingedientVerticalGroupTrans).GetComponent <IngredientBuilderView>(); // fire event for ui element change OnUIElementAdded?.Invoke(); // update the ingredient count text Invoke("UpdateIngredientCount", .1f); return(ingredientView); }
public void prefillWithRecipe(Recipe recipe) { recipeImage.sprite = recipe.ImageSprite; caloriesInputField.text = recipe.Calories.ToString(); prepTimeInputField.text = recipe.PrepTimeMinutes.ToString(); ingredientAmount.text = recipe.Ingredients.Count.ToString(); foreach (var ingredient in recipe.Ingredients) { IngredientBuilderView view = AddIngredientBuilderView(); view.UpdateName(ingredient.IngredientName); view.UpdateAmount(ingredient.IngredientAmount); } foreach (var step in recipe.Steps) { DirectionBuilderView view = AddDirectiontBuilderView(); view.SetDirection(step); } }