Ejemplo n.º 1
0
        public static void AddToRecipeDatabase(this Recipe recipe, RecipeCollectionType collectionType, int plusLevel, string collectionName = "")
        {
            var database = RecipeManager.Instance.GetRecipeDatabase(plusLevel);

            switch (collectionType)
            {
            case RecipeCollectionType.All:
                recipe.AddToRecipeDatabase(database._allBlacksmithCollections, collectionName);
                recipe.AddToRecipeDatabase(database._allWitchCollections, collectionName);
                break;

            case RecipeCollectionType.Blacksmith:
                recipe.AddToRecipeDatabase(database._allBlacksmithCollections, collectionName);
                break;

            case RecipeCollectionType.Witch:
                recipe.AddToRecipeDatabase(database._allWitchCollections, collectionName);
                break;

            default:
                break;
            }

            bool containsRecipe = database._recipeByItemName.TryGetValue(recipe.craftedItemName, out List <Recipe> recipes);

            if (containsRecipe)
            {
                database._recipeByItemName[recipe.craftedItemName].Add(recipe);
            }
            else
            {
                database._recipeByItemName.Add(recipe.craftedItemName, new List <Recipe>()
                {
                    recipe
                });
            }
        }
Ejemplo n.º 2
0
        public static void AddToRecipeDatabase(this Recipe recipe, RecipeCollectionType collectionType, string collectionName = "")
        {
            int plusLevel = GameManager.Instance.GetCurrentGamePlusLevel();

            recipe.AddToRecipeDatabase(collectionType, plusLevel, collectionName);
        }