Forbedrer importeringer og scoping

This commit is contained in:
Kristian Knarvik 2020-04-07 23:00:36 +02:00
parent c163d7d707
commit 24b8f4812b
7 changed files with 29 additions and 13 deletions

View File

@ -1,6 +1,14 @@
package inf112.fiasko.roborally.game_wrapper; package inf112.fiasko.roborally.game_wrapper;
import inf112.fiasko.roborally.game_wrapper.screens.*;
import inf112.fiasko.roborally.game_wrapper.screens.BoardActiveScreen;
import inf112.fiasko.roborally.game_wrapper.screens.CardChoiceScreen;
import inf112.fiasko.roborally.game_wrapper.screens.LoadingScreen;
import inf112.fiasko.roborally.game_wrapper.screens.PowerDownScreen;
import inf112.fiasko.roborally.game_wrapper.screens.UsernameScreen;
import inf112.fiasko.roborally.game_wrapper.screens.IPAddressScreen;
import inf112.fiasko.roborally.game_wrapper.screens.LobbyScreen;
import inf112.fiasko.roborally.game_wrapper.screens.StartMenuScreen;
/** /**
* Keeps track of screen instances * Keeps track of screen instances
@ -67,7 +75,7 @@ public class ScreenManager {
* @param roboRallyWrapper The Robo Rally launcher instance to use * @param roboRallyWrapper The Robo Rally launcher instance to use
* @return A start menu screen instance * @return A start menu screen instance
*/ */
synchronized StartMenuScreen getStartMenuScreen(RoboRallyWrapper roboRallyWrapper) { public synchronized StartMenuScreen getStartMenuScreen(RoboRallyWrapper roboRallyWrapper) {
return new StartMenuScreen(roboRallyWrapper); return new StartMenuScreen(roboRallyWrapper);
} }

View File

@ -6,8 +6,8 @@ import com.badlogic.gdx.Screen;
* This class overrides methods of screens which are often unused * This class overrides methods of screens which are often unused
*/ */
public abstract class AbstractScreen implements Screen { public abstract class AbstractScreen implements Screen {
final int applicationWidth = 600; protected final int applicationWidth = 600;
final int applicationHeight = 800; protected final int applicationHeight = 800;
@Override @Override
public void show() { public void show() {

View File

@ -9,7 +9,9 @@ import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.GlyphLayout; import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.*; import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport; import com.badlogic.gdx.utils.viewport.Viewport;
@ -239,9 +241,9 @@ public class CardChoiceScreen extends InputAdapter implements Screen {
* A helper class for keeping track of card information and a rectangle * A helper class for keeping track of card information and a rectangle
*/ */
class CardRectangle { class CardRectangle {
final Rectangle rectangle; protected final Rectangle rectangle;
final ProgrammingCard card; protected final ProgrammingCard card;
boolean selected = false; protected boolean selected = false;
/** /**
* Instantiates a new card rectangle * Instantiates a new card rectangle

View File

@ -75,7 +75,7 @@ public class UsernameScreen extends AbstractScreen {
*/ */
private boolean nameInvalid(String userName) { private boolean nameInvalid(String userName) {
//TODO: Find a way to ask the server if the name is taken //TODO: Find a way to ask the server if the name is taken
return userName.equals(""); return "".equals(userName);
} }
@Override @Override

View File

@ -76,7 +76,7 @@ class RoboRallyServerListener extends Listener {
* Gets a map between connections and their player name * Gets a map between connections and their player name
* @return A mapping between connections and robot ids * @return A mapping between connections and robot ids
*/ */
Map<Connection, String> getPlayerNames() { public Map<Connection, String> getPlayerNames() {
return playerNames; return playerNames;
} }
@ -84,7 +84,7 @@ class RoboRallyServerListener extends Listener {
* Gets a map between connections and their robot id * Gets a map between connections and their robot id
* @return A mapping between connections and robot ids * @return A mapping between connections and robot ids
*/ */
Map<Connection, RobotID> getRobotID() { public Map<Connection, RobotID> getRobotID() {
return clients; return clients;
} }

View File

@ -4,7 +4,14 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import inf112.fiasko.roborally.element_properties.Direction; import inf112.fiasko.roborally.element_properties.Direction;
import inf112.fiasko.roborally.element_properties.Position; import inf112.fiasko.roborally.element_properties.Position;
import inf112.fiasko.roborally.element_properties.RobotID; import inf112.fiasko.roborally.element_properties.RobotID;
import inf112.fiasko.roborally.objects.*; import inf112.fiasko.roborally.objects.Player;
import inf112.fiasko.roborally.objects.IDrawableObject;
import inf112.fiasko.roborally.objects.Tile;
import inf112.fiasko.roborally.objects.IDrawableGame;
import inf112.fiasko.roborally.objects.Wall;
import inf112.fiasko.roborally.objects.Particle;
import inf112.fiasko.roborally.objects.Robot;
import inf112.fiasko.roborally.objects.DrawableObject;
import com.esotericsoftware.kryonet.Connection; import com.esotericsoftware.kryonet.Connection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -70,7 +70,6 @@ public class DrawableObjectTest {
assertEquals(Y_POSITION_MAX_ARG, drawableObjectMaximumArguments.getYPosition()); assertEquals(Y_POSITION_MAX_ARG, drawableObjectMaximumArguments.getYPosition());
} }
@Test @Test
public void getWidthMinArg() { public void getWidthMinArg() {
assertEquals(64, drawableObjectMinimumArguments.getWidth()); assertEquals(64, drawableObjectMinimumArguments.getWidth());