20 package net.sf.gridarta.model.resource;
22 import java.io.BufferedReader;
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.io.InputStreamReader;
27 import java.io.Reader;
29 import java.util.Collections;
30 import java.util.List;
44 import org.apache.log4j.Category;
45 import org.apache.log4j.Logger;
46 import org.jetbrains.annotations.NotNull;
47 import org.jetbrains.annotations.Nullable;
108 protected AbstractCollectedResourcesReader(@NotNull
final File collectedDirectory, @Nullable
final String
imageSet, @NotNull
final ArchetypeSet<G, A, R> archetypeSet, @NotNull
final AbstractArchetypeParser<G, A, R, ?> archetypeParser, @NotNull
final AnimationObjects animationObjects, @NotNull
final FaceObjects faceObjects, @NotNull
final String animTreeFile, @NotNull
final String archetypesFile) {
109 super(collectedDirectory, imageSet, animationObjects, faceObjects);
123 Map<String, String> animations = null;
128 }
catch (
final IOException ex) {
131 }
catch (
final IOException ex) {
149 try (InputStream inputStream = url.openStream()) {
151 try (BufferedReader bufferedReader =
new BufferedReader(reader)) {
156 }
catch (
final IOException ex) {
160 if (LOG.isInfoEnabled()) {
161 LOG.info(
"Loaded " + (archetypeSet.
getArchetypeCount() - archetypeCount) +
" archetypes from '" + url +
"'.");
163 }
catch (
final IOException ex) {
Convenience class for adding messages to a ErrorView instance using a fixed category name...
Abstract base class for AbstractResourcesReaders that read from collected files.
FaceProvider loadFacesCollection(@NotNull final ErrorView errorView)
Loads all faces.
Reading and writing of maps, handling of paths.
static final String MAP_ENCODING
Encoding to use for maps and other data.
Gridarta can handle frame information of animations and allow the selection of an animation using a t...
This interface represents a lazy loader that provides images on demand.
final AbstractArchetypeParser< G, A, R, ?> archetypeParser
The AbstractArchetypeParser to use.
void loadAnimationsFromCollect( @NotNull final ErrorView errorView, @NotNull final Map< String, String > animations)
Loads all animations from the big collected animations file.
final String animTreeFile
The name of the animation tree information file.
Defines possible error categories for ErrorView instances.
FaceProvider loadFacesCollection(@NotNull ErrorView errorView, @NotNull File collectedDirectory)
Loads all faces from a png collection file.
final AnimationObjects animationObjects
The animation objects instance.
Interface for classes displaying error messages.
Base package of all Gridarta classes.
void loadAnimations(@NotNull final ErrorView errorView)
Loads all animations.
Reflects a game object (object on a map).
int getArchetypeCount()
Returns the number of Archetypes available.
Utility-class for Gridarta's I/O.
AbstractCollectedResourcesReader(@NotNull final File collectedDirectory, @Nullable final String imageSet, @NotNull final ArchetypeSet< G, A, R > archetypeSet, @NotNull final AbstractArchetypeParser< G, A, R, ?> archetypeParser, @NotNull final AnimationObjects animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final String animTreeFile, @NotNull final String archetypesFile)
Creates a new instance.
AnimationObjects is a container for AnimationObjects.
final String archetypesFile
The name of the collected archetypes file.
GameObjects are the objects based on Archetypes found on maps.
void loadArchetypes(@NotNull final ErrorView errorView, @NotNull final List< G > invObjects)
Loads all archetypes.
void parseArchetypeFromStream(@NotNull final BufferedReader in, @Nullable final R prototype, @Nullable final String line, @Nullable final String archName, @NotNull final String panelName, @NotNull final String folderName, @NotNull final String archPath, @NotNull final List< G > invObjects, @NotNull final ErrorViewCollector errorViewCollector)
static URL getResource(@Nullable final File dir, @NotNull final String fileName)
Get the URL of a resource.
final String imageSet
The current image set.
FaceObjects is a container for FaceObjects.
static final Category LOG
The logger for printing log messages.
static Map< String, String > loadAnimTree( @NotNull final URL url)
Loads animations from a file.
final ArchetypeSet< G, A, R > archetypeSet
The ArchetypeSet to update.
final FaceObjects faceObjects
The FaceObjects instance.
The face is the appearance of an object.
Interface that captures similarities between different ArchetypeSet implementations.
Abstract base class for archetype set loader classes.
Abstract base implementation of ArchetypeParser.
void setLoadedFromArchive(boolean loadedFromArchive)
Sets whether Archetypes were loaded from an archive.
Interface for MapArchObjects.
final File collectedDirectory
The collected directory.