public abstract class AbstractMapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.Object implements MapManager<G,A,R>
MapManager
implementations.Modifier | Constructor and Description |
---|---|
protected |
AbstractMapManager(@NotNull MapReaderFactory<G,A> mapReaderFactory,
@NotNull ProjectSettings projectSettings,
@NotNull FaceObjectProviders faceObjectProviders,
@NotNull PathManager pathManager)
Creates a instance.
|
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.
|
protected abstract @NotNull MapControl<G,A,R> |
createMapControl(@Nullable java.util.List<G> objects,
A mapArchObject,
@Nullable MapFile mapFile)
Creates a new
MapControl instance. |
@Nullable MapControl<G,A,R> |
getCurrentMap()
Returns the current top map we are working with.
|
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.
|
void |
setFileControl(@NotNull FileControl<G,A,R> fileControl)
Deprecated.
|
protected AbstractMapManager(@NotNull @NotNull MapReaderFactory<G,A> mapReaderFactory, @NotNull @NotNull ProjectSettings projectSettings, @NotNull @NotNull FaceObjectProviders faceObjectProviders, @NotNull @NotNull PathManager pathManager)
mapReaderFactory
- the map reader factory instanceprojectSettings
- the project settings instancefaceObjectProviders
- the face object providerspathManager
- the path manager for converting file instances@Deprecated public void setFileControl(@NotNull @NotNull FileControl<G,A,R> fileControl)
@NotNull public @NotNull MapControl<G,A,R> newMap(@Nullable @Nullable java.util.List<G> objects, @NotNull A mapArchObject, @Nullable @Nullable MapFile mapFile, boolean interactive)
MapManager
MapManager.release(MapControl)
when not needed anymore.newMap
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
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 map@NotNull protected abstract @NotNull MapControl<G,A,R> createMapControl(@Nullable @Nullable java.util.List<G> objects, @NotNull A mapArchObject, @Nullable @Nullable MapFile mapFile)
MapControl
instance.objects
- the objects to insert into the new mapmapArchObject
- the map arch object to use for the new mapmapFile
- the associated map file@Nullable public @Nullable MapControl<G,A,R> getOpenMap()
MapManager
getOpenMap
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
null
if no open maps existpublic void closeMap(@NotNull @NotNull MapControl<G,A,R> mapControl)
MapManager
closeMap
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
mapControl
- the map to close@NotNull public @NotNull MapControl<G,A,R> openMapFile(@NotNull @NotNull MapFile mapFile, boolean interactive) throws java.io.IOException
MapManager
MapManager.release(MapControl)
when not needed anymore.openMapFile
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
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 public @NotNull MapControl<G,A,R> openMapFile(@NotNull @NotNull java.io.File file, boolean interactive) throws java.io.IOException
MapManager
MapManager.release(MapControl)
when not needed anymore.openMapFile
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
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 occurspublic void setCurrentMap(@Nullable @Nullable MapControl<G,A,R> mapControl)
MapManager
setCurrentMap
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
mapControl
- the MapControl
of the new current map@NotNull public @NotNull java.util.List<MapControl<G,A,R>> getOpenedMaps()
MapManager
getOpenedMaps
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
@Nullable public @Nullable MapControl<G,A,R> getCurrentMap()
getCurrentMap
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
null
if no
map is openpublic void addMapManagerListener(@NotNull @NotNull MapManagerListener<G,A,R> listener)
MapManager
MapManagerListener
to be notified.addMapManagerListener
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
listener
- the listener to addpublic void removeMapManagerListener(@NotNull @NotNull MapManagerListener<G,A,R> listener)
MapManager
MapManagerListener
to be notified.removeMapManagerListener
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
listener
- the listener to removepublic void revert(@NotNull @NotNull MapControl<G,A,R> mapControl) throws java.io.IOException
MapManager
revert
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
mapControl
- the map to revertjava.io.IOException
- if an I/O error occurspublic java.io.File getLocalMapDir()
MapManager
getLocalMapDir
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void release(@NotNull @NotNull MapControl<G,A,R> mapControl)
MapManager
MapControl
instance.release
in interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
mapControl
- the map control instance