Beispiel #1
0
    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;
    }
Beispiel #2
0
 public CookingUtensil(CookingTools c, int uc, int un, float ct)
 {
     utensil     = c;
     upgradeCost = uc;
     upgradeNum  = un;
     cookTime    = ct;
 }
Beispiel #3
0
 public CookingUtensil(CookingTools c)
 {
     utensil     = c;
     upgradeCost = 10;
     upgradeNum  = 0;
     cookTime    = 1f;
 }
Beispiel #4
0
    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"]);
        }
    }
Beispiel #5
0
    //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;
    }
Beispiel #6
0
 //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);
 }
Beispiel #7
0
 Recipe GetRecipe(Ingredients[] items, CookingTools uten)
 {
     foreach (Recipe r in m_recipes)
     {
         if (r.SameRecipe(items, uten))
         {
             return(r);
         }
     }
     return(PlayerData.playerData.slop);
 }
Beispiel #8
0
    //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;
        }
    }
Beispiel #9
0
 public void SetUtensil(CookingTools c)
 {
     utensil = c;
 }