本文整理汇总了C#中Ingredient类的典型用法代码示例。如果您正苦于以下问题:C# Ingredient类的具体用法?C# Ingredient怎么用?C# Ingredient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ingredient类属于命名空间,在下文中一共展示了Ingredient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Dish_compare_ingredients_test
public void Dish_compare_ingredients_test()
{
Ingredient ing = new Ingredient()
{
Name = "ing1",
Price = 200
};
Ingredient ing2 = new Ingredient()
{
Name = "ing2",
Price = 200
};
Dish dish = new Dish()
{
Description = "asd",
Ingredients = new List<Ingredient>() { ing, ing2 },
Name = "dish1",
Status = 0
}; Dish dish2 = new Dish()
{
Description = "asd",
Ingredients = new List<Ingredient>() { ing, ing2 },
Name = "dish1",
Status = 0
};
Assert.IsTrue(dish.Equals(dish2));
dish.Ingredients.Add(new Ingredient() { Name = "changed", Price = 0 });
Assert.IsFalse(dish.Equals(dish2));
Assert.IsFalse(dish.Equals(null));
}
开发者ID:nordtorp95,项目名称:ExamProject2015,代码行数:34,代码来源:DishTest.cs
示例2: IngredientMatches
private bool IngredientMatches(IngredientBase item, Ingredient ingredient)
{
if (item.burnt)
{
return false;
}
// not right type
if (ingredient.Type != item.Type) return false;
// incorrect number of operations done
if (ingredient.Tasks.Count != item.TasksDone.Count) return false;
for (int i = 0; i < item.TasksDone.Count; i++)
{
if (item.TasksDone[i] != ingredient.Tasks[i])
{
// wrong operation done
return false;
}
}
// aaaaaaaaaaaaallllllllllllllllgggggggggggggggg
return true;
}
开发者ID:Kazetsukai,项目名称:DiabloCarbonara,代码行数:25,代码来源:PlateBench.cs
示例3: Init
public void Init(Ingredient ingredient)
{
bool buyable = false;
if (pickup != null)
{
Entity pickupEntity = pickup.GetComponent<Entity>();
if (pickupEntity != null)
{
buyable = pickupEntity.Buyable;
}
}
imgComponent.sprite = ingredient.Sprite;
if (ingredient.AnimalType != AnimalType.None)
{
txtComponent.text = ingredient.AnimalType + " " + ingredient.AnimalState;
if (buyable)
{
txtComponent.text += " " + ingredient.Cost + "$";
}
}
else
{
txtComponent.text = ingredient.GatheredState + " " + ingredient.GatheredType;
if (buyable)
{
txtComponent.text += " " + ingredient.Cost + "$";
}
}
this.ingredient = ingredient;
}
开发者ID:bradur,项目名称:FGJ-2016,代码行数:31,代码来源:InventoryItem.cs
示例4: Before_all_specs
protected override void Before_all_specs()
{
SetupDatabase(ShopGunSpecBase.Database.ShopGun, typeof(Base).Assembly);
var ingredient1 = new Ingredient {IngredientName = "Hop", LastUpdated = DateTime.Now};
var ingredient2 = new Ingredient {IngredientName = "Malt", LastUpdated = DateTime.Now};
var ingredient3 = new Ingredient {IngredientName = "Water", LastUpdated = DateTime.Now };
_ingredientRepository = new Repository<Ingredient>(GetNewDataContext());
_ingredientRepository.Add(ingredient1);
_ingredientRepository.Add(ingredient2);
_ingredientRepository.Add(ingredient3);
_ingredientRepository.Persist();
_product = ProductBuilder.BuildProduct();
_product.AddIngredient(ingredient1);
_product.AddIngredient(ingredient2);
_product.AddIngredient(ingredient3);
_productRepository = new Repository<Product>(GetNewDataContext());
_productRepository.Add(_product);
_productRepository.Persist();
base.Before_each_spec();
}
开发者ID:consumentor,项目名称:Server,代码行数:25,代码来源:ProductIngredientsSpec.cs
示例5: AddIngredient
public void AddIngredient( Ingredient ingredient, double volume )
{
double currentIngredientVolume;
this.composition.TryGetValue( ingredient, out currentIngredientVolume );
this.TotalVolume += volume;
this.composition[ingredient] = currentIngredientVolume + volume;
}
开发者ID:vsmida,项目名称:ThreadingTalk,代码行数:7,代码来源:Icecream.cs
示例6: MoveTo
public void MoveTo(Ingredient ingredient, Transform t, TweenCallback callback)
{
//Should tween
//ingredient.transform.position = t.position;
ingredient.GetComponent<Rigidbody>().DOMove(t.position, 1f).OnComplete(callback);
ingredient.GetComponent<Rigidbody>().velocity = Vector3.zero;
}
开发者ID:hubatish,项目名称:barVR,代码行数:7,代码来源:PlayerHand.cs
示例7: Dish_add_throws_exception_on_updated_ingredient_test
public void Dish_add_throws_exception_on_updated_ingredient_test()
{
Facade facade = new Facade();
Ingredient ing2 = new Ingredient()
{
Name = "ing2",
Price = 200
};
ing2 = facade.IngredientRepo().Add(ing2);
ing2.Name = "Changed";
List<Ingredient> list = new List<Ingredient>();
list.Add(ing2);
facade = new Facade();
Dish dish = new Dish()
{
Description = "asd",
Ingredients = list,
Name = "dish1",
Status = 0
};
dish = facade.DishRepo().Add(dish);
}
开发者ID:nordtorp95,项目名称:ExamProject2015,代码行数:26,代码来源:DishRepositoryTest.cs
示例8: RemoveInventoryItem
public virtual void RemoveInventoryItem(Ingredient ingredient, int count)
{
if(ingredient != null)
{
if (ingredientsInInventory.Count < count)
{
Debug.LogError("unable to comply, insufficient inventory ingredients");
return;
}
while (count > 0)
{
for (int i = 0; i < ingredientsInInventory.Count; i++)
{
if (ingredientsInInventory[i].id == ingredient.id)
{
ingredientsInInventory.RemoveAt(i);
count--;
break;
}
}
}
InitializeInventorySlots();
}
}
开发者ID:Stumpstump,项目名称:RoverGame,代码行数:26,代码来源:Container.cs
示例9: SetContent
/// <summary>
/// initialize to ingredient details
/// </summary>
/// <param name="ingredient"></param>
public void SetContent(Ingredient ingredient)
{
titleText.text = ingredient.displayName;
descriptionText.text = ingredient.description;
gameObject.GetComponent<RectTransform>().position = new Vector3 (Input.mousePosition.x - 1024f, Input.mousePosition.y - 768f, 0f);
}
开发者ID:Stumpstump,项目名称:RoverGame,代码行数:11,代码来源:ToolTip.cs
示例10: MakeMenu
public Menu MakeMenu()
{
Facade facade = new Facade();
Ingredient ing1 = new Ingredient() { Name = "ing1", Price = 10 };
Ingredient ing2 = new Ingredient() { Name = "ing2", Price = 12 };
Ingredient ing3 = new Ingredient() { Name = "ing3", Price = 13 };
Ingredient ing4 = new Ingredient() { Name = "ing4", Price = 15 };
ing1 = facade.IngredientRepo().Add(ing1);
ing2 = facade.IngredientRepo().Add(ing2);
ing3 = facade.IngredientRepo().Add(ing3);
ing4 = facade.IngredientRepo().Add(ing4);
Dish dish1 = new Dish() { Description = "descrip 1", Name = "dish1", Status = 0, Ingredients = new List<Ingredient>() { ing1, ing2 } };
Dish dish2 = new Dish() { Description = "descrip 2", Name = "dish2", Status = 1, Ingredients = new List<Ingredient>() { ing3, ing4 } };
Dish dish3 = new Dish() { Description = "descrip 3", Name = "dish3", Status = 3, Ingredients = new List<Ingredient>() {ing1, ing2, ing3, ing4 } };
dish1 = facade.DishRepo().Add(dish1);
dish2 = facade.DishRepo().Add(dish2);
dish3 = facade.DishRepo().Add(dish3);
Menu menu = new Menu() { Dishes = new List<Dish> { dish1, dish2, dish3 }, Name = "menu1" };
menu = facade.MenuRepo().Add(menu);
return menu;
}
开发者ID:nordtorp95,项目名称:ExamProject2015,代码行数:26,代码来源:MenuRepositoryTest.cs
示例11: AddItem
public void AddItem(Ingredient itemToAdd)
{
if (items.Count >= inventoryLimit)
{
// inventory is full!
}
else
{
int factor = items.Count;
if (factor > 2)
{
level = factor / 3;
factor = factor % 3;
}
InventoryItem newItem = Instantiate(
inventoryItemPrefab,
new Vector3(
factor * gridMemberSize + factor * horizontal_padding + border_padding,
-(level * gridMemberSize + level * vertical_padding + border_padding),
0f
),
Quaternion.identity) as InventoryItem;
newItem.transform.SetParent(inventoryParent, false);
newItem.Init(itemToAdd);
items.Add(newItem);
}
}
开发者ID:bradur,项目名称:FGJ-2016,代码行数:30,代码来源:InventoryManager.cs
示例12: Dish_getall_includes_ingredients_test
public void Dish_getall_includes_ingredients_test()
{
Facade facade = new Facade();
Ingredient ing = new Ingredient()
{
Name = "ing1",
Price = 200
};
Ingredient ing2 = new Ingredient()
{
Name = "ing2",
Price = 200
};
ing = facade.IngredientRepo().Add(ing);
ing2 = facade.IngredientRepo().Add(ing2);
List<Ingredient> list = new List<Ingredient>();
list.Add(ing);
list.Add(ing2);
facade = new Facade();
Dish dish = new Dish()
{
Description = "asd",
Ingredients = list,
Name = "dish1",
Status = 0
};
dish = facade.DishRepo().Add(dish);
facade = new Facade();
Assert.AreEqual(facade.DishRepo().GetAll().ToList().FirstOrDefault(x => x.Id == dish.Id).Ingredients.Count, 2);
}
开发者ID:nordtorp95,项目名称:ExamProject2015,代码行数:33,代码来源:DishRepositoryTest.cs
示例13: CreateIngredient
public ActionResult CreateIngredient(Ingredient ingredient, FormCollection form)
{
//if (ModelState.IsValid)
//{
//Ingredient ingredient = new Ingredient();
// Deserialize (Include white list!)
bool isModelUpdated = TryUpdateModel(ingredient, new[] { "IngredientName" }, form.ToValueProvider());
// Validate
if (String.IsNullOrEmpty(ingredient.IngredientName))
ModelState.AddModelError("IngredientName", "Ingredient Name is required!");
if (ModelState.IsValid)
{
var newIngredient = _ingredientApplicationService.CreateIngredient(ingredient.IngredientName);
if (newIngredient != null)
{
return RedirectToAction("EditIngredient", new{id = newIngredient.Id});
}
ModelState.AddModelError("IngredientName", "Ingredient or AlternativeIngredientName already exists!");
}
return View(ingredient);
}
开发者ID:consumentor,项目名称:Server,代码行数:26,代码来源:IngredientController.cs
示例14: ingredientCheck
public bool ingredientCheck(int index, Ingredient next)
{
if (ingredients[index] == next){
return true;
}
return false;
}
开发者ID:Somfin,项目名称:TroubleBrewing,代码行数:7,代码来源:Recipe.cs
示例15: process
public override void process(Ingredient ingredient)
{
if (!ingredientSet)
{
currentIngredient = ingredient;
ingredientSet = true;
}
else
{
bool comboFound = false;
foreach (GameObject combination in combinations)
{
Combination combo = combination.GetComponent<Combination>();
if ((combo.in1 == currentIngredient && combo.in2 == ingredient)
|| (combo.in2 == currentIngredient && combo.in1 == ingredient))
{
comboFound = true;
GameObject combined = GameObject.Instantiate(combo.combinedIngredient) as GameObject;
combined.transform.position = spawnPoint.transform.position;
}
}
if (!comboFound)
{
// failure event
}
else
{
GetComponent<AudioSource>().Stop();
GetComponent<AudioSource>().Play();
}
ingredientSet = false;
}
}
开发者ID:Somfin,项目名称:TroubleBrewing,代码行数:33,代码来源:Alchemy.cs
示例16: Starting
public void Starting()
{
//Testing ListOfIngredients
Ingredient F1 = new Ingredient("Banana", 500, 3000);
Ingredient F2 = new Ingredient("Apple", 700, 3300);
//#########################
ProductVarietyCmbBx.Items.Add(G3Controller.ProductVariety.Luxury);
ProductVarietyCmbBx.Items.Add(G3Controller.ProductVariety.Everyday);
ProductVarietyCmbBx.Items.Add(G3Controller.ProductVariety.Discount);
ProductSizeCmbBx.Items.Add(G3Controller.ProductSizeLuxury.g175);
ProductSizeCmbBx.Items.Add(G3Controller.ProductSizeLuxury.g350);
ProductSizeCmbBx.Items.Add(G3Controller.ProductSizeEveryDAy.g400);
ProductSizeCmbBx.Items.Add(G3Controller.ProductSizeEveryDAy.g600);
ProductSizeCmbBx.Items.Add(G3Controller.ProductSizeEveryDAy.g800);
ProductSizeCmbBx.Items.Add(G3Controller.ProductSizeDiscount.g500);
ProductSizeCmbBx.Items.Add(G3Controller.ProductSizeDiscount.g1000);
ContainerTypeCmbBx.Items.Add(G3Controller.ContainerType.Jar);
ContainerTypeCmbBx.Items.Add(G3Controller.ContainerType.Plastic);
for (int i = 0; i < G3Controller.ListOfIngredients.Count; i++)
{
string NameOfIngredient = G3Controller.ListOfIngredients[i].Type;
IngredientOneCmbBx.Items.Add(NameOfIngredient);
IngredientTwoCmbBx.Items.Add(NameOfIngredient);
}
}
开发者ID:DMOE15C,项目名称:project-marmelade,代码行数:31,代码来源:AddProduct.xaml.cs
示例17: OnIngredientCaught
public void OnIngredientCaught(Ingredient ingredient)
{
if (IngredientCaught != null)
{
IngredientCaught(ingredient);
}
}
开发者ID:smokingpot,项目名称:smokingpot,代码行数:7,代码来源:Pot.cs
示例18: Before_all_specs
protected override void Before_all_specs()
{
SetupDatabase(ShopGunSpecBase.Database.ShopGun, typeof(Base).Assembly);
IConfiguration configuration = new BasicConfiguration();
var container = configuration.Container;
_ingredientRepository = new IngredientRepository(GetNewDataContext());
_semaphoreRepository = new Repository<Semaphore>(GetNewDataContext());
_mentorRepository = new Repository<Mentor>(GetNewDataContext());
_ingredientAdviceRepository = new Repository<IngredientAdvice>(GetNewDataContext());
_ingredientAdviceDomainService = new IngredientAdviceDomainService(_ingredientRepository,
_ingredientAdviceRepository,
GetNewDataContext());
_mentor = MentorBuilder.BuildMentor();
_mentorRepository.Add(_mentor);
_mentorRepository.Persist();
_redSemaphore = SemaphoreBuilder.BuildRedSemaphore();
_semaphoreRepository.Add(_redSemaphore);
_greenSemaphore = SemaphoreBuilder.BuildGreenSemaphore();
_semaphoreRepository.Add(_greenSemaphore);
_semaphoreRepository.Persist();
_ingredient = IngredientBuilder.BuildIngredient();
_ingredientRepository.Add(_ingredient);
_ingredientRepository.Persist();
base.Before_each_spec();
}
开发者ID:consumentor,项目名称:Server,代码行数:34,代码来源:IngredientAdviceDomainServiceSpec.cs
示例19: Menu_add_throws_exception_on_updated_dish_test
public void Menu_add_throws_exception_on_updated_dish_test()
{
Facade facade = new Facade();
Ingredient ing1 = new Ingredient() { Name = "ing1", Price = 10 };
Ingredient ing2 = new Ingredient() { Name = "ing2", Price = 12 };
Ingredient ing3 = new Ingredient() { Name = "ing3", Price = 13 };
Ingredient ing4 = new Ingredient() { Name = "ing4", Price = 15 };
ing1 = facade.IngredientRepo().Add(ing1);
ing2 = facade.IngredientRepo().Add(ing2);
ing3 = facade.IngredientRepo().Add(ing3);
ing4 = facade.IngredientRepo().Add(ing4);
Dish dish1 = new Dish() { Description = "descrip 1", Name = "dish1", Status = 0, Ingredients = new List<Ingredient>() { ing1, ing2 } };
Dish dish2 = new Dish() { Description = "descrip 2", Name = "dish2", Status = 1, Ingredients = new List<Ingredient>() { ing3, ing4 } };
Dish dish3 = new Dish() { Description = "descrip 3", Name = "dish3", Status = 3, Ingredients = new List<Ingredient>() { ing1, ing2, ing3, ing4 } };
dish1 = facade.DishRepo().Add(dish1);
dish2 = facade.DishRepo().Add(dish2);
dish3 = facade.DishRepo().Add(dish3);
dish1.Name = "changed";
Menu menu = new Menu() { Dishes = new List<Dish> { dish1, dish2, dish3 }, Name = "menu1" };
menu = facade.MenuRepo().Add(menu);
}
开发者ID:nordtorp95,项目名称:ExamProject2015,代码行数:25,代码来源:MenuRepositoryTest.cs
示例20: Open
/// <summary>
/// Open tooltip and initialize to ingredient values
/// </summary>
/// <param name="ingredient"></param>
public virtual void Open(Ingredient ingredient)
{
titleText.text = ingredient.displayName;
descriptionText.text = ingredient.description;
gameObject.GetComponent<RectTransform>().position = Input.mousePosition;
Open();
}
开发者ID:Stumpstump,项目名称:RoverGame,代码行数:12,代码来源:ToolTip.cs
注:本文中的Ingredient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论