diff options
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r-- | src/jrummikub/control/ApplicationControl.java | 8 | ||||
-rw-r--r-- | src/jrummikub/control/SaveControl.java | 11 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/jrummikub/control/ApplicationControl.java b/src/jrummikub/control/ApplicationControl.java index bcf497f..d07a0f6 100644 --- a/src/jrummikub/control/ApplicationControl.java +++ b/src/jrummikub/control/ApplicationControl.java @@ -65,6 +65,12 @@ public class ApplicationControl { } }); + saveControl.getLoadErrorEvent().add(new IListener() { + @Override + public void handle() { + view.showError(); + } + }); } private void addLoginControlListeners() { @@ -123,10 +129,12 @@ public class ApplicationControl { saveControl.setGameState(null); settingsControl = new SettingsControl(view, new GameSettings()); + view.enableSave(false); settingsControl.getStartGameEvent().add(new IListener1<GameSettings>() { @Override public void handle(GameSettings settings) { + view.enableSave(true); settingsControl = null; saveControl.setGameSettings(settings); diff --git a/src/jrummikub/control/SaveControl.java b/src/jrummikub/control/SaveControl.java index bebe6c5..3e12a9d 100644 --- a/src/jrummikub/control/SaveControl.java +++ b/src/jrummikub/control/SaveControl.java @@ -9,6 +9,7 @@ import java.io.ObjectOutputStream; import jrummikub.model.GameSettings; import jrummikub.model.GameState; import jrummikub.model.IRoundState; +import jrummikub.util.Event; import jrummikub.util.Event3; import jrummikub.util.IEvent3; import jrummikub.util.IListener1; @@ -22,6 +23,7 @@ public class SaveControl { private GameState gameState; private IRoundState roundState; private Event3<GameSettings, GameState, IRoundState> loadEvent = new Event3<GameSettings, GameState, IRoundState>(); + private Event loadErrorEvent = new Event(); /** * Creates a new SaveControl @@ -96,17 +98,20 @@ public class SaveControl { stream.close(); if (gameState == null || gameSettings == null) { - // TODO Fehlermeldung - System.err.println("laden ging nicht"); + loadErrorEvent.emit(); return; } loadEvent.emit(gameSettings, gameState, roundState); } catch (Exception e) { - e.printStackTrace(); + loadErrorEvent.emit(); } } + + public Event getLoadErrorEvent(){ + return loadErrorEvent; + } private void save(File file) { if (gameState == null || gameSettings == null) { |