Added client socket
This commit is contained in:
@@ -6,12 +6,14 @@ import java.util.Random;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
|
||||
import gltronic.tronio.model.Game;
|
||||
import gltronic.tronio.model.Player;
|
||||
import gltronic.tronio.model.Wall;
|
||||
|
||||
@Service
|
||||
public class GameManager implements IGameManager {
|
||||
@Autowired
|
||||
Game game;
|
||||
@@ -29,6 +31,7 @@ public class GameManager implements IGameManager {
|
||||
game.getPlayers().put(session.getId(), player);
|
||||
|
||||
SocketUtils.forwardMessage(session, "login", new JSONObject(player));
|
||||
SocketUtils.forwardMessage(session, "gameSettings", new JSONObject(game.getSettings()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,7 +93,7 @@ public class GameManager implements IGameManager {
|
||||
private void killPlayer (String id) {
|
||||
Player player = game.getPlayers().get(id);
|
||||
initPlayer(player);
|
||||
SocketUtils.sendMessage(game.getSessions().get(id), "dead", "yo dead");
|
||||
SocketUtils.sendMessage(game.getSessions().get(id), "gamePlayerDead", "yo dead");
|
||||
}
|
||||
|
||||
private boolean isCloseToWall (double xa, double ya, double xb, double yb, double xc, double yc, double radius) {
|
||||
|
||||
Reference in New Issue
Block a user