private IEnumerator ClearRecipeRoutine() { JSONObject body = JsonBody.AddToPlanner(" ", day.ToString()); UnityWebRequest request = Postman.CreatePostRequest(Endpoints.instance.PLANNER(), body); yield return(request.SendWebRequest()); JSONNode response = JSON.Parse(request.downloadHandler.text); if (request.error == null) { recipe.text = ""; } else { WidgetLogger.instance.Log("Could not clear recipe: " + response["message"]); } }
public IEnumerator SelectRecipeRoutine() { RecipeSelectionDialog dialog = FindObjectOfType <RecipeSelectionDialog>(); dialog.Show(); dialog.SetNone(); dialog.PopulateRecipes(); while (!dialog.IsFinished() && !dialog.IsCancel()) { yield return(null); } if (dialog.IsFinished()) { recipe.text = !string.IsNullOrEmpty(dialog.GetSelectedRecipe()) ? dialog.GetSelectedRecipe() : dialog.GetFreeTextRecipeName(); string recipeName = string.IsNullOrEmpty(recipe.text) ? " " : recipe.text; JSONObject body = JsonBody.AddToPlanner(recipeName, day.ToString()); UnityWebRequest request = Postman.CreatePutRequest(Endpoints.instance.PLANNER(), body.ToString()); yield return(request.SendWebRequest()); yield break; } }