mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
Renamed asset folder to resource, made resourceLoader more robust. Completed some TODO's, formatting
This commit is contained in:
1
.idea/dictionaries/project.xml
generated
1
.idea/dictionaries/project.xml
generated
@@ -13,6 +13,7 @@
|
|||||||
<w>toop</w>
|
<w>toop</w>
|
||||||
<w>vmoptions</w>
|
<w>vmoptions</w>
|
||||||
<w>xplugin</w>
|
<w>xplugin</w>
|
||||||
|
<w>yourturn</w>
|
||||||
</words>
|
</words>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
</component>
|
</component>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package org.toop;
|
package org.toop;
|
||||||
|
|
||||||
import org.toop.app.App;
|
import org.toop.app.App;
|
||||||
import org.toop.framework.asset.ResourceLoader;
|
|
||||||
import org.toop.framework.asset.ResourceManager;
|
|
||||||
import org.toop.framework.audio.SoundManager;
|
import org.toop.framework.audio.SoundManager;
|
||||||
import org.toop.framework.networking.NetworkingClientManager;
|
import org.toop.framework.networking.NetworkingClientManager;
|
||||||
import org.toop.framework.networking.NetworkingInitializationException;
|
import org.toop.framework.networking.NetworkingInitializationException;
|
||||||
|
import org.toop.framework.resource.ResourceLoader;
|
||||||
|
import org.toop.framework.resource.ResourceManager;
|
||||||
|
|
||||||
public final class Main {
|
public final class Main {
|
||||||
static void main(String[] args) {
|
static void main(String[] args) {
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import javafx.stage.Stage;
|
|||||||
import org.toop.app.layer.Layer;
|
import org.toop.app.layer.Layer;
|
||||||
import org.toop.app.layer.layers.MainLayer;
|
import org.toop.app.layer.layers.MainLayer;
|
||||||
import org.toop.app.layer.layers.QuitPopup;
|
import org.toop.app.layer.layers.QuitPopup;
|
||||||
import org.toop.framework.asset.ResourceManager;
|
|
||||||
import org.toop.framework.asset.resources.CssAsset;
|
|
||||||
import org.toop.framework.audio.events.AudioEvents;
|
import org.toop.framework.audio.events.AudioEvents;
|
||||||
import org.toop.framework.eventbus.EventFlow;
|
import org.toop.framework.eventbus.EventFlow;
|
||||||
|
import org.toop.framework.resource.ResourceManager;
|
||||||
|
import org.toop.framework.resource.resources.CssAsset;
|
||||||
import org.toop.local.AppContext;
|
import org.toop.local.AppContext;
|
||||||
import org.toop.local.AppSettings;
|
import org.toop.local.AppSettings;
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ public final class App extends Application {
|
|||||||
try {
|
try {
|
||||||
root.getChildren().removeLast();
|
root.getChildren().removeLast();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
IO.println(e);
|
IO.println(e); // TODO: Use logger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import org.toop.app.layer.Container;
|
|||||||
import org.toop.app.layer.NodeBuilder;
|
import org.toop.app.layer.NodeBuilder;
|
||||||
import org.toop.app.layer.Popup;
|
import org.toop.app.layer.Popup;
|
||||||
import org.toop.app.layer.containers.VerticalContainer;
|
import org.toop.app.layer.containers.VerticalContainer;
|
||||||
import org.toop.framework.asset.resources.SettingsAsset;
|
|
||||||
import org.toop.framework.audio.events.AudioEvents;
|
import org.toop.framework.audio.events.AudioEvents;
|
||||||
import org.toop.framework.eventbus.EventFlow;
|
import org.toop.framework.eventbus.EventFlow;
|
||||||
|
import org.toop.framework.resource.resources.SettingsAsset;
|
||||||
import org.toop.local.AppContext;
|
import org.toop.local.AppContext;
|
||||||
import org.toop.local.AppSettings;
|
import org.toop.local.AppSettings;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package org.toop.local;
|
package org.toop.local;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.toop.framework.asset.ResourceManager;
|
import org.toop.framework.resource.ResourceManager;
|
||||||
import org.toop.framework.asset.resources.LocalizationAsset;
|
import org.toop.framework.resource.resources.LocalizationAsset;
|
||||||
|
|
||||||
public class AppContext {
|
public class AppContext {
|
||||||
private static final LocalizationAsset localization = ResourceManager.get("localization");
|
private static final LocalizationAsset localization = ResourceManager.get("localization");
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package org.toop.local;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.toop.app.App;
|
import org.toop.app.App;
|
||||||
import org.toop.framework.asset.resources.SettingsAsset;
|
|
||||||
import org.toop.framework.audio.events.AudioEvents;
|
import org.toop.framework.audio.events.AudioEvents;
|
||||||
import org.toop.framework.eventbus.EventFlow;
|
import org.toop.framework.eventbus.EventFlow;
|
||||||
|
import org.toop.framework.resource.resources.SettingsAsset;
|
||||||
import org.toop.framework.settings.Settings;
|
import org.toop.framework.settings.Settings;
|
||||||
|
|
||||||
public class AppSettings {
|
public class AppSettings {
|
||||||
|
|||||||
@@ -12,191 +12,190 @@ import org.apache.logging.log4j.core.config.LoggerConfig;
|
|||||||
* <p>Provides methods to enable or disable logs globally or per class, with support for specifying
|
* <p>Provides methods to enable or disable logs globally or per class, with support for specifying
|
||||||
* log levels either via {@link Level} enums or string names.
|
* log levels either via {@link Level} enums or string names.
|
||||||
*/
|
*/
|
||||||
// Todo: refactor
|
|
||||||
public final class Logging {
|
public final class Logging {
|
||||||
|
|
||||||
/** Disables all logging globally by setting the root logger level to {@link Level#OFF}. */
|
/** Disables all logging globally by setting the root logger level to {@link Level#OFF}. */
|
||||||
public static void disableAllLogs() {
|
public static void disableAllLogs() {
|
||||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||||
Configuration config = ctx.getConfiguration();
|
Configuration config = ctx.getConfiguration();
|
||||||
LoggerConfig rootLoggerConfig = config.getRootLogger();
|
LoggerConfig rootLoggerConfig = config.getRootLogger();
|
||||||
rootLoggerConfig.setLevel(Level.OFF);
|
rootLoggerConfig.setLevel(Level.OFF);
|
||||||
ctx.updateLoggers();
|
ctx.updateLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Enables all logging globally by setting the root logger level to {@link Level#ALL}. */
|
/** Enables all logging globally by setting the root logger level to {@link Level#ALL}. */
|
||||||
public static void enableAllLogs() {
|
public static void enableAllLogs() {
|
||||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||||
Configuration config = ctx.getConfiguration();
|
Configuration config = ctx.getConfiguration();
|
||||||
LoggerConfig rootLoggerConfig = config.getRootLogger();
|
LoggerConfig rootLoggerConfig = config.getRootLogger();
|
||||||
rootLoggerConfig.setLevel(Level.ALL);
|
rootLoggerConfig.setLevel(Level.ALL);
|
||||||
ctx.updateLoggers();
|
ctx.updateLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables global logging at a specific level by setting the root logger.
|
* Enables global logging at a specific level by setting the root logger.
|
||||||
*
|
*
|
||||||
* @param level the logging level to enable for all logs
|
* @param level the logging level to enable for all logs
|
||||||
*/
|
*/
|
||||||
public static void enableAllLogs(Level level) {
|
public static void enableAllLogs(Level level) {
|
||||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||||
Configuration config = ctx.getConfiguration();
|
Configuration config = ctx.getConfiguration();
|
||||||
LoggerConfig rootLoggerConfig = config.getRootLogger();
|
LoggerConfig rootLoggerConfig = config.getRootLogger();
|
||||||
rootLoggerConfig.setLevel(level);
|
rootLoggerConfig.setLevel(level);
|
||||||
ctx.updateLoggers();
|
ctx.updateLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies whether the provided string corresponds to a valid class name.
|
* Verifies whether the provided string corresponds to a valid class name.
|
||||||
*
|
*
|
||||||
* @param className fully-qualified class name to check
|
* @param className fully-qualified class name to check
|
||||||
* @return true if the class exists, false otherwise
|
* @return true if the class exists, false otherwise
|
||||||
*/
|
*/
|
||||||
private static boolean verifyStringIsActualClass(String className) {
|
private static boolean verifyStringIsActualClass(String className) {
|
||||||
try {
|
try {
|
||||||
Class.forName(className);
|
Class.forName(className);
|
||||||
return true;
|
return true;
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal helper to disable logs for a specific class by name.
|
* Internal helper to disable logs for a specific class by name.
|
||||||
*
|
*
|
||||||
* @param className fully-qualified class name
|
* @param className fully-qualified class name
|
||||||
*/
|
*/
|
||||||
private static void disableLogsForClassInternal(String className) {
|
private static void disableLogsForClassInternal(String className) {
|
||||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||||
Configuration config = ctx.getConfiguration();
|
Configuration config = ctx.getConfiguration();
|
||||||
config.removeLogger(className);
|
config.removeLogger(className);
|
||||||
LoggerConfig specificConfig = new LoggerConfig(className, Level.OFF, false);
|
LoggerConfig specificConfig = new LoggerConfig(className, Level.OFF, false);
|
||||||
config.addLogger(className, specificConfig);
|
config.addLogger(className, specificConfig);
|
||||||
ctx.updateLoggers();
|
ctx.updateLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables logs for a specific class.
|
* Disables logs for a specific class.
|
||||||
*
|
*
|
||||||
* @param class_ the class for which logs should be disabled
|
* @param class_ the class for which logs should be disabled
|
||||||
* @param <T> type of the class
|
* @param <T> type of the class
|
||||||
*/
|
*/
|
||||||
public static <T> void disableLogsForClass(Class<T> class_) {
|
public static <T> void disableLogsForClass(Class<T> class_) {
|
||||||
disableLogsForClassInternal(class_.getName());
|
disableLogsForClassInternal(class_.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables logs for a class specified by fully-qualified name, if the class exists.
|
* Disables logs for a class specified by fully-qualified name, if the class exists.
|
||||||
*
|
*
|
||||||
* @param className fully-qualified class name
|
* @param className fully-qualified class name
|
||||||
*/
|
*/
|
||||||
public static void disableLogsForClass(String className) {
|
public static void disableLogsForClass(String className) {
|
||||||
if (verifyStringIsActualClass(className)) {
|
if (verifyStringIsActualClass(className)) {
|
||||||
disableLogsForClassInternal(className);
|
disableLogsForClassInternal(className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal helper to enable logs for a specific class at a specific level.
|
* Internal helper to enable logs for a specific class at a specific level.
|
||||||
*
|
*
|
||||||
* @param className fully-qualified class name
|
* @param className fully-qualified class name
|
||||||
* @param level logging level to set
|
* @param level logging level to set
|
||||||
*/
|
*/
|
||||||
private static void enableLogsForClassInternal(String className, Level level) {
|
private static void enableLogsForClassInternal(String className, Level level) {
|
||||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||||
Configuration config = ctx.getConfiguration();
|
Configuration config = ctx.getConfiguration();
|
||||||
LoggerConfig loggerConfig = config.getLoggers().get(className);
|
LoggerConfig loggerConfig = config.getLoggers().get(className);
|
||||||
if (loggerConfig == null) {
|
if (loggerConfig == null) {
|
||||||
loggerConfig = new LoggerConfig(className, level, false);
|
loggerConfig = new LoggerConfig(className, level, false);
|
||||||
config.addLogger(className, loggerConfig);
|
config.addLogger(className, loggerConfig);
|
||||||
} else {
|
} else {
|
||||||
loggerConfig.setLevel(level);
|
loggerConfig.setLevel(level);
|
||||||
}
|
}
|
||||||
ctx.updateLoggers();
|
ctx.updateLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables logging for a class at a specific level.
|
* Enables logging for a class at a specific level.
|
||||||
*
|
*
|
||||||
* @param class_ class to configure
|
* @param class_ class to configure
|
||||||
* @param levelToLog the logging level to set
|
* @param levelToLog the logging level to set
|
||||||
* @param <T> type of the class
|
* @param <T> type of the class
|
||||||
*/
|
*/
|
||||||
public static <T> void enableLogsForClass(Class<T> class_, Level levelToLog) {
|
public static <T> void enableLogsForClass(Class<T> class_, Level levelToLog) {
|
||||||
enableLogsForClassInternal(class_.getName(), levelToLog);
|
enableLogsForClassInternal(class_.getName(), levelToLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables logging for a class specified by name at a specific level, if the class exists.
|
* Enables logging for a class specified by name at a specific level, if the class exists.
|
||||||
*
|
*
|
||||||
* @param className fully-qualified class name
|
* @param className fully-qualified class name
|
||||||
* @param levelToLog the logging level to set
|
* @param levelToLog the logging level to set
|
||||||
*/
|
*/
|
||||||
public static void enableLogsForClass(String className, Level levelToLog) {
|
public static void enableLogsForClass(String className, Level levelToLog) {
|
||||||
if (verifyStringIsActualClass(className)) {
|
if (verifyStringIsActualClass(className)) {
|
||||||
enableLogsForClassInternal(className, levelToLog);
|
enableLogsForClassInternal(className, levelToLog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables logging for a class specified by name at a specific level using a string.
|
* Enables logging for a class specified by name at a specific level using a string.
|
||||||
*
|
*
|
||||||
* @param className fully-qualified class name
|
* @param className fully-qualified class name
|
||||||
* @param levelToLog name of the logging level (e.g., "DEBUG", "INFO")
|
* @param levelToLog name of the logging level (e.g., "DEBUG", "INFO")
|
||||||
*/
|
*/
|
||||||
public static void enableLogsForClass(String className, String levelToLog) {
|
public static void enableLogsForClass(String className, String levelToLog) {
|
||||||
Level level = Level.valueOf(levelToLog.trim().toUpperCase());
|
Level level = Level.valueOf(levelToLog.trim().toUpperCase());
|
||||||
if (level != null && verifyStringIsActualClass(className)) {
|
if (level != null && verifyStringIsActualClass(className)) {
|
||||||
enableLogsForClassInternal(className, level);
|
enableLogsForClassInternal(className, level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convenience methods for enabling logs at specific levels for classes. */
|
/** Convenience methods for enabling logs at specific levels for classes. */
|
||||||
public static <T> void enableAllLogsForClass(Class<T> class_) {
|
public static <T> void enableAllLogsForClass(Class<T> class_) {
|
||||||
enableLogsForClass(class_, Level.ALL);
|
enableLogsForClass(class_, Level.ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void enableAllLogsForClass(String className) {
|
public static void enableAllLogsForClass(String className) {
|
||||||
enableLogsForClass(className, Level.ALL);
|
enableLogsForClass(className, Level.ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void enableDebugLogsForClass(Class<T> class_) {
|
public static <T> void enableDebugLogsForClass(Class<T> class_) {
|
||||||
enableLogsForClass(class_, Level.DEBUG);
|
enableLogsForClass(class_, Level.DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void enableDebugLogsForClass(String className) {
|
public static void enableDebugLogsForClass(String className) {
|
||||||
enableLogsForClass(className, Level.DEBUG);
|
enableLogsForClass(className, Level.DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void enableErrorLogsForClass(Class<T> class_) {
|
public static <T> void enableErrorLogsForClass(Class<T> class_) {
|
||||||
enableLogsForClass(class_, Level.ERROR);
|
enableLogsForClass(class_, Level.ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void enableErrorLogsForClass(String className) {
|
public static void enableErrorLogsForClass(String className) {
|
||||||
enableLogsForClass(className, Level.ERROR);
|
enableLogsForClass(className, Level.ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void enableFatalLogsForClass(Class<T> class_) {
|
public static <T> void enableFatalLogsForClass(Class<T> class_) {
|
||||||
enableLogsForClass(class_, Level.FATAL);
|
enableLogsForClass(class_, Level.FATAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void enableFatalLogsForClass(String className) {
|
public static void enableFatalLogsForClass(String className) {
|
||||||
enableLogsForClass(className, Level.FATAL);
|
enableLogsForClass(className, Level.FATAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void enableInfoLogsForClass(Class<T> class_) {
|
public static <T> void enableInfoLogsForClass(Class<T> class_) {
|
||||||
enableLogsForClass(class_, Level.INFO);
|
enableLogsForClass(class_, Level.INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void enableInfoLogsForClass(String className) {
|
public static void enableInfoLogsForClass(String className) {
|
||||||
enableLogsForClass(className, Level.INFO);
|
enableLogsForClass(className, Level.INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void enableTraceLogsForClass(Class<T> class_) {
|
public static <T> void enableTraceLogsForClass(Class<T> class_) {
|
||||||
enableLogsForClass(class_, Level.TRACE);
|
enableLogsForClass(class_, Level.TRACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void enableTraceLogsForClass(String className) {
|
public static void enableTraceLogsForClass(String className) {
|
||||||
enableLogsForClass(className, Level.TRACE);
|
enableLogsForClass(className, Level.TRACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,8 +68,6 @@ public class AudioVolumeManager {
|
|||||||
|
|
||||||
private void handleMusicVolumeChange(AudioEvents.ChangeMusicVolume event) {
|
private void handleMusicVolumeChange(AudioEvents.ChangeMusicVolume event) {
|
||||||
this.musicVolume = limitVolume(event.newVolume() / 100);
|
this.musicVolume = limitVolume(event.newVolume() / 100);
|
||||||
System.out.println(this.musicVolume);
|
|
||||||
System.out.println(this.volume);
|
|
||||||
for (MediaPlayer mediaPlayer : sM.getActiveMusic()) {
|
for (MediaPlayer mediaPlayer : sM.getActiveMusic()) {
|
||||||
this.updateMusicVolume(mediaPlayer);
|
this.updateMusicVolume(mediaPlayer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import javax.sound.sampled.*;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.toop.framework.SnowflakeGenerator;
|
import org.toop.framework.SnowflakeGenerator;
|
||||||
import org.toop.framework.asset.ResourceManager;
|
|
||||||
import org.toop.framework.asset.ResourceMeta;
|
|
||||||
import org.toop.framework.asset.resources.MusicAsset;
|
|
||||||
import org.toop.framework.asset.resources.SoundEffectAsset;
|
|
||||||
import org.toop.framework.audio.events.AudioEvents;
|
import org.toop.framework.audio.events.AudioEvents;
|
||||||
import org.toop.framework.eventbus.EventFlow;
|
import org.toop.framework.eventbus.EventFlow;
|
||||||
|
import org.toop.framework.resource.ResourceManager;
|
||||||
|
import org.toop.framework.resource.ResourceMeta;
|
||||||
|
import org.toop.framework.resource.resources.MusicAsset;
|
||||||
|
import org.toop.framework.resource.resources.SoundEffectAsset;
|
||||||
|
|
||||||
public class SoundManager {
|
public class SoundManager {
|
||||||
private static final Logger logger = LogManager.getLogger(SoundManager.class);
|
private static final Logger logger = LogManager.getLogger(SoundManager.class);
|
||||||
@@ -20,8 +20,6 @@ public class SoundManager {
|
|||||||
private final Queue<MusicAsset> backgroundMusicQueue = new LinkedList<>();
|
private final Queue<MusicAsset> backgroundMusicQueue = new LinkedList<>();
|
||||||
private final Map<Long, Clip> activeSoundEffects = new HashMap<>();
|
private final Map<Long, Clip> activeSoundEffects = new HashMap<>();
|
||||||
private final HashMap<String, SoundEffectAsset> audioResources = new HashMap<>();
|
private final HashMap<String, SoundEffectAsset> audioResources = new HashMap<>();
|
||||||
private final SnowflakeGenerator idGenerator =
|
|
||||||
new SnowflakeGenerator(); // TODO: Don't create a new generator
|
|
||||||
private final AudioVolumeManager audioVolumeManager = new AudioVolumeManager(this);
|
private final AudioVolumeManager audioVolumeManager = new AudioVolumeManager(this);
|
||||||
|
|
||||||
public SoundManager() {
|
public SoundManager() {
|
||||||
@@ -120,7 +118,9 @@ public class SoundManager {
|
|||||||
logger.info("Playing background music: {}", ma.getFile().getName());
|
logger.info("Playing background music: {}", ma.getFile().getName());
|
||||||
logger.info(
|
logger.info(
|
||||||
"Background music next in line: {}",
|
"Background music next in line: {}",
|
||||||
backgroundMusicQueue.peek() != null ? backgroundMusicQueue.peek().getFile().getName() : null);
|
backgroundMusicQueue.peek() != null
|
||||||
|
? backgroundMusicQueue.peek().getFile().getName()
|
||||||
|
: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private long playSound(String audioFileName, boolean loop)
|
private long playSound(String audioFileName, boolean loop)
|
||||||
@@ -149,10 +149,10 @@ public class SoundManager {
|
|||||||
logger.debug("Playing sound: {}", asset.getFile().getName());
|
logger.debug("Playing sound: {}", asset.getFile().getName());
|
||||||
|
|
||||||
// Generate id for clip
|
// Generate id for clip
|
||||||
long clipId = idGenerator.nextId();
|
long clipId = new SnowflakeGenerator().nextId();
|
||||||
|
|
||||||
// store it so we can stop it later
|
// store it so we can stop it later
|
||||||
activeSoundEffects.put(clipId, clip); // TODO: Do on snowflake for specific sound to stop
|
activeSoundEffects.put(clipId, clip);
|
||||||
|
|
||||||
// remove when finished (only for non-looping sounds)
|
// remove when finished (only for non-looping sounds)
|
||||||
clip.addLineListener(
|
clip.addLineListener(
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ public class NetworkingClientManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long startClientRequest(String ip, int port) {
|
long startClientRequest(String ip, int port) {
|
||||||
long connectionId = new SnowflakeGenerator().nextId(); // TODO: Maybe use the one generated
|
long connectionId = new SnowflakeGenerator().nextId();
|
||||||
try { // With EventFlow
|
try {
|
||||||
NetworkingClient client =
|
NetworkingClient client =
|
||||||
new NetworkingClient(
|
new NetworkingClient(
|
||||||
() -> new NetworkingGameClientHandler(connectionId),
|
() -> new NetworkingGameClientHandler(connectionId),
|
||||||
@@ -81,19 +81,13 @@ public class NetworkingClientManager {
|
|||||||
void handleStartClient(NetworkEvents.StartClient event) {
|
void handleStartClient(NetworkEvents.StartClient event) {
|
||||||
long id = this.startClientRequest(event.ip(), event.port());
|
long id = this.startClientRequest(event.ip(), event.port());
|
||||||
new Thread(
|
new Thread(
|
||||||
() -> {
|
() ->
|
||||||
try {
|
|
||||||
Thread.sleep(100); // TODO: Is this a good idea?
|
|
||||||
new EventFlow()
|
new EventFlow()
|
||||||
.addPostEvent(
|
.addPostEvent(
|
||||||
NetworkEvents.StartClientResponse.class,
|
NetworkEvents.StartClientResponse.class,
|
||||||
id,
|
id,
|
||||||
event.eventSnowflake())
|
event.eventSnowflake())
|
||||||
.asyncPostEvent();
|
.asyncPostEvent())
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.start();
|
.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +179,7 @@ public class NetworkingClientManager {
|
|||||||
|
|
||||||
void handleCloseClient(NetworkEvents.CloseClient event) {
|
void handleCloseClient(NetworkEvents.CloseClient event) {
|
||||||
NetworkingClient client = this.networkClients.get(event.clientId());
|
NetworkingClient client = this.networkClients.get(event.clientId());
|
||||||
client.closeConnection(); // TODO: Check if not blocking, what if error, mb not remove?
|
client.closeConnection();
|
||||||
this.networkClients.remove(event.clientId());
|
this.networkClients.remove(event.clientId());
|
||||||
logger.info("Client {} closed successfully.", event.clientId());
|
logger.info("Client {} closed successfully.", event.clientId());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class NetworkingGameClientHandler extends ChannelInboundHandlerAdapter {
|
|||||||
gameWinConditionHandler(recSrvRemoved);
|
gameWinConditionHandler(recSrvRemoved);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
return;
|
// return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -93,10 +93,10 @@ public class NetworkingGameClientHandler extends ChannelInboundHandlerAdapter {
|
|||||||
helpHandler(recSrvRemoved);
|
helpHandler(recSrvRemoved);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
return;
|
// return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return; // TODO: Should be an error.
|
logger.error("Could not parse: {}", rec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.toop.framework.asset;
|
package org.toop.framework.resource;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -9,12 +9,13 @@ import java.util.function.Function;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.reflections.Reflections;
|
import org.reflections.Reflections;
|
||||||
import org.toop.framework.asset.events.AssetLoaderEvents;
|
|
||||||
import org.toop.framework.asset.resources.*;
|
|
||||||
import org.toop.framework.asset.types.BundledResource;
|
|
||||||
import org.toop.framework.asset.types.FileExtension;
|
|
||||||
import org.toop.framework.asset.types.PreloadResource;
|
|
||||||
import org.toop.framework.eventbus.EventFlow;
|
import org.toop.framework.eventbus.EventFlow;
|
||||||
|
import org.toop.framework.resource.events.AssetLoaderEvents;
|
||||||
|
import org.toop.framework.resource.exceptions.CouldNotCreateResourceFactoryException;
|
||||||
|
import org.toop.framework.resource.resources.*;
|
||||||
|
import org.toop.framework.resource.types.BundledResource;
|
||||||
|
import org.toop.framework.resource.types.FileExtension;
|
||||||
|
import org.toop.framework.resource.types.PreloadResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsible for loading assets from a file system directory into memory.
|
* Responsible for loading assets from a file system directory into memory.
|
||||||
@@ -141,19 +142,24 @@ public class ResourceLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Maps a file to a resource instance based on its extension and registered factories. */
|
/** Maps a file to a resource instance based on its extension and registered factories. */
|
||||||
private <T extends BaseResource> T resourceMapper(File file, Class<T> type) {
|
private <T extends BaseResource> T resourceMapper(File file)
|
||||||
|
throws CouldNotCreateResourceFactoryException, IllegalArgumentException {
|
||||||
String ext = getExtension(file.getName());
|
String ext = getExtension(file.getName());
|
||||||
Function<File, ? extends BaseResource> factory = registry.get(ext);
|
Function<File, ? extends BaseResource> factory = registry.get(ext);
|
||||||
if (factory == null) return null;
|
if (factory == null)
|
||||||
|
throw new CouldNotCreateResourceFactoryException(registry, file.getName());
|
||||||
|
|
||||||
BaseResource resource = factory.apply(file);
|
BaseResource resource = factory.apply(file);
|
||||||
|
|
||||||
if (!type.isInstance(resource)) {
|
if (resource == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"File " + file.getName() + " is not of type " + type.getSimpleName());
|
"File "
|
||||||
|
+ file.getName()
|
||||||
|
+ " is not of type "
|
||||||
|
+ BaseResource.class.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return type.cast(resource);
|
return ((Class<T>) BaseResource.class).cast(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads the given list of files into assets, handling bundled and preload resources. */
|
/** Loads the given list of files into assets, handling bundled and preload resources. */
|
||||||
@@ -162,7 +168,14 @@ public class ResourceLoader {
|
|||||||
|
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
boolean skipAdd = false;
|
boolean skipAdd = false;
|
||||||
BaseResource resource = resourceMapper(file, BaseResource.class);
|
BaseResource resource = null;
|
||||||
|
try {
|
||||||
|
resource = resourceMapper(file);
|
||||||
|
} catch (CouldNotCreateResourceFactoryException _) {
|
||||||
|
logger.warn("Could not create resource for: {}", file);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
logger.error(e);
|
||||||
|
}
|
||||||
switch (resource) {
|
switch (resource) {
|
||||||
case null -> {
|
case null -> {
|
||||||
continue;
|
continue;
|
||||||
@@ -216,7 +229,7 @@ public class ResourceLoader {
|
|||||||
* {@link FileExtension}.
|
* {@link FileExtension}.
|
||||||
*/
|
*/
|
||||||
private void autoRegisterResources() {
|
private void autoRegisterResources() {
|
||||||
Reflections reflections = new Reflections("org.toop.framework.asset.resources");
|
Reflections reflections = new Reflections("org.toop.framework.resource.resources");
|
||||||
Set<Class<? extends BaseResource>> classes = reflections.getSubTypesOf(BaseResource.class);
|
Set<Class<? extends BaseResource>> classes = reflections.getSubTypesOf(BaseResource.class);
|
||||||
|
|
||||||
for (Class<? extends BaseResource> cls : classes) {
|
for (Class<? extends BaseResource> cls : classes) {
|
||||||
@@ -1,16 +1,15 @@
|
|||||||
package org.toop.framework.asset;
|
package org.toop.framework.resource;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.toop.framework.resource.exceptions.ResourceNotFoundException;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.toop.framework.resource.resources.*;
|
||||||
import org.toop.framework.asset.resources.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Centralized manager for all loaded assets in the application.
|
* Centralized manager for all loaded assets in the application.
|
||||||
*
|
*
|
||||||
* <p>{@code ResourceManager} maintains a thread-safe registry of {@link ResourceMeta} objects and provides
|
* <p>{@code ResourceManager} maintains a thread-safe registry of {@link ResourceMeta} objects and
|
||||||
* utility methods to retrieve assets by name, ID, or type. It works together with {@link
|
* provides utility methods to retrieve assets by name, ID, or type. It works together with {@link
|
||||||
* ResourceLoader} to register assets automatically when they are loaded from the file system.
|
* ResourceLoader} to register assets automatically when they are loaded from the file system.
|
||||||
*
|
*
|
||||||
* <p>Key responsibilities:
|
* <p>Key responsibilities:
|
||||||
@@ -49,7 +48,7 @@ import org.toop.framework.asset.resources.*;
|
|||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public class ResourceManager {
|
public class ResourceManager {
|
||||||
private static final Logger logger = LogManager.getLogger(ResourceManager.class);
|
// private static final Logger logger = LogManager.getLogger(ResourceManager.class);
|
||||||
private static final Map<String, ResourceMeta<? extends BaseResource>> assets =
|
private static final Map<String, ResourceMeta<? extends BaseResource>> assets =
|
||||||
new ConcurrentHashMap<>();
|
new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@@ -61,7 +60,7 @@ public class ResourceManager {
|
|||||||
* @param loader the loader that has already loaded assets
|
* @param loader the loader that has already loaded assets
|
||||||
*/
|
*/
|
||||||
public static synchronized void loadAssets(ResourceLoader loader) {
|
public static synchronized void loadAssets(ResourceLoader loader) {
|
||||||
for (var asset : loader.getAssets()) {
|
for (ResourceMeta<? extends BaseResource> asset : loader.getAssets()) {
|
||||||
assets.put(asset.getName(), asset);
|
assets.put(asset.getName(), asset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,12 +76,7 @@ public class ResourceManager {
|
|||||||
public static <T extends BaseResource> T get(String name) {
|
public static <T extends BaseResource> T get(String name) {
|
||||||
ResourceMeta<T> asset = (ResourceMeta<T>) assets.get(name);
|
ResourceMeta<T> asset = (ResourceMeta<T>) assets.get(name);
|
||||||
if (asset == null) {
|
if (asset == null) {
|
||||||
throw new TypeNotPresentException(
|
throw new ResourceNotFoundException(name);
|
||||||
name,
|
|
||||||
new RuntimeException(
|
|
||||||
String.format(
|
|
||||||
"Type %s not present",
|
|
||||||
name))); // TODO: Create own exception, BAM
|
|
||||||
}
|
}
|
||||||
return asset.getResource();
|
return asset.getResource();
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.toop.framework.asset;
|
package org.toop.framework.resource;
|
||||||
|
|
||||||
import org.toop.framework.SnowflakeGenerator;
|
import org.toop.framework.SnowflakeGenerator;
|
||||||
import org.toop.framework.asset.resources.BaseResource;
|
import org.toop.framework.resource.resources.BaseResource;
|
||||||
|
|
||||||
public class ResourceMeta<T extends BaseResource> {
|
public class ResourceMeta<T extends BaseResource> {
|
||||||
private final Long id;
|
private final Long id;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.toop.framework.asset.events;
|
package org.toop.framework.resource.events;
|
||||||
|
|
||||||
import org.toop.framework.eventbus.events.EventWithoutSnowflake;
|
import org.toop.framework.eventbus.events.EventWithoutSnowflake;
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.toop.framework.resource.exceptions;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CouldNotCreateResourceFactoryException extends RuntimeException {
|
||||||
|
public CouldNotCreateResourceFactoryException(Map<?, ?> registry, String fileName) {
|
||||||
|
super(
|
||||||
|
String.format(
|
||||||
|
"Could not create resource factory for: %s, isRegistryEmpty: %b",
|
||||||
|
fileName, registry.isEmpty()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package org.toop.framework.resource.exceptions;
|
||||||
|
|
||||||
|
public class IsNotAResourceException extends RuntimeException {
|
||||||
|
public <T> IsNotAResourceException(Class<T> clazz, String message) {
|
||||||
|
super(clazz.getName() + " does not implement BaseResource");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package org.toop.framework.resource.exceptions;
|
||||||
|
|
||||||
|
public class ResourceNotFoundException extends RuntimeException {
|
||||||
|
public ResourceNotFoundException(String name) {
|
||||||
|
super("Could not find resource: " + name);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.toop.framework.asset.resources;
|
package org.toop.framework.resource.resources;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.toop.framework.asset.resources;
|
package org.toop.framework.resource.resources;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import org.toop.framework.asset.types.FileExtension;
|
import org.toop.framework.resource.types.FileExtension;
|
||||||
|
|
||||||
@FileExtension({"css"})
|
@FileExtension({"css"})
|
||||||
public class CssAsset extends BaseResource {
|
public class CssAsset extends BaseResource {
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package org.toop.framework.asset.resources;
|
package org.toop.framework.resource.resources;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javafx.scene.text.Font;
|
import javafx.scene.text.Font;
|
||||||
import org.toop.framework.asset.types.FileExtension;
|
import org.toop.framework.resource.types.FileExtension;
|
||||||
import org.toop.framework.asset.types.PreloadResource;
|
import org.toop.framework.resource.types.PreloadResource;
|
||||||
|
|
||||||
@FileExtension({"ttf", "otf"})
|
@FileExtension({"ttf", "otf"})
|
||||||
public class FontAsset extends BaseResource implements PreloadResource {
|
public class FontAsset extends BaseResource implements PreloadResource {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package org.toop.framework.asset.resources;
|
package org.toop.framework.resource.resources;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import org.toop.framework.asset.types.FileExtension;
|
import org.toop.framework.resource.types.FileExtension;
|
||||||
import org.toop.framework.asset.types.LoadableResource;
|
import org.toop.framework.resource.types.LoadableResource;
|
||||||
|
|
||||||
@FileExtension({"png", "jpg", "jpeg"})
|
@FileExtension({"png", "jpg", "jpeg"})
|
||||||
public class ImageAsset extends BaseResource implements LoadableResource {
|
public class ImageAsset extends BaseResource implements LoadableResource {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.toop.framework.asset.resources;
|
package org.toop.framework.resource.resources;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
@@ -6,8 +6,8 @@ import java.io.File;
|
|||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import org.toop.framework.asset.types.FileExtension;
|
import org.toop.framework.resource.types.FileExtension;
|
||||||
import org.toop.framework.asset.types.LoadableResource;
|
import org.toop.framework.resource.types.LoadableResource;
|
||||||
|
|
||||||
@FileExtension({"json"})
|
@FileExtension({"json"})
|
||||||
public class JsonAsset<T> extends BaseResource implements LoadableResource {
|
public class JsonAsset<T> extends BaseResource implements LoadableResource {
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package org.toop.framework.asset.resources;
|
package org.toop.framework.resource.resources;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.toop.framework.asset.types.BundledResource;
|
import org.toop.framework.resource.types.BundledResource;
|
||||||
import org.toop.framework.asset.types.FileExtension;
|
import org.toop.framework.resource.types.FileExtension;
|
||||||
import org.toop.framework.asset.types.LoadableResource;
|
import org.toop.framework.resource.types.LoadableResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a localization resource asset that loads and manages property files containing
|
* Represents a localization resource asset that loads and manages property files containing
|
||||||
@@ -38,7 +38,7 @@ public class LocalizationAsset extends BaseResource implements LoadableResource,
|
|||||||
private final String baseName = "localization";
|
private final String baseName = "localization";
|
||||||
|
|
||||||
/** Fallback locale used when no matching locale is found. */
|
/** Fallback locale used when no matching locale is found. */
|
||||||
private final Locale fallback = Locale.forLanguageTag("en_US");
|
private final Locale fallback = Locale.forLanguageTag("en");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new LocalizationAsset for the specified file.
|
* Constructs a new LocalizationAsset for the specified file.
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.toop.framework.asset.resources;
|
package org.toop.framework.resource.resources;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import javafx.scene.media.Media;
|
import javafx.scene.media.Media;
|
||||||
import org.toop.framework.asset.types.FileExtension;
|
import org.toop.framework.resource.types.FileExtension;
|
||||||
import org.toop.framework.asset.types.LoadableResource;
|
import org.toop.framework.resource.types.LoadableResource;
|
||||||
|
|
||||||
@FileExtension({"mp3"})
|
@FileExtension({"mp3"})
|
||||||
public class MusicAsset extends BaseResource implements LoadableResource {
|
public class MusicAsset extends BaseResource implements LoadableResource {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.toop.framework.asset.resources;
|
package org.toop.framework.resource.resources;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package org.toop.framework.asset.resources;
|
package org.toop.framework.resource.resources;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import javax.sound.sampled.*;
|
import javax.sound.sampled.*;
|
||||||
import org.toop.framework.asset.types.FileExtension;
|
import org.toop.framework.resource.types.FileExtension;
|
||||||
import org.toop.framework.asset.types.LoadableResource;
|
import org.toop.framework.resource.types.LoadableResource;
|
||||||
|
|
||||||
@FileExtension({"wav"})
|
@FileExtension({"wav"})
|
||||||
public class SoundEffectAsset extends BaseResource implements LoadableResource {
|
public class SoundEffectAsset extends BaseResource implements LoadableResource {
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package org.toop.framework.asset.resources;
|
package org.toop.framework.resource.resources;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import org.toop.framework.asset.types.FileExtension;
|
import org.toop.framework.resource.types.FileExtension;
|
||||||
import org.toop.framework.asset.types.LoadableResource;
|
import org.toop.framework.resource.types.LoadableResource;
|
||||||
|
|
||||||
@FileExtension({"txt", "json", "xml"})
|
@FileExtension({"txt", "json", "xml"})
|
||||||
public class TextAsset extends BaseResource implements LoadableResource {
|
public class TextAsset extends BaseResource implements LoadableResource {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.toop.framework.asset.types;
|
package org.toop.framework.resource.types;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import org.toop.framework.asset.ResourceLoader;
|
import org.toop.framework.resource.ResourceLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a resource that can be composed of multiple files, or "bundled" together under a
|
* Represents a resource that can be composed of multiple files, or "bundled" together under a
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package org.toop.framework.asset.types;
|
package org.toop.framework.resource.types;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
import org.toop.framework.asset.ResourceLoader;
|
import org.toop.framework.resource.ResourceLoader;
|
||||||
import org.toop.framework.asset.resources.BaseResource;
|
import org.toop.framework.resource.resources.BaseResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Annotation to declare which file extensions a {@link BaseResource} subclass can handle.
|
* Annotation to declare which file extensions a {@link BaseResource} subclass can handle.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.toop.framework.asset.types;
|
package org.toop.framework.resource.types;
|
||||||
|
|
||||||
import org.toop.framework.asset.ResourceLoader;
|
import org.toop.framework.resource.ResourceLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a resource that can be explicitly loaded and unloaded.
|
* Represents a resource that can be explicitly loaded and unloaded.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.toop.framework.asset.types;
|
package org.toop.framework.resource.types;
|
||||||
|
|
||||||
import org.toop.framework.asset.ResourceLoader;
|
import org.toop.framework.resource.ResourceLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marker interface for resources that should be **automatically loaded** by the {@link
|
* Marker interface for resources that should be **automatically loaded** by the {@link
|
||||||
Reference in New Issue
Block a user