Commit 175d7172 authored by Myriam Begel's avatar Myriam Begel
Browse files

New graphic presentation for multiplayer

parent 2f39a182
......@@ -38,7 +38,8 @@ public abstract class GraphicsMasterAbstraction {
GAME_OVER,
LOST_CONNECTION,
PLEASE_WAIT,
SERVER_ADDRESS_PANEL
SERVER_ADDRESS_PANEL,
SERVER_CREATED_PANEL
}
//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<>();
......
......@@ -12,6 +12,7 @@ import graphics.guiSkeleton.guiPanel.menuPanel.gameCreation.SinglePlayer_GameCre
import graphics.guiSkeleton.guiPanel.menuPanel.gameLoad.SinglePlayer_LoadGamePanel;
import graphics.guiSkeleton.guiPanel.menuPanel.loungePanel.LoungePanel;
import graphics.guiSkeleton.guiPanel.menuPanel.multiPlayer_MenuPanel.MultiPlayer_MenuPanel;
import graphics.guiSkeleton.guiPanel.menuPanel.multiPlayer_MenuPanel.SeverCreatedPanel;
import graphics.guiSkeleton.inputManagement.MainFrameKeyListener;
import graphics.ingame_input_listener.InputConfiguration;
import ingame_programming.IGPpanel;
......@@ -60,6 +61,7 @@ public class GraphicsMaster extends GraphicsMasterAbstraction {
mapGUIStatesToGUIPanel.put(GUIStates.PLEASE_WAIT, new PleaseWaitPanel(this));
mapGUIStatesToGUIPanel.put(GUIStates.SERVER_ADDRESS_PANEL, new ServerAddressPanel(this));
mapGUIStatesToGUIPanel.put(GUIStates.SERVER_CREATED_PANEL, new SeverCreatedPanel(this));
mapGUIStatesToGUIPanel.put(GUIStates.GAME_OVER, new GameOverPanel(this));
}
......
......@@ -8,6 +8,7 @@ import graphics.guiSkeleton.guiPanel.menuPanel.facilities.ButtonMaker;
import graphics.guiSkeleton.guiPanel.menuPanel.facilities.MenuPanel;
import graphics.ingame_input_listener.Input;
import network.outershell.RPCClient;
import network.outershell.server.RPCServer;
import javax.swing.*;
import java.awt.event.ActionEvent;
......@@ -21,14 +22,15 @@ public class ServerAddressPanel extends MenuPanel{
public ServerAddressPanel(GraphicsMaster graphicsMaster) {
super(graphicsMaster);
JLabel inputLabel = new JLabel("Please input server address to connect...");
JLabel inputLabel = new JLabel("To play please write the server address");
inputLabel.setFont(GUIColorsAndFonts.smallFont1);
inputLabel.setForeground(GUIColorsAndFonts.fontColor1);
addToCentralColumn(inputLabel,1,1);
setTitlePanel("IP address.");
addToCentralColumn(addressTextField,1,1);
addToCentralColumn(ButtonMaker.makeButton("Host a server", serverButtonActionListener),1,1);
addToCentralColumn(inputLabel,1,1);
addToCentralColumn(ButtonMaker.makeButton("Confirm", confirmButtonActionListener),1,1);
addToCentralColumn(addressTextField,1,1);
//addToCentralColumn(inputLabel,1,1);
addToCentralColumn(ButtonMaker.makeButton("Connection", confirmButtonActionListener),1,1);
addToCentralColumn(ButtonMaker.makeButton("Back", backButtonActionListener),1,1);
......@@ -51,6 +53,15 @@ public class ServerAddressPanel extends MenuPanel{
getGraphicsMaster().changeGUIStateTo(GraphicsMaster.GUIStates.MAIN_MENU);
}
};
private ActionListener serverButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
RPCServer.main();
getGraphicsMaster().changeGUIStateTo(GraphicsMaster.GUIStates.SERVER_CREATED_PANEL);
}
};
@Override
public void initialise() {
......
package graphics.guiSkeleton.guiPanel.menuPanel.multiPlayer_MenuPanel;
import graphics.guiSkeleton.GUIColorsAndFonts;
import graphics.guiSkeleton.GraphicsMaster;
import network.outershell.Lounge;
import network.outershell.RPCClient;
......
package graphics.guiSkeleton.guiPanel.menuPanel.multiPlayer_MenuPanel;
import graphics.graphical_abstraction.GraphicsMasterAbstraction;
import graphics.guiSkeleton.GUIColorsAndFonts;
import graphics.guiSkeleton.GraphicsMaster;
import graphics.guiSkeleton.guiPanel.menuPanel.facilities.ButtonMaker;
import graphics.guiSkeleton.guiPanel.menuPanel.facilities.MenuPanel;
......@@ -26,12 +27,14 @@ public class MultiPlayer_MenuPanel extends MenuPanel {
private static final long serialVersionUID = 1L;
public MultiPlayer_MenuPanel(GraphicsMaster graphicsMaster){
super(graphicsMaster);
JLabel inputLabel = new JLabel("Choose the game you want to join :");
inputLabel.setFont(GUIColorsAndFonts.smallFont1);
inputLabel.setForeground(GUIColorsAndFonts.fontColor1);
setTitlePanel("MultiPlayer Thessia");
addToCentralColumn(new LoungeList_SubPanel(getGraphicsMaster()),1,1);
//addToCentralColumn(ButtonMaker.makeButton("Join Lounge", joinLoungeButton_ActionListener),1,1);
addToCentralColumn(ButtonMaker.makeButton("Host new game", hostNewGameButton_ActionListener),1,1);
//addToCentralColumn(new IPtextField(),1,1);
//addToCentralColumn(ButtonMaker.makeButton("Join game at IP:", joinGameAtIP_ActionListener),1,1);
addToCentralColumn(ButtonMaker.makeButton("Create a new game", hostNewGameButton_ActionListener),1,1);
addToCentralColumn(inputLabel,1,1);
addToCentralColumn(new LoungeList_SubPanel(getGraphicsMaster()),1,1);
JButton oldPlayButton = ButtonMaker.makeButton("Old play button", oldPlayButton_ActionListener);
oldPlayButton.setBackground(new Color(174,0,0));
addToCentralColumn(oldPlayButton, 1, 1);
......
package graphics.guiSkeleton.guiPanel.menuPanel.multiPlayer_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;
/**
* @author Myriam Bégel
*/
public class SeverCreatedPanel extends MenuPanel{
public SeverCreatedPanel(GraphicsMaster graphicsMaster) {
super(graphicsMaster);
JLabel label1 = new JLabel("A server has been launched on your computer.");
label1.setFont(GUIColorsAndFonts.smallFont1);
label1.setForeground(GUIColorsAndFonts.fontColor1);
addToCentralColumn(label1,1,1);
JLabel label2 = new JLabel("People can now connect to it,");
label2.setFont(GUIColorsAndFonts.smallFont1);
label2.setForeground(GUIColorsAndFonts.fontColor1);
addToCentralColumn(label2,1,1);
JLabel label3 = new JLabel("please give them your IP address");
label3.setFont(GUIColorsAndFonts.smallFont1);
label3.setForeground(GUIColorsAndFonts.fontColor1);
addToCentralColumn(label3,1,1);
JLabel label4 = new JLabel("and don't close this window");
label4.setFont(GUIColorsAndFonts.smallFont1);
label4.setForeground(GUIColorsAndFonts.fontColor1);
addToCentralColumn(label4,1,1);
addToCentralColumn(ButtonMaker.makeButton("Back to Main Menu", backButtonActionListener),1,1);
setTitlePanel("Server Created");
}
private ActionListener backButtonActionListener = 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 network.junit_tests;
/**
* Created by moi on 05/01/16.
*/
public class ClientAndServerConnectionTest {
}
......@@ -14,7 +14,7 @@ import java.util.logging.Logger;
public class RPCServer {
public static int scale=25;
private static Logger LOGGER = Logging.getInstance().getLogger();
public static void main(String Crocodiles[])
public static void main()
{
try {
LocateRegistry.createRegistry(1099);
......
Supports Markdown
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