Commit c2163620 authored by Bogdan's avatar Bogdan
Browse files

Lounges work now + new file organization

parent c85835e1
......@@ -2,7 +2,7 @@ package core.event;
import core.gamestate.GameContent;
import network.innershell.NetworkObject;
import network.helpers.NetworkObject;
/**
* This interface is used to define the message transmitted between the Relayer,
......
......@@ -13,7 +13,7 @@ import gameloop.DummyLocalGameLoop;
import graphics.guiSkeleton.entityDisplayer.EntityDisplayerType;
import logging.Logging;
import map_generation.tiles.TilePropertyVector;
import network.innershell.NetworkConnection;
import network.inner_shell.NetworkConnection;
/**
* This class represents an Entity able to be hit and die.
......
......@@ -18,7 +18,7 @@ import graphics.guiSkeleton.entityDisplayer.EntityDisplayerProvider;
import graphics.guiSkeleton.entityDisplayer.EntityDisplayerType;
import map_generation.map.Map;
import map_generation.tiles.TilePropertyVector;
import network.innershell.NetworkConnection;
import network.inner_shell.NetworkConnection;
/**
* This interface is used to define one object in the GameState.
......
......@@ -3,13 +3,12 @@ package core.gamestate;
import core.zone.Point;
import logging.Logging;
import map_generation.map.Map;
import network.innershell.NetworkConnection;
import network.inner_shell.NetworkConnection;
import core.event.MapChangeEvent;
import core.relayer.*;
import artificial_intelligence.AIControler;
import artificial_intelligence.AIEntities.EnumBehaviourType;
import java.io.InterruptedIOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
......
......@@ -8,8 +8,8 @@ import core.relayer.Relayer;
import core.relayer.Relayers;
import graphics.graphical_abstraction.GraphicsMasterAbstraction;
import logging.Logging;
import network.innershell.EndEvent;
import network.innershell.NetworkConnection;
import network.helpers.EndEvent;
import network.inner_shell.NetworkConnection;
import java.util.concurrent.Semaphore;
......
......@@ -4,10 +4,9 @@ import artificial_intelligence.AIControler;
import core.relayer.Relayer;
import core.relayer.Relayers;
import logging.Logging;
import network.innershell.ClientConnection;
import network.innershell.LocalConnection;
import network.innershell.NetworkConnection;
import network.innershell.NetworkObject;
import network.inner_shell.ClientConnection;
import network.inner_shell.LocalConnection;
import network.inner_shell.NetworkConnection;
/**
* Created by dupriez on 12/11/15.
......
......@@ -9,9 +9,10 @@ import logging.Logging;
import map_generation.map.Map;
import map_generation.map.MapGeneration;
import map_generation.map.MapSize;
import network.innershell.EndEvent;
import network.innershell.NetworkConnection;
import network.innershell.ServerConnection;
import network.helpers.EndEvent;
import network.inner_shell.NetworkConnection;
import network.inner_shell.ServerConnection;
import network.outer_shell.Lounge;
/**
* This might also be a LocalServerLoop, it is just a thread object that cannot and should not be reused
......@@ -47,7 +48,7 @@ public class ServerLoop extends Thread {
nextMap= MapGeneration.mapGeneration(MapSize.SMALL);
int playerNumber;
if (networkConnection instanceof ServerConnection)
playerNumber=2;
playerNumber= Lounge.MAX_PLAYERS;
else
playerNumber=1;
GameContent gameContent=null;
......
package graphics.guiSkeleton.guiPanel.menuPanel;
import gameloop.DummyLocalGameLoop;
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;
import graphics.ingame_input_listener.Input;
import network.outershell.RPCClient;
import network.outershell.server.RPCServer;
import network.outer_shell.RPCClient;
import network.outer_shell.server.RPCServer;
import javax.swing.*;
import java.awt.event.ActionEvent;
......
package graphics.guiSkeleton.guiPanel.menuPanel.multiPlayer_MenuPanel;
import graphics.guiSkeleton.GUIColorsAndFonts;
import graphics.guiSkeleton.GraphicsMaster;
import network.outershell.Lounge;
import network.outershell.RPCClient;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
/**
* Created by dupriez on 07/12/15.
......
......@@ -10,8 +10,8 @@ import graphics.ingame_input_listener.Input;
import javax.swing.*;
import gameloop.GameStarter;
import network.outershell.Lounge;
import network.outershell.RPCClient;
import network.outer_shell.Lounge;
import network.outer_shell.RPCClient;
import java.awt.*;
import java.awt.event.ActionEvent;
......
......@@ -4,10 +4,9 @@ import gameloop.GameStarter;
import graphics.graphical_abstraction.GraphicsMasterAbstraction;
import graphics.guiSkeleton.GUIColorsAndFonts;
import graphics.guiSkeleton.GraphicsMaster;
import graphics.guiSkeleton.guiPanel.menuPanel.facilities.ButtonMaker;
import logging.Logging;
import network.outershell.Lounge;
import network.outershell.RPCClient;
import network.outer_shell.Lounge;
import network.outer_shell.RPCClient;
import javax.swing.*;
import java.awt.*;
......
package network.innershell;
package network.helpers;
import core.event.Event;
import core.gamestate.GameContent;
......
package network.innershell;
package network.helpers;
import gameloop.ServerLoop;
import logging.Logging;
import network.outershell.Lounge;
import network.inner_shell.ServerConnection;
import network.outer_shell.Lounge;
/**
* Created by bogdanbear on 20/11/2015.
*/
public class LoungeServer extends Thread {
public class LoungeServer extends Waitable implements Runnable{
private Lounge lounge;
private int numberOfPlayers;
public LoungeServer(Lounge lounge, int numberOfPlayers)
......@@ -27,21 +28,4 @@ public class LoungeServer extends Thread {
}
/**
* we need this wrapper because notify must be called inside a synchronized method
* to do - implement this and waitOnIt() as an interface.
*/
public synchronized void notifyOnIt()
{
notify();
}
public synchronized void waitOnIt()
{
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
package network.innershell;
package network.helpers;
import logging.Logging;
......
package network.test;
package network.helpers;
import core.event.Event;
import core.gamestate.GameContent;
......@@ -9,10 +9,10 @@ import core.gamestate.GameContent;
*/
public class TestEvent implements Event{
String testMessage;
private String testMessage;
public TestEvent(String string)
{
testMessage=string;
setTestMessage(string);
}
@Override
public boolean execute(GameContent gameContent) {
......@@ -25,4 +25,11 @@ public class TestEvent implements Event{
return this;
}
public String getTestMessage() {
return testMessage;
}
public void setTestMessage(String testMessage) {
this.testMessage = testMessage;
}
}
package network.helpers;
/**
* Created by bogdanbear on 06/01/2016.
* this abstract class is for objects which can be used for thread synchronization using notify and wait
* since these require that the object monitor is acquired, we have to use synchronized methods
*/
public abstract class Waitable {
/**
* we need this wrapper because notify must be called inside a synchronized method
* to do - implement this and waitOnIt() as an interface.
*/
public synchronized void notifyOnIt()
{
notify();
}
/**
* just wait on this object till notified by another thread
*/
public synchronized void waitOnIt()
{
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
package network.innershell;
package network.inner_shell;
import network.helpers.EndEvent;
import network.helpers.NetworkObject;
import java.io.IOException;
import java.io.NotSerializableException;
......
package network.innershell;
package network.inner_shell;
import logging.Logging;
import network.helpers.EndEvent;
import network.helpers.NetworkObject;
import java.io.EOFException;
import java.io.IOException;
......
package network.innershell;
package network.inner_shell;
import logging.Logging;
import network.helpers.NetworkObject;
import java.io.IOException;
import java.io.ObjectOutputStream;
......
package network.innershell;
package network.inner_shell;
import network.helpers.EndEvent;
import network.helpers.NetworkObject;
import java.util.NoSuchElementException;
import java.util.concurrent.BlockingDeque;
......
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