public interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
Modifier and Type | Method and Description |
---|---|
void |
addMapManagerListener(MapManagerListener<G,A,R> listener)
Adds a
MapManagerListener to be notified. |
void |
closeMap(MapControl<G,A,R> mapControl)
Closes the given map, ignoring modified status.
|
MapControl<G,A,R> |
getCurrentMap()
Returns the current map.
|
java.io.File |
getLocalMapDir()
Returns a guess for a script directory to use.
|
java.util.List<MapControl<G,A,R>> |
getOpenedMaps()
Returns all opened maps.
|
MapControl<G,A,R> |
getOpenMap()
Returns one open map.
|
MapControl<G,A,R> |
newMap(java.util.List<G> objects,
A mapArchObject,
MapFile mapFile,
boolean interactive)
Creates a new map control without view.
|
MapControl<G,A,R> |
openMapFile(java.io.File file,
boolean interactive)
Loads a map file.
|
MapControl<G,A,R> |
openMapFile(MapFile mapFile,
boolean interactive)
Loads a map file.
|
void |
release(MapControl<G,A,R> mapControl)
Releases a
MapControl instance. |
void |
removeMapManagerListener(MapManagerListener<G,A,R> listener)
Removes a
MapManagerListener to be notified. |
void |
revert(MapControl<G,A,R> mapControl)
Reverts one map.
|
void |
setCurrentMap(MapControl<G,A,R> mapControl)
Sets the given map as the current one.
|
@NotNull MapControl<G,A,R> openMapFile(@NotNull MapFile mapFile, boolean interactive) throws java.io.IOException
release(MapControl)
when not needed anymore.mapFile
- the map file to loadinteractive
- if set, may ask to delete undefined archetypes; if
unset, keep undefined archetypesjava.io.IOException
- if an I/O error occurs@NotNull MapControl<G,A,R> openMapFile(@NotNull java.io.File file, boolean interactive) throws java.io.IOException
release(MapControl)
when not needed anymore.file
- the map file to loadinteractive
- if set, may ask to delete undefined archetypes; if
unset, keep undefined archetypesjava.io.IOException
- if an I/O error occursvoid closeMap(@NotNull MapControl<G,A,R> mapControl)
mapControl
- the map to close@NotNull MapControl<G,A,R> newMap(@Nullable java.util.List<G> objects, @NotNull A mapArchObject, @Nullable MapFile mapFile, boolean interactive)
release(MapControl)
when not needed anymore.objects
- the game objects to insert; may be null
mapArchObject
- the map arch object for the new mapmapFile
- the map file, or null
if the map was not yet
savedinteractive
- if set, the new map becomes the current mapvoid setCurrentMap(@Nullable MapControl<G,A,R> mapControl)
mapControl
- the MapControl
of the new current map@NotNull java.util.List<MapControl<G,A,R>> getOpenedMaps()
@Nullable MapControl<G,A,R> getCurrentMap()
@Nullable MapControl<G,A,R> getOpenMap()
null
if no open maps existvoid addMapManagerListener(@NotNull MapManagerListener<G,A,R> listener)
MapManagerListener
to be notified.listener
- the listener to addvoid removeMapManagerListener(@NotNull MapManagerListener<G,A,R> listener)
MapManagerListener
to be notified.listener
- the listener to removevoid revert(@NotNull MapControl<G,A,R> mapControl) throws java.io.IOException
mapControl
- the map to revertjava.io.IOException
- if an I/O error occursjava.io.File getLocalMapDir()
void release(@NotNull MapControl<G,A,R> mapControl)
MapControl
instance.mapControl
- the map control instance