Package net.sf.gridarta.model.resource
Class AbstractResourcesReader<G extends GameObject<G,?,?>>
- java.lang.Object
-
- net.sf.gridarta.model.resource.AbstractResourcesReader<G>
-
- Direct Known Subclasses:
AbstractCollectedResourcesReader,AbstractFilesResourcesReader
public abstract class AbstractResourcesReader<G extends GameObject<G,?,?>> extends java.lang.ObjectAbstract base class for archetype set loader classes.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractResourcesReader(@NotNull java.io.File collectedDirectory, @Nullable java.lang.String imageSet, @NotNull AnimationObjects animationObjects, @NotNull FaceObjects faceObjects)Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddPNGFace(@NotNull java.lang.String filename, @NotNull java.lang.String path, @NotNull java.lang.String name, @NotNull ErrorView errorView, @NotNull ArchFaceProvider archFaceProvider)Loads a png from the file, convert it to IconImage and attach it to the face list.protected voidloadAnimationsFromCollect(@NotNull ErrorView errorView, @NotNull java.util.Map<java.lang.String,java.lang.String> animations, @NotNull AbstractAnimationObjectsReader animationObjectsReader)Loads all animations from the big collected animations file.protected static @NotNull java.util.Map<java.lang.String,java.lang.String>loadAnimTree(@NotNull java.net.URL url)Loads animations from a file.abstract @NotNull FaceProviderread(@NotNull ErrorView errorView, @NotNull java.util.List<G> invObjects)Reads the resources.
-
-
-
Constructor Detail
-
AbstractResourcesReader
protected AbstractResourcesReader(@NotNull @NotNull java.io.File collectedDirectory, @Nullable @Nullable java.lang.String imageSet, @NotNull @NotNull AnimationObjects animationObjects, @NotNull @NotNull FaceObjects faceObjects)Creates a new instance.- Parameters:
collectedDirectory- the collected directoryimageSet- the active image set ornullanimationObjects- the animation objects instancefaceObjects- the face objects instance
-
-
Method Detail
-
loadAnimationsFromCollect
protected void loadAnimationsFromCollect(@NotNull @NotNull ErrorView errorView, @NotNull @NotNull java.util.Map<java.lang.String,java.lang.String> animations, @NotNull @NotNull AbstractAnimationObjectsReader animationObjectsReader)Loads all animations from the big collected animations file.- Parameters:
errorView- the error view for reporting errorsanimations- maps animation name to animation pathanimationObjectsReader- the animation objects reader instance to use
-
addPNGFace
protected void addPNGFace(@NotNull @NotNull java.lang.String filename, @NotNull @NotNull java.lang.String path, @NotNull @NotNull java.lang.String name, @NotNull @NotNull ErrorView errorView, @NotNull @NotNull ArchFaceProvider archFaceProvider)Loads a png from the file, convert it to IconImage and attach it to the face list.- Parameters:
filename- the filename, an absolute pathpath- the path name ofnamename- the name of the png (e.g. blocked.111.png)errorView- the error view to usearchFaceProvider- the arch face provider to add to
-
read
@NotNull public abstract @NotNull FaceProvider read(@NotNull @NotNull ErrorView errorView, @NotNull @NotNull java.util.List<G> invObjects)
Reads the resources.- Parameters:
errorView- the error view for reporting problemsinvObjects- all read archetypes are added to this list- Returns:
- the face provider for accessing the read faces
-
loadAnimTree
@NotNull protected static @NotNull java.util.Map<java.lang.String,java.lang.String> loadAnimTree(@NotNull @NotNull java.net.URL url) throws java.io.IOExceptionLoads animations from a file.- Parameters:
url- the URL to load animations tree from- Returns:
- a map from animation name to animation path
- Throws:
java.io.IOException- in case of I/O errorsjava.io.FileNotFoundException- in case the file couldn't be opened
-
-