示例#1
0
 internal void Add(PaintActionList paintActions)
 {
     foreach (PaintAction paintAction in paintActions)
     {
         _actions.Add(paintAction);
     }
 }
示例#2
0
文件: Map.cs 项目: gmoller/MapEditor
        internal void FillBetween(int layerId, byte?paletteId, byte?imageId, Point start, Point end)
        {
            CellPainter     cellPainter  = CellPainterFactory.GetCellPainter(start, end);
            PaintActionList paintActions = cellPainter.Paint(layerId, paletteId, imageId, this);

            _undoLog.Push(paintActions);
        }
示例#3
0
        internal override PaintActionList Paint(int layer, byte?selectedPaletteId, byte?selectedImageId, Map map)
        {
            PaintActionList paintActionList = new PaintActionList();
            Cell            oldCell         = FillCell(StartCell, layer, selectedPaletteId, selectedImageId, map);

            paintActionList.Add(layer, StartCell.X, StartCell.Y, (byte)oldCell.PaletteId, (byte)oldCell.TileId);

            return(paintActionList);
        }
示例#4
0
        internal override PaintActionList Paint(int layer, byte?selectedPaletteId, byte?selectedImageId, Map map)
        {
            PaintActionList paintActionList = new PaintActionList();
            Point           currentCell     = StartCell;

            do
            {
                Cell oldCell = FillCell(currentCell, layer, selectedPaletteId, selectedImageId, map);
                paintActionList.Add(layer, currentCell.X, currentCell.Y, (byte)oldCell.PaletteId, (byte)oldCell.TileId);
                currentCell.X--;
            } while (currentCell.X >= EndCell.X);

            return(paintActionList);
        }
示例#5
0
文件: Map.cs 项目: gmoller/MapEditor
        internal void Redo()
        {
            if (_redoLog.Count > 0)
            {
                PaintActionList paintActions = _redoLog.Pop();

                PaintActionList undoActionList = new PaintActionList();
                // undo that action
                foreach (PaintAction paintAction in paintActions)
                {
                    CellPainter     cellPainter     = CellPainterFactory.GetCellPainter(new Point(paintAction.X, paintAction.Y), new Point(paintAction.X, paintAction.Y));
                    PaintActionList paintActionList = cellPainter.Paint(paintAction.Layer, paintAction.PaletteId, paintAction.ImageId, this);
                    undoActionList.Add(paintActionList);
                }

                _undoLog.Push(undoActionList);
            }
        }
示例#6
0
文件: Map.cs 项目: gmoller/MapEditor
        internal void Undo()
        {
            // pop most recent action off stack
            if (_undoLog.Count > 0)
            {
                PaintActionList paintActions = _undoLog.Pop();

                PaintActionList redoActionList = new PaintActionList();
                // undo that action
                foreach (PaintAction paintAction in paintActions)
                {
                    CellPainter     cellPainter     = CellPainterFactory.GetCellPainter(new Point(paintAction.X, paintAction.Y), new Point(paintAction.X, paintAction.Y));
                    PaintActionList paintActionList = cellPainter.Paint(paintAction.Layer, paintAction.PaletteId, paintAction.ImageId, this);
                    redoActionList.Add(paintActionList);
                }

                _redoLog.Push(redoActionList);
            }
        }