Exemple #1
0
        private void BtnOk_Click(object sender, RoutedEventArgs e)
        {
            _CRTIngredientInfo        = (cb.SelectedItem as IngredientInfo);
            _IngredientStep.ID        = _CRTIngredientInfo.ID;
            _IngredientStep.Name      = _CRTIngredientInfo.Name;
            _IngredientStep.ScaleRate = 100;
            switch (_CRTIngredientInfo.Type)
            {
            case IngredientType.ESPRESSO:
                _IngredientStep.UsedTime = _CRTIngredientInfo._Espresso.UsedTime;
                break;

            case IngredientType.FILTERBREW:
                _IngredientStep.UsedTime = _CRTIngredientInfo._FilterBrew.UsedTime;
                break;

            case IngredientType.FRESHMILK:
                _IngredientStep.UsedTime = _CRTIngredientInfo._FreshMilk.UsedTime;
                break;

            case IngredientType.INSTANTPOWDER:
                _IngredientStep.UsedTime = _CRTIngredientInfo._InstantPowder.UsedTime;
                break;

            case IngredientType.NoSelect:
                _IngredientStep.UsedTime = 0;
                break;

            default:
                break;
            }
            _IngredientStep._Type = (byte)_CRTIngredientInfo.Type;
            myclick.BeginInvoke(_IngredientStep, null, null, null);
            this.Close();
        }
Exemple #2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            IngredientInfo tmp = new IngredientInfo(IngredientType.INSTANTPOWDER);

            SetIngredientInfo(tmp, _IngredientInfo);
            UInt16 stim;

            try
            {
                stim = UInt16.Parse(tbstm.Text);
            }
            catch (Exception)
            {
                stim = 0;
            }
            tmp.ID   = ((IDGenrator)Function.XmlSerializer.LoadFromXml("EVO.ID.xml", typeof(IDGenrator))).GetID();
            tmp.Name = _IngredientInfo.Name + "_ID" + tmp.ID.ToString();
            _RecipeInfo._lstIngredientInfo.Add(tmp);
            _RecipeInfo._lstRecipeInfo.First(c => c.IsSelected == true)._lstIngredientStep.First(a => a.ID == _ID).StartTime = stim;
            _RecipeInfo._lstRecipeInfo.First(c => c.IsSelected == true)._lstIngredientStep.First(a => a.ID == _ID).Name      = tmp.Name;
            _RecipeInfo._lstRecipeInfo.First(c => c.IsSelected == true)._lstIngredientStep.First(a => a.ID == _ID).ID        = tmp.ID;
            Function.XmlSerializer.SaveToXml("EVO.Ingredient.xml", _RecipeInfo, typeof(EvoRecipe), null);
            MessageBox.Show("Save Finished!");
            this.Close();
        }
Exemple #3
0
        public FindIngredientObjective(Ingredient[] oldIngredients, bool blackheartMet = false)
        {
            if (!blackheartMet)
            {
                Ingredients = new Ingredient[oldIngredients.Length + 1];

                for (int i = 0; i < oldIngredients.Length; i++)
                {
                    Ingredients[i] = oldIngredients[i];
                }

                Ingredients[Ingredients.Length - 1] = IngredientInfo.RandomIngredient(oldIngredients);
            }
            else
            {
                Ingredients = new Ingredient[oldIngredients.Length];

                for (int i = 0; i < oldIngredients.Length; i++)
                {
                    Ingredients[i] = oldIngredients[i];
                }
            }

            BlackheartMet = blackheartMet;
        }
