Example #1
0
 public Food(FoodName name, FoodType type, Rarity rarity, float portions = 1)
 {
     Name     = name;
     Type     = type;
     Rarity   = rarity;
     Portions = portions;
 }
Example #2
0
        private List <Ingredient> GetEquivalenceList()
        {
            var categories = new List <List <Ingredient> >
            {
                EquivalenceList.Fruits,
                EquivalenceList.Vegetables,
                EquivalenceList.Legumes,
                EquivalenceList.LowFatCereals,
                EquivalenceList.HighFatCereals,
                EquivalenceList.AnimalOriginFood,
                EquivalenceList.DairyProducts,
                EquivalenceList.DairySubstitutes,
                EquivalenceList.LowProteinOils,
                EquivalenceList.ProteinOils,
                EquivalenceList.LowFatSugars,
                EquivalenceList.FatSugars,
                EquivalenceList.SuperFood,
            };

            foreach (var category in categories)
            {
                if (category.Exists(x => x.Name == FoodName.ToLower()))
                {
                    return(category);
                }
            }

            return(new List <Ingredient>());
        }
Example #3
0
        public int GetPointValue(FoodName foodName)
        {
            int pointValueOfFood;

            switch (foodName)
            {
            case FoodName.Apple:
                pointValueOfFood = 10;
                return(pointValueOfFood);

            case FoodName.CottonCandy:
                pointValueOfFood = 15;
                return(pointValueOfFood);

            case FoodName.Person:
                pointValueOfFood = 25;
                return(pointValueOfFood);

            case FoodName.Bacon:
                pointValueOfFood = 50;
                return(pointValueOfFood);

            default:
                pointValueOfFood = 10;
                return(pointValueOfFood);
            }
        }
Example #4
0
        public char GetFoodCharacter(FoodName foodName)
        {
            char characterValueOfFood;

            switch (foodName)
            {
            case FoodName.Apple:
                characterValueOfFood = '@';
                return(characterValueOfFood);

            case FoodName.CottonCandy:
                characterValueOfFood = '*';
                return(characterValueOfFood);

            case FoodName.Person:
                characterValueOfFood = '¥';
                return(characterValueOfFood);

            case FoodName.Bacon:
                characterValueOfFood = '~';
                return(characterValueOfFood);

            default:
                characterValueOfFood = '@';
                return(characterValueOfFood);
            }
        }
Example #5
0
        protected override async Task OnDisappearingAnimationBeginAsync()
        {
            if (!IsAnimationEnabled)
            {
                return;
            }

            var taskSource = new TaskCompletionSource <bool>();

            var currentHeight = FrameContainer.Height;

            await Task.WhenAll(
                FoodCal.FadeTo(0),
                //FoodFat.FadeTo(0),
                FoodName.FadeTo(0));

            FrameContainer.Animate("HideAnimation", d =>
            {
                FrameContainer.HeightRequest = d;
            },
                                   start: currentHeight,
                                   end: 55,
                                   finished: async(d, b) =>
            {
                await Task.Delay(60);
                taskSource.TrySetResult(true);
            });

            await taskSource.Task;
        }
Example #6
0
 private void completeFood(FoodName f)
 {
     switch(f) {
     case FoodName.Cake:
         itemName = "Cake";
         itemDescription = "";
         weight = 1;
         value = 1;
         foodEffect = FoodEffect.GainHealth;
         potency = 1;
         break;
     case FoodName.Tomato:
         itemName = "Tomato";
         itemDescription = "";
         weight = 1;
         value = 1;
         foodEffect = FoodEffect.GainHealth;
         potency = 1;
         break;
     case FoodName.Pie:
         itemName = "Pie";
         itemDescription = "";
         weight = 1;
         value = 1;
         foodEffect = FoodEffect.GainHealth;
         potency = 1;
         break;
     default:
         break;
     }
 }
Example #7
0
    public Recipe(string[] row)
    {
        Names       = new Dictionary <Language, string>();
        ingredients = new Dictionary <IngredientType1, IngredientName>();
        strong      = false;
        if (row.Length > 0)
        {
            result = (FoodName)Enum.Parse(typeof(FoodName), row[0]);

            Names[Language.Korean] = row[1];
            if (row.Length > 7)
            {
                Names[Language.English] = row[7];
            }
            else
            {
                Names[Language.English] = result.ToString();
            }

            process = (CookProcess)Enum.Parse(typeof(CookProcess), row[2]);

            for (int i = 3; i < 6; i++)
            {
                ingredients[(IngredientType1)i - 3] = (IngredientName)Enum.Parse(typeof(IngredientName), row[i]);
            }
            strong = (row[6] == "strong");
        }
        else
        {
            Names[Language.English] = "trash";
            Names[Language.Korean]  = "음식물 쓰레기";
            result  = FoodName.trash;
            process = CookProcess.none;
        }
    }
