public Map(string JSONFileName) { dynamic mapInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <dynamic>(File.ReadAllText(JSONFileName)); Bounds = new Point((int)mapInfo.Width, (int)mapInfo.Height); Grid = new MapTile[Bounds.X, Bounds.Y]; Number = (int)mapInfo.Number; Name = (string)mapInfo.Name; string lodMapName = $"lod{mapInfo.Number}.map"; string directory = Path.GetDirectoryName(JSONFileName); string lodMapPath = directory + "\\" + lodMapName; ReadFile(lodMapPath); TabMap = new TabMap(this); Floor = new FloorLayer(TabMap); TabMap.Layers.Add(Floor); Grid.Action( (x, y, mapTile) => { mapTile.OnMapLoaded(); mapTile.Register(); mapTile.RegisterLayers(Floor); } ); PathFinder = new PathFinder(this); Loaded = true; }
public FloorLayer(TabMap TabMap) { this.TabMap = TabMap; LayerHeights = new int[] { 100 }; }