Disable pause function in network mode
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@536 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
9b5f3648ed
commit
b62babba45
9 changed files with 117 additions and 89 deletions
|
@ -76,6 +76,11 @@ public class RoundControl {
|
||||||
private Event1<Score> endOfRoundEvent = new Event1<Score>();
|
private Event1<Score> endOfRoundEvent = new Event1<Score>();
|
||||||
protected List<Connection> connections = new ArrayList<Connection>();
|
protected List<Connection> connections = new ArrayList<Connection>();
|
||||||
private boolean roundFinished;
|
private boolean roundFinished;
|
||||||
|
private boolean mayPause;
|
||||||
|
|
||||||
|
public RoundControl(IRoundState roundState, IView view) {
|
||||||
|
this(roundState, view, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new RoundControl using the given gameState and view
|
* Create a new RoundControl using the given gameState and view
|
||||||
|
@ -85,9 +90,10 @@ public class RoundControl {
|
||||||
* @param view
|
* @param view
|
||||||
* view used for user interaction
|
* view used for user interaction
|
||||||
*/
|
*/
|
||||||
public RoundControl(IRoundState roundState, IView view) {
|
protected RoundControl(IRoundState roundState, IView view, boolean mayPause) {
|
||||||
this.roundState = roundState;
|
this.roundState = roundState;
|
||||||
this.view = view;
|
this.view = view;
|
||||||
|
this.mayPause = mayPause;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -221,7 +227,8 @@ public class RoundControl {
|
||||||
view.getPlayerPanel().setEndTurnMode(turnMode);
|
view.getPlayerPanel().setEndTurnMode(turnMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
turnControl.setup(new ITurnControl.TurnInfo(roundState, turnMode),
|
turnControl.setup(
|
||||||
|
new ITurnControl.TurnInfo(roundState, turnMode, mayPause),
|
||||||
roundState.getGameSettings(), view);
|
roundState.getGameSettings(), view);
|
||||||
turnControl.getEndOfTurnEvent().add(
|
turnControl.getEndOfTurnEvent().add(
|
||||||
new IListener2<IRoundState, InvalidTurnInfo>() {
|
new IListener2<IRoundState, InvalidTurnInfo>() {
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class NetworkRoundControl extends RoundControl {
|
||||||
|
|
||||||
public NetworkRoundControl(IRoundState roundState, IView view,
|
public NetworkRoundControl(IRoundState roundState, IView view,
|
||||||
final IConnectionControl connectionControl, boolean startActive) {
|
final IConnectionControl connectionControl, boolean startActive) {
|
||||||
super(roundState, view);
|
super(roundState, view, false);
|
||||||
|
|
||||||
this.connectionControl = connectionControl;
|
this.connectionControl = connectionControl;
|
||||||
currentlyActive = startActive;
|
currentlyActive = startActive;
|
||||||
|
|
|
@ -53,8 +53,4 @@ public class NetworkTurnControl extends AbstractTurnControl {
|
||||||
@Override
|
@Override
|
||||||
protected void timeOut() {
|
protected void timeOut() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void pauseTurn() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,10 @@ public abstract class AbstractTurnControl implements ITurnControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void pauseTurn() {
|
protected void pauseTurn() {
|
||||||
|
if (!turnInfo.isMayPause()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
timer.stopTimer();
|
timer.stopTimer();
|
||||||
view.enablePauseMode(true);
|
view.enablePauseMode(true);
|
||||||
}
|
}
|
||||||
|
@ -108,6 +112,8 @@ public abstract class AbstractTurnControl implements ITurnControl {
|
||||||
resumeTurn();
|
resumeTurn();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
view.setMayPause(info.isMayPause());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void cleanUp() {
|
protected void cleanUp() {
|
||||||
|
|
|
@ -73,6 +73,8 @@ public interface ITurnControl {
|
||||||
|
|
||||||
private TurnMode turnMode;
|
private TurnMode turnMode;
|
||||||
|
|
||||||
|
private boolean mayPause;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new TurnInfo instance
|
* Creates a new TurnInfo instance
|
||||||
*
|
*
|
||||||
|
@ -81,7 +83,7 @@ public interface ITurnControl {
|
||||||
* @param turnMode
|
* @param turnMode
|
||||||
* the turn mode
|
* the turn mode
|
||||||
*/
|
*/
|
||||||
public TurnInfo(IRoundState roundState, TurnMode turnMode) {
|
public TurnInfo(IRoundState roundState, TurnMode turnMode, boolean mayPause) {
|
||||||
this.roundState = roundState;
|
this.roundState = roundState;
|
||||||
|
|
||||||
oldTable = roundState.getTable();
|
oldTable = roundState.getTable();
|
||||||
|
@ -91,6 +93,8 @@ public interface ITurnControl {
|
||||||
this.hand = (IHand) oldHand.clone();
|
this.hand = (IHand) oldHand.clone();
|
||||||
|
|
||||||
this.turnMode = turnMode;
|
this.turnMode = turnMode;
|
||||||
|
|
||||||
|
this.mayPause = mayPause;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRoundState getRoundState() {
|
public IRoundState getRoundState() {
|
||||||
|
@ -150,5 +154,9 @@ public interface ITurnControl {
|
||||||
public TurnMode getTurnMode() {
|
public TurnMode getTurnMode() {
|
||||||
return turnMode;
|
return turnMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMayPause() {
|
||||||
|
return mayPause;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -57,7 +57,7 @@ public interface IView {
|
||||||
* Sets the current player's name
|
* Sets the current player's name
|
||||||
*
|
*
|
||||||
* @param playerName
|
* @param playerName
|
||||||
* the player name
|
* the player name
|
||||||
*/
|
*/
|
||||||
public void setCurrentPlayerName(String playerName);
|
public void setCurrentPlayerName(String playerName);
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public interface IView {
|
||||||
* Sets the stones that are to be painted selected
|
* Sets the stones that are to be painted selected
|
||||||
*
|
*
|
||||||
* @param stones
|
* @param stones
|
||||||
* the stones to be painted selected
|
* the stones to be painted selected
|
||||||
*/
|
*/
|
||||||
public void setSelectedStones(Collection<Stone> stones);
|
public void setSelectedStones(Collection<Stone> stones);
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public interface IView {
|
||||||
* Shows or hides the game settings panel
|
* Shows or hides the game settings panel
|
||||||
*
|
*
|
||||||
* @param show
|
* @param show
|
||||||
* specifies if the panel shall be shown or hidden
|
* specifies if the panel shall be shown or hidden
|
||||||
*/
|
*/
|
||||||
public void showSettingsPanel(boolean show);
|
public void showSettingsPanel(boolean show);
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public interface IView {
|
||||||
* Shows or hides the score panel
|
* Shows or hides the score panel
|
||||||
*
|
*
|
||||||
* @param show
|
* @param show
|
||||||
* specifies if the panel shall be shown or hidden
|
* specifies if the panel shall be shown or hidden
|
||||||
*/
|
*/
|
||||||
public void showScorePanel(boolean show);
|
public void showScorePanel(boolean show);
|
||||||
|
|
||||||
|
@ -119,16 +119,16 @@ public interface IView {
|
||||||
* along with the name
|
* along with the name
|
||||||
*
|
*
|
||||||
* @param color
|
* @param color
|
||||||
* the current player's color
|
* the current player's color
|
||||||
*/
|
*/
|
||||||
public void setCurrentPlayerColor(Color color);
|
public void setCurrentPlayerColor(Color color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is used for the PlayerPanel to display if a player has laid out along
|
* Is used for the PlayerPanel to display if a player has laid out along with
|
||||||
* with the name
|
* the name
|
||||||
*
|
*
|
||||||
* @param hasLaidOut
|
* @param hasLaidOut
|
||||||
* specifies if the current player has laid out or not
|
* specifies if the current player has laid out or not
|
||||||
*/
|
*/
|
||||||
public void setCurrentPlayerHasLaidOut(boolean hasLaidOut);
|
public void setCurrentPlayerHasLaidOut(boolean hasLaidOut);
|
||||||
|
|
||||||
|
@ -143,13 +143,13 @@ public interface IView {
|
||||||
* Sets the bottom panels type
|
* Sets the bottom panels type
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type
|
||||||
* the type of the bottom panel
|
* the type of the bottom panel
|
||||||
*/
|
*/
|
||||||
public void setBottomPanel(BottomPanelType type);
|
public void setBottomPanel(BottomPanelType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The menu new game event is emitted when the user selects the new game
|
* The menu new game event is emitted when the user selects the new game menu
|
||||||
* menu entry
|
* entry
|
||||||
*
|
*
|
||||||
* @return the event
|
* @return the event
|
||||||
*/
|
*/
|
||||||
|
@ -224,7 +224,7 @@ public interface IView {
|
||||||
* Show/hide login panel
|
* Show/hide login panel
|
||||||
*
|
*
|
||||||
* @param show
|
* @param show
|
||||||
* true = login panel is shown
|
* true = login panel is shown
|
||||||
*/
|
*/
|
||||||
public void showLoginPanel(boolean show);
|
public void showLoginPanel(boolean show);
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ public interface IView {
|
||||||
* Enable/disable pause mode
|
* Enable/disable pause mode
|
||||||
*
|
*
|
||||||
* @param enable
|
* @param enable
|
||||||
* true = enable
|
* true = enable
|
||||||
*/
|
*/
|
||||||
public void enablePauseMode(boolean enable);
|
public void enablePauseMode(boolean enable);
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ public interface IView {
|
||||||
* Show/hide game list panel
|
* Show/hide game list panel
|
||||||
*
|
*
|
||||||
* @param show
|
* @param show
|
||||||
* true = show
|
* true = show
|
||||||
*/
|
*/
|
||||||
public void showGameListPanel(boolean show);
|
public void showGameListPanel(boolean show);
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ public interface IView {
|
||||||
* Show/hide side panel
|
* Show/hide side panel
|
||||||
*
|
*
|
||||||
* @param show
|
* @param show
|
||||||
* true to show
|
* true to show
|
||||||
*/
|
*/
|
||||||
void showSidePanel(boolean show);
|
void showSidePanel(boolean show);
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ public interface IView {
|
||||||
* Is set if a player tried to lay out less than initial meld threshold
|
* Is set if a player tried to lay out less than initial meld threshold
|
||||||
*
|
*
|
||||||
* @param points
|
* @param points
|
||||||
* initial meld threshold
|
* initial meld threshold
|
||||||
*/
|
*/
|
||||||
public void setInitialMeldError(int points);
|
public void setInitialMeldError(int points);
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ public interface IView {
|
||||||
* Show stone collection
|
* Show stone collection
|
||||||
*
|
*
|
||||||
* @param enable
|
* @param enable
|
||||||
* showing collection
|
* showing collection
|
||||||
*/
|
*/
|
||||||
public void setStoneCollectionHidden(boolean enable);
|
public void setStoneCollectionHidden(boolean enable);
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ public interface IView {
|
||||||
* Set invalid sets to enable showing
|
* Set invalid sets to enable showing
|
||||||
*
|
*
|
||||||
* @param sets
|
* @param sets
|
||||||
* invalid sets on table
|
* invalid sets on table
|
||||||
*/
|
*/
|
||||||
public void setInvalidStoneSets(Collection<StoneSet> sets);
|
public void setInvalidStoneSets(Collection<StoneSet> sets);
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ public interface IView {
|
||||||
* Enables/disables saving in menu bar
|
* Enables/disables saving in menu bar
|
||||||
*
|
*
|
||||||
* @param enable
|
* @param enable
|
||||||
* saving possible
|
* saving possible
|
||||||
*/
|
*/
|
||||||
public void enableSave(boolean enable);
|
public void enableSave(boolean enable);
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ public interface IView {
|
||||||
* Sets the quit warning panel visible
|
* Sets the quit warning panel visible
|
||||||
*
|
*
|
||||||
* @param show
|
* @param show
|
||||||
* is visible
|
* is visible
|
||||||
*/
|
*/
|
||||||
public void showQuitWarningPanel(boolean show);
|
public void showQuitWarningPanel(boolean show);
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ public interface IView {
|
||||||
* Set the connect panel visible
|
* Set the connect panel visible
|
||||||
*
|
*
|
||||||
* @param show
|
* @param show
|
||||||
* is visible
|
* is visible
|
||||||
*/
|
*/
|
||||||
public void showConnectPanel(boolean show);
|
public void showConnectPanel(boolean show);
|
||||||
|
|
||||||
|
@ -344,6 +344,8 @@ public interface IView {
|
||||||
*/
|
*/
|
||||||
public IConnectPanel getConnectPanel();
|
public IConnectPanel getConnectPanel();
|
||||||
|
|
||||||
|
public void setMayPause(boolean mayPause);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Different types of bottom panels
|
* Different types of bottom panels
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.ComponentAdapter;
|
import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
|
import java.awt.event.ComponentListener;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
@ -60,6 +61,10 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
|
||||||
private Event redealEvent = new Event();
|
private Event redealEvent = new Event();
|
||||||
private Event pauseEvent = new Event();
|
private Event pauseEvent = new Event();
|
||||||
private int leftPanelWidth;
|
private int leftPanelWidth;
|
||||||
|
private boolean mayPause = true;
|
||||||
|
|
||||||
|
private ComponentListener leftPanelResizeListener = new LeftPanelResizeListener();
|
||||||
|
private ComponentListener rightPanelResizeListener = new RightPanelResizeListener();
|
||||||
|
|
||||||
HandPanel getHandPanel() {
|
HandPanel getHandPanel() {
|
||||||
return hand;
|
return hand;
|
||||||
|
@ -157,7 +162,7 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
leftPanel.addComponentListener(new LeftPanelResizeListener());
|
leftPanel.addComponentListener(leftPanelResizeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createRightPanel() {
|
private void createRightPanel() {
|
||||||
|
@ -188,7 +193,7 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
|
||||||
|
|
||||||
createRightPanelButtons();
|
createRightPanelButtons();
|
||||||
|
|
||||||
rightPanel.addComponentListener(new RightPanelResizeListener());
|
rightPanel.addComponentListener(rightPanelResizeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createRightPanelButtons() {
|
private void createRightPanelButtons() {
|
||||||
|
@ -237,7 +242,7 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
|
||||||
Insets insets = getInsets();
|
Insets insets = getInsets();
|
||||||
int x = insets.left, y = insets.top, width = getWidth() - insets.left
|
int x = insets.left, y = insets.top, width = getWidth() - insets.left
|
||||||
- insets.right, height = getHeight() - insets.top - insets.bottom;
|
- insets.right, height = getHeight() - insets.top - insets.bottom;
|
||||||
|
|
||||||
int boardWidth = hand.rescale(height);
|
int boardWidth = hand.rescale(height);
|
||||||
int handButtonWidth = (int) (width * HAND_ROW_BUTTON_RATIO);
|
int handButtonWidth = (int) (width * HAND_ROW_BUTTON_RATIO);
|
||||||
int meanPanelWidth = (width - boardWidth) / 2;
|
int meanPanelWidth = (width - boardWidth) / 2;
|
||||||
|
@ -252,7 +257,7 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
|
||||||
leftPanel.validate();
|
leftPanel.validate();
|
||||||
rightPanel.validate();
|
rightPanel.validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
int getLeftPanelWidth() {
|
int getLeftPanelWidth() {
|
||||||
return leftPanelWidth;
|
return leftPanelWidth;
|
||||||
}
|
}
|
||||||
|
@ -342,6 +347,11 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
|
||||||
hand.setEnabled(enable);
|
hand.setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setMayPause(boolean mayPause) {
|
||||||
|
this.mayPause = mayPause;
|
||||||
|
rightPanelResizeListener.componentResized(null);
|
||||||
|
}
|
||||||
|
|
||||||
private class LeftPanelResizeListener extends ComponentAdapter {
|
private class LeftPanelResizeListener extends ComponentAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void componentResized(ComponentEvent e) {
|
public void componentResized(ComponentEvent e) {
|
||||||
|
@ -427,12 +437,17 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rescaleTimeBar(int x, int y, int width, int firstLineHeight) {
|
private void rescaleTimeBar(int x, int y, int width, int firstLineHeight) {
|
||||||
timeBar.setBounds(x, y, width - firstLineHeight - SIDE_PANEL_SEPARATOR,
|
if (mayPause) {
|
||||||
firstLineHeight);
|
timeBar.setBounds(x, y, width - firstLineHeight - SIDE_PANEL_SEPARATOR,
|
||||||
pauseButton.setBounds(x + width - firstLineHeight, y, firstLineHeight,
|
firstLineHeight);
|
||||||
firstLineHeight);
|
pauseButton.setBounds(x + width - firstLineHeight, y, firstLineHeight,
|
||||||
pauseButton.setIcon(ImageUtil
|
firstLineHeight);
|
||||||
.createPauseIcon((int) (firstLineHeight * 0.5f)));
|
pauseButton.setIcon(ImageUtil
|
||||||
|
.createPauseIcon((int) (firstLineHeight * 0.5f)));
|
||||||
|
} else {
|
||||||
|
timeBar.setBounds(x, y, width, firstLineHeight);
|
||||||
|
pauseButton.setBounds(0, 0, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rescaleUpDownButtons(int handButtonWidth, float fontSize) {
|
private void rescaleUpDownButtons(int handButtonWidth, float fontSize) {
|
||||||
|
|
|
@ -123,22 +123,14 @@ class TablePanel extends AbstractStonePanel implements ITablePanel {
|
||||||
void createPauseStoneSets() {
|
void createPauseStoneSets() {
|
||||||
pauseStoneSets = new ArrayList<Pair<StoneSet, Position>>();
|
pauseStoneSets = new ArrayList<Pair<StoneSet, Position>>();
|
||||||
|
|
||||||
Stone stoneCoffee1 = new Stone(-'\u2615', StoneColor.BLACK);
|
|
||||||
|
|
||||||
Stone stoneP = new Stone(-'P', StoneColor.BLACK);
|
Stone stoneP = new Stone(-'P', StoneColor.BLACK);
|
||||||
Stone stonea = new Stone(-'a', StoneColor.ORANGE);
|
Stone stonea = new Stone(-'a', StoneColor.ORANGE);
|
||||||
Stone stoneu = new Stone(-'u', StoneColor.BLUE);
|
Stone stoneu = new Stone(-'u', StoneColor.BLUE);
|
||||||
Stone stones = new Stone(-'s', StoneColor.RED);
|
Stone stones = new Stone(-'s', StoneColor.RED);
|
||||||
Stone stonee = new Stone(-'e', StoneColor.BLACK);
|
Stone stonee = new Stone(-'e', StoneColor.BLACK);
|
||||||
|
|
||||||
Stone stoneCoffee2 = new Stone(-'\u2615', StoneColor.RED);
|
|
||||||
|
|
||||||
pauseStoneSets.add(new Pair<StoneSet, Position>(new StoneSet(stoneCoffee1),
|
|
||||||
new Position(-4, 0)));
|
|
||||||
pauseStoneSets.add(new Pair<StoneSet, Position>(new StoneSet(Arrays.asList(
|
pauseStoneSets.add(new Pair<StoneSet, Position>(new StoneSet(Arrays.asList(
|
||||||
stoneP, stonea, stoneu, stones, stonee)), new Position(-2.5, 0)));
|
stoneP, stonea, stoneu, stones, stonee)), new Position(-2.5, 0)));
|
||||||
pauseStoneSets.add(new Pair<StoneSet, Position>(new StoneSet(stoneCoffee2),
|
|
||||||
new Position(3, 0)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -193,8 +193,7 @@ public class View extends JFrame implements IView {
|
||||||
showSettingsPanel(false);
|
showSettingsPanel(false);
|
||||||
showLoginPanel(false);
|
showLoginPanel(false);
|
||||||
showGameListPanel(false);
|
showGameListPanel(false);
|
||||||
getHandPanel().setStones(
|
getHandPanel().setStones(Collections.<Pair<Stone, Position>> emptyList());
|
||||||
Collections.<Pair<Stone, Position>> emptyList());
|
|
||||||
getTablePanel().setStoneSets(
|
getTablePanel().setStoneSets(
|
||||||
Collections.<Pair<StoneSet, Position>> emptyList());
|
Collections.<Pair<StoneSet, Position>> emptyList());
|
||||||
setSelectedStones(Collections.<Stone> emptyList());
|
setSelectedStones(Collections.<Stone> emptyList());
|
||||||
|
@ -321,6 +320,7 @@ public class View extends JFrame implements IView {
|
||||||
public void componentResized(ComponentEvent e) {
|
public void componentResized(ComponentEvent e) {
|
||||||
rescale();
|
rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentMoved(ComponentEvent e) {
|
public void componentMoved(ComponentEvent e) {
|
||||||
quitWarningFrame.setLocationRelativeTo(View.this);
|
quitWarningFrame.setLocationRelativeTo(View.this);
|
||||||
|
@ -355,10 +355,10 @@ public class View extends JFrame implements IView {
|
||||||
quitWarningFrame.add(quitWarningPanel);
|
quitWarningFrame.add(quitWarningPanel);
|
||||||
quitWarningFrame.setAlwaysOnTop(true);
|
quitWarningFrame.setAlwaysOnTop(true);
|
||||||
quitWarningFrame.setUndecorated(true);
|
quitWarningFrame.setUndecorated(true);
|
||||||
|
|
||||||
//layeredPane.setLayer(quitWarningPanel, JLayeredPane.POPUP_LAYER);
|
// layeredPane.setLayer(quitWarningPanel, JLayeredPane.POPUP_LAYER);
|
||||||
//layeredPane.add(quitWarningPanel);
|
// layeredPane.add(quitWarningPanel);
|
||||||
//quitWarningPanel.setVisible(true);
|
// quitWarningPanel.setVisible(true);
|
||||||
scorePanel = new ScorePanel();
|
scorePanel = new ScorePanel();
|
||||||
scorePanel.setVisible(false);
|
scorePanel.setVisible(false);
|
||||||
layeredPane.setLayer(scorePanel, JLayeredPane.POPUP_LAYER);
|
layeredPane.setLayer(scorePanel, JLayeredPane.POPUP_LAYER);
|
||||||
|
@ -390,8 +390,7 @@ public class View extends JFrame implements IView {
|
||||||
|
|
||||||
table = new TablePanel();
|
table = new TablePanel();
|
||||||
mainLayer.add(table);
|
mainLayer.add(table);
|
||||||
table.setBorder(new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0,
|
table.setBorder(new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0, Color.BLACK));
|
||||||
Color.BLACK));
|
|
||||||
|
|
||||||
playerPanel = new PlayerPanel();
|
playerPanel = new PlayerPanel();
|
||||||
mainLayer.add(playerPanel);
|
mainLayer.add(playerPanel);
|
||||||
|
@ -411,9 +410,14 @@ public class View extends JFrame implements IView {
|
||||||
sidePanel = new SidePanel();
|
sidePanel = new SidePanel();
|
||||||
sidePanel.setVisible(false);
|
sidePanel.setVisible(false);
|
||||||
mainLayer.add(sidePanel);
|
mainLayer.add(sidePanel);
|
||||||
sidePanel.setBorder(new CompoundBorder(new MatteBorder(0, 0, 0, 1,
|
sidePanel
|
||||||
Color.BLACK), new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0,
|
.setBorder(new CompoundBorder(new MatteBorder(0, 0, 0, 1, Color.BLACK),
|
||||||
Color.GRAY)));
|
new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0, Color.GRAY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMayPause(boolean mayPause) {
|
||||||
|
playerPanel.setMayPause(mayPause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -525,15 +529,14 @@ public class View extends JFrame implements IView {
|
||||||
public void showQuitWarningPanel(boolean show) {
|
public void showQuitWarningPanel(boolean show) {
|
||||||
quitWarningFrame.setLocationRelativeTo(this);
|
quitWarningFrame.setLocationRelativeTo(this);
|
||||||
quitWarningFrame.setVisible(show);
|
quitWarningFrame.setVisible(show);
|
||||||
|
|
||||||
setEnabled(!show);
|
setEnabled(!show);
|
||||||
/*mainLayer.setEnabled(!show);
|
/*
|
||||||
menuBar.setEnabled(!show);
|
* mainLayer.setEnabled(!show); menuBar.setEnabled(!show);
|
||||||
settingsPanel.setEnabled(!show);
|
* settingsPanel.setEnabled(!show); loginPanel.setEnabled(!show);
|
||||||
loginPanel.setEnabled(!show);
|
* scorePanel.setEnabled(!show); gameListPanel.setEnabled(!show);
|
||||||
scorePanel.setEnabled(!show);
|
* connectPanel.setEnabled(!show);
|
||||||
gameListPanel.setEnabled(!show);
|
*/
|
||||||
connectPanel.setEnabled(!show);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -597,24 +600,24 @@ public class View extends JFrame implements IView {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private List<Pair<Stone, Position>> createDecorationStones() {
|
private List<Pair<Stone, Position>> createDecorationStones() {
|
||||||
Pair<Stone, Position> stoneJ = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stoneJ = new Pair<Stone, Position>(new Stone(-'J',
|
||||||
-'J', StoneColor.BLACK), new Position(2.5f, 0));
|
StoneColor.BLACK), new Position(2.5f, 0));
|
||||||
Pair<Stone, Position> stoneR = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stoneR = new Pair<Stone, Position>(new Stone(-'R',
|
||||||
-'R', StoneColor.ORANGE), new Position(3.5f, 0));
|
StoneColor.ORANGE), new Position(3.5f, 0));
|
||||||
Pair<Stone, Position> stoneu1 = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stoneu1 = new Pair<Stone, Position>(new Stone(-'u',
|
||||||
-'u', StoneColor.BLUE), new Position(4.5f, 0));
|
StoneColor.BLUE), new Position(4.5f, 0));
|
||||||
Pair<Stone, Position> stonem1 = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stonem1 = new Pair<Stone, Position>(new Stone(-'m',
|
||||||
-'m', StoneColor.RED), new Position(5.5f, 0));
|
StoneColor.RED), new Position(5.5f, 0));
|
||||||
Pair<Stone, Position> stonem2 = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stonem2 = new Pair<Stone, Position>(new Stone(-'m',
|
||||||
-'m', StoneColor.GREEN), new Position(6.5f, 0));
|
StoneColor.GREEN), new Position(6.5f, 0));
|
||||||
Pair<Stone, Position> stonei = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stonei = new Pair<Stone, Position>(new Stone(-'i',
|
||||||
-'i', StoneColor.VIOLET), new Position(7.5f, 0));
|
StoneColor.VIOLET), new Position(7.5f, 0));
|
||||||
Pair<Stone, Position> stonek = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stonek = new Pair<Stone, Position>(new Stone(-'k',
|
||||||
-'k', StoneColor.AQUA), new Position(8.5f, 0));
|
StoneColor.AQUA), new Position(8.5f, 0));
|
||||||
Pair<Stone, Position> stoneu2 = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stoneu2 = new Pair<Stone, Position>(new Stone(-'u',
|
||||||
-'u', StoneColor.GRAY), new Position(9.5f, 0));
|
StoneColor.GRAY), new Position(9.5f, 0));
|
||||||
Pair<Stone, Position> stoneb = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stoneb = new Pair<Stone, Position>(new Stone(-'b',
|
||||||
-'b', StoneColor.BLACK), new Position(10.5f, 0));
|
StoneColor.BLACK), new Position(10.5f, 0));
|
||||||
|
|
||||||
Pair<Stone, Position> stone1 = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stone1 = new Pair<Stone, Position>(new Stone(
|
||||||
StoneColor.RED), new Position(2, 1));
|
StoneColor.RED), new Position(2, 1));
|
||||||
|
@ -629,9 +632,9 @@ public class View extends JFrame implements IView {
|
||||||
Pair<Stone, Position> stone6 = new Pair<Stone, Position>(new Stone(
|
Pair<Stone, Position> stone6 = new Pair<Stone, Position>(new Stone(
|
||||||
StoneColor.BLACK), new Position(11, 1));
|
StoneColor.BLACK), new Position(11, 1));
|
||||||
|
|
||||||
return Arrays.asList(stoneJ, stoneR, stoneu1, stonem1, stonem2, stonei,
|
return Arrays
|
||||||
stonek, stoneu2, stoneb, stone1, stone2, stone3, stone4,
|
.asList(stoneJ, stoneR, stoneu1, stonem1, stonem2, stonei, stonek,
|
||||||
stone5, stone6);
|
stoneu2, stoneb, stone1, stone2, stone3, stone4, stone5, stone6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -650,8 +653,7 @@ public class View extends JFrame implements IView {
|
||||||
&& type != BottomPanelType.WIN_PANEL && type != null);
|
&& type != BottomPanelType.WIN_PANEL && type != null);
|
||||||
|
|
||||||
if (type == BottomPanelType.START_GAME_PANEL) {
|
if (type == BottomPanelType.START_GAME_PANEL) {
|
||||||
table.setStoneSets(Collections
|
table.setStoneSets(Collections.<Pair<StoneSet, Position>> emptyList());
|
||||||
.<Pair<StoneSet, Position>> emptyList());
|
|
||||||
playerPanel.getHandPanel().setStones(createDecorationStones());
|
playerPanel.getHandPanel().setStones(createDecorationStones());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue