pause panel and start turn panel now show player color
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@489 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
4231fad826
commit
b875e44530
3 changed files with 56 additions and 52 deletions
|
@ -1,5 +1,6 @@
|
|||
package jrummikub.view.impl;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
@ -40,9 +41,7 @@ class PausePanel extends JPanel {
|
|||
|
||||
pauseLabel = new JLabel();
|
||||
pauseLabel.setHorizontalAlignment(JLabel.CENTER);
|
||||
pauseLabel.setHorizontalTextPosition(JLabel.CENTER);
|
||||
pauseLabel.setVerticalAlignment(JLabel.CENTER);
|
||||
pauseLabel.setVerticalTextPosition(JLabel.CENTER);
|
||||
pauseLabel.putClientProperty("html.disable", Boolean.TRUE);
|
||||
add(pauseLabel);
|
||||
|
||||
|
@ -64,7 +63,11 @@ class PausePanel extends JPanel {
|
|||
}
|
||||
|
||||
void setCurrentPlayerName(String playerName) {
|
||||
pauseLabel.setText("Der Zug von " + playerName + " ist pausiert.");
|
||||
pauseLabel.setText(playerName + "'s Zug ist pausiert.");
|
||||
}
|
||||
|
||||
void setCurrentPlayerColor(Color color) {
|
||||
pauseLabel.setIcon(ImageUtil.createColorIcon(color, 12, 1));
|
||||
}
|
||||
|
||||
IEvent getEndPauseEvent() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package jrummikub.view.impl;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
@ -44,9 +45,7 @@ class StartTurnPanel extends JPanel {
|
|||
|
||||
startTurnLabel = new JLabel();
|
||||
startTurnLabel.setHorizontalAlignment(JLabel.CENTER);
|
||||
startTurnLabel.setHorizontalTextPosition(JLabel.CENTER);
|
||||
startTurnLabel.setVerticalAlignment(JLabel.CENTER);
|
||||
startTurnLabel.setVerticalTextPosition(JLabel.CENTER);
|
||||
startTurnLabel.putClientProperty("html.disable", Boolean.TRUE);
|
||||
add(startTurnLabel);
|
||||
|
||||
|
@ -71,6 +70,10 @@ class StartTurnPanel extends JPanel {
|
|||
startTurnLabel.setText(playerName + " ist jetzt an der Reihe.");
|
||||
}
|
||||
|
||||
void setCurrentPlayerColor(Color color) {
|
||||
startTurnLabel.setIcon(ImageUtil.createColorIcon(color, 12, 1));
|
||||
}
|
||||
|
||||
void setInitialMeldError(int points) {
|
||||
startTurnLabel.setText("Es wurden weniger als " + points
|
||||
+ " Punkte ausgelegt.");
|
||||
|
@ -117,16 +120,15 @@ class StartTurnPanel extends JPanel {
|
|||
}
|
||||
|
||||
switch (type) {
|
||||
case START_TURN_PANEL:
|
||||
startTurnButton.setText("Zug beginnen");
|
||||
buttonEvent = startTurnEvent;
|
||||
break;
|
||||
case INVALID_TURN_PANEL:
|
||||
startTurnLabel
|
||||
.setText("Es liegen ung\u00FCltige Serien auf dem Tisch.");
|
||||
startTurnButton.setText("N\u00E4chster Spieler");
|
||||
buttonEvent = acknowledgeInvalidEvent;
|
||||
break;
|
||||
case START_TURN_PANEL:
|
||||
startTurnButton.setText("Zug beginnen");
|
||||
buttonEvent = startTurnEvent;
|
||||
break;
|
||||
case INVALID_TURN_PANEL:
|
||||
startTurnLabel.setText("Es liegen ung\u00FCltige Serien auf dem Tisch.");
|
||||
startTurnButton.setText("N\u00E4chster Spieler");
|
||||
buttonEvent = acknowledgeInvalidEvent;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -164,8 +164,7 @@ public class View extends JFrame implements IView {
|
|||
showSettingsPanel(false);
|
||||
showLoginPanel(false);
|
||||
showGameListPanel(false);
|
||||
getHandPanel().setStones(
|
||||
Collections.<Pair<Stone, Position>> emptyList());
|
||||
getHandPanel().setStones(Collections.<Pair<Stone, Position>> emptyList());
|
||||
getTablePanel().setStoneSets(
|
||||
Collections.<Pair<StoneSet, Position>> emptyList());
|
||||
setSelectedStones(Collections.<Stone> emptyList());
|
||||
|
@ -330,8 +329,7 @@ public class View extends JFrame implements IView {
|
|||
|
||||
table = new TablePanel();
|
||||
mainLayer.add(table);
|
||||
table.setBorder(new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0,
|
||||
Color.BLACK));
|
||||
table.setBorder(new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0, Color.BLACK));
|
||||
|
||||
playerPanel = new PlayerPanel();
|
||||
mainLayer.add(playerPanel);
|
||||
|
@ -380,7 +378,8 @@ public class View extends JFrame implements IView {
|
|||
playerPanel.setBounds(0, tableHeight, width, playerPanelHeight);
|
||||
playerPanel.rescale();
|
||||
|
||||
int sideWidth = sidePanel.isVisible() ? playerPanel.getLeftPanelWidth() + 1 : 0;
|
||||
int sideWidth = sidePanel.isVisible() ? playerPanel.getLeftPanelWidth() + 1
|
||||
: 0;
|
||||
|
||||
table.setBounds(sideWidth, 0, width - sideWidth, tableHeight);
|
||||
table.validate();
|
||||
|
@ -391,11 +390,10 @@ public class View extends JFrame implements IView {
|
|||
pausePanel.setBounds(0, tableHeight, width, playerPanelHeight);
|
||||
winPanel.setBounds(0, tableHeight, width, playerPanelHeight);
|
||||
|
||||
|
||||
rescaleSubpanel(settingsPanel, 1 / 2.0, 1/ 2.0, 475, 300);
|
||||
rescaleSubpanel(scorePanel, 3 / 4.0, 1/ 2.0, 450, 300);
|
||||
rescaleSubpanel(loginPanel, 1 / 3.0, 1/ 3.0, 200, 200);
|
||||
rescaleSubpanel(gameListPanel, 1 / 2.0, 1/ 2.0, 475, 300);
|
||||
rescaleSubpanel(settingsPanel, 1 / 2.0, 1 / 2.0, 475, 300);
|
||||
rescaleSubpanel(scorePanel, 3 / 4.0, 1 / 2.0, 450, 300);
|
||||
rescaleSubpanel(loginPanel, 1 / 3.0, 1 / 3.0, 200, 200);
|
||||
rescaleSubpanel(gameListPanel, 1 / 2.0, 1 / 2.0, 475, 300);
|
||||
}
|
||||
|
||||
private void rescaleSubpanel(JPanel sub, double widthFactor,
|
||||
|
@ -476,6 +474,8 @@ public class View extends JFrame implements IView {
|
|||
@Override
|
||||
public void setCurrentPlayerColor(Color color) {
|
||||
playerPanel.setCurrentPlayerColor(color);
|
||||
startTurnPanel.setCurrentPlayerColor(color);
|
||||
pausePanel.setCurrentPlayerColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -510,24 +510,24 @@ public class View extends JFrame implements IView {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<Pair<Stone, Position>> createDecorationStones() {
|
||||
Pair<Stone, Position> stoneJ = new Pair<Stone, Position>(new Stone(
|
||||
-'J', StoneColor.BLACK), new Position(2.5f, 0));
|
||||
Pair<Stone, Position> stoneR = new Pair<Stone, Position>(new Stone(
|
||||
-'R', StoneColor.ORANGE), new Position(3.5f, 0));
|
||||
Pair<Stone, Position> stoneu1 = new Pair<Stone, Position>(new Stone(
|
||||
-'u', StoneColor.BLUE), new Position(4.5f, 0));
|
||||
Pair<Stone, Position> stonem1 = new Pair<Stone, Position>(new Stone(
|
||||
-'m', StoneColor.RED), new Position(5.5f, 0));
|
||||
Pair<Stone, Position> stonem2 = new Pair<Stone, Position>(new Stone(
|
||||
-'m', StoneColor.GREEN), new Position(6.5f, 0));
|
||||
Pair<Stone, Position> stonei = new Pair<Stone, Position>(new Stone(
|
||||
-'i', StoneColor.VIOLET), new Position(7.5f, 0));
|
||||
Pair<Stone, Position> stonek = new Pair<Stone, Position>(new Stone(
|
||||
-'k', StoneColor.AQUA), new Position(8.5f, 0));
|
||||
Pair<Stone, Position> stoneu2 = new Pair<Stone, Position>(new Stone(
|
||||
-'u', StoneColor.GRAY), new Position(9.5f, 0));
|
||||
Pair<Stone, Position> stoneb = new Pair<Stone, Position>(new Stone(
|
||||
-'b', StoneColor.BLACK), new Position(10.5f, 0));
|
||||
Pair<Stone, Position> stoneJ = new Pair<Stone, Position>(new Stone(-'J',
|
||||
StoneColor.BLACK), new Position(2.5f, 0));
|
||||
Pair<Stone, Position> stoneR = new Pair<Stone, Position>(new Stone(-'R',
|
||||
StoneColor.ORANGE), new Position(3.5f, 0));
|
||||
Pair<Stone, Position> stoneu1 = new Pair<Stone, Position>(new Stone(-'u',
|
||||
StoneColor.BLUE), new Position(4.5f, 0));
|
||||
Pair<Stone, Position> stonem1 = new Pair<Stone, Position>(new Stone(-'m',
|
||||
StoneColor.RED), new Position(5.5f, 0));
|
||||
Pair<Stone, Position> stonem2 = new Pair<Stone, Position>(new Stone(-'m',
|
||||
StoneColor.GREEN), new Position(6.5f, 0));
|
||||
Pair<Stone, Position> stonei = new Pair<Stone, Position>(new Stone(-'i',
|
||||
StoneColor.VIOLET), new Position(7.5f, 0));
|
||||
Pair<Stone, Position> stonek = new Pair<Stone, Position>(new Stone(-'k',
|
||||
StoneColor.AQUA), new Position(8.5f, 0));
|
||||
Pair<Stone, Position> stoneu2 = new Pair<Stone, Position>(new Stone(-'u',
|
||||
StoneColor.GRAY), new Position(9.5f, 0));
|
||||
Pair<Stone, Position> stoneb = new Pair<Stone, Position>(new Stone(-'b',
|
||||
StoneColor.BLACK), new Position(10.5f, 0));
|
||||
|
||||
Pair<Stone, Position> stone1 = new Pair<Stone, Position>(new Stone(
|
||||
StoneColor.RED), new Position(2, 1));
|
||||
|
@ -542,9 +542,9 @@ public class View extends JFrame implements IView {
|
|||
Pair<Stone, Position> stone6 = new Pair<Stone, Position>(new Stone(
|
||||
StoneColor.BLACK), new Position(11, 1));
|
||||
|
||||
return Arrays.asList(stoneJ, stoneR, stoneu1, stonem1, stonem2, stonei,
|
||||
stonek, stoneu2, stoneb, stone1, stone2, stone3, stone4,
|
||||
stone5, stone6);
|
||||
return Arrays
|
||||
.asList(stoneJ, stoneR, stoneu1, stonem1, stonem2, stonei, stonek,
|
||||
stoneu2, stoneb, stone1, stone2, stone3, stone4, stone5, stone6);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -564,8 +564,7 @@ public class View extends JFrame implements IView {
|
|||
&& type != BottomPanelType.WIN_PANEL && type != null);
|
||||
|
||||
if (type == BottomPanelType.START_GAME_PANEL) {
|
||||
table.setStoneSets(Collections
|
||||
.<Pair<StoneSet, Position>> emptyList());
|
||||
table.setStoneSets(Collections.<Pair<StoneSet, Position>> emptyList());
|
||||
playerPanel.getHandPanel().setStones(createDecorationStones());
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue