Select a random player for the first round
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@263 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
d9a0b0e37d
commit
92d1109954
5 changed files with 61 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
package jrummikub.control;
|
||||
|
||||
import jrummikub.model.GameSettings;
|
||||
import jrummikub.model.GameState;
|
||||
import jrummikub.model.IRoundState;
|
||||
import jrummikub.model.RoundState;
|
||||
import jrummikub.util.IListener;
|
||||
|
@ -13,6 +14,7 @@ public class GameControl {
|
|||
private GameSettings gameSettings;
|
||||
private IView view;
|
||||
private RoundControl roundControl;
|
||||
private GameState gameState;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -25,6 +27,9 @@ public class GameControl {
|
|||
public GameControl(GameSettings gameSettings, IView view) {
|
||||
this.gameSettings = gameSettings;
|
||||
this.view = view;
|
||||
|
||||
gameState = new GameState();
|
||||
gameState.setFirstRoundFirstPlayer((int)(Math.random() * gameSettings.getPlayerList().size()));
|
||||
|
||||
view.getNewGameEvent().add(new IListener() {
|
||||
@Override
|
||||
|
@ -54,6 +59,9 @@ public class GameControl {
|
|||
|
||||
IRoundState roundState = new RoundState(gameSettings);
|
||||
|
||||
// TODO: add number of already played rounds
|
||||
roundState.setActivePlayerNumber(gameState.getFirstRoundFirstPlayer());
|
||||
|
||||
roundControl = new RoundControl(roundState, view);
|
||||
roundControl.getEndRoundEvent().add(new IListener() {
|
||||
|
||||
|
|
Reference in a new issue