public InternalBuyInfo() { Add(new GenericBuyInfo(typeof(Apple), 3, 20, 0x9D0, 0)); Add(new GenericBuyInfo(typeof(Grapes), 3, 20, 0x9D1, 0)); Add(new GenericBuyInfo(typeof(Watermelon), 7, 20, 0xC5C, 0)); Add(new GenericBuyInfo(typeof(YellowGourd), 3, 20, 0xC64, 0)); Add(new GenericBuyInfo(typeof(Pumpkin), 11, 20, 0xC6A, 0)); Add(new GenericBuyInfo(typeof(Onion), 3, 20, 0xC6D, 0)); Add(new GenericBuyInfo(typeof(Lettuce), 5, 20, 0xC70, 0)); Add(new GenericBuyInfo(typeof(Squash), 3, 20, 0xC72, 0)); Add(new GenericBuyInfo(typeof(HoneydewMelon), 7, 20, 0xC74, 0)); Add(new GenericBuyInfo(typeof(Carrot), 3, 20, 0xC77, 0)); Add(new GenericBuyInfo(typeof(Cantaloupe), 6, 20, 0xC79, 0)); Add(new GenericBuyInfo(typeof(Cabbage), 5, 20, 0xC7B, 0)); Add(new GenericBuyInfo(typeof(Lemon), 3, 20, 0x1728, 0)); Add(new GenericBuyInfo(typeof(Lime), 3, 20, 0x172A, 0)); Add(new GenericBuyInfo(typeof(Peach), 3, 20, 0x9D2, 0)); Add(new GenericBuyInfo(typeof(Pear), 3, 20, 0x994, 0)); Add(new GenericBuyInfo(typeof(CottonSeed), 50, 20, 0xDCF, CropHelper.GetInfo(CropType.Cotton).CropHue)); Add(new GenericBuyInfo(typeof(FlaxSeed), 50, 20, 0xDCF, CropHelper.GetInfo(CropType.Flax).CropHue)); Add(new GenericBuyInfo(typeof(WheatSeed), 55, 20, 0xDCF, CropHelper.GetInfo(CropType.Wheat).CropHue)); Add(new GenericBuyInfo(typeof(CarrotSeed), 75, 20, 0xDCF, CropHelper.GetInfo(CropType.Carrot).CropHue)); Add(new GenericBuyInfo(typeof(OnionSeed), 75, 20, 0xDCF, CropHelper.GetInfo(CropType.Onion).CropHue)); Add(new GenericBuyInfo(typeof(LettuceSeed), 75, 20, 0xDCF, CropHelper.GetInfo(CropType.Lettuce).CropHue)); Add(new GenericBuyInfo(typeof(CabbageSeed), 75, 20, 0xDCF, CropHelper.GetInfo(CropType.Cabbage).CropHue)); Add(new GenericBuyInfo(typeof(TurnipSeed), 75, 20, 0xDCF, CropHelper.GetInfo(CropType.Turnip).CropHue)); Add(new GenericBuyInfo(typeof(PumpkinSeed), 75, 20, 0xDCF, CropHelper.GetInfo(CropType.Pumpkin).CropHue)); Add(new GenericBuyInfo(typeof(BloodmossSeed), 50, 20, 0xDCF, CropHelper.GetInfo(CropType.Bloodmoss).CropHue)); Add(new GenericBuyInfo(typeof(GarlicSeed), 50, 20, 0xDCF, CropHelper.GetInfo(CropType.Garlic).CropHue)); Add(new GenericBuyInfo(typeof(GinsengSeed), 50, 20, 0xDCF, CropHelper.GetInfo(CropType.Ginseng).CropHue)); Add(new GenericBuyInfo(typeof(MandrakeSeed), 50, 20, 0xDCF, CropHelper.GetInfo(CropType.Mandrake).CropHue)); Add(new GenericBuyInfo(typeof(NightshadeSeed), 50, 20, 0xDCF, CropHelper.GetInfo(CropType.Nightshade).CropHue)); Add(new GenericBuyInfo(typeof(GardenDeed), 10250, 20, 7971, 0)); }
public virtual void Harvest(Mobile from) { if (this.ItemID == CropHelper.GetInfo(this.m_CropType).PlantId) { if (this.m_NbRessources > 0) { if (this.LootItem(from)) { this.m_NbRessources--; this.m_HarvestCount--; from.Animate(from.Mounted ? 29 : 32, 5, 1, true, false, 0); } if (this.m_NbRessources == 0) { this.ItemID = CropHelper.GetInfo(this.m_CropType).CropId; this.Name = CropHelper.GetInfo(this.m_CropType).CropName + " seedling"; } if (this.m_HarvestCount == 0) { from.SendMessage("You accidently uproot all of the " + CropHelper.GetInfo(this.m_CropType).CropName + " plant"); this.Delete(); } } else { from.SendMessage("There is nothing to harvest!"); } this.m_GrowTimer.Stop(); this.m_GrowTimer.Start(); } else { from.SendMessage("This plant is to young to harvest!"); } }
public static string GetCropUrl <T>(this IPublishedContent mediaItem, T cropAlias, int?width = null, int?height = null, string propertyAlias = Constants.Conventions.Media.File, int?quality = null, ImageCropMode?imageCropMode = null, ImageCropAnchor?imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, bool cacheBuster = true, string furtherOptions = null, ImageCropRatioMode?ratioMode = null, bool upScale = true) where T : struct { var crop = CropHelper.GetCropAttribute(cropAlias); var alias = string.IsNullOrWhiteSpace(crop.Alias) == false ? crop.Alias : null; if (width.HasValue == false) { if (crop.Width > 0) { width = crop.Width; } } if (height.HasValue == false) { if (crop.Height > 0) { height = crop.Height; } } return(mediaItem.GetCropUrl(width, height, propertyAlias, alias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, ratioMode, upScale)); }
public async Task <ActionResult> CropCau(ImageCroped model, long idImage) { if (ModelState.IsValid) { try { if (model.X == model.Y && model.Width == model.Height && model.Height == 0 && model.Y == 0) { Json(new ExecuteResult() { Isok = false, Data = null, Message = "Crop k hợp lệ" }); } var croped = new ImageCroped(); croped = model; croped.ImageId = idImage; db.ImageCropeds.Add(croped); await db.SaveChangesAsync(); // cắt hình && show var img = db.Images.Find(idImage); if (img != null) { string pat = FileHelper.GetRunningPath(); string ax = Server.MapPath("~/" + img.Uri); var rootImage = new Image <Bgr, byte>(ax); // get Id insered db.Entry(croped).GetDatabaseValues(); long i = croped.Id; PreViewImage = PreViewImage + idImage + "_" + i + "_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss_fff") + ".jpg"; var ok = CropHelper.Save(CropHelper.Crop(rootImage, model.X, model.Y, model.Width, model.Height), Server.MapPath(PreViewImage)); if (!ok) { return(Json(new ExecuteResult() { Isok = false, Data = PreViewImage.Replace("~", ""), Message = "Lưu đươc vào db nhưng lỗi trong quá trình xử lý ảnh", PreVeiwImage = PreViewImage.Replace("~", "") })); } } return(Json(new ExecuteResult() { Isok = true, Data = PreViewImage.Replace("~", ""), Message = "Saved", PreVeiwImage = PreViewImage.Replace("~", "") })); } catch (Exception ex) { return(Json(new ExecuteResult() { Isok = false, Data = null, Message = ex.Message })); } } return(Json(new ExecuteResult() { Isok = false, Data = null, Message = "Hãy nhập đủ thông tin" })); }
public GrowableSeed(CropType cropType) : base(0xDCF) { this.Weight = 1.0; this.Stackable = Core.SA; this.Name = CropHelper.GetInfo(cropType).CropName + " seed"; this.Hue = CropHelper.GetInfo(cropType).CropHue; this.m_CropType = cropType; }
public GrowableCrop(CropType cropType) : base(CropHelper.GetInfo(cropType).CropId) { this.Name = CropHelper.GetInfo(cropType).CropName + " seedling"; this.Movable = false; this.m_CropType = cropType; this.m_NbRessources = CropHelper.GetInfo(cropType).NbRessources; this.m_HarvestCount = CropHelper.GetInfo(cropType).HarvestMax; this.m_GrowTimer = new GrowTimer(this, CropHelper.GetInfo(cropType).GrowDuration); this.m_GrowTimer.Start(); }
//构造函数 public PhotoViewerForLocal() { // 自绘制和双缓冲 this.SetStyle((ControlStyles.AllPaintingInWmPaint | (ControlStyles.DoubleBuffer | (ControlStyles.UserPaint | ControlStyles.ResizeRedraw))), true); // 创建gdi对象 _penFrame = new Pen(Consts.FrameColor, Consts.FrameSize); _brushDimCrop = new SolidBrush(Consts.CropDimColor); // 初始化用于辅助剪裁的对象 _cropHelper = new CropHelper(this); }
public static string CropImage(string path) { try { CropHelper.WebCropImage(path, HttpContext.Current.Session.SessionID); } catch (Exception ex) { return(ex.Message); } return(HttpContext.Current.Session.SessionID); }
public override void OnDelete() { m_GardenGround.Delete(); m_GardenFence.Delete(); m_GardenVerifier.Delete(); ArrayList crops = CropHelper.GetCropItems(this); foreach (Item c in crops) { c.Delete(); } }
// GET: ImageCropeds/Edit/5 public async Task <ActionResult> Edit(long?id) { string er = ""; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ImageCroped imageCroped = await db.ImageCropeds.FindAsync(id); if (imageCroped == null) { return(HttpNotFound()); } //nếu chưa có link ảnh thì cắt hình if (imageCroped.Uri == null) { try { // quay về ảnh gốc lấy hình và tên var rootImage = new Image <Bgr, byte>(Server.MapPath("~" + imageCroped.Image.Uri)); string path = Server.MapPath("~/Traning/data/" + imageCroped.Image.Name); FileHelper.CreateFolderIfNotExist(path); if (1 == 1) { // ghi file mô tả string data = "được cắt từ hình: id: " + imageCroped.Image.Id + "; tên" + Path.GetFileNameWithoutExtension(imageCroped.Image.Uri) + "ở : " + Path.GetFullPath(imageCroped.Image.Uri); await FileHelper.CreateFileAsync(path, "MoTa.txt", data); } // hình mới tạo ra ghi đè luôn file đã có nếu thao tác là training lại với mỗi phần tử string nameFile = imageCroped.Image.Name + "-" + imageCroped.Line.ToString("D2") + "-" + imageCroped.Index.ToString("D2") + ".png"; var ok = CropHelper.Save(CropHelper.Crop(rootImage, imageCroped.X, imageCroped.Y, imageCroped.Width, imageCroped.Height), path + "\\" + nameFile); if (ok) { imageCroped.Uri = "/Traning/data/" + imageCroped.Image.Name + "/" + nameFile; db.Entry(imageCroped).State = EntityState.Modified; await db.SaveChangesAsync(); } } catch (Exception ex) { er = ex.Message; } } ViewBag.Error = er; ViewBag.ImageId = new SelectList(db.Images, "Id", "Name", imageCroped.ImageId); return(View(imageCroped)); }
void baseView(Image img) { ViewBag.Image = img.Uri; ViewBag.idImage = img.Id; int h; ViewBag.widthImage = CropHelper.WidthImage(Server.MapPath("~" + img.Uri), out h); ViewBag.heightImage = h; #region drop var listDau = db.Daus; ViewBag.IdDau = new SelectList(listDau, "Code", "Name"); var listLoaiTu = db.LoaiTus; ViewBag.IdLoaiTu = new SelectList(listLoaiTu, "Code", "Name"); #endregion }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadEncodedInt(); switch (version) { case 0: this.m_CropType = (CropType)reader.ReadInt(); this.m_NbRessources = (int)reader.ReadInt(); this.m_HarvestCount = (int)reader.ReadInt(); break; } this.m_GrowTimer = new GrowTimer(this, CropHelper.GetInfo(this.m_CropType).GrowDuration); this.m_GrowTimer.Start(); }
void baseView() { var img = db.Images.FirstOrDefault(); ViewBag.Image = img.Uri == null ? "/Uploads/Images/Mau1.jpg" : img.Uri; ViewBag.idImage = 1; int h; string link = img.Uri == null ? "~/Uploads/Images/Mau1.jpg" : "~" + img.Uri; ViewBag.widthImage = CropHelper.WidthImage(Server.MapPath(link), out h); ViewBag.heightImage = h; ViewBag.PreViewImage = "/TempImage/tempImages.jpg"; #region drop var listDau = db.Daus; ViewBag.IdDau = new SelectList(listDau, "Code", "Name"); var listLoaiTu = db.LoaiTus; ViewBag.IdLoaiTu = new SelectList(listLoaiTu, "Code", "Name"); #endregion }
public override void OnDoubleClick(Mobile from) { Point3D m_pnt = from.Location; Map m_map = from.Map; if (CropHelper.ValidateGardenGround(m_map, m_pnt.X, m_pnt.Y)) { if (CropHelper.ValidateNoCrop(m_map, m_pnt.X, m_pnt.Y)) { if (!this.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it. return; } GrowableCrop crop = CropHelper.GetInfo(m_CropType).CropItem; from.Animate(from.Mounted ? 29 : 32, 5, 1, true, false, 0); crop.Location = m_pnt; crop.Z = crop.Z + 1; crop.Map = m_map; from.SendMessage("You manage to plant a " + this.Name); if (this.Amount > 1) { this.Amount--; } else { this.Delete(); } } else { from.SendMessage("There already is a seed here!"); } } else { from.SendMessage("You must be in a garden to plant the seed!"); } }
public override void OnDoubleClick(Mobile from) { if (GardenCheck(from) == false) { from.SendMessage("You reach the maximum amount of garden."); } else { if (IsChildOf(from.Backpack)) { if (CropHelper.ValidateRegion(from)) { GardenFence v = new GardenFence(); v.Location = from.Location; v.Map = from.Map; GardenGround y = new GardenGround(); y.Location = from.Location; y.Map = from.Map; GardenVerifier gardenverifier = new GardenVerifier(); from.AddToBackpack(gardenverifier); GardenDestroyer x = new GardenDestroyer(v, y, from, gardenverifier); x.Location = new Point3D(from.X - 2, from.Y + 4, from.Z - 3); x.Map = from.Map; this.Delete(); } else { from.SendMessage("You cannot create your garden in this area!"); } } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } } }
public static string GetCropUrl <T>(this string imageUrl, T cropAlias, int?width = null, int?height = null, string imageCropperValue = null, int?quality = null, ImageCropMode?imageCropMode = null, ImageCropAnchor?imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, string cacheBusterValue = null, string furtherOptions = null, ImageCropRatioMode?ratioMode = null, bool upScale = false) where T : struct { var crop = CropHelper.GetCropAttribute(cropAlias); if (width.HasValue == false) { if (crop.Width > 0) { width = crop.Width; } } if (height.HasValue == false) { if (crop.Height > 0) { height = crop.Height; } } return(imageUrl.GetCropUrl(width, height, imageCropperValue, crop.Alias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBusterValue, furtherOptions, ratioMode, upScale)); }
public void Grow() { this.ItemID = CropHelper.GetInfo(this.m_CropType).PlantId; this.m_NbRessources = CropHelper.GetInfo(this.m_CropType).NbRessources; this.Name = CropHelper.GetInfo(this.m_CropType).CropName + " plant"; }
public GrowableBloodmoss() : base(CropType.Bloodmoss) { this.Hue = CropHelper.GetInfo(CropType.Bloodmoss).CropHue; }