Moved loads to own class for better memory management. Added ability to add text- and localizationassets.

This commit is contained in:
lieght
2025-10-01 04:19:28 +02:00
parent f11ff0421b
commit 5e4db91750
11 changed files with 177 additions and 93 deletions

View File

@@ -3,6 +3,7 @@ package org.toop;
import org.toop.app.gui.LocalServerSelector;
import org.toop.framework.asset.AssetLoader;
import org.toop.framework.asset.AssetManager;
import org.toop.framework.asset.resources.TextAsset;
import org.toop.framework.audio.SoundManager;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
@@ -14,22 +15,26 @@ import java.io.IOException;
import java.nio.file.NotDirectoryException;
public class Main {
static void main(String[] args) throws IOException, UnsupportedAudioFileException, LineUnavailableException, InterruptedException {
static void main(String[] args) {
AssetLoader.initialize("app/src/main/resources/assets");
AssetManager.loadAssets(AssetLoader.getInstance());
AssetManager.loadAssets(new AssetLoader("app/src/main/resources/assets"));
var text = AssetManager.getAllOfType(TextAsset.class).getFirst().getResource();
text.load();
IO.println(text.getContent());
var b = new NetworkingClientManager();
var c = new SoundManager();
new EventFlow().addPostEvent(new AudioEvents.PlayAudio("mainmenu.wav", true)).asyncPostEvent();
new EventFlow().addPostEvent(new AudioEvents.PlayAudio("sadtrombone.wav", true)).asyncPostEvent();
Thread.sleep(200);
new EventFlow().addPostEvent(new AudioEvents.PlayAudio("mainmenu.wav", true)).asyncPostEvent();
new EventFlow().addPostEvent(new AudioEvents.PlayAudio("sadtrombone.wav", true)).asyncPostEvent();
Thread.sleep(200);
new EventFlow().addPostEvent(new AudioEvents.PlayAudio("mainmenu.wav", true)).asyncPostEvent();
new EventFlow().addPostEvent(new AudioEvents.PlayAudio("sadtrombone.wav", true)).asyncPostEvent();
// new EventFlow().addPostEvent(new AudioEvents.PlayAudio("sadtrombone.wav", false)).asyncPostEvent();
// Thread.sleep(200);
// new EventFlow().addPostEvent(new AudioEvents.PlayAudio("mainmenu.wav", false)).asyncPostEvent();
// new EventFlow().addPostEvent(new AudioEvents.PlayAudio("sadtrombone.wav", false)).asyncPostEvent();
// Thread.sleep(200);
// new EventFlow().addPostEvent(new AudioEvents.PlayAudio("mainmenu.wav", false)).asyncPostEvent();
// new EventFlow().addPostEvent(new AudioEvents.PlayAudio("sadtrombone.wav", false)).asyncPostEvent();
javax.swing.SwingUtilities.invokeLater(LocalServerSelector::new);
}