Commit d593e3a4 authored by Anders H. Rebner's avatar Anders H. Rebner
Browse files

Gathered game-finished-functions in PlayView

parent 68c1e43e
...@@ -111,7 +111,6 @@ public class GameController { ...@@ -111,7 +111,6 @@ public class GameController {
} }
public void setGameFinished() { public void setGameFinished() {
this.view.removeTurnIndicator(); this.view.setGameFinished();
this.view.placeExitButton();
} }
} }
...@@ -56,6 +56,8 @@ public class PlayView extends AbstractView { ...@@ -56,6 +56,8 @@ public class PlayView extends AbstractView {
List<Image> possibleMoves = new ArrayList<>(); List<Image> possibleMoves = new ArrayList<>();
Texture possibleMoveTexture; Texture possibleMoveTexture;
TextButton leaveButton;
float scale_factor_piece; float scale_factor_piece;
public float hex_side_length; public float hex_side_length;
...@@ -213,11 +215,6 @@ public class PlayView extends AbstractView { ...@@ -213,11 +215,6 @@ public class PlayView extends AbstractView {
rocketExhaustImage.setPosition(rocketImage.getX() - 62F, rocketImage.getY() + 20F - (rocketImage.getHeight()) * rocketImage.getScaleY()); rocketExhaustImage.setPosition(rocketImage.getX() - 62F, rocketImage.getY() + 20F - (rocketImage.getHeight()) * rocketImage.getScaleY());
} }
public void removeTurnIndicator() {
rocketImage.remove();
rocketExhaustImage.remove();
}
public void placePossibleMoves(List<Vector3> cubeCoordinates) { public void placePossibleMoves(List<Vector3> cubeCoordinates) {
Float[] coordinates; Float[] coordinates;
...@@ -274,6 +271,14 @@ public class PlayView extends AbstractView { ...@@ -274,6 +271,14 @@ public class PlayView extends AbstractView {
stage.addActor(placeField); stage.addActor(placeField);
} }
public void setGameFinished() {
// Remove turn indicator and leavebutton. Place exit button
rocketImage.remove();
rocketExhaustImage.remove();
leaveButton.remove();
placeExitButton();
}
public void placeExitButton() { public void placeExitButton() {
TextButton homeButton = new TextButton("Exit", skin, "small"); TextButton homeButton = new TextButton("Exit", skin, "small");
homeButton.setPosition(Gdx.graphics.getWidth() / 2F - homeButton.getWidth() / 2F, Gdx.graphics.getHeight() / 2F - homeButton.getHeight() / 2F); homeButton.setPosition(Gdx.graphics.getWidth() / 2F - homeButton.getWidth() / 2F, Gdx.graphics.getHeight() / 2F - homeButton.getHeight() / 2F);
...@@ -292,7 +297,7 @@ public class PlayView extends AbstractView { ...@@ -292,7 +297,7 @@ public class PlayView extends AbstractView {
} }
public void placeLeaveButton() { public void placeLeaveButton() {
TextButton leaveButton = new TextButton("Leave", skin, "small"); leaveButton = new TextButton("Leave", skin, "small");
leaveButton.setSize(col_width, (float)(row_height*0.75)); leaveButton.setSize(col_width, (float)(row_height*0.75));
leaveButton.setPosition(Gdx.graphics.getWidth() / 2 + (boardImage.getWidth() * boardImage.getScaleX()) / 3 - leaveButton.getWidth() / 2, Gdx.graphics.getHeight() - 3F * hex_side_length - leaveButton.getHeight() / 2F); leaveButton.setPosition(Gdx.graphics.getWidth() / 2 + (boardImage.getWidth() * boardImage.getScaleX()) / 3 - leaveButton.getWidth() / 2, Gdx.graphics.getHeight() - 3F * hex_side_length - leaveButton.getHeight() / 2F);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment