diff --git a/android/src/com/aqwsxlostfly/packandgo/client/MessageProcessor.java b/android/src/com/aqwsxlostfly/packandgo/client/MessageProcessor.java
index 2291176..3765108 100644
--- a/android/src/com/aqwsxlostfly/packandgo/client/MessageProcessor.java
+++ b/android/src/com/aqwsxlostfly/packandgo/client/MessageProcessor.java
@@ -48,7 +48,6 @@ private void processObject(JsonValue object) {
main.setMeId(meId);
break;
case "sessionRoom":
-
String sessionId = object.getString("id");
String sessionPassword = object.getString("password");
String sessionMsg = object.getString("msg");
diff --git a/assets/Map.tmx b/assets/Map.tmx
index 18d6802..d55443e 100644
--- a/assets/Map.tmx
+++ b/assets/Map.tmx
@@ -1,5 +1,5 @@
-
\ No newline at end of file
diff --git a/core/src/com/aqwsxlostfly/packandgo/AssetManagerSingleton.java b/core/src/com/aqwsxlostfly/packandgo/AssetManagerSingleton.java
index 6533b41..c1b3425 100644
--- a/core/src/com/aqwsxlostfly/packandgo/AssetManagerSingleton.java
+++ b/core/src/com/aqwsxlostfly/packandgo/AssetManagerSingleton.java
@@ -1,22 +1,22 @@
-package com.aqwsxlostfly.packandgo;
-
-import com.badlogic.gdx.assets.AssetManager;
-import com.badlogic.gdx.graphics.Texture;
-
-public class AssetManagerSingleton {
- private static AssetManagerSingleton assetManagerSingleton;
-
- private AssetManager assetManager;
-
- private AssetManagerSingleton() {
- assetManager = new AssetManager();
- }
-
- public static AssetManager getAssetManager() {
- if (assetManagerSingleton == null) {
- assetManagerSingleton = new AssetManagerSingleton();
- }
- Texture.setAssetManager(assetManagerSingleton.assetManager);
- return assetManagerSingleton.assetManager;
- }
-}
+//package com.aqwsxlostfly.packandgo;
+//
+//import com.badlogic.gdx.assets.AssetManager;
+//import com.badlogic.gdx.graphics.Texture;
+//
+//public class AssetManagerSingleton {
+// private static AssetManagerSingleton assetManagerSingleton;
+//
+// private AssetManager assetManager;
+//
+// private AssetManagerSingleton() {
+// assetManager = new AssetManager();
+// }
+//
+// public static AssetManager getAssetManager() {
+// if (assetManagerSingleton == null) {
+// assetManagerSingleton = new AssetManagerSingleton();
+// }
+// Texture.setAssetManager(assetManagerSingleton.assetManager);
+// return assetManagerSingleton.assetManager;
+// }
+//}
diff --git a/core/src/com/aqwsxlostfly/packandgo/GraphicsObj/GraphicsObj.java b/core/src/com/aqwsxlostfly/packandgo/GraphicsObj/GraphicsObj.java
index 48f71a7..730390c 100644
--- a/core/src/com/aqwsxlostfly/packandgo/GraphicsObj/GraphicsObj.java
+++ b/core/src/com/aqwsxlostfly/packandgo/GraphicsObj/GraphicsObj.java
@@ -12,6 +12,4 @@ public GraphicsObj(Texture img){
public abstract void draw(SpriteBatch batch);
- public abstract void update();
-
}
diff --git a/core/src/com/aqwsxlostfly/packandgo/Main.java b/core/src/com/aqwsxlostfly/packandgo/Main.java
index cb9b0c9..9360685 100644
--- a/core/src/com/aqwsxlostfly/packandgo/Main.java
+++ b/core/src/com/aqwsxlostfly/packandgo/Main.java
@@ -29,13 +29,8 @@ public Main(InputState inputState) {
public static int screenWidth;
public static int screenHeight;
- public static int record;
-
public boolean socketState;
-// public WaitingSc waitingSc;
-
-
@Override
public void create() {
diff --git a/core/src/com/aqwsxlostfly/packandgo/Screens/HomeSc.java b/core/src/com/aqwsxlostfly/packandgo/Screens/HomeSc.java
index 19ed50e..210a8fa 100644
--- a/core/src/com/aqwsxlostfly/packandgo/Screens/HomeSc.java
+++ b/core/src/com/aqwsxlostfly/packandgo/Screens/HomeSc.java
@@ -1,6 +1,20 @@
package com.aqwsxlostfly.packandgo.Screens;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.CONNECTING;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.CONNECTING_TEXT;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.CONNECTION_ERROR;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.CREATE_ROOM;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.DOES_NOT_EXIST_TEXT;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.FAILED_TO_CONNECT;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.INCORRECT_PASSWORD_TEXT;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.JOIN_ERROR;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.JOIN_ROOM;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.MAX_PLAYERS_TEXT;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.SESSION_EXISTS;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.SESSION_EXIST_TEXT;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.SOME_ERROR;
+import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.SOME_ERROR_TEXT;
import static com.aqwsxlostfly.packandgo.render.Renderer.setGameScreen;
import com.aqwsxlostfly.packandgo.Heroes.Player;
@@ -264,29 +278,13 @@ public void clicked(InputEvent event, float x, float y) {
}
-
- private static final String CONNECTING = "CONNECTING";
- private static final String CONNECTING_TEXT = "CONNECTING...";
- private static final String CONNECTION_ERROR = "Connection Error";
- private static final String FAILED_TO_CONNECT = "Failed to connect to the server. Check your internet.";
- private static final String CREATE_ROOM = "CREATE ROOM";
- private static final String JOIN_ROOM = "JOIN ROOM";
- private static final String SESSION_EXISTS = "Creation Error";
- private static final String SESSION_EXIST_TEXT = "Session already exist.";
- private static final String DOES_NOT_EXIST_TEXT = "Session does not exist.";
- private static final String INCORRECT_PASSWORD_TEXT = "Incorrect session password.";
- private static final String JOIN_ERROR = "Joining Error";
- private static final String MAX_PLAYERS_TEXT = "Room is full. Players limit exceeded.";
-
- private static final String SOME_ERROR = "Error occured";
- private static final String SOME_ERROR_TEXT = "Some error occured. Restart game.";
-
private void connectToServer(String password, String roomId, boolean isCreating) {
String action = isCreating ? "createRoom" : "joinRoom";
SessionState sessionState = new SessionStateToSend(action, roomId, password);
try {
Main.messageSender.sendMessage(sessionState);
startConnectionTimer(isCreating, roomId, password);
+
} catch (Exception e) {
showErrorDialog(CONNECTION_ERROR, FAILED_TO_CONNECT, 5);
Gdx.app.log(isCreating ? "ERROR CREATE" : "ERROR JOIN", action + "State " + main.gameSession.getSessionMsg());
@@ -317,7 +315,7 @@ private void checkConnectionStatus(boolean isCreating, String roomId, String pas
case "connected_ok":
Gdx.app.log(isCreating ? CREATE_ROOM : JOIN_ROOM, "Creating a room with ID: " + roomId + " and password: " + password +
" response " + main.gameSession.getSessionMsg());
- setGameScreen(new PlayScreen());
+ setGameScreen();
break;
case "session_exists":
showErrorDialog(SESSION_EXISTS, SESSION_EXIST_TEXT, 5);
diff --git a/core/src/com/aqwsxlostfly/packandgo/Screens/PlayScreen.java b/core/src/com/aqwsxlostfly/packandgo/Screens/PlayScreen.java
index 5d68a3d..379efe7 100644
--- a/core/src/com/aqwsxlostfly/packandgo/Screens/PlayScreen.java
+++ b/core/src/com/aqwsxlostfly/packandgo/Screens/PlayScreen.java
@@ -10,22 +10,17 @@
import com.aqwsxlostfly.packandgo.Heroes.Player;
import com.aqwsxlostfly.packandgo.InputState;
import com.aqwsxlostfly.packandgo.Main;
-import com.aqwsxlostfly.packandgo.Tools.GameHud;
import com.aqwsxlostfly.packandgo.Tools.Joystick;
import com.aqwsxlostfly.packandgo.Tools.Point2D;
import com.aqwsxlostfly.packandgo.Tools.TileMapHelper;
import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.InputAdapter;
-import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.maps.MapProperties;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
-import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
-import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.Timer;
@@ -36,37 +31,33 @@ public class PlayScreen implements Screen {
Joystick joy;
private final TileMapHelper tileMapHelper;
- private static final float frameRate = 1/60f;
- public GameHud gameHud;
private static final float frameRateRender = 1/60f;
private static final float frameRateTimer = 1/50f;
- private final int mapWidth, mapHeight, tilePixelWidth, tilePixelHeight, mapPixelWidth, mapPixelHeight;
+ private final int mapPixelWidth;
+ private final int mapPixelHeight;
public static ObjectMap players = new ObjectMap<>();
private final OrthogonalTiledMapRenderer orthogonalTiledMapRenderer;
private final OrthographicCamera hudCamera;
- private Box2DDebugRenderer box2DDebugRenderer = new Box2DDebugRenderer();
+ private final Box2DDebugRenderer box2DDebugRenderer = new Box2DDebugRenderer();
public PlayScreen() {
hudCamera = new OrthographicCamera(screenWidth, screenHeight);
hudCamera.viewportWidth = screenWidth; // Размеры для камеры HUD
hudCamera.viewportHeight = screenHeight;
- hudCamera.position.set(screenWidth / 2, screenHeight / 2, 0);
+ hudCamera.position.set((float) screenWidth / 2, (float) screenHeight / 2, 0);
hudCamera.update();
this.tileMapHelper = new TileMapHelper();
orthogonalTiledMapRenderer = tileMapHelper.setupMap();
updatePlayerArray(meId, 0,0);
- InputMultiplexer inputMultiplexer = new InputMultiplexer();
- gameHud = new GameHud(players.get(meId)); // (или передайте player если он нужен для инициализации GameHud)
- inputMultiplexer.addProcessor(gameHud.stage); // Первый обработчик, чтобы убедиться, что UI имеет приоритет
- inputMultiplexer.addProcessor(new InputAdapter() { // Ваш текущий обработчик событий в PlayScreen
+ Gdx.input.setInputProcessor(new InputProcessor() {
@Override
public boolean keyDown(int keycode) {
return false;
@@ -116,20 +107,17 @@ public boolean scrolled(float amountX, float amountY) {
return false;
}
});
- Gdx.input.setInputProcessor(inputMultiplexer);
MapProperties properties = tileMapHelper.tiledMap.getProperties();
- mapWidth = properties.get("width", Integer.class);
- mapHeight = properties.get("height", Integer.class);
- tilePixelWidth = properties.get("tilewidth", Integer.class);
- tilePixelHeight = properties.get("tileheight", Integer.class);
+ int mapWidth = properties.get("width", Integer.class);
+ int mapHeight = properties.get("height", Integer.class);
+ int tilePixelWidth = properties.get("tilewidth", Integer.class);
+ int tilePixelHeight = properties.get("tileheight", Integer.class);
mapPixelWidth = mapWidth * tilePixelWidth;
mapPixelHeight = mapHeight * tilePixelHeight;
loadHeroes();
-
-
}
public void updatePlayerArray(String id, float x_, float y_) {
@@ -179,8 +167,6 @@ public void render(SpriteBatch batch, OrthographicCamera camera) {
batch.setProjectionMatrix(hudCamera.combined);
joy.draw(batch); // Рисуем джойстик с использованием камеры HUD
- gameHud.update(frameRateRender);
- gameHud.draw();
box2DDebugRenderer.render(world,camera.combined.scl(1));
@@ -194,7 +180,7 @@ public void updatePlayers(){
@Override
public void dispose() {
- gameHud.dispose();
+
}
public void loadHeroes() {
@@ -251,8 +237,9 @@ public InputState updateAndGetInputState(Player player) {
inputState.setId(meId);
inputState.setX(player.getX());
inputState.setY(player.getY());
+// inputState.setX(player.getBody().getLinearVelocity().x);
+// inputState.setY(player.getBody().getLinearVelocity().y);
return inputState;
}
}
-
diff --git a/core/src/com/aqwsxlostfly/packandgo/Tools/GameHud.java b/core/src/com/aqwsxlostfly/packandgo/Tools/GameHud.java
index 3ec1522..17923e9 100644
--- a/core/src/com/aqwsxlostfly/packandgo/Tools/GameHud.java
+++ b/core/src/com/aqwsxlostfly/packandgo/Tools/GameHud.java
@@ -1,95 +1,95 @@
-package com.aqwsxlostfly.packandgo.Tools;
-
-
-import static com.aqwsxlostfly.packandgo.AssetManagerSingleton.getAssetManager;
-
-import com.aqwsxlostfly.packandgo.Heroes.Player;
-import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.graphics.Texture;
-import com.badlogic.gdx.scenes.scene2d.Stage;
-import com.badlogic.gdx.scenes.scene2d.ui.Skin;
-import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
-import com.badlogic.gdx.scenes.scene2d.InputEvent;
-import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
-import com.badlogic.gdx.utils.viewport.ScreenViewport;
-
-public class GameHud {
- Texture tabouret;
- Texture hero;
- public Stage stage; // Используется для управления и отображения UI
- public Skin skin; // Скин для стилизации элементов UI
- public TextButton takeBtn; // Кнопка в UI
- public TextButton fightBtn; // Кнопка в UI
- public Player player;
-
-
- public GameHud(Player player) {
- tabouret = new Texture("tabouret.png");
- hero = new Texture("tile_0456.png");
- // Инициализация скина и сцены
- skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
- stage = new Stage(new ScreenViewport());
-
- // Установка обработчика ввода в текущую сцену
- //Gdx.input.setInputProcessor(stage);
-
- // Создание и настройка кнопки
- takeBtn = new TextButton("Take", skin);
- fightBtn = new TextButton("GIVE PUSSY", skin);
- takeBtn.setSize(250, 150); // Установка размера кнопки
- takeBtn.setPosition(Gdx.graphics.getWidth() -450, Gdx.graphics.getHeight() / 2 - 450); // Позиционирование кнопки
- fightBtn.setSize(250, 150); // Установка размера кнопки
- fightBtn.setPosition(Gdx.graphics.getWidth() -450, Gdx.graphics.getHeight() / 2 - 250); // Позиционирование кнопки
-
- this.player = player;
-
- // Добавление кнопки на сцену
- stage.addActor(takeBtn);
- stage.addActor(fightBtn);
-
- // Добавление обработчика событий для кнопки
- addListeners();
-
- }
-
- public void draw() {
- // Отрисовка сцены (и всех элементов UI на ней)
- stage.draw();
- }
-
- public void update(float delta) {
- // Обновление сцены
- stage.act(delta);
- }
-
- private void addListeners() {
- takeBtn.addListener(new ClickListener() {
-
- @Override
- public void clicked(InputEvent event, float x, float y) {
- Texture currentTexture = player.textureMapObject.getTextureRegion().getTexture();
- // Обработка нажатия на кнопку
- Gdx.app.log("Button Clicked", "Take button was pressed");
- if (currentTexture != tabouret){
- Gdx.app.log("INFO","смена текстуры");
- player.textureMapObject.getTextureRegion().setTexture(tabouret);
-
- } else{
- //player.textureMapObject.getTextureRegion().setTexture(null);
- player.textureMapObject.getTextureRegion().setTexture(hero);
- }
- }
- });
- }
-
- // Вызовите этот метод в вашем основном цикле приложения для обеспечения обновления UI
- public void resize(int width, int height) {
- stage.getViewport().update(width, height, true);
- }
-
- // Не забудьте освободить ресурсы
- public void dispose() {
- stage.dispose();
- skin.dispose();
- }
-}
\ No newline at end of file
+//package com.aqwsxlostfly.packandgo.Tools;
+//
+//
+//import static com.aqwsxlostfly.packandgo.AssetManagerSingleton.getAssetManager;
+//
+//import com.aqwsxlostfly.packandgo.Heroes.Player;
+//import com.badlogic.gdx.Gdx;
+//import com.badlogic.gdx.graphics.Texture;
+//import com.badlogic.gdx.scenes.scene2d.Stage;
+//import com.badlogic.gdx.scenes.scene2d.ui.Skin;
+//import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
+//import com.badlogic.gdx.scenes.scene2d.InputEvent;
+//import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
+//import com.badlogic.gdx.utils.viewport.ScreenViewport;
+//
+//public class GameHud {
+// Texture tabouret;
+// Texture hero;
+// public Stage stage; // Используется для управления и отображения UI
+// public Skin skin; // Скин для стилизации элементов UI
+// public TextButton takeBtn; // Кнопка в UI
+// public TextButton fightBtn; // Кнопка в UI
+// public Player player;
+//
+//
+// public GameHud(Player player) {
+// tabouret = new Texture("tabouret.png");
+// hero = new Texture("tile_0456.png");
+// // Инициализация скина и сцены
+// skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
+// stage = new Stage(new ScreenViewport());
+//
+// // Установка обработчика ввода в текущую сцену
+// //Gdx.input.setInputProcessor(stage);
+//
+// // Создание и настройка кнопки
+// takeBtn = new TextButton("Take", skin);
+// fightBtn = new TextButton("GIVE PUSSY", skin);
+// takeBtn.setSize(250, 150); // Установка размера кнопки
+// takeBtn.setPosition(Gdx.graphics.getWidth() -450, Gdx.graphics.getHeight() / 2 - 450); // Позиционирование кнопки
+// fightBtn.setSize(250, 150); // Установка размера кнопки
+// fightBtn.setPosition(Gdx.graphics.getWidth() -450, Gdx.graphics.getHeight() / 2 - 250); // Позиционирование кнопки
+//
+// this.player = player;
+//
+// // Добавление кнопки на сцену
+// stage.addActor(takeBtn);
+// stage.addActor(fightBtn);
+//
+// // Добавление обработчика событий для кнопки
+// addListeners();
+//
+// }
+//
+// public void draw() {
+// // Отрисовка сцены (и всех элементов UI на ней)
+// stage.draw();
+// }
+//
+// public void update(float delta) {
+// // Обновление сцены
+// stage.act(delta);
+// }
+//
+// private void addListeners() {
+// takeBtn.addListener(new ClickListener() {
+//
+// @Override
+// public void clicked(InputEvent event, float x, float y) {
+// Texture currentTexture = player.textureMapObject.getTextureRegion().getTexture();
+// // Обработка нажатия на кнопку
+// Gdx.app.log("Button Clicked", "Take button was pressed");
+// if (currentTexture != tabouret){
+// Gdx.app.log("INFO","смена текстуры");
+// player.textureMapObject.getTextureRegion().setTexture(tabouret);
+//
+// } else{
+// //player.textureMapObject.getTextureRegion().setTexture(null);
+// player.textureMapObject.getTextureRegion().setTexture(hero);
+// }
+// }
+// });
+// }
+//
+// // Вызовите этот метод в вашем основном цикле приложения для обеспечения обновления UI
+// public void resize(int width, int height) {
+// stage.getViewport().update(width, height, true);
+// }
+//
+// // Не забудьте освободить ресурсы
+// public void dispose() {
+// stage.dispose();
+// skin.dispose();
+// }
+//}
\ No newline at end of file
diff --git a/core/src/com/aqwsxlostfly/packandgo/Tools/Joystick.java b/core/src/com/aqwsxlostfly/packandgo/Tools/Joystick.java
index 5d7a11b..ba290aa 100644
--- a/core/src/com/aqwsxlostfly/packandgo/Tools/Joystick.java
+++ b/core/src/com/aqwsxlostfly/packandgo/Tools/Joystick.java
@@ -1,6 +1,7 @@
package com.aqwsxlostfly.packandgo.Tools;
import com.aqwsxlostfly.packandgo.Main;
+import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
@@ -34,6 +35,7 @@ public void draw(SpriteBatch batch){
}
public void update(float x, float y, boolean isDownTouch, int pointer){
+ Gdx.app.log("Joystick", "Update called with x: " + x + ", y: " + y + ", isDownTouch: " + isDownTouch + ", pointer: " + pointer);
Point2D touch = new Point2D(x, y);
if (CircleBounds.isContains(touch) && isDownTouch && this.pointer == -1) this.pointer = pointer;
if (CircleBounds.overLaps(StickBounds) && isDownTouch && pointer == this.pointer) atControl(new Point2D(x, y));
diff --git a/core/src/com/aqwsxlostfly/packandgo/Tools/TileMapHelper.java b/core/src/com/aqwsxlostfly/packandgo/Tools/TileMapHelper.java
index 0a97253..87ca1ce 100644
--- a/core/src/com/aqwsxlostfly/packandgo/Tools/TileMapHelper.java
+++ b/core/src/com/aqwsxlostfly/packandgo/Tools/TileMapHelper.java
@@ -34,7 +34,6 @@
public class TileMapHelper {
public TiledMap tiledMap;
- public static TiledMapTileLayer collisionLayer;
public static int worldHeight;
public static int worldWigth;
private Player player;
@@ -79,8 +78,6 @@ public OrthogonalTiledMapRenderer setupMap() {
parseMapObjects(tiledMap.getLayers().get("hero").getObjects());
- collisionLayer = (TiledMapTileLayer) tiledMap.getLayers().get(0);
-
for(MapLayer mapLayer : tiledMap.getLayers()){
// Gdx.app.log("CHECK LAYER", "id " + mapLayer.getName());
diff --git a/core/src/com/aqwsxlostfly/packandgo/constants/ScreensConstants.java b/core/src/com/aqwsxlostfly/packandgo/constants/ScreensConstants.java
new file mode 100644
index 0000000..bea4963
--- /dev/null
+++ b/core/src/com/aqwsxlostfly/packandgo/constants/ScreensConstants.java
@@ -0,0 +1,19 @@
+package com.aqwsxlostfly.packandgo.constants;
+
+public class ScreensConstants {
+ public static final String CONNECTING = "CONNECTING";
+ public static final String CONNECTING_TEXT = "CONNECTING...";
+ public static final String CONNECTION_ERROR = "Connection Error";
+ public static final String FAILED_TO_CONNECT = "Failed to connect to the server. Check your internet.";
+ public static final String CREATE_ROOM = "CREATE ROOM";
+ public static final String JOIN_ROOM = "JOIN ROOM";
+ public static final String SESSION_EXISTS = "Creation Error";
+ public static final String SESSION_EXIST_TEXT = "Session already exist.";
+ public static final String DOES_NOT_EXIST_TEXT = "Session does not exist.";
+ public static final String INCORRECT_PASSWORD_TEXT = "Incorrect session password.";
+ public static final String JOIN_ERROR = "Joining Error";
+ public static final String MAX_PLAYERS_TEXT = "Room is full. Players limit exceeded.";
+
+ public static final String SOME_ERROR = "Error occured";
+ public static final String SOME_ERROR_TEXT = "Some error occured. Restart game.";
+}
diff --git a/core/src/com/aqwsxlostfly/packandgo/render/Renderer.java b/core/src/com/aqwsxlostfly/packandgo/render/Renderer.java
index d0712ea..6e97d59 100644
--- a/core/src/com/aqwsxlostfly/packandgo/render/Renderer.java
+++ b/core/src/com/aqwsxlostfly/packandgo/render/Renderer.java
@@ -13,7 +13,7 @@
public class Renderer {
- public static final SpriteBatch batch = new SpriteBatch();
+ private final SpriteBatch batch = new SpriteBatch();
private final OrthographicCamera camera;
@@ -35,6 +35,8 @@ public Renderer() {
font = generator.generateFont(parameter);
generator.dispose();
+ Renderer.gameScreen = new PlayScreen();
+
}
@@ -76,10 +78,9 @@ public void setHomeScreen(HomeSc screen) {
// homeScreen.screenToChange(newScreen -> homeScreen = (HomeSc) screen);
}
- public static void setGameScreen(PlayScreen screen) {
- gameScreen = screen;
+ public static void setGameScreen() {
currentScreen = gameScreen;
-// gameScreen.screenToChange(newScreen -> gameScreen = (PlayScreen) screen);
+// gameScreen.screenToChange(newScreen -> gameScreen = (PlayScreen) gameScreen);
}
-}
+}
\ No newline at end of file
diff --git a/server/src/main/java/com/aqwsxlostfly/packandgo/packandgo/Sessions/GameSessionManager.java b/server/src/main/java/com/aqwsxlostfly/packandgo/packandgo/Sessions/GameSessionManager.java
index 08e8f32..ceee671 100644
--- a/server/src/main/java/com/aqwsxlostfly/packandgo/packandgo/Sessions/GameSessionManager.java
+++ b/server/src/main/java/com/aqwsxlostfly/packandgo/packandgo/Sessions/GameSessionManager.java
@@ -43,13 +43,14 @@ public GameSessionManager(Json json) {
}
public String getSessionIdByUserId(String userSessionId) {
+
return userToSession.getOrDefault(userSessionId, null);
}
public void updateGameSession(String userId, JsonNode state) {
String sessionId = getSessionIdByUserId(userId);
- if (activeGameSessions.containsKey(sessionId)) {
+ if (sessionId != null && activeGameSessions.containsKey(sessionId)) {
activeGameSessions.get(sessionId).updateGameState(state);
} else {
// TODO