/// <summary> /// Creates a new <see cref="MapInstance"/>. /// </summary> /// <param name="id">Map Id.</param> /// <param name="name">Map name.</param> /// <param name="worldInformations">Map world informations.</param> /// <param name="mapFactory">Map factory.</param> public MapInstance(int id, string name, WldFileInformations worldInformations, IMapFactory mapFactory) { Id = id; Name = name; MapInformation = worldInformations; _mapFactory = mapFactory; _layers = new ConcurrentDictionary <int, IMapLayer>(); }
/// <summary> /// Loads the world map informations from the WLD file. /// </summary> public void LoadWld() { string wldFilePath = Path.Combine(this._mapPath, $"{this.Name}.wld"); using (var wldFile = new WldFile(wldFilePath)) { this._worldInformations = wldFile.WorldInformations; } }
/// <inheritdoc /> public IMapInstance Create(string mapPath, string mapName, int mapId) { WldFileInformations worldInformations = LoadWld(mapPath, mapName); var mapInstance = ActivatorUtilities.CreateInstance <MapInstance>(_serviceProvider, mapId, mapName, worldInformations); LoadDyo(mapPath, mapInstance); LoadRgn(mapPath, mapInstance); mapInstance.CreateMapLayer(); return(mapInstance); }