Exemple #4
0
    private void Start()
    {
        itemLabel.text = Regex.Replace(ItemName, "([a-z])([A-Z])", "$1 $2");

        Sprite spr = ResourcesDatabase.GetSprite(ItemName);

        if (spr != null)
        {
            itemSprite.sprite = spr;
        }

        foreach (string s in ResourcesDatabase.GetIngredients(ItemName))
        {
            GameObject go = Instantiate(ingredient);
            go.transform.SetParent(ingredientGrid.transform);

            string[] d = s.Split(' ');

            IngredientInfo ing = go.GetComponent <IngredientInfo>();
            ing.Info = s;
            ing.LoadSprite(d[1]);

            //set sprite of go's image to whatever the ingredient is
        }
    }
        public async Task <IActionResult> UpdateRecipe([FromRoute] int id, [FromBody] RecipesRespondModel recipeRespondModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (string.IsNullOrEmpty(recipeRespondModel.Title))
            {
                return(BadRequest("Invalid Title"));
            }

            var recipe = await _context.Recipes.FindAsync(id);

            recipe.Title       = recipeRespondModel.Title;
            recipe.Catagory    = _context.Catagories.First(a => recipeRespondModel != null && a.Name.ToLower().Equals(recipeRespondModel.Category.ToLower()));
            recipe.Description = recipeRespondModel.Description;


            // delete IngredientInfoes
            DeleteRelevantIngredentInfosDetails(id);

            var recipeIngredentsInfo = new List <IngredientInfo>();

            foreach (var kvp in recipeRespondModel.Ingredients)
            {
                var ingredient     = _context.Ingredients.FirstOrDefault(a => a.Title.ToLower().Equals(kvp.Key.ToLower()));
                var ingredientInfo = new IngredientInfo()
                {
                    Ingredient = ingredient, Qty = kvp.Value, Recipe = recipe
                };
                recipeIngredentsInfo.Add(ingredientInfo);
            }

            recipe.IngredientInfoes = recipeIngredentsInfo;
            await _context.IngredientInfoes.AddRangeAsync(recipeIngredentsInfo);

            ///
            ///
            _context.Entry(recipe).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RecipeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #6
0
    private void AddIngredientToDish(GameObject ingredientGameObject)
    {
        String ingredientName = ExtractNameFromGameObject(ingredientGameObject);

        IngredientInfo ingredientInfo = cookbook.GetIngredientInfo(ingredientName);

        currentDish.AddIngredientInfo(ingredientInfo);
    }
Exemple #7
0
    public string GetRandomIngredient()
    {
        IngredientInfo item = ingredients[UnityEngine.Random.Range(0, ingredients.Length)];

        this.name = item.name;
        this.GetComponent <Ingredient>().SetSprite(item.name);
        return(item.name);
    }
Exemple #8
0
    public void AddIngredientBookmarks()
    {
        List <int>    ingredientBookmarkList = StringToIntList(Panels.instance.memberInfo.member.ingredientBookmarks);
        int           amount       = ingredientBookmarkList.Count;
        Vector2       panelSize    = body.GetComponent <RectTransform>().rect.size;
        RectTransform content      = body.GetChild(1).GetChild(0).GetComponent <RectTransform>();
        float         ySize        = panelSize.y / ingredientOnePageAmount;
        float         contentYSize = panelSize.y;

        if (amount > ingredientOnePageAmount)
        {
            contentYSize = ySize * amount;
        }
        content.offsetMin     = new Vector2(0, 0);
        content.offsetMax     = new Vector2(0, contentYSize);
        content.localPosition = new Vector2(0, -contentYSize / 2);
        for (int i = 0; i < amount; i++)
        {
            Transform newBookmark = Instantiate(ingredientBookmark);
            newBookmark.SetParent(content);
            IngredientBookmark bookmarkInfo = newBookmark.GetComponent <IngredientBookmark>();

            ingredientBookmarks.Add(bookmarkInfo);
            RectTransform rectTransform = newBookmark.GetComponent <RectTransform>();

            rectTransform.offsetMin     = Vector2.zero;
            rectTransform.offsetMax     = new Vector2(0, ySize);
            rectTransform.localPosition = new Vector2(0, contentYSize / 2 + -ySize * i - ySize / 2);

            int    ingredientID = ingredientBookmarkList[i];
            string sql          = "SELECT * FROM ingredient WHERE id = " + ingredientID + ";";
            MySql.Data.MySqlClient.MySqlDataReader reader = DbConnecter.instance.Reader(sql);
            reader.Read();

            Ingredient ingredient = new Ingredient();
            ingredient.id            = reader.GetInt32(0);
            ingredient.casNo         = reader.GetString(1);
            ingredient.english       = reader.GetString(2);
            ingredient.korean        = reader.GetString(3);
            ingredient.ewgGrade      = reader.GetString(4);
            ingredient.eye           = reader.GetString(5);
            ingredient.respiratory   = reader.GetString(6);
            ingredient.digestive     = reader.GetString(7);
            ingredient.reproductive  = reader.GetString(8);
            ingredient.integumentary = reader.GetString(9);
            reader.Close();
            DbConnecter.instance.CloseConnection();
            IngredientInfo ingredientInfo = newBookmark.GetChild(0).GetComponent <IngredientInfo>();
            ingredientInfo.IngredientChange(ingredient, gameObject);

            bookmarkInfo.ingredientID = ingredient.id;
        }
    }
Exemple #9
0
    private void UpdateDishProperty(String name, IngredientInfo ingredientInfo)
    {
        if (dishPropertyDictionary.ContainsKey(name))
        {
            dishPropertyDictionary[name].IncreaseValue();
        }
        else
        {
            DishProperty newDishProperty = new DishProperty(ingredientInfo.name, ingredientInfo, value: 1);

            dishPropertyDictionary.Add(name, newDishProperty);
        }
    }
Exemple #10
0
 public Ingredient_Instant(UInt16 Id, UInt16 stm, EvoRecipe rcp, ObservableCollection <CanisterUnit> a)
 {
     _RecipeInfo     = rcp;
     _StartTime      = stm;
     _ID             = Id;
     _CanisterUnit   = a;
     _IngredientInfo = new IngredientInfo(IngredientType.INSTANTPOWDER);
     SetIngredientInfo(_IngredientInfo, (IngredientInfo)_RecipeInfo._lstIngredientInfo.First(c => c.ID == _ID));
     InitializeComponent();
     this.DataContext = _IngredientInfo;
     tbstm.Text       = stm.ToString();
     fillpowder();
     ReloadCanisterIngredient();
 }
 public Ingredient_FilterBrew(UInt16 Id, UInt16 stm, EvoRecipe rcp)
 {
     // _EvoRecipe = (EvoRecipe)Function.XmlSerializer.LoadFromXml("EVO.Ingredient.xml", typeof(EvoRecipe));
     _RecipeInfo     = rcp;
     _StartTime      = stm;
     _ID             = Id;
     _IngredientInfo = new IngredientInfo(IngredientType.FILTERBREW);
     SetIngredientInfo(_IngredientInfo, (IngredientInfo)_RecipeInfo._lstIngredientInfo.First(c => c.ID == _ID));
     InitializeComponent();
     this.DataContext = _IngredientInfo;
     tbstm.Text       = stm.ToString();
     tbpkg1.Text      = Function.GetBeanType(_IngredientInfo._FilterBrew.Grind1Type);
     tbpkg2.Text      = Function.GetBeanType(_IngredientInfo._FilterBrew.Grind2Type);
 }
Exemple #12
0
        public async Task <IngredientInfo> UpdateIngredientInfo(IngredientInfo data)
        {
            try
            {
                _repoIngredientInfo.Update(data);
                await _repoIngredientInfo.SaveAll();

                return(data);
            }
            catch (Exception)
            {
                return(data);
            }
        }
    public IEnumerator StartPrep()
    {
        PrepStep currentStep = currentPrep.steps[stepCounter];

        UtensilCollision.step = currentStep;
        instructions.text     = currentStep.instructions;

        while (!UtensilCollision.stepClear)
        {
            yield return(null);
        }

        IngredientInfo info = UtensilCollision.currentInteraction.GetComponent <IngredientInfo>();

        UtensilCollision.stepClear = false;
        stepCounter++;

        Debug.Log(UtensilCollision.self);



        if (info.choppedIngredient != null && !(UtensilCollision.self.tag == "mix") && currentStep.stepType == "chop")
        {
            info.choppedIngredient.transform.position = UtensilCollision.currentInteraction.transform.position;
            Destroy(UtensilCollision.currentInteraction);
            for (int i = 0; i < currentStep.quantity; i++)
            {
                // Kagebunshin no jutsu
                Instantiate(info.choppedIngredient);
            }
        }


        if (stepCounter < currentPrep.steps.Length)
        {
            // Continue down recipe
            Debug.Log("Going to next step");
            StartCoroutine(StartPrep());
        }
        else
        {
            // Done cooking
            UtensilCollision.prepDone = true;
            Debug.Log("All ready to cook.");
            instructions.text = "ready to cook";

            finishPrep();
        }
    }
Exemple #14
0
    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
    {
        if (reader.TokenType != JsonToken.StartObject)
        {
            throw new JsonReaderException($"Expected token 'StartObject', got '{reader.TokenType}' with value '{reader.Value}'");
        }

        JObject jobject = JObject.Load(reader);

        String         name           = jobject.GetValue("Name")?.ToObject <String>() ?? String.Empty;
        int            value          = jobject.GetValue("Value")?.ToObject <int>() ?? 0;
        IngredientInfo ingredientInfo = jobject.GetValue("IngredientInfo")?.ToObject <IngredientInfo>();

        return(new DishProperty(name, ingredientInfo, value));
    }
Exemple #15
0
        public Item(JsonData jsonData)
        {
            id       = jsonData["id"].ToString();
            index    = jsonData["index"].ToInt();
            category = jsonData["category"].ToString();

            string _itemType = jsonData["type"].ToString();

            if (System.Enum.IsDefined(typeof(ItemType), _itemType))
            {
                itemType = (ItemType)System.Enum.Parse(typeof(ItemType), _itemType);
            }

            if (jsonData.ContainsKey("productionAmount"))
            {
                productionAmountBase = jsonData["productionAmount"].ToDouble();
            }

            if (jsonData.ContainsKey("price"))
            {
                basePrice = jsonData["price"].ToDouble();
            }

            name           = jsonData["name"].ToString();
            image          = jsonData["image"].ToString();
            description    = jsonData["description"].ToString();
            productionTime = jsonData["productionTime"].ToInt();

            string ingredientIDHeader    = "ingredientID_";
            string ingredientCountHeader = "ingredientCount_";


            for (int i = 1; i < 4; i++)
            {
                string ingredientId = string.Empty;
                if (string.IsNullOrEmpty(jsonData[ingredientIDHeader + i].ToString()))
                {
                    continue;
                }

                ingredientId = jsonData[ingredientIDHeader + i].ToString();

                double ingredientCount = jsonData[ingredientCountHeader + i].ToDouble();

                IngredientInfo info = new IngredientInfo(ingredientId, ingredientCount);
                ingredientList.Add(info);
            }
        }
Exemple #16
0
        public override void RenderProgress(BaseQuestGump gump)
        {
            if (!Completed)
            {
                IngredientInfo info = IngredientInfo.Get(Ingredient);

                gump.AddHtmlLocalized(70, 260, 270, 100, info.Name, BaseQuestGump.Blue);
                gump.AddLabel(70, 280, 0x64, CurProgress.ToString());
                gump.AddLabel(100, 280, 0x64, "/");
                gump.AddLabel(130, 280, 0x64, info.Quantity.ToString());
            }
            else
            {
                base.RenderProgress(gump);
            }
        }
Exemple #17
0
        public async Task <NotificationResult> UpdateAsync(IngredientInfo item)
        {
            var result = new NotificationResult();

            try
            {
                _context.Attach(item);
                _context.Entry(item).State = EntityState.Modified;
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                result.AddError(ex);
            }

            return(result);
        }
Exemple #18
0
        public async Task <NotificationResult> InsertAsync(IngredientInfo item)
        {
            var result = new NotificationResult();

            try
            {
                await _context.AddAsync(item);

                item.SetId(_context.SaveChanges());
            }
            catch (Exception ex)
            {
                result.AddError(ex);
            }

            return(result);
        }
        public async Task <IActionResult> SaveRecipe([FromBody] RecipesRespondModel recipeRespondModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var user = _context.Users.FirstOrDefault(a => a.UserName.Equals(recipeRespondModel.Owner));

            if (user == null)
            {
                return(BadRequest($"Invalid User {recipeRespondModel.Owner}"));
            }

            var category = _context.Catagories.FirstOrDefault(a => a.Name.Trim().ToLower().Equals(recipeRespondModel.Category.Trim().ToLower()));

            if (category == null)
            {
                return(BadRequest($"Invalid Catagory {recipeRespondModel.Category}"));
            }

            var recipe = new Recipe()
            {
                Title       = recipeRespondModel.Title,
                Description = recipeRespondModel.Description,
                Catagory    = category,
                User        = user,
            };

            foreach (var kvp in recipeRespondModel.Ingredients)
            {
                var ingredient     = _context.Ingredients.FirstOrDefault(a => a.Title.ToLower().Equals(kvp.Key.ToLower()));
                var ingredientInfo = new IngredientInfo()
                {
                    Ingredient = ingredient, Qty = kvp.Value, Recipe = recipe
                };
                recipe.IngredientInfoes.Add(ingredientInfo);
                await _context.IngredientInfoes.AddAsync(ingredientInfo);
            }

            await _context.Recipes.AddAsync(recipe);

            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetRecipeByID", new { id = recipe.RecipeId }, recipeRespondModel));
        }
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Potion")
     {
         if (other.isTrigger)
         {
             return;
         }
         IngredientInfo II = other.GetComponent <IngredientInfo> ();
         addToPot(II);
         other.GetComponent <ObjectReturn> ().returnToPoint();
     }
     if (other.tag == "Final Bottle")
     {
         other.GetComponent <ObjectReturn> ().returnToPoint();
         r.finishRecipe();
     }
 }