Example #8
0
        public List <string> GetEquivalentTable()
        {
            var resultsTable    = new List <string>();
            var equivalenceList = GetEquivalenceList();

            if (equivalenceList.Exists(x => x.Name == FoodName.ToLower()))
            {
                var ingredientPortion = equivalenceList.First(x => x.Name == FoodName.ToLower()).Quantity;
                var portionFactor     = Quantity / ingredientPortion;

                foreach (var ingredient in equivalenceList)
                {
                    resultsTable.Add($"{ingredient.Name} {(ingredient.Quantity * portionFactor).ToString("0.##")} {ingredient.Unit}");
                }
            }

            return(resultsTable);
        }
Example #9
0
        protected override async Task OnAppearingAnimationEndAsync()
        {
            if (!IsAnimationEnabled)
            {
                return;
            }

            var translateLength = 400u;

            await Task.WhenAll(
                FoodName.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                FoodName.FadeTo(1)
                //,
                //(new Func<Task>(async () =>
                //{
                //    await Task.Delay(200);
                //    await Task.WhenAll(
                //        FoodFat.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                //        FoodFat.FadeTo(1));

                //}))()
                );

            await Task.WhenAll(
                CloseImage.FadeTo(1),
                CloseImage.ScaleTo(1, easing: Easing.SpringOut),
                CloseImage.RotateTo(0),
                FoodCal.ScaleTo(1),
                FoodCal.FadeTo(1),
                FoodCarb.ScaleTo(1),
                FoodCarb.FadeTo(1),
                FoodProt.ScaleTo(1),
                FoodProt.FadeTo(1),
                FoodFat.ScaleTo(1),
                FoodFat.FadeTo(1),
                TimesPressed.ScaleTo(1),
                TimesPressed.FadeTo(1),
                IsCustom.ScaleTo(1),
                IsCustom.FadeTo(1),
                MoreInfo.ScaleTo(1),
                MoreInfo.FadeTo(1));
        }
Example #10
0
File: Food.cs Project: Gtsz/Daylily
        private CommonMessageResponse ModuleSearch(IEnumerable <string> fullContent)
        {
            string[] choices = int.TryParse(FoodName, out _)
                ? EnumerateAlbumByNum(int.Parse(FoodName), fullContent).ToArray()
                : EnumerateAlbumBySearch(FoodName, fullContent).ToArray();

            if (choices.Length == 0 && FoodName != null)
            {
                return(new CommonMessageResponse(
                           string.Format("没有找到 \"{0}\"", FoodName.Length > 30 ? FoodName.Substring(0, 27) + "…" : FoodName),
                           _cm));
            }

            var dir = GetRandomAlbum(choices);

            var file = GetRandomPhoto(dir);

            Bitmap bitmap = DrawWatermark(file);

            return(new CommonMessageResponse(new FileImage(bitmap, 85).ToString(), _cm));
        }
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     if (FoodName.Text == "Food Name")
     {
         MessageBox.Show("Ey yo! Món ăn phải có tên nè");
         FoodName.Focus();
     }
     else if (FoodIngredient.Text == "Ingredient")
     {
         MessageBox.Show("Hey! Món ăn thì phải có thành phần, nguyên liệu chứ nhờ");
         FoodIngredient.Focus();
     }
     else if (String.IsNullOrEmpty(thumbnailPath))
     {
         MessageBox.Show("Hmmmm! Món ăn phải có hình mới hấp dẫn chớ");
     }
     else if (Steps.Count == 0)
     {
         MessageBox.Show("Oh no! Phải có ít nhất một bước nấu ăn chớ");
     }
     else
     {
         Recipe recipe = new Recipe(FoodName.Text, FoodIngredient.Text, thumbnailPath, YoutubeLink.Text, false, Steps, "HeartOutline", "White");
         int    err    = recipe.SaveToFiles($"{pathRoot}");
         if (err == 0)
         {
             MessageBox.Show("Đã thêm công thức");
         }
         else if (err == 1)
         {
             MessageBox.Show("Tên công thức món ăn này đã tồn tại. Hãy đổi thành tên khác");
         }
         else
         {
             MessageBox.Show("Chưa thêm được công thức\nLiên hệ nhà phát triển.");
         }
     }
 }
Example #12
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            bool isValid = false;

            for (int i = 0; i < foodList.Count; i++)
            {
                if (foodList[i].Name == FoodName.Text)
                {
                    //nowNum.Text = foodList[i].Mojoodi.ToString();
                    foodList[i].Mojoodi = int.Parse(newNum.Text);
                    isValid             = true;
                    FoodName.Clear();
                    newNum.Clear();
                }
            }
            if (isValid)
            {
                MessageBox.Show("تعداد موجودی تغییر یافت");
            }
            else
            {
                MessageBox.Show("نام غذای وارد شده نادرست است");
            }
        }
Example #13
0
 public Food(FoodName foodName)
 {
     FoodType = foodName;
 }
Example #14
0
 public Food(FoodName foodName)
 {
     this.foodName = foodName;
     baseItemType = BaseItemType.Food;
     completeFood(foodName);
 }