/// <summary> /// 食べ物の種類に対応した画像を取得する /// </summary> /// <param name="foodType">食べ物の種類</param> /// <returns>食べ物の画像</returns> public static Bitmap GetPictureFoodType(FoodType foodType) { Bitmap img = null; switch (foodType) { case FoodType.Vegetable: img = Properties.Resources.FoodType_1; img.Tag = (Int32)FoodType.Vegetable; break; case FoodType.Meat: img = Properties.Resources.FoodType_2; img.Tag = (Int32)FoodType.Meat; break; case FoodType.Bread: img = Properties.Resources.FoodType_3; img.Tag = (Int32)FoodType.Bread; break; default: break; } return img; }
public Food(FoodType type, FoodItem item, int n) { Id = Guid.NewGuid(); Type = type; Item = item; N = n; }
void CollectedBuff(FoodType type) { spawnedBuff.GetComponent<BuffPickupScript>().PickedUpBuff -= CollectedBuff; spawnedBuff = null; spawnPosition = null; timerTime = spawnTime; PickedUpBuff(type); }
public void PickUp(FoodType Food,int Amount) { if (!_HoldingFood) { _FoodType = Food; _HoldingFood = true; _Amount = Amount; } }
public FoodFactory(int x, int y, Grid g, FoodType ft, int val = 0) { _pos_x = x; _pos_y = y; _grid = g; _food_type = ft; _level = val; }
protected Product(string name, BaseUnit measure, bool isVegetarian, FoodType type, ShoppingUnit unit, decimal price) { this.Name = name; this.BaseUnit = measure; this.IsVegetarian = isVegetarian; this.ShoppingUnit = unit; this.PricePerShoppingUnit = price; this.FoodType = type; }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } FoodType = await _context.FoodType.SingleOrDefaultAsync(m => m.Id == id); if (FoodType == null) { return(NotFound()); } return(Page()); }
public void setPlatter(Platter platter) { this.platter = platter; for (int i = 0; i < 4; i++) { FoodType food = platter.Foods[i]; if (food != null) { GameObject foodObj = Instantiate(food.prefab, transform); foodObj.transform.localPosition = new Vector3(xPos[i], yPos[i], -1.5f); foodObj.transform.localScale = new Vector3(0.3f, 0.3f); } } }
public static string GetProperName(this FoodType food) { switch (food) { case FoodType.FT_CRAP: return("Cheap"); case FoodType.FT_BASIC: return("Basic"); case FoodType.FT_DELUXE: return("Deluxe"); } return("Mystery"); }
public static int GetPrice(this FoodType food) { switch (food) { case FoodType.FT_CRAP: return(0); case FoodType.FT_BASIC: return(100); case FoodType.FT_DELUXE: return(400); } return(0); }
public IActionResult Upsert(int?id) { FoodType = new FoodType(); if (id == null || id == 0) { return(View(FoodType)); } FoodType = _foodService.FindFoodType(id); if (FoodType == null) { return(NotFound()); } return(View(FoodType)); //return View("Upsert"); }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } FoodType = await _context.FoodTypes.AsNoTracking().FirstOrDefaultAsync(m => m.Id == id); if (FoodType == null) { return(NotFound()); } return(Page()); }
async Task <FoodType> IRepository <FoodType, int> .Update(FoodType entity) { FoodType resFoodType; try { resFoodType = _dbSet.Update(entity).Entity; await _context.SaveChangesAsync(); } catch { resFoodType = null; } return(resFoodType); }
void CollectedBuff(FoodType type) { GameObject newGunType = null; if (type == FoodType.Apple) { newGunType = appleGun; } if (type == FoodType.Cupcake) { newGunType = cupcakeGun; } GameObject newGun = Instantiate (newGunType, currentGun.transform.position, currentGun.transform.rotation) as GameObject; newGun.transform.parent = transform; newGun.transform.localScale = new Vector3(1f,1f,1f); Destroy(currentGun); currentGun = newGun; }
public IActionResult Delete(int id) { FoodType = new FoodType(); FoodType = _foodService.FindFoodType(id); if (FoodType == null) { return(RedirectToAction("ListFoodType")); // return Json(new { success = false, message = "Error while Deleting" }); } else { _foodService.DeleteFoodType(FoodType); return(RedirectToAction("ListFoodType")); // return Json(new { success = true, message = "Delete Successful" }); } }
public void setFoodRequest(FoodType[] foods) { RequestedFood = foods; fed = new bool[dishCount]; FoodObjects = new GameObject[dishCount]; for (int i = 0; i < dishCount; i++) { FoodType food = RequestedFood[i]; GameObject foodObj = Instantiate(food.prefab, transform); FoodObjects[i] = foodObj; //TODO: Properly do table stuff so we can make this function nice and neat foodObj.transform.localPosition = new Vector3((i - 1.5f) / 3 / 16, (i - 1.5f) / 3 / 16, -2); } }
public async Task <IActionResult> Create([Bind("FoodTypeId,FoodTypeName,Description,OwnerSignature,EntryDate")] FoodType foodType) { if (ModelState.IsValid) { foodType.OwnerSignature = HttpContext.Session.GetString("username"); foodType.EntryDate = DateTime.Now; _context.Add(foodType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(foodType)); }
public ActionResult ThemTypeMonAn(FoodType foodtype, string StoreID) { var stID = Guid.Parse(StoreID); if (ModelState.IsValid) { db.Entry(foodtype).State = System.Data.Entity.EntityState.Added; db.SaveChanges(); Session["Message"] = foodtype.TypeName + " thêm thành công"; return(RedirectToAction("QuanLyTypeMonAn", new { StoreID = StoreID, page = 1, method = "ThemMoi" })); } ViewBag.FoodID = new SelectList(db.Foods.Where(n => n.StoreID == stID) .OrderBy(n => n.FoodName).ToList(), "FoodID", "FoodName", foodtype.FoodID); ViewBag.StoreID = StoreID; return(View(foodtype)); }
/// <summary> /// Modify a Food Type /// </summary> /// <param name="ft"></param> /// <returns></returns> public bool ModifyFoodType(FoodType ft) { int nbrRowsUpdated = -1; DataRow row = dp.ds.FOODTYPE.Select("FOODTYPEID = '" + ft.Id + "'").FirstOrDefault(); row["NAME"] = ft.Name; row["DESCRIPTION"] = ft.Description; row["ENABLE"] = ft.IsEnabled; //FoodType foodtype = GetFoodTypeById(ft.Id); using (RestoBook.Common.Model.DataSetRestoBookTableAdapters.FOODTYPETableAdapter daFoodType = new RestoBook.Common.Model.DataSetRestoBookTableAdapters.FOODTYPETableAdapter()) { nbrRowsUpdated = daFoodType.Update(row); } return(nbrRowsUpdated > 0); }
public static Food Create(FoodType type) { switch (type) { case FoodType.Pizza: return new Pizza(); case FoodType.Starbursts: return new Starbursts(); case FoodType.Burger: return new Burger(); case FoodType.Taco: return new Taco(); default: return new NullFood(); } }
public List <dynamic> addFoodTypeWithFoods([FromBody] FoodType foodType) { if (foodType != null) { FoodEntities db = new FoodEntities(); db.Configuration.ProxyCreationEnabled = false; db.FoodTypes.Add(foodType); db.SaveChanges(); return(getAllFoodTypesWithFood()); } else { return(null); } }
public async Task <FoodType> Get(long Id) { FoodType FoodType = await DataContext.FoodType.Where(x => x.Id == Id).Select(x => new FoodType() { Id = x.Id, Name = x.Name, StatusId = x.StatusId, }).AsNoTracking().FirstOrDefaultAsync(); if (FoodType == null) { return(null); } return(FoodType); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } this.foodType = await dbContext.FoodTypes.FindAsync(id); if (this.foodType == null) { return(NotFound()); } return(Page()); }
// Algorithm private double CalculateRumEffect(int amountDrank, FoodType foodAte) { switch (foodAte) { case FoodType.SaltedMeat: case FoodType.Slop: return amountDrank * 0.1; case FoodType.SeaBiscuits: case FoodType.Bread: return amountDrank * 0.5; case FoodType.Fruit: case FoodType.Veggies: default: return amountDrank * 1.0; } }
public void Revise(Agent reviseur, Creature from, FoodType foodType) { if (reviseur.Creature.SpecieID == from.SpecieID) { base.Revise(reviseur); } DataSpecies data = reviseur.Memory.Species.GetByKey(from.SpecieID); if (data == null) { return; } data.addHerbivorFood(new HerbivorFood(foodType, Time.time)); }
public GameObject CreateFood(FoodType type, Vector3 position, Quaternion rotation) { GameObject obj = null; switch (type) { case FoodType.Fruit: if (!activePooling) { obj = Instantiate(fruitPool.prefab, position, rotation, fruitHolder.transform); } else if (fruitPooled.Count != 0) { obj = fruitPooled.Pop(); obj.transform.position = position; obj.transform.rotation = rotation; } else { obj = Instantiate(fruitPool.prefab, position, rotation, fruitHolder.transform); } break; case FoodType.Vegetable: if (!activePooling) { obj = Instantiate(vegetablePool.prefab, position, rotation, vegetableHolder.transform); } else if (vegetablePooled.Count != 0) { obj = vegetablePooled.Pop(); obj.transform.position = position; obj.transform.rotation = rotation; } else { obj = Instantiate(vegetablePool.prefab, position, rotation, vegetableHolder.transform); } break; default: throw new ArgumentException("FoodType : " + type + " cannot be created with this food factory"); } obj.SetActive(true); return(obj); }
public static string FoodTypeToString(FoodType foodType) { switch (foodType) { case FoodType.Normal: return("Normal"); case FoodType.Remains: return("Remains"); case FoodType.Contamination: return("Contamination"); default: throw new System.ArgumentOutOfRangeException(); } }
public Animal( long animalID, AnimalSpeciesType type, Gender gender, int age, FoodType foodType, decimal price, long cageID, HabitatType habitat, HealthStatus healthStatus) : this(animalID) { this.Type = type; this.Gender = gender; this.Age = age; this.FoodType = foodType; this.Price = price; this.CageID = cageID; this.Habitat = habitat; this.HealthStatus = healthStatus; }
public static BasicCuisine EnumCookingFood(FoodType foodType) { switch (foodType) { case FoodType.GuangdongCuisine: return(new GuangdongCuisineModel()); case FoodType.HunanCuisine: return(new HunanCuisineModel()); case FoodType.SichuanCuisine: return(new SichuanCuisineModel()); default: throw new Exception("没有这个菜系"); } }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } FoodType = await _context.FoodType.FindAsync(id); if (FoodType != null) { _context.FoodType.Remove(FoodType); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
/// <summary> /// 获取食物类型列表 /// </summary> /// <returns></returns> public List <FoodType> GetFoodTypeList() { var ListModel = CacheHelper.Instance.GetCache <List <FoodType> >("ListFoodType"); if (ListModel == null) { int outTime = CacheHelper.Instance.CacheOutTime; FoodType model = new FoodType(); ListModel = FoodTypeOper.Instance.Select(model); CacheHelper.Instance.SetCache("ListFoodType", ListModel, outTime); if (ListModel == null) { ListModel = new List <FoodType>(); } } return(ListModel); }
public static I18NString Translate(FoodType type) { switch (type) { case FoodType.Entree: return(I18N.Instance.Get("enum_food_type_entree")); case FoodType.Dessert: return(I18N.Instance.Get("enum_food_type_dessert")); case FoodType.Drink: return(I18N.Instance.Get("enum_food_type_drink")); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
/// <summary> /// 简单工厂 /// 免除了直接创建菜品的责任 /// 只要符合抽象产品制定的合同 /// 那么只要通知工厂类知道就可以被客户使用了 /// 对于产品部分来说,它是符合开闭原则的——对扩展开放、对修改关闭 /// 但是工厂类不太理想,因为每增加一辆车,都要在工厂类中增加相应的商业逻辑和判 断逻辑,这显自然是违背开闭原则的 /// </summary> /// <param name="Type"></param> /// <returns></returns> public override GeneralFoodModel OrderFood(FoodType Type) { switch (Type) { case FoodType.ChairmanFavouriteofRoastMeat: return(CreatedChairmanFavouriteofRoastMeat()); case FoodType.HotPepperOfFishHead: return(CreatedHotPepperFishHead()); case FoodType.OverFryofFrog: return(CreatedOverFryofFrog()); default: throw new Exception("还没准备这道菜啊!!"); } }
public object AddType(JToken jt, string ACCOUNT, string SHOP_ID) { var model = JsonConvert.DeserializeObject <ProductType>(jt.ToString()); using (var db = new OrderDB()) { db.BeginTransaction(); try { if (string.IsNullOrEmpty(model.TYPE_NAME)) { throw new Exception("类别名称不能为空!"); } //更新 db.FoodTypes .Where(c => c.SEQ >= model.SEQ && c.ShopId == SHOP_ID && c.STATE == 'A') .Set(c => c.SEQ, c => c.SEQ + 1) .Update(); var repeat = (from p in db.FoodTypes where p.ShopId == SHOP_ID && p.TypeName == model.TYPE_NAME && p.STATE == 'A' select p).FirstOrDefault(); if (repeat != null) { throw new Exception($"当前分类{model.TYPE_NAME}已存在!"); } var type = new FoodType(); type.ID = Guid.NewGuid().ToString("N").ToUpper(); type.DatetimeCreated = DateTime.Now; type.UserCreated = ACCOUNT; type.ICON = model.ICON; type.ShopId = SHOP_ID; type.TypeName = model.TYPE_NAME; type.STATE = 'A'; type.SEQ = model.SEQ ?? 0; db.Insert(type); db.CommitTransaction(); } catch (Exception ex) { db.RollbackTransaction(); throw ex; } return(true); } }
public async Task <bool> Update(FoodType FoodType) { FoodTypeDAO FoodTypeDAO = DataContext.FoodType.Where(x => x.Id == FoodType.Id).FirstOrDefault(); if (FoodTypeDAO == null) { return(false); } FoodTypeDAO.Id = FoodType.Id; FoodTypeDAO.Name = FoodType.Name; FoodTypeDAO.StatusId = FoodType.StatusId; await DataContext.SaveChangesAsync(); await SaveReference(FoodType); return(true); }
public ActionResult DishDone(int id) { ProductOrderModel productOrder = db.ProductOrders.Include("Product").First(x => x.ProductOrderId == id); FoodType foodType = productOrder.Product.ProductType; productOrder.ProductOrderStatus = Status.Done; db.Entry(productOrder).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); if ((int)foodType > 2) { return(RedirectToAction("Kitchen")); } else { return(RedirectToAction("Bar")); } }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } FoodType = await _context.FoodTypes.FindAsync(id); if (FoodType != null) { FoodType.IsDeleted = true; await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> SelelctedOrderItemInfo(int id) { Food food = await _context.Food.FirstOrDefaultAsync(f => f.FoodId == id); FoodType foodType = await _context.FoodType.FirstOrDefaultAsync(f => f.TypeId == food.TypeId); ViewBag.foodName = food.FoodName; ViewBag.foodTypeName = foodType.TypeName; ViewBag.image = food.Image; ViewBag.discount = food.Discount; ViewBag.price = food.Price; ViewBag.description = food.Description; return(PartialView("_SelectedOrderItemInfoPartial")); }
public void OnEatenFood(FoodType food) { switch(food) { case FoodType.Rabbit: progress.addValueToTimer(rabbitNutritionalValue); break; case FoodType.RedHood: progress.addValueToTimer(redHoodNutritionalValue); break; case FoodType.Granny: progress.addValueToTimer(grannyNutritionalValue); break; case FoodType.Hunter: progress.addValueToTimer(hunterNutritionalValue); break; default: break; } }
public static void Feed(FoodType food, int foodCaloires, int foodValue) { AdventurerNutrition[(int)food] = foodValue; calories += foodCaloires; }
protected PackagedFood(string name, BaseUnit measure, bool isVegetarian, FoodType type, ShoppingUnit unit, decimal price) : base(name, measure, isVegetarian, type, unit, price) { }
public Food(string id, ProductType productType, FoodType foodType, int quantity, int healthEffect) : base(id, productType, quantity) { this.HealthEffect = healthEffect; this.FoodType = foodType; }
protected WeightFood(string name, BaseUnit measure, bool isVegetarian, FoodType type, decimal price) : base(name, measure, isVegetarian, type, new ShoppingUnit(ShoppingPackage.kg, 1000), price) { }
public void Setup() { #region Necessary To Load Random r = new Random(); bool Overlap = true; Model[] m = new Model[3]; m[0] = Content.Load<Model>("Models/Pizza"); m[1] = Content.Load<Model>("Models/Orange"); m[2] = Content.Load<Model>("Models/Banana"); FoodType[] ft = new FoodType[3]; ft[0] = FoodType.Pizza; ft[1] = FoodType.Orange; ft[2] = FoodType.Banana; #endregion #region Hole for (int i = 0; i < _HOLECOUNT; ++i) { Hole h; do { h = new Hole(Content.Load<Model>("Models/Hole"), new Vector3(r.Next(-(_WIDTH / 2), _WIDTH / 2) * -2f, 0, r.Next(1, _DEPTH - 1) * -2f), new Vector3(-1f, 0, -1f), new Vector3(1f, 0.5f, 1f), new Chef(Content.Load<Model>("Models/Chef"), new Vector3(-0.5f, 0, -0.5f), new Vector3(0.5f, 3, 0.5f), _MINTHROWTIMER, _MAXTHROWTIMER, _ChefStrength), _MINMOVE, _MAXMOVE, _MINSPAWN, _MAXSPAWN); Overlap = false; foreach (Hole node in _HoleList) if (node._Bound.Intersects(h._Bound)) Overlap = true; } while (Overlap); Overlap = true; _HoleList.Add(h); } #endregion #region Food for (int i = 0; i < _FOODCOUNT; ++i) { Food f; do { int num = r.Next(3); f = new Food(m[num], new Vector3(r.Next(-(_WIDTH / 2), _WIDTH / 2) * -2f, 0, r.Next(1, _DEPTH - 1) * -2f), new Vector3(-0.5f, 0, -0.5f), new Vector3(0.5f, 1, 0.5f), ft[num]); Overlap = false; foreach (Hole node in _HoleList) if (node._Bound.Intersects(f._Bound)) Overlap = true; foreach (Food node in _FoodList) if (node._Bound.Intersects(f._Bound)) Overlap = true; } while (Overlap); Overlap = true; _FoodList.Add(f); } _TypeList.Add(new Food(m[0], new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, 0.5f, 0.5f), _PizzaStrength)); _TypeList.Add(new Food(m[1], new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, 0.5f, 0.5f), _OrangeStrength)); _TypeList.Add(new Food(m[2], new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, 0.5f, 0.5f), _BananaStrength)); _ThrownList = new List<Food>(); #endregion _IceCream.SetPosition(new Vector3(r.Next(-(_WIDTH / 2), (_WIDTH / 2) + 1) * -2, 0, (_DEPTH) * -2)); _Player.SetPosition(Vector3.Zero); _Player.SetStrength(_PlayerStrength); }
public Milk(string id, ProductType productType, FoodType foodType, int quantity, int healthEffect) : base(id, productType, foodType, quantity, healthEffect) { }
private int numItemsByType(FoodType ft) { int numItems = 0; foreach (GrocItem g in _itemList) { if (g.ItemFoodType == ft) { numItems += 1; } } return numItems; }
public static FoodType CreateFoodType(string ID) { FoodType foodType = new FoodType(); foodType.Id = ID; return foodType; }
public Food(FoodType type, FoodItem item, int n) { Type = type; Item = item; N = n; }
public static int GetStat(FoodType type) { return AdventurerNutrition[(int)type]; }
internal SwitchableFood(FoodType foodType, string flavour) { this.foodType = foodType; this.flavour = flavour; }
public Food(Model Model, Vector3 Position, Vector3 MinVec, Vector3 MaxVec, FoodType Type) : base(Model, Position, MinVec, MaxVec) { _Type = Type; _World = Matrix.CreateRotationX((float)-(Math.PI / 2)) * Matrix.CreateTranslation(_Position); }
public static Type[] FoodTypeFromPreference( FoodType type ) { List<Type> types = new List<Type>(); if ( ( type & FoodType.FruitsAndVeggies ) != 0 ) types.AddRange( m_FruitsAndVeggies ); if ( ( type & FoodType.Meat ) != 0 ) types.AddRange( m_Meat ); if ( ( type & FoodType.GrainsAndHay ) != 0 ) types.AddRange( m_GrainsAndHay ); if ( ( type & FoodType.Fish ) != 0 ) types.AddRange( m_Fish ); if ( ( type & FoodType.Eggs ) != 0 ) types.AddRange( m_Eggs ); return types.ToArray(); }
protected Animal(string id, int health, int productionQuantity, ProductType productType, int healthEffect, FoodType foodType) : base(id, health, productionQuantity, productType, healthEffect) { this.foodType = foodType; }
public void AddToFoodTypes(FoodType foodType) { base.AddObject("FoodTypes", foodType); }
public virtual bool CheckFoodPreference( Item fed, FoodType type, Type[] types ) { if ( (FavoriteFood & type) == 0 ) return false; Type fedType = fed.GetType(); bool contains = false; for ( int i = 0; !contains && i < types.Length; ++i ) contains = ( fedType == types[i] ); return contains; }
// newly extracted method private double calculateTaxTotal(FoodType type, double taxRate) { double runningTotal = 0.0; foreach (GrocItem g in this._itemList) { if (g.ItemFoodType == type) { runningTotal += g.ItemPrice * taxRate; } } return runningTotal; }
private static bool ClassifyWithSurf( FoodType foodType, Image<Gray, byte> cvImage ) { switch ( foodType ) { case FoodType.Banana: return cvImage.HasBananaStem() && cvImage.HasBananaFlesh() && cvImage.HasLongBananaStem(); case FoodType.Strawberry: return cvImage.HasStrawberrySeeds() && cvImage.HasStrawberryLeaves(); case FoodType.Cookie: return cvImage.HasCookieChips(); case FoodType.HotDog: return cvImage.HasSausageBetweenBuns() && ( cvImage.HasSausage() || cvImage.HasSausageWithToppings() ); case FoodType.Broccoli: return cvImage.HasBroccoliTop(); case FoodType.FrenchFries: return cvImage.HasFrenchFryParts(); case FoodType.Egg: return cvImage.HasEggYolk(); default: return false; } }
public Food(FoodType tp) : base() { type = tp; }