mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
@@ -19,6 +19,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Clipboard;
|
||||
import forge.adventure.scene.*;
|
||||
import forge.adventure.stage.GameHUD;
|
||||
import forge.adventure.stage.MapStage;
|
||||
import forge.adventure.util.Config;
|
||||
import forge.adventure.world.WorldSave;
|
||||
import forge.animation.ForgeAnimation;
|
||||
@@ -1016,6 +1017,7 @@ public class Forge implements ApplicationListener {
|
||||
Dscreens.clear();
|
||||
graphics.dispose();
|
||||
SoundSystem.instance.dispose();
|
||||
MapStage.getInstance().disposeWorld();
|
||||
try {
|
||||
ExceptionHandler.unregisterErrorHandling();
|
||||
lastPreview.dispose();
|
||||
|
||||
@@ -135,6 +135,7 @@ public class MapStage extends GameStage {
|
||||
private boolean freezeAllEnemyBehaviors = false;
|
||||
|
||||
protected MapStage() {
|
||||
disposeWorld();
|
||||
gdxWorld = new World(new Vector2(0, 0),false);
|
||||
dialog = Controls.newDialog("");
|
||||
eventTouchDown = new InputEvent();
|
||||
@@ -149,6 +150,16 @@ public class MapStage extends GameStage {
|
||||
return instance == null ? instance = new MapStage() : instance;
|
||||
}
|
||||
|
||||
public void disposeWorld() {
|
||||
if (gdxWorld != null) {
|
||||
try {
|
||||
gdxWorld.dispose();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addMapActor(MapObject obj, MapActor newActor) {
|
||||
newActor.setWidth(Float.parseFloat(obj.getProperties().get("width").toString()));
|
||||
newActor.setHeight(Float.parseFloat(obj.getProperties().get("height").toString()));
|
||||
@@ -252,7 +263,12 @@ public class MapStage extends GameStage {
|
||||
dialog.getContentTable().add(L).width(250f);
|
||||
dialog.getButtonTable().add(Controls.newTextButton("OK", () -> {
|
||||
hideDialog();
|
||||
Timer.schedule(new Timer.Task() {
|
||||
@Override
|
||||
public void run() {
|
||||
fb.dispose();
|
||||
}
|
||||
}, 0.5f);
|
||||
})).width(240f);
|
||||
dialog.setKeepWithinStage(true);
|
||||
setDialogStage(GameHUD.getInstance());
|
||||
@@ -319,6 +335,7 @@ public class MapStage extends GameStage {
|
||||
}
|
||||
|
||||
public void loadMap(TiledMap map, String sourceMap, String targetMap, int spawnTargetId) {
|
||||
disposeWorld();
|
||||
gdxWorld = new World(new Vector2(0, 0),false);
|
||||
isLoadingMatch = false;
|
||||
isInMap = true;
|
||||
|
||||
Reference in New Issue
Block a user