Пример #1
0
        public void End(Point tile)
        {
            if (region == null)
            {
                return;
            }

            EditorExtensionNode node = form.SelectedSquareType();

            if (node != null)
            {
                foreach (Point p in Line(start, tile))
                {
                    Vector3 loc = new Vector3(p.X + form.Map.View.X,
                                              p.Y + form.Map.View.Y, form.Map.View.Z);
                    AbstractSquare sq = (AbstractSquare)node.CreateInstance();
                    change.AddOperation(form.Map.GetSafeSquare(loc), sq, loc);
                    form.Map.SetSquare(loc, sq);
                }
            }
            if (change.Count > 0)
            {
                form.UndoRedo.AddChange(change);
            }

            change = null;

            region.Invalidate();

            region.Dispose();
            region = null;

            form.Map.ViewFrom(form.Map.View, true);
        }
Пример #2
0
        public override void End(Point tile)
        {
            base.End(tile);

            EditorExtensionNode node = form.SelectedSquareType();

            if (node != null)
            {
                for (int y = border.Location.Y; y < border.Location.Y + border.Size.Height; ++y)
                {
                    for (int x = border.Location.X; x < border.Location.X + border.Size.Width; ++x)
                    {
                        if (fill ||
                            (x == border.Location.X || x == border.Location.X + border.Size.Width - 1 ||
                             y == border.Location.Y || y == border.Location.Y + border.Size.Height - 1))
                        {
                            AbstractSquare sq  = (AbstractSquare)node.CreateInstance();
                            Vector3        loc = new Vector3(x + form.Map.View.x,
                                                             y + form.Map.View.y, form.Map.View.z);

                            change.AddOperation(form.Map.GetSafeSquare(loc), sq, loc);
                            form.Map.SetSquare(loc, sq);
                        }
                    }
                }
            }
            if (change.Count > 0)
            {
                form.UndoRedo.AddChange(change);
            }

            change = null;
            form.Map.ViewFrom(form.Map.View, true);
        }
Пример #3
0
        public void Run(Point tile)
        {
            if (tile != lastloc)
            {
                Vector3 squareloc = new Vector3(tile.X + form.Map.View.X,
                                                tile.Y + form.Map.View.Y, form.Map.View.Z);
                EditorExtensionNode node = form.SelectedSquareType();
                if (node != null)
                {
                    AbstractSquare sq = (AbstractSquare)node.CreateInstance();
                    change.AddOperation(form.Map.GetSafeSquare(squareloc), sq, squareloc);
                    form.Map.SetSquare(squareloc, sq);
                }
                form.Map.InvalidateTiles(new Rectangle(tile, new Size(1, 1)));
                form.Map.ViewFrom(form.Map.View, true);

                lastloc = tile;
            }
        }
Пример #4
0
        public void End(Point tile)
        {
            Vector3 start = new Vector3(tile.X + form.Map.View.X,
                                        tile.Y + form.Map.View.Y, form.Map.View.Z);
            EditorExtensionNode node = form.SelectedSquareType();
            AbstractSquare      sq   = form.Map.GetSafeSquare(start);

            if (sq != null && node != null && !sq.GetType().Equals(node.Type))
            {
                foreach (Vector3 v in Flood(form.Map, start))
                {
                    AbstractSquare square = (AbstractSquare)node.CreateInstance();
                    change.AddOperation(form.Map.GetSafeSquare(v), square, v);
                    form.Map.SetSquare(v, square);
                }
            }
            form.Map.ViewFrom(form.Map.View, true);
            if (change.Count > 0)
            {
                form.UndoRedo.AddChange(change);
            }
            change = null;
        }