Exemple #1
0
    public Recipe(string name, List <string> outputItems, List <int> outputQuantities, List <string> inputItems, List <int> inputQuantities, List <string> jobs) : base(name)
    {
        // make sure that output and input items are valid
        Debug.AssertFormat(outputItems.Count == outputQuantities.Count,
                           "# of outputItems: {0}, # of outputQuantities: {1}", outputItems.Count, outputQuantities.Count);
        Debug.AssertFormat(inputItems.Count == inputQuantities.Count,
                           "# of inputItems: {0}, # of inputQuantities: {1}", inputItems.Count, inputQuantities.Count);
        NumbOutputs = outputItems.Count;
        NumbInputs  = inputItems.Count;

        foreach (string jobName in jobs)
        {
            Job job = Job.GetJob(jobName);
            job.AddRecipe(this);
            Jobs.Add(job);
        }

        for (int x = 0; x < NumbInputs; x++)
        {
            InputInfo.Add(GetID(inputItems[x]), inputQuantities[x]);
        }

        for (int x = 0; x < NumbOutputs; x++)
        {
            OutputInfo.Add(GetID(outputItems[x]), outputQuantities[x]);
        }
    }