mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Tokens now appear client side
#story[1250]
This commit is contained in:
@@ -100,7 +100,7 @@ public class GameState implements Runnable {
|
|||||||
|
|
||||||
//TEMP TEST STUFF
|
//TEMP TEST STUFF
|
||||||
// TODO: 29/08/17 wmu16 - Take this out!
|
// TODO: 29/08/17 wmu16 - Take this out!
|
||||||
tokens.add(new Token(TokenType.BOOST, 1233d, 11.83154));
|
tokens.add(new Token(TokenType.BOOST, 57.66946, 11.83154));
|
||||||
tokens.add(new Token(TokenType.BOOST, 57.66877, 11.83382));
|
tokens.add(new Token(TokenType.BOOST, 57.66877, 11.83382));
|
||||||
tokens.add(new Token(TokenType.BOOST, 57.66914, 11.83965));
|
tokens.add(new Token(TokenType.BOOST, 57.66914, 11.83965));
|
||||||
tokens.add(new Token(TokenType.BOOST, 57.66684, 11.83214));
|
tokens.add(new Token(TokenType.BOOST, 57.66684, 11.83214));
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import seng302.model.Limit;
|
|||||||
import seng302.model.mark.CompoundMark;
|
import seng302.model.mark.CompoundMark;
|
||||||
import seng302.model.mark.Corner;
|
import seng302.model.mark.Corner;
|
||||||
import seng302.model.mark.Mark;
|
import seng302.model.mark.Mark;
|
||||||
|
import seng302.model.token.Token;
|
||||||
import seng302.utilities.GeoUtility;
|
import seng302.utilities.GeoUtility;
|
||||||
import seng302.visualiser.fxObjects.AnnotationBox;
|
import seng302.visualiser.fxObjects.AnnotationBox;
|
||||||
import seng302.visualiser.fxObjects.BoatObject;
|
import seng302.visualiser.fxObjects.BoatObject;
|
||||||
@@ -82,6 +83,7 @@ public class GameView extends Pane {
|
|||||||
private Group boatObjectGroup = new Group();
|
private Group boatObjectGroup = new Group();
|
||||||
private Group trails = new Group();
|
private Group trails = new Group();
|
||||||
private Group markers = new Group();
|
private Group markers = new Group();
|
||||||
|
private Group tokens = new Group();
|
||||||
private List<CompoundMark> course = new ArrayList<>();
|
private List<CompoundMark> course = new ArrayList<>();
|
||||||
|
|
||||||
private ImageView mapImage = new ImageView();
|
private ImageView mapImage = new ImageView();
|
||||||
@@ -141,6 +143,7 @@ public class GameView extends Pane {
|
|||||||
gameObjects.add(mapImage);
|
gameObjects.add(mapImage);
|
||||||
gameObjects.add(raceBorder);
|
gameObjects.add(raceBorder);
|
||||||
gameObjects.add(markers);
|
gameObjects.add(markers);
|
||||||
|
gameObjects.add(tokens);
|
||||||
initializeTimer();
|
initializeTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,6 +438,28 @@ public class GameView extends Pane {
|
|||||||
raceBorder.getPoints().setAll(boundaryPoints);
|
raceBorder.getPoints().setAll(boundaryPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces all tokens in the course with those passed in
|
||||||
|
*
|
||||||
|
* @param newTokens the tokens to be put on the course.
|
||||||
|
*/
|
||||||
|
public void updateTokens(List<Token> newTokens) {
|
||||||
|
|
||||||
|
List<Marker> mapTokens = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Token token : newTokens) {
|
||||||
|
Point2D location = findScaledXY(token.getLat(), token.getLng());
|
||||||
|
Marker thisMarker = new Marker(Color.YELLOW);
|
||||||
|
thisMarker.setLayoutX(location.getX());
|
||||||
|
thisMarker.setLayoutY(location.getY());
|
||||||
|
mapTokens.add(thisMarker);
|
||||||
|
}
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
tokens.getChildren().clear();
|
||||||
|
tokens.getChildren().addAll(mapTokens);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: 16/08/17 initialize zooming internal to GameView only
|
// TODO: 16/08/17 initialize zooming internal to GameView only
|
||||||
/**
|
/**
|
||||||
* Enables zoom. Has to be called after this is added to a scene.
|
* Enables zoom. Has to be called after this is added to a scene.
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import seng302.model.RaceState;
|
|||||||
import seng302.model.mark.CompoundMark;
|
import seng302.model.mark.CompoundMark;
|
||||||
import seng302.model.mark.Mark;
|
import seng302.model.mark.Mark;
|
||||||
import seng302.model.stream.xml.parser.RaceXMLData;
|
import seng302.model.stream.xml.parser.RaceXMLData;
|
||||||
|
import seng302.model.token.Token;
|
||||||
import seng302.visualiser.GameView;
|
import seng302.visualiser.GameView;
|
||||||
import seng302.visualiser.controllers.annotations.Annotation;
|
import seng302.visualiser.controllers.annotations.Annotation;
|
||||||
import seng302.visualiser.controllers.annotations.ImportantAnnotationController;
|
import seng302.visualiser.controllers.annotations.ImportantAnnotationController;
|
||||||
@@ -139,7 +140,8 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
gameView.updateBorder(raceData.getCourseLimit());
|
gameView.updateBorder(raceData.getCourseLimit());
|
||||||
gameView.updateCourse(
|
gameView.updateCourse(
|
||||||
new ArrayList<>(raceData.getCompoundMarks().values()), raceData.getMarkSequence()
|
new ArrayList<>(raceData.getCompoundMarks().values()), raceData.getMarkSequence()
|
||||||
);
|
);
|
||||||
|
gameView.updateTokens(raceData.getTokens());
|
||||||
gameView.enableZoom();
|
gameView.enableZoom();
|
||||||
gameView.setBoatAsPlayer(player);
|
gameView.setBoatAsPlayer(player);
|
||||||
gameView.startRace();
|
gameView.startRace();
|
||||||
@@ -621,5 +623,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
public void updateRaceData (RaceXMLData raceData) {
|
public void updateRaceData (RaceXMLData raceData) {
|
||||||
this.courseData = raceData;
|
this.courseData = raceData;
|
||||||
gameView.updateBorder(raceData.getCourseLimit());
|
gameView.updateBorder(raceData.getCourseLimit());
|
||||||
|
gameView.updateTokens(raceData.getTokens());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user