summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-05 17:14:34 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-05 17:14:34 +0200
commitb1fd03e366971ee53d6260b36b8236a996104fd4 (patch)
tree12440541066c7ae4f88fad2971bed7fb8a4a1f4c
parent63ffedd7b0ecfbf690551b0e2fefac3058ff08c2 (diff)
downloadJRummikub-b1fd03e366971ee53d6260b36b8236a996104fd4.tar
JRummikub-b1fd03e366971ee53d6260b36b8236a996104fd4.zip
Show player name labels
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@146 72836036-5685-4462-b002-a69064685172
-rw-r--r--mock/jrummikub/model/MockGameState.java5
-rw-r--r--src/jrummikub/JRummikub.java8
-rw-r--r--src/jrummikub/control/RoundControl.java16
-rw-r--r--src/jrummikub/model/GameState.java5
-rw-r--r--src/jrummikub/model/IGameState.java2
5 files changed, 34 insertions, 2 deletions
diff --git a/mock/jrummikub/model/MockGameState.java b/mock/jrummikub/model/MockGameState.java
index 1d4a7a2..e6b8622 100644
--- a/mock/jrummikub/model/MockGameState.java
+++ b/mock/jrummikub/model/MockGameState.java
@@ -51,4 +51,9 @@ public class MockGameState implements IGameState {
public StoneHeap getGameHeap() {
return gameHeap;
}
+
+ @Override
+ public IPlayer getNthNextPlayer(int i) {
+ return players.get((activePlayer + i) % players.size());
+ }
}
diff --git a/src/jrummikub/JRummikub.java b/src/jrummikub/JRummikub.java
index 80d7080..4400be7 100644
--- a/src/jrummikub/JRummikub.java
+++ b/src/jrummikub/JRummikub.java
@@ -9,8 +9,16 @@ import jrummikub.model.Stone;
import jrummikub.model.StoneSet;
import jrummikub.view.impl.View;
+/**
+ * The main class
+ */
public class JRummikub {
+ /**
+ * The main method
+ *
+ * @param args command line arguments
+ */
public static void main(String[] args) {
String nativeLF = UIManager.getSystemLookAndFeelClassName();
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java
index 1411337..6e02ef2 100644
--- a/src/jrummikub/control/RoundControl.java
+++ b/src/jrummikub/control/RoundControl.java
@@ -33,9 +33,21 @@ public class RoundControl {
startTurn();
}
});
- view.enableStartTurnPanel(true);
+
+ prepareTurn();
+ }
+
+ private void prepareTurn() {
clonedTable = (ITable) gameState.getTable().clone();
+ view.enableStartTurnPanel(true);
view.getTablePanel().setStoneSets(clonedTable);
+ view.setCurrentPlayerName(gameState.getActivePlayer().getName());
+ view.getTablePanel().setRightPlayerName(
+ gameState.getNthNextPlayer(1).getName());
+ view.getTablePanel().setTopPlayerName(
+ gameState.getNthNextPlayer(2).getName());
+ view.getTablePanel().setLeftPlayerName(
+ gameState.getNthNextPlayer(3).getName());
}
private void startTurn() {
@@ -78,7 +90,7 @@ public class RoundControl {
ret.remove(stone);
}
}
-
+
return ret;
}
diff --git a/src/jrummikub/model/GameState.java b/src/jrummikub/model/GameState.java
index 3bd4d94..0539ea0 100644
--- a/src/jrummikub/model/GameState.java
+++ b/src/jrummikub/model/GameState.java
@@ -44,6 +44,11 @@ public class GameState implements IGameState {
}
@Override
+ public IPlayer getNthNextPlayer(int i) {
+ return players.get((activePlayer + i) % players.size());
+ }
+
+ @Override
public IPlayer getActivePlayer() {
return players.get(activePlayer);
}
diff --git a/src/jrummikub/model/IGameState.java b/src/jrummikub/model/IGameState.java
index 56ab917..46ea0b0 100644
--- a/src/jrummikub/model/IGameState.java
+++ b/src/jrummikub/model/IGameState.java
@@ -15,4 +15,6 @@ public interface IGameState {
public StoneHeap getGameHeap();
+ public IPlayer getNthNextPlayer(int i);
+
} \ No newline at end of file