Exemple #21
0
 private void SetIngredientInfo(IngredientInfo a, IngredientInfo b)
 {
     a.ID                            = b.ID;
     a.IsSelected                    = b.IsSelected;
     a.Name                          = b.Name;
     a.Type                          = b.Type;
     a.CrtModifyStatus               = b.CrtModifyStatus;
     a._InstantPowder.MixIndex       = b._InstantPowder.MixIndex;
     a._InstantPowder.PackageOneType = b._InstantPowder.PackageOneType;
     a._InstantPowder.PackageOneAmt  = b._InstantPowder.PackageOneAmt;
     a._InstantPowder.PackageTwoType = b._InstantPowder.PackageTwoType;
     a._InstantPowder.PackageTwoAmt  = b._InstantPowder.PackageTwoAmt;
     a._InstantPowder.AfterFlush     = b._InstantPowder.AfterFlush;
     a._InstantPowder.PreFlush       = b._InstantPowder.PreFlush;
     a._InstantPowder.WaterVolume    = b._InstantPowder.WaterVolume;
     a._InstantPowder.WhipperSpeed   = b._InstantPowder.WhipperSpeed;
     a._InstantPowder.UsedTime       = b._InstantPowder.UsedTime;
 }
 private void SetIngredientInfo(IngredientInfo a, IngredientInfo b)
 {
     a.ID              = b.ID;
     a.IsSelected      = b.IsSelected;
     a.Name            = b.Name;
     a.Type            = b.Type;
     a.CrtModifyStatus = b.CrtModifyStatus;
     a._FilterBrew.ActionDownPostion = b._FilterBrew.ActionDownPostion;
     a._FilterBrew.ActionUpPostion   = b._FilterBrew.ActionUpPostion;
     a._FilterBrew.Grind1Cnt         = b._FilterBrew.Grind1Cnt;
     a._FilterBrew.Grind2Cnt         = b._FilterBrew.Grind2Cnt;
     a._FilterBrew.Tm_DelayOpen      = b._FilterBrew.Tm_DelayOpen;
     a._FilterBrew.Tm_Depress        = b._FilterBrew.Tm_Depress;
     a._FilterBrew.Tm_Pre            = b._FilterBrew.Tm_Pre;
     a._FilterBrew.Tm_Press          = b._FilterBrew.Tm_Press;
     a._FilterBrew.WaterVolume       = b._FilterBrew.WaterVolume;
     a._FilterBrew.Grind1Type        = b._FilterBrew.Grind1Type;
     a._FilterBrew.Grind2Type        = b._FilterBrew.Grind2Type;
 }
