Ejemplo n.º 1
0
        public MapRegionView(MapRegion MapRegion, TileRenderer Renderer)
        {
            this.MapRegion = MapRegion;
            _Text          = new Text(MapRegion.Name, Renderer.FontFace, 32);
            _Text.Color    = Renderer.FontColor;
            _Text.Scale    = new Vector2f(1f / 128, 1f / 128);

            MapRegion.OnChange += (sender, e) => Update();
            Update();
        }
Ejemplo n.º 2
0
        void HandleAddMapRegion(object Sender, ValuedEventArgs <string> E)
        {
            var m = new MapRegion {
                Name = E.Value
            };

            m.OnChange += HandleRegionChanged;
            _EditScreen.MapView.Map.Regions.Add(m);
            _EditScreen.MapView.MapRegions.Add(new MapRegionView(m, _EditScreen.MapView.TileRenderer));
            _EditPane.UpdateFromMap(_EditScreen.MapView.Map);
            UnHighlight();

            _EditScreen.PaneLayer.Remove(_NewRegionPane);
            _NewRegionPane = null;
        }
Ejemplo n.º 3
0
        internal void CopyTo(Map From, int X, int Y, bool Invert)
        {
            var max = new Coordinate(From.Tiles.GetLength(0), From.Tiles.GetLength(1));

            foreach (MapRegion m in From.Regions)
            {
                var copy = Regions.FirstOrDefault(i => i.Name == m.Name);
                if (copy == null)
                {
                    copy = new MapRegion {
                        Name = m.Name
                    }
                }
                ;
                foreach (Tile t in m.Tiles)
                {
                    var c = TransformCoordinate(t.Coordinate, new Coordinate(X, Y), max, Invert);
                    copy.Add(Tiles[c.X + X, c.Y + Y]);
                }
                Regions.Add(copy);
            }

            for (int i = 0; i < From.Tiles.GetLength(0); ++i)
            {
                for (int j = 0; j < From.Tiles.GetLength(1); ++j)
                {
                    var c = TransformCoordinate(new Coordinate(i, j), new Coordinate(X, Y), max, Invert);
                    if (c.X < From.Tiles.GetLength(0) && c.X >= 0)
                    {
                        Tile t = From.Tiles[c.X, c.Y];
                        Tiles[X + i, Y + j].Configuration.Merge(new TileConfiguration(
                                                                    t.Configuration, Invert));
                    }
                }
            }
        }

        Coordinate TransformCoordinate(Coordinate Coordinate, Coordinate Offset, Coordinate Max, bool Invert)
        {
            return(Invert ? new Coordinate(
                       Max.X - Coordinate.X - 1 - ((Offset.X + Coordinate.Y) % 2 == 0 ? 1 : 0),
                       Max.Y - Coordinate.Y - 1)
                                                                        : Coordinate);
        }
Ejemplo n.º 4
0
 public static string Describe(MapRegion Region)
 {
     return(Region.Name);
 }