diff --git a/CheckersClient/core/src/com/mygdx/game/controllers/NetworkController.java b/CheckersClient/core/src/com/mygdx/game/controllers/NetworkController.java index 92da9b2b6c542d654861ae95958c972aa16a1b7a..54e4d8076bbcbaf0727292c05536848e34f930ab 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 5cc6e3558b09a2ea158f805c8ab421c1bf84cd98..71e9d8f528c3a362b2bfde71af675f1a5502c136 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 c1141950398660b820ba5f0b902af399e48c5767..c1045161a9e9e1f228ebf4077a16695c97edc875 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 154bbc33b5977f585b3de67d398512e8e13f08db..b7d659018e85e81549861a5284e7dae6f976d40d 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 ffdadf1d75bd490ed8475a8f40941bdf80d37b19..3e3cef6d6852625d864f867607144ebed05a392f 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 c6ea9ecd8323d6fb50528b9fb4a2ee8320cd4b7c..f05dcf2268633d17f41d33d833602d454d2b073a 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 7bdd794acae25ce40dc46ec642802f69d502076d..05d47ee3e497d30d664c28465e0a92fa1ba89aeb 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 9c0712a7b7193edec88ee75cdb76d026839ff9de..5564e4f9f5e945ad1405d1cfd5c8622db80304ba 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 df0823fb9ed6cb01de376ec331d530fdcb20eb8e..f4291dd2b669b23182ddbcee088b33e7d88cbe93 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 2cfa26e2ea734f6f816475348a046ba8c82d3249..d7f9232b43d7b14766903bffb275ece66e1a3ce7 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 415e1f505459caff943bf3ae1773c0d5d2c50d57..9583a0ce1373b02626269e8d602f3ffde2080eb4 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 017f74cc32081f50ca42315c9df80dd2fe458b53..ccf5cd926dbb29de2f31ee67e316f795a19c7033 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 06c2633c9e2718e9766088afad23cf65728902cc..ace1cfd3cae60563810563ca561eeb58f3484ff0 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 029006dfdf6409a238319fef327e5c869f907c43..65754418711aac01d1ea9f4b9176b7b8756154ea 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 abb44e26dab37ca89f5c652186b96e514f317ff4..f25b6f9dc03a6fdb2c01ccf2caaf9ca240b865f1 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 e27c87eb04923377c80eea1d421a2d05ec27327f..ecf3ac088ecf70768853a7af687a0adad595dd30 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 d3d16fe0749542df62249fdf5d3bfb282577bd6b..a0a73b10a22e43fdf76effada23cd87ac187e45b 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 c99cadce1f7c244f7dd26c2586647b8326fb577d..0f4ded6b7516daa5045f0505033368422803db48 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 e5a4b39261e5b3ca9f734ff06b85e66e1424c786..a4b8480c2bff4c16ce276976e2bd93f2740de151 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 b71867589461243fefe5c9eb524e834733e53f71..1f93751c711963b37a08b47b6f2baa55eb9f8c9d 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 a3dc1e88d5891fc0ee138c48e3186c142c6b39b3..c07619d765a70d25610f339b2f4c70e414549a54 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 323be48847559289ea56bd005f016e208f8dbd27..5f28c44ed4cd1dd5b89f01ce1518f45569d6353f 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 a3b66e4da33cf5205fb8494db5e1c66fea217219..730ee031baacbaf724638eabec39d6447c61880f 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 1cb08f0e99b8189abdc780cd2f3fdb8f71c4c98e..0c244e5dd80895c72600502f4e2eedc61e75034c 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){ } }