From d29494f88993f2ea27e073aae9ee2b17cf312263 Mon Sep 17 00:00:00 2001 From: stefagr <stefagr@stud.ntnu.no> Date: Thu, 22 Apr 2021 17:46:21 +0200 Subject: [PATCH] minor changes --- .../mygdx/game/controllers/NetworkController.java | 4 ++-- .../game/views/{View.java => AbstractView.java} | 4 ++-- .../core/src/com/mygdx/game/views/CinematicView.java | 4 +--- .../src/com/mygdx/game/views/GameViewManager.java | 10 +++++----- .../core/src/com/mygdx/game/views/LoadingView.java | 4 +--- .../core/src/com/mygdx/game/views/LobbyView.java | 2 +- .../core/src/com/mygdx/game/views/MenuView.java | 8 +++++--- .../core/src/com/mygdx/game/views/PauseView.java | 2 +- .../core/src/com/mygdx/game/views/PlayView.java | 6 +----- .../core/src/com/mygdx/game/UniCheckersServer.java | 12 ++---------- ...{NetworkController.java => ServerController.java} | 9 ++++----- .../com/mygdx/game/controller/commands/Command.java | 4 ++-- .../mygdx/game/controller/commands/cLobbyCreate.java | 6 ++---- .../mygdx/game/controller/commands/cLobbyDelete.java | 6 ++---- .../game/controller/commands/cLobbyGetList.java | 5 ++--- .../mygdx/game/controller/commands/cLobbyJoin.java | 4 ++-- .../mygdx/game/controller/commands/cLobbyLeave.java | 5 ++--- .../mygdx/game/controller/commands/cPlayerJoin.java | 6 ++---- .../game/controller/commands/cPlayerPieceClick.java | 4 ++-- .../game/controller/commands/cPlayerPieceMove.java | 4 ++-- .../game/controller/commands/cSetIndexAvatar.java | 6 ++---- .../game/controller/commands/cSetPlayerName.java | 8 ++------ .../game/controller/commands/cSetPlayerReady.java | 4 ++-- .../mygdx/game/controller/commands/cStartGame.java | 4 ++-- 24 files changed, 51 insertions(+), 80 deletions(-) rename CheckersClient/core/src/com/mygdx/game/views/{View.java => AbstractView.java} (94%) rename CheckersServer/core/src/com/mygdx/game/controller/{NetworkController.java => ServerController.java} (96%) diff --git a/CheckersClient/core/src/com/mygdx/game/controllers/NetworkController.java b/CheckersClient/core/src/com/mygdx/game/controllers/NetworkController.java index 92da9b2..54e4d80 100644 --- a/CheckersClient/core/src/com/mygdx/game/controllers/NetworkController.java +++ b/CheckersClient/core/src/com/mygdx/game/controllers/NetworkController.java @@ -23,8 +23,8 @@ public class NetworkController { this.client = new Client(); client.start(); try { - String IP4_LAN_ADDRESS = "192.168.0.136"; //122 //"192.168.87.20"; - client.connect(10000, IP4_LAN_ADDRESS, 54555, 54777); + String IP4_LAN_ADDRESS = "192.168.10.154"; //122 //"192.168.87.20"; + client.connect(10000, IP4_LAN_ADDRESS, 20123, 21393); } catch (IOException e) { e.printStackTrace(); } diff --git a/CheckersClient/core/src/com/mygdx/game/views/View.java b/CheckersClient/core/src/com/mygdx/game/views/AbstractView.java similarity index 94% rename from CheckersClient/core/src/com/mygdx/game/views/View.java rename to CheckersClient/core/src/com/mygdx/game/views/AbstractView.java index 5cc6e35..71e9d8f 100644 --- a/CheckersClient/core/src/com/mygdx/game/views/View.java +++ b/CheckersClient/core/src/com/mygdx/game/views/AbstractView.java @@ -17,7 +17,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.mygdx.game.controllers.PlayerController; -public abstract class View extends ApplicationAdapter { +public abstract class AbstractView extends ApplicationAdapter { protected OrthographicCamera cam; protected float[] lastTouch = new float[2];; @@ -44,7 +44,7 @@ public abstract class View extends ApplicationAdapter { protected boolean startFadeIn; protected Texture fadeOverlayTexture; - protected View(GameViewManager gvm, PlayerController playerController, AssetManager assetManager, Stage stage, Skin skin){ + protected AbstractView(GameViewManager gvm, PlayerController playerController, AssetManager assetManager, Stage stage, Skin skin){ this.gvm = gvm; this.stage = stage; this.assetManager = assetManager; diff --git a/CheckersClient/core/src/com/mygdx/game/views/CinematicView.java b/CheckersClient/core/src/com/mygdx/game/views/CinematicView.java index c114195..c104516 100644 --- a/CheckersClient/core/src/com/mygdx/game/views/CinematicView.java +++ b/CheckersClient/core/src/com/mygdx/game/views/CinematicView.java @@ -1,9 +1,7 @@ package com.mygdx.game.views; -import com.badlogic.gdx.Gdx; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.audio.Music; -import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; @@ -28,7 +26,7 @@ import com.mygdx.game.views.tokens.AnimatedSprite; import java.util.ArrayList; -public class CinematicView extends View{ +public class CinematicView extends AbstractView { private final Image lobbyImage; private final Image backgroundImage; diff --git a/CheckersClient/core/src/com/mygdx/game/views/GameViewManager.java b/CheckersClient/core/src/com/mygdx/game/views/GameViewManager.java index 154bbc3..b7d6590 100644 --- a/CheckersClient/core/src/com/mygdx/game/views/GameViewManager.java +++ b/CheckersClient/core/src/com/mygdx/game/views/GameViewManager.java @@ -5,23 +5,23 @@ import java.util.Stack; public class GameViewManager { - private Stack<View> views; + private Stack<AbstractView> views; public GameViewManager(){ views = new Stack<>(); } - public void push(View view){ - views.push(view); + public void push(AbstractView abstractView){ + views.push(abstractView); } public void pop(){ views.pop(); } - public void set(View view){ + public void set(AbstractView abstractView){ views.pop(); - views.push(view); + views.push(abstractView); } public void handleInput(float dt){ diff --git a/CheckersClient/core/src/com/mygdx/game/views/LoadingView.java b/CheckersClient/core/src/com/mygdx/game/views/LoadingView.java index ffdadf1..3e3cef6 100644 --- a/CheckersClient/core/src/com/mygdx/game/views/LoadingView.java +++ b/CheckersClient/core/src/com/mygdx/game/views/LoadingView.java @@ -3,16 +3,14 @@ package com.mygdx.game.views; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.mygdx.game.controllers.PlayerController; import com.mygdx.game.views.enums.CharacterAssets; -import com.mygdx.game.views.enums.LobbyAssets; import com.mygdx.game.views.enums.MenuAssets; -public class LoadingView extends View { +public class LoadingView extends AbstractView { private Image loadingTextImage = new Image(new Texture("Loading/LoadingText.png")); private Image loadingDotImage = new Image(new Texture("Loading/LoadingDot.png")); diff --git a/CheckersClient/core/src/com/mygdx/game/views/LobbyView.java b/CheckersClient/core/src/com/mygdx/game/views/LobbyView.java index c6ea9ec..f05dcf2 100644 --- a/CheckersClient/core/src/com/mygdx/game/views/LobbyView.java +++ b/CheckersClient/core/src/com/mygdx/game/views/LobbyView.java @@ -38,7 +38,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -public class LobbyView extends View{ +public class LobbyView extends AbstractView { private final ArrayList<Actor> playerUIWidgets = new ArrayList<>(); private final Music currentSong; diff --git a/CheckersClient/core/src/com/mygdx/game/views/MenuView.java b/CheckersClient/core/src/com/mygdx/game/views/MenuView.java index 7bdd794..05d47ee 100644 --- a/CheckersClient/core/src/com/mygdx/game/views/MenuView.java +++ b/CheckersClient/core/src/com/mygdx/game/views/MenuView.java @@ -33,7 +33,7 @@ import com.mygdx.game.views.tokens.AnimatedSprite; import java.util.ArrayList; import java.util.HashMap; -public class MenuView extends View{ +public class MenuView extends AbstractView { private boolean startFadeFromWhiteToBlank; private boolean startFadeFromBlankToWhite; @@ -81,8 +81,10 @@ public class MenuView extends View{ availableAvatarsHashMap = Constants.AVAILABLEAVATARSHASHMAP; this.backgroundImage = new Image ((Texture) assetManager.get(MenuAssets.BACKGROUND.path, MenuAssets.BACKGROUND.classType)); - backgroundImage.setPosition(Gdx.graphics.getWidth()/2-backgroundImage.getWidth()/2, 0); - backgroundImage.setOrigin(0,0); + //backgroundImage.setPosition(Gdx.graphics.getWidth()/2-backgroundImage.getWidth()/2, 0); + //backgroundImage.setOrigin(0,0); + backgroundImage.setPosition(0, 0); + backgroundImage.setSize(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); formImage = new Image((Texture) assetManager.get(MenuAssets.FORM.path, MenuAssets.FORM.classType)); formImage.setPosition(col_width*6-formImage.getWidth()/2, row_height*0.15f); diff --git a/CheckersClient/core/src/com/mygdx/game/views/PauseView.java b/CheckersClient/core/src/com/mygdx/game/views/PauseView.java index 9c0712a..5564e4f 100644 --- a/CheckersClient/core/src/com/mygdx/game/views/PauseView.java +++ b/CheckersClient/core/src/com/mygdx/game/views/PauseView.java @@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.mygdx.game.controllers.PlayerController; -public class PauseView extends View{ +public class PauseView extends AbstractView { private Texture background; private Texture playBtn; diff --git a/CheckersClient/core/src/com/mygdx/game/views/PlayView.java b/CheckersClient/core/src/com/mygdx/game/views/PlayView.java index df0823f..f4291dd 100644 --- a/CheckersClient/core/src/com/mygdx/game/views/PlayView.java +++ b/CheckersClient/core/src/com/mygdx/game/views/PlayView.java @@ -13,13 +13,11 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.ui.TextField; -import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Scaling; import com.mygdx.game.Constants; import com.mygdx.game.controllers.GameController; import com.mygdx.game.controllers.PlayerController; import com.mygdx.game.controllers.UtilsKt; -import com.mygdx.game.model.Lobby; import com.mygdx.game.model.Player; import com.mygdx.game.views.enums.PlayAssets; import com.mygdx.game.views.tokens.AnimatedSprite; @@ -30,10 +28,8 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.ConcurrentHashMap; -import static com.badlogic.gdx.scenes.scene2d.InputEvent.Type.touchDown; - -public class PlayView extends View{ +public class PlayView extends AbstractView { int Help_Guides = 12; int row_height = Gdx.graphics.getHeight() / Help_Guides; diff --git a/CheckersServer/core/src/com/mygdx/game/UniCheckersServer.java b/CheckersServer/core/src/com/mygdx/game/UniCheckersServer.java index 2cfa26e..d7f9232 100644 --- a/CheckersServer/core/src/com/mygdx/game/UniCheckersServer.java +++ b/CheckersServer/core/src/com/mygdx/game/UniCheckersServer.java @@ -2,18 +2,10 @@ package com.mygdx.game; import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.Input; -import com.badlogic.gdx.InputProcessor; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryonet.Connection; -import com.esotericsoftware.kryonet.Listener; -import com.esotericsoftware.kryonet.Server; -import com.mygdx.game.controller.NetworkController; - -import java.io.IOException; +import com.mygdx.game.controller.ServerController; public class UniCheckersServer extends ApplicationAdapter { SpriteBatch batch; @@ -23,7 +15,7 @@ public class UniCheckersServer extends ApplicationAdapter { public void create () { batch = new SpriteBatch(); img = new Texture("ServerBackground.png"); - NetworkController networkController = new NetworkController(); + ServerController serverController = new ServerController(); } @Override diff --git a/CheckersServer/core/src/com/mygdx/game/controller/NetworkController.java b/CheckersServer/core/src/com/mygdx/game/controller/ServerController.java similarity index 96% rename from CheckersServer/core/src/com/mygdx/game/controller/NetworkController.java rename to CheckersServer/core/src/com/mygdx/game/controller/ServerController.java index 415e1f5..9583a0c 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/NetworkController.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/ServerController.java @@ -11,11 +11,10 @@ import com.mygdx.game.model.Player; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; import java.util.List; -public class NetworkController { +public class ServerController { private final int MAX_PLAYERS = 8; private final int MAX_LOBBIES = 40; @@ -27,11 +26,11 @@ public class NetworkController { private Server server; private Kryo kryo; - public NetworkController(){ + public ServerController(){ server = new Server(); server.start(); try { - server.bind(54555, 54777); + server.bind(54555); } catch (IOException e) { e.printStackTrace(); } @@ -165,7 +164,7 @@ public class NetworkController { kryo.register(List.class, 30); } - public NetworkController getNetworkController() { return this; } + public ServerController getNetworkController() { return this; } public ArrayList<Connection> getConnections(Lobby lobby){ HashSet<Integer> players_id = lobby.getPlayersID(); diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/Command.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/Command.java index 017f74c..ccf5cd9 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/Command.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/Command.java @@ -1,7 +1,7 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; public class Command{ @@ -18,7 +18,7 @@ public class Command{ this.data = "None"; } - public void execute(NetworkController net, Connection connection){} + public void execute(ServerController net, Connection connection){} public String getText(){ return text; } diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyCreate.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyCreate.java index 06c2633..ace1cfd 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyCreate.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyCreate.java @@ -1,10 +1,8 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; -import com.mygdx.game.controller.commands.Command; +import com.mygdx.game.controller.ServerController; import com.mygdx.game.model.Lobby; -import com.mygdx.game.model.Player; import java.util.ArrayList; @@ -15,7 +13,7 @@ public class cLobbyCreate extends Command { //public cLobbyCreate(int MAX_PLAYERS) { super("cLobbyCreate", (Integer) MAX_PLAYERS); } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ if(data instanceof ArrayList){ String name = (String) ((ArrayList) data).get(0); int MAX_PLAYERS = (int) ((ArrayList) data).get(1); diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyDelete.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyDelete.java index 029006d..6575441 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyDelete.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyDelete.java @@ -1,17 +1,15 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; import com.mygdx.game.model.Lobby; -import java.util.HashSet; - public class cLobbyDelete extends Command{ public cLobbyDelete() { super("cLobbyDelete"); } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ if(data instanceof Integer) { int lobby_id = (int) data; Lobby lobby = net.getLobby(lobby_id); diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyGetList.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyGetList.java index abb44e2..f25b6f9 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyGetList.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyGetList.java @@ -1,9 +1,8 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; import com.mygdx.game.model.Lobby; -import com.mygdx.game.model.Player; import java.util.ArrayList; import java.util.List; @@ -13,7 +12,7 @@ public class cLobbyGetList extends Command{ public cLobbyGetList(){ super("cLobbyGetList"); } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ data = net.getLobbies(); // Exclude lobbies where game has already started diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyJoin.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyJoin.java index e27c87e..ecf3ac0 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyJoin.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyJoin.java @@ -1,7 +1,7 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; import com.mygdx.game.model.Lobby; public class cLobbyJoin extends Command{ @@ -11,7 +11,7 @@ public class cLobbyJoin extends Command{ //public cLobbyJoin(int id) { super("cLobbyJoin", (Integer) id); } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ if(data instanceof Integer){ int lobby_id = (int) data; data = net.joinLobby(connection.getID(), lobby_id); diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyLeave.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyLeave.java index d3d16fe..a0a73b1 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyLeave.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cLobbyLeave.java @@ -1,11 +1,10 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; import com.mygdx.game.model.Lobby; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; public class cLobbyLeave extends Command{ @@ -18,7 +17,7 @@ public class cLobbyLeave extends Command{ public cLobbyLeave(Lobby lobby) { super("cLobbyLeave", lobby); } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ if (data instanceof ArrayList) { List<Object> receivedData = (ArrayList<Object>) data; diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerJoin.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerJoin.java index c99cadc..0f4ded6 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerJoin.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerJoin.java @@ -1,11 +1,9 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; import com.mygdx.game.model.Player; -import java.io.PrintStream; - public class cPlayerJoin extends Command { public cPlayerJoin() { @@ -13,7 +11,7 @@ public class cPlayerJoin extends Command { } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ if (data instanceof Integer){ int indexAvatar = (int) data; data = net.playerJoin(connection.getID(), indexAvatar); diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerPieceClick.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerPieceClick.java index e5a4b39..a4b8480 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerPieceClick.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerPieceClick.java @@ -1,7 +1,7 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; // THIS SHOULD PROBABLY BE AN INPUT COMMAND, AND NOT A NETWORK COMMAND. MAYBE SPLIT NON-NETWORKING COMMANDS ETC. public class cPlayerPieceClick extends Command { @@ -11,7 +11,7 @@ public class cPlayerPieceClick extends Command { } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ } } diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerPieceMove.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerPieceMove.java index b718675..1f93751 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerPieceMove.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cPlayerPieceMove.java @@ -2,7 +2,7 @@ package com.mygdx.game.controller.commands; import com.badlogic.gdx.math.Vector3; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; import java.util.ArrayList; @@ -33,7 +33,7 @@ public class cPlayerPieceMove extends Command { }*/ @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ if (data instanceof ArrayList) { System.out.println("Checking if valid move.. If valid, moving player piece from A to B... Updating model.. Sending move to clients...."); } diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetIndexAvatar.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetIndexAvatar.java index a3dc1e8..c07619d 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetIndexAvatar.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetIndexAvatar.java @@ -1,11 +1,9 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; import com.mygdx.game.model.Player; -import java.util.HashSet; - public class cSetIndexAvatar extends Command { public cSetIndexAvatar() { super("cLobbyJoin"); } @@ -15,7 +13,7 @@ public class cSetIndexAvatar extends Command { } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ if(data instanceof Integer){ int indexAvatar = (int) data; if (indexAvatar == -1) System.out.println("Failed to set index avatar."); diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetPlayerName.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetPlayerName.java index 323be48..5f28c44 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetPlayerName.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetPlayerName.java @@ -1,11 +1,7 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; -import com.mygdx.game.model.Lobby; -import com.mygdx.game.model.Player; - -import org.javatuples.Pair; +import com.mygdx.game.controller.ServerController; public class cSetPlayerName extends Command{ @@ -16,7 +12,7 @@ public class cSetPlayerName extends Command{ } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ if(data instanceof String){ String name = (String) data; net.getPlayer(connection.getID()).setPlayerName(name); diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetPlayerReady.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetPlayerReady.java index a3b66e4..730ee03 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetPlayerReady.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cSetPlayerReady.java @@ -1,7 +1,7 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; import com.mygdx.game.model.Lobby; public class cSetPlayerReady extends Command{ @@ -24,7 +24,7 @@ public class cSetPlayerReady extends Command{ } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ if(data instanceof Boolean){ boolean isPlayerReady = (Boolean) data; net.getPlayer(connection.getID()).setIsPlayerReady(isPlayerReady); diff --git a/CheckersServer/core/src/com/mygdx/game/controller/commands/cStartGame.java b/CheckersServer/core/src/com/mygdx/game/controller/commands/cStartGame.java index 1cb08f0..0c244e5 100644 --- a/CheckersServer/core/src/com/mygdx/game/controller/commands/cStartGame.java +++ b/CheckersServer/core/src/com/mygdx/game/controller/commands/cStartGame.java @@ -1,7 +1,7 @@ package com.mygdx.game.controller.commands; import com.esotericsoftware.kryonet.Connection; -import com.mygdx.game.controller.NetworkController; +import com.mygdx.game.controller.ServerController; public class cStartGame extends Command{ @@ -10,7 +10,7 @@ public class cStartGame extends Command{ public cStartGame(int id) { super("cStartGame", (Integer) id); } @Override - public void execute(NetworkController net, Connection connection){ + public void execute(ServerController net, Connection connection){ } } -- GitLab