Exemple #23
0
        public override void OnKill(BaseCreature creature, Container corpse)
        {
            IngredientInfo info = IngredientInfo.Get(Ingredient);

            for (int i = 0; i < info.Creatures.Length; i++)
            {
                Type type = info.Creatures[i];

                if (creature.GetType() == type)
                {
                    System.From.SendLocalizedMessage(1055043,
                                                     $"#{info.Name}"); // You gather a ~1_INGREDIENT_NAME~ from the corpse.

                    CurProgress++;

                    break;
                }
            }
        }
Exemple #24
0
    private void RefreshPage(int pageNum)
    {
        Debug.Log("Currently on page #" + pageNum);

        FoodObject food = levelList[currentPage - 1];

        FoodNameLabel.text = food.getName();
        FoodImage.sprite   = Resources.Load <Sprite>(food.getIcon());

        foreach (GameObject obj in ingredientList)
        {
            Destroy(obj);
        }
        ingredientList.Clear();

        foreach (FoodObject ing in food.getIngNeeded())
        {
            GameObject newObj = Instantiate(ingInfo, ScrollViewContent);

            ingredientList.Add(newObj);

            IngredientInfo ingredientInfo = newObj.GetComponent <IngredientInfo>();
            ingredientInfo.Setup(ing);
        }

        if (currentPage == 1)
        {
            ButtonBackPage.interactable = false;
        }
        else
        {
            ButtonBackPage.interactable = true;
        }

        if (currentPage == maxPage)
        {
            ButtonNextPage.interactable = false;
        }
        else
        {
            ButtonNextPage.interactable = true;
        }
    }
