From 3ff911ab930cb87f90307b9a82dafc4d0b5fe305 Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Wed, 8 Jun 2011 16:29:13 +0200 Subject: =?UTF-8?q?man=20kann=20speichern=20und=20laden,=20nur=20nicht=20w?= =?UTF-8?q?=C3=A4hrend=20eines=20laufenden=20spiels=20laden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@386 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/GameControl.java | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src/jrummikub/control/GameControl.java') diff --git a/src/jrummikub/control/GameControl.java b/src/jrummikub/control/GameControl.java index fb3fcf8..985781a 100644 --- a/src/jrummikub/control/GameControl.java +++ b/src/jrummikub/control/GameControl.java @@ -33,11 +33,11 @@ public class GameControl { * Constructor * * @param gameSettings - * the game settings + * the game settings * @param saveControl - * the save control + * the save control * @param view - * the view + * the view */ public GameControl(GameSettings gameSettings, SaveControl saveControl, IView view) { @@ -96,6 +96,16 @@ public class GameControl { startRound(); } + public void continueGame(GameState gameState, IRoundState roundState) { + this.gameState = gameState; + if (roundState == null) { + showScorePanel(); + } else { + prepareRound(roundState); + roundControl.continueRound(); + } + } + private void startRound() { if (roundControl != null) { return; @@ -104,6 +114,11 @@ public class GameControl { view.showScorePanel(false); IRoundState roundState = new RoundState(gameSettings); + prepareRound(roundState); + roundControl.startRound(); + } + + private void prepareRound(IRoundState roundState) { saveControl.setRoundState(roundState); roundState.setActivePlayerNumber(gameState.getFirstRoundFirstPlayer() @@ -125,8 +140,6 @@ public class GameControl { restartRound(); } }); - - roundControl.startRound(); } private void restartRound() { @@ -136,13 +149,19 @@ public class GameControl { private void endOfRound(Score roundScore) { gameState.getScores().add(roundScore); + saveControl.setRoundState(null); roundControl = null; + showScorePanel(); + } + + private void showScorePanel() { view.setBottomPanel(BottomPanelType.WIN_PANEL); view.getScorePanel().setPlayers(gameSettings.getPlayerList()); view.getScorePanel().setScores(gameState.getScores()); - view.getScorePanel().setAccumulatedScore(gameState.getAccumulatedScore()); + view.getScorePanel().setAccumulatedScore( + gameState.getAccumulatedScore()); view.getScorePanel().update(); view.showScorePanel(true); } -- cgit v1.2.3