EditedWithAction() публичный Метод

public EditedWithAction ( HistoryAction action ) : void
action HistoryAction
Результат void
Пример #1
0
 public void Click(ScreenDrawingSurface surface, Point location)
 {
     var info = surface.Screen.AddEntity(entity, location);
     var action = new AddEntityAction(info, surface);
     surface.EditedWithAction(action);
     surface.ReDrawEntities();
 }
Пример #2
0
        public void Release(ScreenDrawingSurface surface)
        {
            if (startTiles == null)
            {
                return;
            }

            held = false;
            var changes = new List <TileChange>();

            for (int y = 0; y < surface.Screen.Height; y++)
            {
                for (int x = 0; x < surface.Screen.Width; x++)
                {
                    if (startTiles[x, y].HasValue && endTiles[x, y].HasValue && startTiles[x, y].Value != endTiles[x, y].Value)
                    {
                        changes.Add(new TileChange(x, y, startTiles[x, y].Value, endTiles[x, y].Value, surface));
                    }
                }
            }

            if (changes.Count > 0)
            {
                surface.EditedWithAction(new DrawAction("Brush", changes, surface));
            }
            changes.Clear();
        }
Пример #3
0
        public void Click(ScreenDrawingSurface surface, Point location)
        {
            var selection = surface.Selection;

            if (selection != null)
            {
                // only paint inside selection
                if (!selection.Value.Contains(location))
                {
                    return;
                }
            }

            int tile_x = location.X / surface.Screen.Tileset.TileSize;
            int tile_y = location.Y / surface.Screen.Tileset.TileSize;

            var old = surface.Screen.TileAt(tile_x, tile_y);

            Flood(surface, tile_x, tile_y, old.Id, 0, 0);

            // need to manually inform the screen surface that I messed with it
            if (changes.Count > 0)
            {
                surface.EditedWithAction(new DrawAction("Fill", changes, surface));
                surface.ReDrawTiles();
            }
            changes.Clear();
        }
Пример #4
0
        public void Click(ScreenDrawingSurface surface, Point location)
        {
            var info   = surface.Screen.AddEntity(entity, location);
            var action = new AddEntityAction(info, surface);

            surface.EditedWithAction(action);
            surface.ReDrawEntities();
        }
Пример #5
0
        public void Release(ScreenDrawingSurface surface)
        {
            held = false;

            var g = surface.GetToolLayerGraphics();

            if (g != null)
            {
                g.Clear(Color.Transparent);
                surface.ReturnToolLayerGraphics(g);
            }

            int x_start = Math.Min(tx1, tx2);
            int x_end   = Math.Max(tx1, tx2) - 1;
            int y_start = Math.Min(ty1, ty2);
            int y_end   = Math.Max(ty1, ty2) - 1;

            startTiles = new int?[surface.Screen.Width, surface.Screen.Height];
            endTiles   = new int?[surface.Screen.Width, surface.Screen.Height];

            for (int y = y_start; y <= y_end; y += brush.Height)
            {
                for (int x = x_start; x <= x_end; x += brush.Width)
                {
                    Draw(surface, x, y);
                }
            }

            var changes = new List <TileChange>();

            for (int y = 0; y < surface.Screen.Height; y++)
            {
                for (int x = 0; x < surface.Screen.Width; x++)
                {
                    if (startTiles[x, y].HasValue && endTiles[x, y].HasValue && startTiles[x, y].Value != endTiles[x, y].Value)
                    {
                        changes.Add(new TileChange(x, y, startTiles[x, y].Value, endTiles[x, y].Value, surface));
                    }
                }
            }

            if (changes.Count > 0)
            {
                surface.EditedWithAction(new DrawAction("Rectangle", changes, surface));
            }
        }
Пример #6
0
        public void Click(ScreenDrawingSurface surface, Point location)
        {
            var selection = surface.Selection;
            if (selection != null)
            {
                // only paint inside selection
                if (!selection.Value.Contains(location))
                {
                    return;
                }
            }

            int tile_x = location.X / surface.Screen.Tileset.TileSize;
            int tile_y = location.Y / surface.Screen.Tileset.TileSize;

            var old = surface.Screen.TileAt(tile_x, tile_y);

            Flood(surface, tile_x, tile_y, old.Id, 0, 0);

            // need to manually inform the screen surface that I messed with it
            if (changes.Count > 0)
            {
                surface.EditedWithAction(new DrawAction("Fill", changes, surface));
                surface.ReDrawTiles();
            }
            changes.Clear();
        }
Пример #7
0
        public void Release(ScreenDrawingSurface surface)
        {
            if (startTiles == null) return;

            held = false;
            var changes = new List<TileChange>();

            for (int y = 0; y < surface.Screen.Height; y++)
            {
                for (int x = 0; x < surface.Screen.Width; x++)
                {
                    if (startTiles[x, y].HasValue && endTiles[x, y].HasValue && startTiles[x, y].Value != endTiles[x, y].Value)
                    {
                        changes.Add(new TileChange(x, y, startTiles[x, y].Value, endTiles[x, y].Value, surface));
                    }
                }
            }

            if (changes.Count > 0) surface.EditedWithAction(new DrawAction("Brush", changes, surface));
            changes.Clear();
        }
Пример #8
0
        public void Release(ScreenDrawingSurface surface)
        {
            held = false;

            var g = surface.GetToolLayerGraphics();
            if (g != null)
            {
                g.Clear(Color.Transparent);
                surface.ReturnToolLayerGraphics(g);
            }

            int x_start = Math.Min(tx1, tx2);
            int x_end = Math.Max(tx1, tx2) - 1;
            int y_start = Math.Min(ty1, ty2);
            int y_end = Math.Max(ty1, ty2) - 1;

            startTiles = new int?[surface.Screen.Width, surface.Screen.Height];
            endTiles = new int?[surface.Screen.Width, surface.Screen.Height];

            for (int y = y_start; y <= y_end; y += brush.Height)
            {
                for (int x = x_start; x <= x_end; x += brush.Width)
                {
                    Draw(surface, x, y);
                }
            }

            var changes = new List<TileChange>();

            for (int y = 0; y < surface.Screen.Height; y++)
            {
                for (int x = 0; x < surface.Screen.Width; x++)
                {
                    if (startTiles[x, y].HasValue && endTiles[x, y].HasValue && startTiles[x, y].Value != endTiles[x, y].Value)
                    {
                        changes.Add(new TileChange(x, y, startTiles[x, y].Value, endTiles[x, y].Value, surface));
                    }
                }
            }

            if (changes.Count > 0) surface.EditedWithAction(new DrawAction("Rectangle", changes, surface));
        }