Don't show show the human player panel before the turn is started and the stones are displayed
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@507 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
a97b8445a2
commit
39da662f0d
1 changed files with 26 additions and 33 deletions
|
@ -18,7 +18,6 @@ import jrummikub.model.IHand;
|
|||
import jrummikub.model.IPlayer;
|
||||
import jrummikub.model.IRoundState;
|
||||
import jrummikub.model.ITable;
|
||||
import jrummikub.model.Player;
|
||||
import jrummikub.model.PlayerSettings;
|
||||
import jrummikub.model.Position;
|
||||
import jrummikub.model.Score;
|
||||
|
@ -56,9 +55,9 @@ public class RoundControl {
|
|||
* Create a new RoundControl using the given gameState and view
|
||||
*
|
||||
* @param roundState
|
||||
* initial round state
|
||||
* initial round state
|
||||
* @param view
|
||||
* view used for user interaction
|
||||
* view used for user interaction
|
||||
*/
|
||||
public RoundControl(IRoundState roundState, IView view) {
|
||||
this.roundState = roundState;
|
||||
|
@ -152,20 +151,16 @@ public class RoundControl {
|
|||
clonedTable = (ITable) roundState.getTable().clone();
|
||||
clonedHand = (IHand) roundState.getActivePlayer().getHand().clone();
|
||||
|
||||
if (isHuman) {
|
||||
view.setBottomPanel(oneHuman ? BottomPanelType.HUMAN_HAND_PANEL
|
||||
: BottomPanelType.START_TURN_PANEL);
|
||||
} else {
|
||||
view.setBottomPanel(BottomPanelType.NONHUMAN_HAND_PANEL);
|
||||
if (isHuman && !oneHuman) {
|
||||
view.setBottomPanel(BottomPanelType.START_TURN_PANEL);
|
||||
}
|
||||
|
||||
view.getTablePanel().setStoneSets(clonedTable.clone());
|
||||
view.setCurrentPlayerName(roundState.getActivePlayer()
|
||||
.getPlayerSettings().getName());
|
||||
view.setCurrentPlayerColor(roundState.getActivePlayer()
|
||||
.getPlayerSettings().getColor());
|
||||
view.setCurrentPlayerHasLaidOut(roundState.getActivePlayer()
|
||||
.getLaidOut());
|
||||
view.setCurrentPlayerName(roundState.getActivePlayer().getPlayerSettings()
|
||||
.getName());
|
||||
view.setCurrentPlayerColor(roundState.getActivePlayer().getPlayerSettings()
|
||||
.getColor());
|
||||
view.setCurrentPlayerHasLaidOut(roundState.getActivePlayer().getLaidOut());
|
||||
|
||||
turnControl = createTurnControl(roundState.getActivePlayer()
|
||||
.getPlayerSettings());
|
||||
|
@ -179,6 +174,9 @@ public class RoundControl {
|
|||
boolean isHuman = roundState.getActivePlayer().getPlayerSettings()
|
||||
.getType() == HUMAN;
|
||||
|
||||
view.setBottomPanel(isHuman ? BottomPanelType.HUMAN_HAND_PANEL
|
||||
: BottomPanelType.NONHUMAN_HAND_PANEL);
|
||||
|
||||
TurnMode turnMode = TurnMode.NORMAL_TURN;
|
||||
|
||||
if (roundState.getTurnNumber() < 1) {
|
||||
|
@ -194,8 +192,8 @@ public class RoundControl {
|
|||
}
|
||||
|
||||
turnControl.setup(new ITurnControl.TurnInfo(clonedTable, clonedHand,
|
||||
roundState.getActivePlayer().getLaidOut(), turnMode),
|
||||
roundState.getGameSettings(), view);
|
||||
roundState.getActivePlayer().getLaidOut(), turnMode), roundState
|
||||
.getGameSettings(), view);
|
||||
turnControl.getEndOfTurnEvent().add(new IListener1<ITable>() {
|
||||
@Override
|
||||
public void handle(ITable newTable) {
|
||||
|
@ -237,10 +235,8 @@ public class RoundControl {
|
|||
void deal() {
|
||||
for (int i = 0; i < roundState.getPlayerCount(); i++) {
|
||||
IHand hand = roundState.getNthNextPlayer(i).getHand();
|
||||
for (int j = 0; j < roundState.getGameSettings()
|
||||
.getNumberOfStonesDealt(); j++) {
|
||||
hand.drop(roundState.getGameHeap().drawStone(), new Position(0,
|
||||
0));
|
||||
for (int j = 0; j < roundState.getGameSettings().getNumberOfStonesDealt(); j++) {
|
||||
hand.drop(roundState.getGameHeap().drawStone(), new Position(0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,13 +249,11 @@ public class RoundControl {
|
|||
|
||||
int totalValue = 0;
|
||||
for (StoneSet set : newSets) {
|
||||
totalValue += set.classify(roundState.getGameSettings())
|
||||
.getSecond();
|
||||
totalValue += set.classify(roundState.getGameSettings()).getSecond();
|
||||
}
|
||||
|
||||
return totalValue == 0
|
||||
|| totalValue >= roundState.getGameSettings()
|
||||
.getInitialMeldThreshold();
|
||||
|| totalValue >= roundState.getGameSettings().getInitialMeldThreshold();
|
||||
}
|
||||
|
||||
protected void endOfTurn(ITable newTable) {
|
||||
|
@ -269,9 +263,10 @@ public class RoundControl {
|
|||
turnControl = null;
|
||||
|
||||
roundState.getActivePlayer().setLastTurnInvalid(false);
|
||||
roundState.getActivePlayer().setLastTurnStoneCount(
|
||||
roundState.getActivePlayer().getHand().getSize()
|
||||
- clonedHand.getSize());
|
||||
roundState.getActivePlayer()
|
||||
.setLastTurnStoneCount(
|
||||
roundState.getActivePlayer().getHand().getSize()
|
||||
- clonedHand.getSize());
|
||||
|
||||
roundState.getActivePlayer().setHand(clonedHand);
|
||||
boolean goToNextPlayer = true;
|
||||
|
@ -290,8 +285,8 @@ public class RoundControl {
|
|||
if (lastTurnNotEnoughPoints) {
|
||||
view.setInitialMeldError(roundState.getGameSettings()
|
||||
.getInitialMeldThreshold());
|
||||
view.setInvalidStoneSets(tableSetDifference(
|
||||
roundState.getTable(), newTable));
|
||||
view.setInvalidStoneSets(tableSetDifference(roundState.getTable(),
|
||||
newTable));
|
||||
} else if (lastTurnMeldError) {
|
||||
view.setInitialMeldFirstError();
|
||||
view.setInvalidStoneSets(touchedStoneSets(newTable));
|
||||
|
@ -484,12 +479,10 @@ public class RoundControl {
|
|||
stonePoints = playerHand.isInitialMeldPossible(roundState
|
||||
.getGameSettings()) ? 200 : 100;
|
||||
} else {
|
||||
stonePoints = playerHand.getStonePoints(roundState
|
||||
.getGameSettings());
|
||||
stonePoints = playerHand.getStonePoints(roundState.getGameSettings());
|
||||
}
|
||||
|
||||
bestScore = updateBestScore(bestScore, -stonePoints,
|
||||
playerHand.getSize());
|
||||
bestScore = updateBestScore(bestScore, -stonePoints, playerHand.getSize());
|
||||
|
||||
points.add(-stonePoints);
|
||||
pointSum += stonePoints;
|
||||
|
|
Reference in a new issue