Exemple #25
0
        public override bool IgnoreYoungProtection(Mobile from)
        {
            if (Completed)
            {
                return(false);
            }

            IngredientInfo info     = IngredientInfo.Get(Ingredient);
            Type           fromType = from.GetType();

            for (int i = 0; i < info.Creatures.Length; i++)
            {
                if (fromType == info.Creatures[i])
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #26
0
    float ShowIngredient(List <Ingredient> ingredients, float startYMax, float yRate)
    {
        int   amount        = ingredients.Count;
        float yAnchorHeight = amount * yRate;
        float nextYMax      = SizeChange(ingredientListPanel, startYMax, startYMax - yAnchorHeight);

        for (int i = 0; i < amount; i++)
        {
            Transform newTextBox = Instantiate(ingredientInfoPanel);
            newTextBox.SetParent(ingredientListPanel.transform);
            RectTransform rectTransform = newTextBox.GetComponent <RectTransform>();
            float         yMax          = 1 - i / (float)amount;
            float         yMin          = 1 - (i + 1) / (float)amount;
            SizeChange(rectTransform, yMax, yMin);
            IngredientInfo ingredientInfo = newTextBox.GetComponent <IngredientInfo>();
            Ingredient     ingredient     = ingredients[i];
            ingredientInfo.IngredientChange(ingredient, gameObject);
        }
        return(nextYMax);
    }
    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
    {
        IngredientInfo ingredientInfo = value as IngredientInfo;

        JObject jobject = new JObject();

        jobject.Add("Name", new JValue(ingredientInfo.name));
        jobject.Add("RusName", new JValue(ingredientInfo.rusName));
        jobject.Add("Score", new JValue(ingredientInfo.score));
        jobject.Add("SpritePath", new JValue(ingredientInfo.spritePath));

        bool needToWriteRotation = (ingredientInfo.rotation != 0);

        if (needToWriteRotation)
        {
            jobject.Add("Rotation", new JValue(ingredientInfo.rotation));
        }

        jobject.WriteTo(writer);
    }
    public void addToPot(IngredientInfo II)
    {
        bool found = false;

        foreach (Ingredient i in inCauldon)
        {
            if (i.type == II.type)
            {
                i.count += II.amount;
                found    = true;
            }
        }
        if (!found)
        {
            Ingredient newIngred = new Ingredient();
            newIngred.count = II.amount;
            newIngred.type  = II.type;
            inCauldon.Add(newIngred);
        }
        CID.updateRecipeUI(inCauldon);
    }
Exemple #29
0
    private void SetButtonColor(IngredientInfo item)
    {
        int i = 0;

        switch (item.foodType)
        {
        case FoodType.Fish:
            i = 0;
            break;

        case FoodType.Vegetable:
            i = 1;
            break;

        case FoodType.Fruit:
            i = 2;
            break;

        case FoodType.Meat:
            i = 3;
            break;

        case FoodType.Dairy:
            i = 4;
            break;

        case FoodType.Other:
            i = 5;
            break;

        default:
            break;
        }

        this.GetComponent <Image>().sprite = Buttons[i].Idle;
        SpriteState ss;

        ss.pressedSprite = Buttons[i].Pressed;
        this.GetComponent <Button>().spriteState = ss;
    }
        public virtual async Task <NotificationResult> InsertAsync(InsertIngredientCommand command)
        {
            var result = new NotificationResult();
            var item   = new IngredientInfo(command);

            result.Add(item.GetNotificationResult());
            if (!result.IsValid)
            {
                return(result);
            }
            result.Add(await _ingredientRepository.InsertAsync(item));
            if (result.IsValid)
            {
                result.Data = item.Id;
                result.AddMessage(Shared.Domain.Resources.Handler.InsertSuccess_Message);
            }
            else
            {
                result.AddErrorOnTop(Shared.Domain.Resources.Handler.InsertError_Message);
            }
            return(result);
        }