package jrummikub.control; import java.util.ArrayList; import java.util.List; import jrummikub.model.GameSettings; import jrummikub.util.Connection; import jrummikub.util.IListener; import jrummikub.util.IListener1; import jrummikub.view.IView; /** * The application control controls the settings for a new games and create the * game control */ public class ApplicationControl { private IView view; /** * Creates a new application control * * @param view * the view to use */ public ApplicationControl(IView view) { this.view = view; } /** * Starts the application by showing the game settings dialog panel */ public void startApplication() { view.showScorePanel(false); view.enableWinPanel(false); SettingsControl settingsControl = new SettingsControl(view, new GameSettings()); settingsControl.getStartGameEvent().add(new IListener1() { @Override public void handle(GameSettings settings) { GameControl gameControl = new GameControl(settings, view); gameControl.getEndOfGameEvent().add(new IListener() { @Override public void handle() { startApplication(); } }); gameControl.startGame(); } }); settingsControl.startSettings(); } }