void InitializingArray() { string[] FieldName; List <string[]> DataList; BaseRecipeList = new List <BaseRecipe>(); FieldName = new string[] { "Type", "Input", "Processor" }; DataList = new List <string[]>(); int CurArr = 0; xmlReader.xmlReaderAccess.ReadXml("Data/Tech/XML/Recipeinfo", "RecipeInfo/Recipe", FieldName, DataList); foreach (string[] Data in DataList) { BaseRecipe newRecipe = new BaseRecipe(); newRecipe.ObjectID = CurArr++; newRecipe.Name = Data[0]; newRecipe.InputName = new List <string[]>(); string[] InputStringArray = Data[1].Split(';'); foreach (var Inputs in InputStringArray) { List <string> InputList = new List <string>(); InputList.AddRange(Inputs.Split(',')); InputList.Sort(); newRecipe.InputName.Add(InputList.ToArray()); } newRecipe.RequiredProcessor = Data[2]; BaseRecipeList.Add(newRecipe); } RecipeArray = new List <Recipe>(); string ObjectName; string outputName; string[] inputName; string requiredProcessor; Attractiveness attractiveness; ObjectName = "Silicon mass"; outputName = "Silicon mass"; inputName = null; requiredProcessor = null; attractiveness = new Attractiveness(); attractiveness.MaterialPoint = 0.5f; attractiveness.TechPoint = 0f; attractiveness.LookPoint = 0f; attractiveness.TotalPoint = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint; AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness); ObjectName = "Plastic mass"; outputName = "Plastic mass"; inputName = null; requiredProcessor = null; attractiveness = new Attractiveness(); attractiveness.MaterialPoint = 0.5f; attractiveness.TechPoint = 0f; attractiveness.LookPoint = 0.5f; attractiveness.TotalPoint = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint; AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness); ObjectName = "Steel mass"; outputName = "Steel mass"; inputName = null; requiredProcessor = null; attractiveness = new Attractiveness(); attractiveness.MaterialPoint = 0.5f; attractiveness.TechPoint = 0f; attractiveness.LookPoint = 0f; attractiveness.TotalPoint = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint; AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness); ObjectName = "Copper mass"; outputName = "Copper mass"; inputName = null; requiredProcessor = null; attractiveness = new Attractiveness(); attractiveness.MaterialPoint = 0.5f; attractiveness.TechPoint = 0f; attractiveness.LookPoint = 0f; attractiveness.TotalPoint = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint; AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness); ObjectName = "Paper roll"; outputName = "Paper roll"; inputName = null; requiredProcessor = null; attractiveness = new Attractiveness(); attractiveness.MaterialPoint = 0.5f; attractiveness.TechPoint = 0f; attractiveness.LookPoint = 0f; attractiveness.TotalPoint = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint; AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness); ObjectName = "Chemical mix"; outputName = "Chemical mix"; inputName = null; requiredProcessor = null; attractiveness = new Attractiveness(); attractiveness.MaterialPoint = 0.5f; attractiveness.TechPoint = 0f; attractiveness.LookPoint = 0f; attractiveness.TotalPoint = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint; AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness); }
public void AddRecipeArray(string Type, string Name, string[] inputName, string requiredProcessor, Attractiveness attractiveness) { Recipe newRecipe = new Recipe(); newRecipe.Type = Type; newRecipe.OutputName = Name; if (inputName == null) { newRecipe.InputName = null; } else { newRecipe.InputName = new string[inputName.Length]; for (int i = 0; i < inputName.Length; i++) { newRecipe.InputName[i] = inputName[i]; } } newRecipe.RequiredProcessor = requiredProcessor; newRecipe.Attractiveness = attractiveness; newRecipe.ObjectID = CurrentID; RecipeArray.Add(newRecipe); CurrentID++; }