Commit d2636435 authored by bogdanbear's avatar bogdanbear

Added a panel for lost connection notification.

parent 6d370a64
......@@ -35,7 +35,9 @@ public abstract class GraphicsMasterAbstraction {
SINGLEPLAYER_GAME_CREATION,
MULTIPLAYER_CHARACTER_CHOICE,
SINGLEPLAYER_CHARACTER_CHOICE,
GAME_OVER}
GAME_OVER,
LOST_CONNECTION
}
//This map indicates to graphicsMaster which guiPanel is associated to each GUIState, it is filled in Graphicsmaster's constructor
protected HashMap<GUIStates, PanelAbstraction> mapGUIStatesToGUIPanel = new HashMap<>();
//The current state of the GUI
......
......@@ -11,5 +11,6 @@ public interface LoungePanelAbstraction extends MenuPanelAbstraction {
public void chooseCharacterButtonAction();
public void backButtonAction();
public void playButtonAction();
}
......@@ -24,5 +24,6 @@ public class LoungePanelAbstractionController extends MenuPanelAbstractionContro
public void backButtonPressed(){
this.lounge_panel.backButtonAction();
}
public void playButtonPressed(){this.lounge_panel.playButtonAction();}
}
......@@ -54,6 +54,7 @@ public class GraphicsMaster extends GraphicsMasterAbstraction {
mapGUIStatesToGUIPanel.put(GUIStates.SINGLEPLAYER_GAME_CREATION, new SinglePlayer_GameCreationPanel(this));
mapGUIStatesToGUIPanel.put(GUIStates.SINGLEPLAYER_CHARACTER_CHOICE, new SinglePlayer_CharacterChoicePanel(this));
mapGUIStatesToGUIPanel.put(GUIStates.SINGLEPLAYER_LOADGAME, new SinglePlayer_LoadGamePanel(this));
mapGUIStatesToGUIPanel.put(GUIStates.LOST_CONNECTION, new LostConnectionPanel(this));
mapGUIStatesToGUIPanel.put(GUIStates.GAME_OVER, new GameOverPanel(this));
}
......
package graphics.guiSkeleton.guiPanel.menuPanel;
import graphics.guiSkeleton.GUIColorsAndFonts;
import graphics.guiSkeleton.GraphicsMaster;
import graphics.guiSkeleton.guiPanel.menuPanel.facilities.ButtonMaker;
import graphics.guiSkeleton.guiPanel.menuPanel.facilities.MenuPanel;
import graphics.ingame_input_listener.Input;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by bogdanbear on 02/01/2016.
*/
public class LostConnectionPanel extends MenuPanel{
public LostConnectionPanel(GraphicsMaster graphicsMaster) {
super(graphicsMaster);
JLabel sorryLabel = new JLabel("Connection Lost...");
sorryLabel.setFont(GUIColorsAndFonts.smallFont1);
sorryLabel.setForeground(GUIColorsAndFonts.fontColor1);
setTitlePanel("Connection Lost");
addToCentralColumn(sorryLabel,1,1);
addToCentralColumn(ButtonMaker.makeButton("Return to main menu", returnButtonActionListener),1,1);
}
private ActionListener returnButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
getGraphicsMaster().changeGUIStateTo(GraphicsMaster.GUIStates.MAIN_MENU);
}
};
@Override
public void initialise() {
}
@Override
public void finalise() {
}
@Override
public void keyPressedHandler(Input e) {
}
@Override
public void keyReleasedHandler(Input e) {
}
@Override
public void keyTypedHandler(Input e) {
}
}
package graphics.guiSkeleton.guiPanel.menuPanel.loungePanel;
import graphics.graphical_abstraction.GraphicsMasterAbstraction;
import graphics.graphical_abstraction.panel.menu.loungePanel.LoungePanelAbstraction;
import graphics.graphical_abstraction.panel.menu.loungePanel.LoungePanelAbstractionController;
import graphics.guiSkeleton.guiPanel.menuPanel.facilities.ButtonMaker;
......@@ -31,6 +32,7 @@ public class LoungePanel extends MenuPanel implements LoungePanelAbstraction {
addToCentralColumn(new PlayerInformationList_SubPanel(lounge), 1, 1);
addToCentralColumn(ButtonMaker.makeButton("Choose Character", chooseCharacterButton_ActionListener), 1, 1);
addToCentralColumn(ButtonMaker.makeButton("Play", playButton_ActionListener), 1, 1);
addToCentralColumn(ButtonMaker.makeButton("back", backButton_ActionListener), 1, 1);
lounge.addPlayer(new PlayerInformation("YourName"));
......@@ -50,6 +52,13 @@ public class LoungePanel extends MenuPanel implements LoungePanelAbstraction {
}
};
private ActionListener playButton_ActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
controller.playButtonPressed();
}
};
@Override
public void keyPressedHandler(Input e) {
......@@ -84,4 +93,10 @@ public class LoungePanel extends MenuPanel implements LoungePanelAbstraction {
public void backButtonAction() {
getGraphicsMaster().changeGUIStateTo(GraphicsMaster.GUIStates.MULTIPLAYER_MENU);
}
@Override
public void playButtonAction() {
getGraphicsMaster().changeGUIStateTo(GraphicsMaster.GUIStates.LOST_CONNECTION);
}
}
......@@ -25,4 +25,9 @@ public class LoungePanelTerminal extends MenuPanelTerminal implements LoungePane
public void backButtonAction() {
}
@Override
public void playButtonAction() {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment