コード例 #1
0
        private static void LoadRecipesFromNodes(XmlNodeList nodes)
        {
            if (nodes == null)
            {
                return;
            }

            foreach (XmlNode node in nodes)
            {
                Recipe recipe = new Recipe(node.AttributeAsInt("ID"),
                                           node.SelectSingleNode("./Name")?.InnerText ?? "");

                foreach (XmlNode childNode in node.SelectNodes("./Ingredients/Item"))
                {
                    recipe.AddIngredient(childNode.AttributeAsInt("ID"), childNode.AttributeAsInt("Quantity"));
                }

                foreach (XmlNode childNode in node.SelectNodes("./OutputItems/Item"))
                {
                    recipe.AddOutputItem(childNode.AttributeAsInt("ID"), childNode.AttributeAsInt("Quantity"));
                }

                _recipes.Add(recipe);
            }
        }
コード例 #2
0
        private static void LoadRecipesFromNodes(XmlNodeList nodes)
        {
            foreach (XmlNode node in nodes)
            {
                Recipe recipe =
                    new Recipe(node.GetXmlAttributeAsInt("ID"),
                               node.SelectSingleNode("./Name")?.InnerText ?? "");

                foreach (XmlNode childNode in node.SelectNodes("./Ingredients/Item"))
                {
                    recipe.AddIngredient(childNode.GetXmlAttributeAsInt("ID"),
                                         childNode.GetXmlAttributeAsInt("Quantity"));
                }

                foreach (XmlNode childNode in node.SelectNodes("./Ingredients/Weapon"))
                {
                    recipe.AddWeaponIngredient(childNode.GetXmlAttributeAsInt("ID"));
                }
                foreach (XmlNode childNode in node.SelectNodes("./OutputItems/Item"))
                {
                    recipe.AddOutputItem(childNode.GetXmlAttributeAsInt("ID"),
                                         childNode.GetXmlAttributeAsInt("Quantity"));
                }

                foreach (XmlNode childNode in node.SelectNodes("./OutputItems/Weapon"))
                {
                    recipe.AddOutputWeapon(childNode.GetXmlAttributeAsInt("ID"));
                }

                AddRecipeToList(recipe);
            }
        }
コード例 #3
0
ファイル: RecipeFactory.cs プロジェクト: Jufebrown/wpf-rpg
        static RecipeFactory()
        {
            Recipe granolaBar = new Recipe(1, "Granola bar");

            granolaBar.AddIngredient(3001, 1);
            granolaBar.AddIngredient(3002, 1);
            granolaBar.AddIngredient(3003, 1);
            granolaBar.AddOutputItem(2001, 1);

            _recipes.Add(granolaBar);
        }
コード例 #4
0
        static RecipeFactory()
        {
            Recipe granolaBar = new Recipe(1, "Cereálie", "Po pozření doplní 4 HP a 40 Many. Ingredience: 1 Rozinky, 1 Oves, 1 Med");

            granolaBar.AddIngredient(3001, 1);
            granolaBar.AddIngredient(3002, 1);
            granolaBar.AddIngredient(3003, 1);
            granolaBar.AddOutputItem(2001, 1);

            _recipes.Add(granolaBar);
        }
コード例 #5
0
        static RecipeFactory()
        {
            Recipe strongPotion = new Recipe(1, "Strong Potion");

            strongPotion.AddIngredient(2001, 1);
            strongPotion.AddIngredient(3001, 1);
            strongPotion.AddIngredient(3002, 1);
            strongPotion.AddOutputItem(2002, 1);

            _recipes.Add(strongPotion);
        }
コード例 #6
0
ファイル: RecipeFactory.cs プロジェクト: MrMauzy/RPG-Magic
        static RecipeFactory()
        {
            Recipe legendarySword = new Recipe(1, "Legendary Sword");

            legendarySword.AddIngredient(3000, 1);
            legendarySword.AddIngredient(3001, 1);
            legendarySword.AddIngredient(3002, 1);
            legendarySword.AddOutputItem(1005, 1);

            Recipe prisonKey = new Recipe(2, "Prison Key");

            prisonKey.AddIngredient(3003, 1);
            prisonKey.AddIngredient(3004, 1);
            prisonKey.AddIngredient(3005, 1);
            prisonKey.AddOutputItem(9001, 1);

            _recipes.Add(legendarySword);
            _recipes.Add(prisonKey);
        }