private void btnOk_Click(object sender, EventArgs e) { lrNew = new LayerRect() { Name = tbName.Text, FileName = tbFileName.Text, LayerFile = Transform.ImageToByte(Image.FromFile(tbFileName.Text)) }; DialogResult = DialogResult.OK; }
public virtual void Move(Vector2 offset) { if (rect == null) { return; } rect = new LayerRect(rect, offset); }
public static ObjectAnchor Create(Subject2 owner, LayerRect rect, int cullingLayer) { ObjectAnchor ret = new GameObject(owner.GetType().Name).AddComponent<ObjectAnchor>(); ret.gameObject.layer = cullingLayer; ret.SetForcingly("owner", owner); ret.SetForcingly("centerRect", rect.ObjectRectInLayer); ret.transform.parent = rect.point.layer.transform; ret.transform.localPosition = new Vector3(ret.centerRect.x, ret.centerRect.y, 0); return ret; }
public void UpdateObjectLayer(LayerRect oldL, LayerRect newL) { // найдем объект в базе с таким ид и в него будем добавлять введенный пользователем слой; var old_layer = context.Value.RentLayers.Where(x => x.Id == oldL.Id).FirstOrDefault(); old_layer.Name = newL.Name; old_layer.LayerFileName = newL.FileName; // нужно удалить все связанные площади при замене файла слоя ???? context.Value.SaveChanges(); }
public void AddObjectLayer(ObjectRect oRect, LayerRect lRect) { // найдем объект в базе с таким адресом и названием и в него будем добавлять введенный пользователем слой; var dbo = context.Value.RentObjects.Where(x => x.Id == oRect.Id).FirstOrDefault(); context.Value.RentLayers.Add(new RentLayer() { Name = lRect.Name, LayerFileName = lRect.FileName, Object = dbo, LayerFile = lRect.LayerFile }); context.Value.SaveChanges(); }
public void AddLayerArea(LayerRect layer, AreaRect area) { var dbl = context.Value.RentLayers.Where(x => x.Id == layer.Id).FirstOrDefault(); Transform.PointsToDimensions(area.x1, area.y1, area.x2, area.y2, out int width, out int height); context.Value.RentAreas.Add(new RentArea() { Layer = dbl, Name = area.AreaName, X = area.x1, Y = area.y1, Width = width, Height = height, Square = area.Square, Price = area.Price, Cost = area.Cost }); context.Value.SaveChanges(); }
void AddNewTile() { float x = initX; float y = initY; if (lastGenRect != null) { x = lastGenRect.point.layerPoint.x + lastGenRect.width; y = lastGenRect.point.layerPoint.y; } Tile tile = new Tile(layerInfo, anchor); base.AddSubject(tile, x, y); lastGenRect = tile.Rect; }
public List <AreaRect> GetLayerAreas(LayerRect layer) { var dbl = context.Value.RentLayers.Where(x => x.Id == layer.Id).FirstOrDefault(); return(context.Value.RentAreas .Where(x => x.Layer.Id == dbl.Id) .Select(x => new AreaRect() { Id = x.Id, AreaName = x.Name, x1 = x.X, y1 = x.Y, x2 = Math.Abs(x.Width + x.X), y2 = Math.Abs(x.Height + x.Y), Square = x.Square, Price = x.Price, Cost = x.Cost, isRented = x.Renter != null }).ToList()); }
public LayerRect(LayerRect rect, Vector3 offset) : this(new LayerPoint(rect.point, offset), rect.width, rect.height, rect.anchor) { }
public bool IsOverlappingInYAxis(LayerRect rect) { return RectTool.IsOverlappingInYAxis(ViewportRect, rect.ViewportRect); }
public void SetPosInLayer(Layer layer, Vector2 pos) { rect = new LayerRect(new LayerPoint(layer, pos), width, height, anchor); }
public string FindAreaByPoint(LayerRect layer, int x, int y) { return(context.Value.RentAreas .Where(a => x >= a.X && x <= (a.X + a.Width) && y >= a.Y && y <= (a.Y + a.Height) && a.Layer.Id == layer.Id) .Select(a => a.Name).FirstOrDefault()); }