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(@NotNull MapManagerListener<G,A,R> listener)
Adds a
MapManagerListener to be notified. |
void |
closeMap(@NotNull MapControl<G,A,R> mapControl)
Closes the given map, ignoring modified status.
|
@Nullable MapControl<G,A,R> |
getCurrentMap()
Returns the current map.
|
java.io.File |
getLocalMapDir()
Returns a guess for a script directory to use.
|
@NotNull java.util.List<MapControl<G,A,R>> |
getOpenedMaps()
Returns all opened maps.
|
@Nullable MapControl<G,A,R> |
getOpenMap()
Returns one open map.
|
@NotNull MapControl<G,A,R> |
newMap(@Nullable java.util.List<G> objects,
A mapArchObject,
@Nullable MapFile mapFile,
boolean interactive)
Creates a new map control without view.
|
@NotNull MapControl<G,A,R> |
openMapFile(@NotNull java.io.File file,
boolean interactive)
Loads a map file.
|
@NotNull MapControl<G,A,R> |
openMapFile(@NotNull MapFile mapFile,
boolean interactive)
Loads a map file.
|
void |
release(@NotNull MapControl<G,A,R> mapControl)
Releases a
MapControl instance. |
void |
removeMapManagerListener(@NotNull MapManagerListener<G,A,R> listener)
Removes a
MapManagerListener to be notified. |
void |
revert(@NotNull MapControl<G,A,R> mapControl)
Reverts one map.
|
void |
setCurrentMap(@Nullable MapControl<G,A,R> mapControl)
Sets the given map as the current one.
|
@NotNull @NotNull MapControl<G,A,R> openMapFile(@NotNull @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 @NotNull MapControl<G,A,R> openMapFile(@NotNull @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 @NotNull MapControl<G,A,R> mapControl)
mapControl
- the map to close@NotNull @NotNull MapControl<G,A,R> newMap(@Nullable @Nullable java.util.List<G> objects, @NotNull A mapArchObject, @Nullable @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 @Nullable MapControl<G,A,R> mapControl)
mapControl
- the MapControl
of the new current map@NotNull @NotNull java.util.List<MapControl<G,A,R>> getOpenedMaps()
@Nullable @Nullable MapControl<G,A,R> getCurrentMap()
@Nullable @Nullable MapControl<G,A,R> getOpenMap()
null
if no open maps existvoid addMapManagerListener(@NotNull @NotNull MapManagerListener<G,A,R> listener)
MapManagerListener
to be notified.listener
- the listener to addvoid removeMapManagerListener(@NotNull @NotNull MapManagerListener<G,A,R> listener)
MapManagerListener
to be notified.listener
- the listener to removevoid revert(@NotNull @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 @NotNull MapControl<G,A,R> mapControl)
MapControl
instance.mapControl
- the map control instance