Class EnterMap<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>


  • public class EnterMap<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>
    extends java.lang.Object
    Helper class for entering maps.
    • Constructor Summary

      Constructors 
      Constructor Description
      EnterMap​(@NotNull java.awt.Component parent, @NotNull Direction @NotNull [] directionMap, @NotNull FileControl<G,​A,​R> fileControl, @NotNull MapViewsManager<G,​A,​R> mapViewsManager)
      Creates a new instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static @NotNull java.awt.Point calculateNewCursorLocation​(@NotNull java.awt.Point oldCursorLocation, @NotNull Size2D mapSize, @NotNull Direction direction)
      Calculate the map cursor location for the new viewport.
      boolean enterExit​(@NotNull MapView<G,​A,​R> mapView, @NotNull GameObject<G,​A,​R> exit, boolean allowRandomMapParameters)
      Opens the map an exit game object points to.
      boolean enterMap​(@NotNull MapView<G,​A,​R> mapView, @NotNull MapPath mapPath, @NotNull Direction direction, @Nullable java.awt.Point destinationPoint)
      Enters a map wanted.
      boolean enterMap​(@Nullable MapView<G,​A,​R> mapView, @NotNull MapFile mapFile, @Nullable java.awt.Point destinationPoint, @NotNull Direction direction)
      Enters a map.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EnterMap

        public EnterMap​(@NotNull
                        @NotNull java.awt.Component parent,
                        @NotNull
                        @NotNull Direction @NotNull [] directionMap,
                        @NotNull
                        @NotNull FileControl<G,​A,​R> fileControl,
                        @NotNull
                        @NotNull MapViewsManager<G,​A,​R> mapViewsManager)
        Creates a new instance.
        Parameters:
        parent - the component for showing dialog boxes
        directionMap - maps relative direction to map window direction
        fileControl - the file control
        mapViewsManager - the map views
    • Method Detail

      • enterMap

        public boolean enterMap​(@NotNull
                                @NotNull MapView<G,​A,​R> mapView,
                                @NotNull
                                @NotNull MapPath mapPath,
                                @NotNull
                                @NotNull Direction direction,
                                @Nullable
                                @Nullable java.awt.Point destinationPoint)
        Enters a map wanted.
        Parameters:
        mapView - the map view to leave
        mapPath - path to map that should be loaded
        direction - the direction to go
        destinationPoint - the desired destination point on the map (pass null if unknown, and note that the point gets modified)
        Returns:
        whether the destination map has been entered
      • enterMap

        public boolean enterMap​(@Nullable
                                @Nullable MapView<G,​A,​R> mapView,
                                @NotNull
                                @NotNull MapFile mapFile,
                                @Nullable
                                @Nullable java.awt.Point destinationPoint,
                                @NotNull
                                @NotNull Direction direction)
        Enters a map.
        Parameters:
        mapView - the current map view; may be closed it non-null
        mapFile - the map file to enter
        destinationPoint - the desired destination point on the map or null for default
        direction - the direction to go
        Returns:
        whether the destination map has been entered
      • enterExit

        public boolean enterExit​(@NotNull
                                 @NotNull MapView<G,​A,​R> mapView,
                                 @NotNull
                                 @NotNull GameObject<G,​A,​R> exit,
                                 boolean allowRandomMapParameters)
        Opens the map an exit game object points to.
        Parameters:
        mapView - the map view to leave
        exit - the game object
        allowRandomMapParameters - whether exit paths may point to random maps
        Returns:
        whether the destination map could be opened
      • calculateNewCursorLocation

        @NotNull
        public static @NotNull java.awt.Point calculateNewCursorLocation​(@NotNull
                                                                         @NotNull java.awt.Point oldCursorLocation,
                                                                         @NotNull
                                                                         @NotNull Size2D mapSize,
                                                                         @NotNull
                                                                         @NotNull Direction direction)
        Calculate the map cursor location for the new viewport.
        Parameters:
        oldCursorLocation - the old cursor location
        mapSize - the size of the new map
        direction - the direction to scroll
        Returns:
        the new map cursor location