Commit 49f9b22b authored by Thomas Lecluse's avatar Thomas Lecluse
Browse files

Merge branch 'feature/com/createGameClientAndServer' into 'int/v2'

As per GDrive>Dev>Communication>ToDoV2>Clement

See merge request !32
parents f0e885b6 f1524da9
......@@ -8,6 +8,7 @@ import main.java.common.interfaces.client.IDataToCom;
import java.sql.Timestamp;
import java.util.UUID;
import main.java.client.network.messages.clientToServer.NewGameToServerMessage;
public class DataToComClientImpl implements IDataToCom {
......@@ -38,7 +39,8 @@ public class DataToComClientImpl implements IDataToCom {
@Override
public void addNewGameAvailable(GameLight newGame) {
// TODO Auto-generated method stub
NewGameToServerMessage message = new NewGameToServerMessage(newGame);
comCoreClient.getMessageClientController().sendNewGameAvailableToServer(message);
}
@Override
......
......@@ -3,6 +3,7 @@ package main.java.client.network;
import main.java.client.network.messages.clientToServer.LoginUserToServerMessage;
import java.util.Optional;
import main.java.client.network.messages.clientToServer.NewGameToServerMessage;
/**
* Class handling message sending & receiving
......@@ -41,4 +42,8 @@ public class MessageClientController {
public void sendLoginUserToServer(LoginUserToServerMessage message) {
wsHandler.sendMessage(message);
}
void sendNewGameAvailableToServer(NewGameToServerMessage message) {
wsHandler.sendMessage(message);
}
}
package main.java.client.network.messages.serverToClient;
import main.java.common.dataModel.GameLight;
import main.java.common.interfaces.client.IComToData;
import main.java.common.message.MessageMeta;
/**
......@@ -8,6 +9,8 @@ import main.java.common.message.MessageMeta;
*/
public class NewGameNotificationToClientMessage extends MessageMeta {
private GameLight newGame;
private IComToData iComToData;
public NewGameNotificationToClientMessage(GameLight newGame) {
this.newGame = newGame;
......@@ -18,7 +21,7 @@ public class NewGameNotificationToClientMessage extends MessageMeta {
@Override
public void processData() {
// TODO: Implement
iComToData.notifyNewGame(this.newGame);
}
public GameLight getNewGame() {
......
......@@ -7,6 +7,7 @@ import main.java.common.interfaces.server.IDataToCom;
import main.java.server.network.messages.serverToClient.ServerStateOnConnectionMessage;
import java.util.ArrayList;
import main.java.server.network.messages.serverToClient.NewGameNotificationToClientMessage;
public class DataToComServerImpl implements IDataToCom {
......@@ -18,7 +19,9 @@ public class DataToComServerImpl implements IDataToCom {
@Override
public void notifyNewGame(GameLight newGameCreated) {
// TODO Auto-generated method stub
NewGameNotificationToClientMessage message = new NewGameNotificationToClientMessage(newGameCreated);
MessageServerController.getInstance().sendNewGameNotification(message);
comCoreServer.getMessageServerController().sendNewGameNotification(message);
}
@Override
......
......@@ -4,6 +4,7 @@ import main.java.server.network.messages.serverToClient.NewUserAddedMessage;
import main.java.server.network.messages.serverToClient.ServerStateOnConnectionMessage;
import java.util.Optional;
import main.java.server.network.messages.serverToClient.NewGameNotificationToClientMessage;
/**
* Class handling sending & receiving messages from clients
......@@ -70,4 +71,8 @@ public class MessageServerController {
public void notifyNewUserAdded(NewUserAddedMessage message) {
wsController.sendMessage(message);
}
public void sendNewGameNotification(NewGameNotificationToClientMessage message) {
wsController.sendMessage(message);
}
}
package main.java.server.network.messages.clientToServer;
import main.java.common.dataModel.GameLight;
import main.java.common.interfaces.server.IComToData;
import main.java.common.message.MessageMeta;
/**
......@@ -8,6 +9,8 @@ import main.java.common.message.MessageMeta;
*/
public class NewGameToServerMessage extends MessageMeta {
private IComToData iComToData;
private GameLight newGame;
public NewGameToServerMessage(GameLight newGame) {
......@@ -19,7 +22,7 @@ public class NewGameToServerMessage extends MessageMeta {
@Override
public void processData() {
// TODO: Implement
iComToData.createGame(this.newGame);
}
public GameLight getNewGame() {
......
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