Hello manmap,
Cities expose an API to access its information:
- The most immediate access is directly through the "cities" list which provides you a complete list of City objects in the asset (+1200).
Each City object has a name, country which belongs to, metro population (city + surroundings) and unity2DLocation which defines its location over the plane. EDIT: APIs are also included for lat/lon conversion. - In addition to this you have several APIs like GetCityIndex (name), GetCityNames (retrieves a complete list of names), FlyToCity (to navigate to that city location).
2D Edition includes an editor to modify the frontiers and cities. You can add new cities, rename, move or delete any of them. All editing occurs in editor time and affects the included catalog (backup functionality is included).
At runtime you can simply make any modifications to the Cities list, serialize the list or copy its fields to a comma separated string and save it into the resource you want (text file, database, ...), and later load it replacing the cities list and calling Redraw() method to update their representation on the globe. That's all. We don't provide loading/saving changes during runtime because each user has their own formats/requirements but it's quite straightforward.
For instance, to get a string with all cities info you could do:
/// <summary>
/// Exports the geographic data in packed string format.
/// </summary>
public string GetCityGeoData () {
StringBuilder sb = new StringBuilder ();
for (int k=0; k<map.cities.Count; k++) {
City city = map.cities[k];
if (k > 0)
sb.Append ("|");
sb.Append (city.name + "$");
sb.Append (city.country + "$");
sb.Append (city.population + "$");
sb.Append (city.unity2DLocation.x + "$");
sb.Append (city.unity2DLocation.y);
}
return sb.ToString ();
}