示例#1
0
 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;
 }
示例#2
0
文件: Subject2.cs 项目: pb0/ID0_Test
    public virtual void Move(Vector2 offset)
    {
        if (rect == null)
        {
            return;
        }

        rect = new LayerRect(rect, offset);
    }
示例#3
0
 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;
 }
示例#4
0
        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();
        }
示例#5
0
        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();
        }
示例#6
0
        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();
        }
示例#7
0
文件: TileLayer.cs 项目: pb0/ID0_Test
    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;
    }
示例#8
0
        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());
        }
示例#9
0
文件: LayerRect.cs 项目: pb0/ID0_Test
 public LayerRect(LayerRect rect, Vector3 offset)
     : this(new LayerPoint(rect.point, offset), rect.width, rect.height, rect.anchor)
 {
 }
示例#10
0
文件: LayerRect.cs 项目: pb0/ID0_Test
 public bool IsOverlappingInYAxis(LayerRect rect)
 {
     return RectTool.IsOverlappingInYAxis(ViewportRect, rect.ViewportRect);
 }
示例#11
0
文件: Subject2.cs 项目: pb0/ID0_Test
 public void SetPosInLayer(Layer layer, Vector2 pos)
 {
     rect = new LayerRect(new LayerPoint(layer, pos), width, height, anchor);
 }
示例#12
0
 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());
 }