当前位置: 首页>>代码示例>>C#>>正文


C# Ingredient类代码示例

本文整理汇总了C#中Ingredient的典型用法代码示例。如果您正苦于以下问题:C# Ingredient类的具体用法?C# Ingredient怎么用?C# Ingredient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Ingredient类属于命名空间,在下文中一共展示了Ingredient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Ingredient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。