本文整理汇总了C#中Recipe.BuildIngredientList方法的典型用法代码示例。如果您正苦于以下问题:C# Recipe.BuildIngredientList方法的具体用法?C# Recipe.BuildIngredientList怎么用?C# Recipe.BuildIngredientList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Recipe
的用法示例。
在下文中一共展示了Recipe.BuildIngredientList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasRequiredIngredients
public static bool HasRequiredIngredients (Recipe recipe, Sim sim)
{
if (sim.IsNPC)
{
return true;
}
if (sim.Household == null || sim.Household.SharedFridgeInventory == null)
{
return false;
}
List<Ingredient> list = null;
return recipe.BuildIngredientList(Recipe.GetCookableIngredients(sim.Inventory), Recipe.GetCookableIngredients(sim.Household.SharedFridgeInventory.Inventory), ref list, ref list).Count == 0;
}
示例2: if
/*public static Recipe ReturnSnackIngredientRecipe(Sim sim, Recipe recipe)
{
Recipe chosenRecipe = null;
bool lotHasCounter = Food.LotHasUsableCounter(sim.LotCurrent);
bool lotHasStove = Food.LotHasUsableStove(sim.LotCurrent);
bool lotHasMicrowave = Food.LotHasUsableMicrowave(sim.LotCurrent);
bool lotHasGrill = Food.LotHasUsableGrill(sim.LotCurrent);
//Find the correct recipes
Recipe fruitRecipe = Recipe.Recipes.Find(delegate(Recipe r) { return r.Key.Equals(AddMenuItem.FruitRecipe); });
Recipe cheeseRecipe = Recipe.Recipes.Find(delegate(Recipe r) { return r.Key.Equals(AddMenuItem.CheeseRecipe); });
Recipe vegetableRecipe = Recipe.Recipes.Find(delegate(Recipe r) { return r.Key.Equals(AddMenuItem.VegetableRecipe); });
Recipe vampireRecipe = Recipe.Recipes.Find(delegate(Recipe r) { return r.Key.Equals(AddMenuItem.VampireRecipe); });
if ((!recipe.CookingProcessData.UsesAMicrowave || !sim.SimDescription.ChildOrBelow) && (!(recipe.Key == "VampireJuice") || sim.SimDescription.IsVampire) && recipe.DoesLotHaveRightTech(lotHasCounter, lotHasStove, lotHasMicrowave, lotHasGrill, Recipe.MealQuantity.Single) == Recipe.CanMakeFoodTestResult.Pass)
{
if (vegetableRecipe != null && recipe.Key.Equals("CannedSoup"))
{
chosenRecipe = vegetableRecipe;
}
else if (chosenRecipe == null && vampireRecipe != null && recipe.Key.Equals("VampireJuice"))
{
chosenRecipe = vampireRecipe;
}
else if (chosenRecipe == null && fruitRecipe != null && !recipe.CookingProcessData.UsesAMicrowave)
{
chosenRecipe = fruitRecipe;
}
else if (chosenRecipe == null && cheeseRecipe != null && recipe.CookingProcessData.UsesAMicrowave)
{
chosenRecipe = cheeseRecipe;
}
}
return chosenRecipe;
}
public static int CalculateCost(Recipe recipe, List<Ingredient> simIngredients, List<Ingredient> lotIngredients, bool isSnack)
{
List<Ingredient> list = null;
List<Ingredient> list2 = null;
List<IngredientData> list3 = null;
return CalculateCost(recipe, simIngredients, lotIngredients, ref list, ref list2, out list3, isSnack);
}
public static int CalculateCost(Recipe recipe, List<Ingredient> simIngredients, List<Ingredient> lotIngredients, ref List<Ingredient> toRemoveFromSim, ref List<Ingredient> toRemoveFromFridge, out List<IngredientData> remainingIngredients, bool isSnack)
{
if (simIngredients == null || lotIngredients == null)
{
remainingIngredients = null;
return 0;
}
remainingIngredients = BuildIngredientList(recipe, simIngredients, lotIngredients, ref toRemoveFromSim, ref toRemoveFromFridge, isSnack);
int num = 0;
foreach (IngredientData current in remainingIngredients)
{
if (!current.IsAbstract)
{
if (!current.CanBuyFromStore)
{
return -2147483648;
}
num += current.Price;
}
else
{
IngredientData cheapestIngredientOfAbstractType = IngredientData.GetCheapestIngredientOfAbstractType(current.Key, false);
if (cheapestIngredientOfAbstractType != null)
{
num += cheapestIngredientOfAbstractType.Price;
}
}
}
//return num + (int)Math.Ceiling((double)((float)(num * Recipe.kFridgeRestockingPriceMarkupPercentage) / 100f));
if (num > 0)
num = -2147483648;
return num;
}
private static List<IngredientData> BuildIngredientList(Recipe recipe, List<Ingredient> simIngredients, List<Ingredient> lotIngredients, ref List<Ingredient> toRemoveFromSim, ref List<Ingredient> toRemoveFromFridge, bool isSnack)
{
List<Ingredient> list = new List<Ingredient>(simIngredients);
List<Ingredient> list2 = new List<Ingredient>(lotIngredients);
List<IngredientData> list3 = new List<IngredientData>(recipe.IngredientsAll);
//If snack, then only use one ingredient
if (isSnack && recipe.Ingredient1 != null)
{
list3.Clear();
list3.Add(recipe.Ingredient1);
}
for (int i = 0; i < list3.Count; i++)
{
IngredientData data = list3[i];
if (RemoveIngredientFromList(list, data, ref toRemoveFromSim) || RemoveIngredientFromList(list2, data, ref toRemoveFromFridge))
{
list3.RemoveAt(i);
//.........这里部分代码省略.........