public RecipeData(XmlNode recipe, string type) { if (recipe.Attributes["id"].Value != "") { idNum = int.Parse(recipe.Attributes["id"].Value); } recipeName = recipe.Attributes["name"].Value; if (recipe.Attributes["price"].Value != "") { price = int.Parse(recipe.Attributes["price"].Value); } ingredients = new List <Ingredients>(); foreach (XmlNode ingred in recipe.SelectNodes("ingredient")) { if (ingred.Attributes["name"].Value != "") { ingredients.Add(GetXmlIngredient(ingred.Attributes["name"].Value)); } } utensils = GetXmlCookingTool(recipe.SelectSingleNode("cookingTool").Attributes["name"].Value); itemType = type; }
public CookingUtensil(CookingTools c, int uc, int un, float ct) { utensil = c; upgradeCost = uc; upgradeNum = un; cookTime = ct; }
public CookingUtensil(CookingTools c) { utensil = c; upgradeCost = 10; upgradeNum = 0; cookTime = 1f; }
public Recipe(CatalogItem d) { id = d.ItemId; recipeName = d.DisplayName; description = d.Description; cost = (int)d.VirtualCurrencyPrices["NM"]; sprite = PlayerData.GetFoodSprite(d.ItemImageUrl); //getting the customdata from the object var custom = JsonConvert.DeserializeObject <Dictionary <string, string> >(d.CustomData); starLevel = 0; if (custom["StarLevel"] != "") { starLevel = Int32.Parse(custom["StarLevel"]); } if (custom["Ingredients"] != "") { ingredients = new List <Ingredients>(); string[] ingreds = custom["Ingredients"].Split(','); foreach (string s in ingreds) { ingredients.Add(GetXmlIngredient(s)); } } if (custom["CookingTool"] != "") { utensils = GetXmlCookingTool(custom["CookingTool"]); } }
//getting the recipe from the xml file public Recipe(XmlNode recipe, string type, int star) { if (recipe.Attributes["id"].Value != "") { id = recipe.Attributes["id"].Value; } recipeName = recipe.Attributes["name"].Value; if (recipe.Attributes["price"].Value != "") { price = int.Parse(recipe.Attributes["price"].Value); } ingredients = new List <Ingredients>(); foreach (XmlNode ingred in recipe.SelectNodes("ingredient")) { if (ingred.Attributes["name"].Value != "") { ingredients.Add(GetXmlIngredient(ingred.Attributes["name"].Value)); } } //this is used to make the slop's ingredients null if (ingredients.Count == 0) { ingredients = null; } starLevel = star; utensils = GetXmlCookingTool(recipe.SelectSingleNode("cookingTool").Attributes["name"].Value); itemType = type; }
//checks if the ingredients picked up by the player and the cooking tool used matches this recipe public bool SameRecipe(Ingredients[] ins, CookingTools c) { if (c == utensils) { return(SameIngredients(ins)); } return(false); }
Recipe GetRecipe(Ingredients[] items, CookingTools uten) { foreach (Recipe r in m_recipes) { if (r.SameRecipe(items, uten)) { return(r); } } return(PlayerData.playerData.slop); }
//takes the type of the cooking utensil and the number of times it was upgraded public Sprite GetCookingUtenSprite(CookingTools c, int i) { switch (c) { case CookingTools.Knife: return(m_utensilSprites[m_utensilSpriteNames.IndexOf("Knife_" + i)]); break; case CookingTools.Stove: return(m_utensilSprites[m_utensilSpriteNames.IndexOf("Oven_" + i)]); break; default: return(m_utensilSprites[m_utensilSpriteNames.IndexOf("Knife_0")]); break; } }
public void SetUtensil(CookingTools c) { utensil = c; }