mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Added preliminary icons for pickups
RaceView now has a grid pane to contain some icons to display power ups. These are just preliminary ClientYacht now has a power up field that is set from recieveing messages in the Game Client, as well as observed by the RaceViewController to display the relevant icon when the powerup field is changed #story[1245]
This commit is contained in:
@@ -37,6 +37,7 @@ import seng302.model.stream.parser.RaceStatusData;
|
||||
import seng302.model.stream.parser.YachtEventData;
|
||||
import seng302.model.stream.xml.parser.RaceXMLData;
|
||||
import seng302.model.stream.xml.parser.RegattaXMLData;
|
||||
import seng302.model.token.TokenType;
|
||||
import seng302.utilities.Sounds;
|
||||
import seng302.utilities.StreamParser;
|
||||
import seng302.utilities.XMLGenerator;
|
||||
@@ -245,7 +246,7 @@ public class GameClient {
|
||||
break;
|
||||
|
||||
case YACHT_EVENT_CODE:
|
||||
displayYachtEvent(StreamParser.extractYachtEventCode(packet));
|
||||
processYachtEvent(StreamParser.extractYachtEventCode(packet));
|
||||
break;
|
||||
|
||||
case CHATTER_TEXT:
|
||||
@@ -408,19 +409,25 @@ public class GameClient {
|
||||
*
|
||||
* @param yachtEventData The YachtEvent data packet
|
||||
*/
|
||||
private void displayYachtEvent(YachtEventData yachtEventData) {
|
||||
private void processYachtEvent(YachtEventData yachtEventData) {
|
||||
if (yachtEventData.getEventId() == YachtEventType.COLLISION.getCode()) {
|
||||
showCollisionAlert(yachtEventData);
|
||||
} else if (yachtEventData.getEventId() == YachtEventType.TOKEN_VELOCITY.getCode()) {
|
||||
showPickUp(yachtEventData);
|
||||
} else if (yachtEventData.getEventId() == YachtEventType.TOKEN_BUMPER.getCode()) {
|
||||
showPickUp(yachtEventData);
|
||||
} else if (yachtEventData.getEventId() == YachtEventType.TOKEN_HANDLING.getCode()) {
|
||||
showPickUp(yachtEventData);
|
||||
} else if (yachtEventData.getEventId() == YachtEventType.TOKEN_RANDOM.getCode()) {
|
||||
showPickUp(yachtEventData);
|
||||
} else if (yachtEventData.getEventId() == YachtEventType.TOKEN_WIND_WALKER.getCode()) {
|
||||
showPickUp(yachtEventData);
|
||||
} else {
|
||||
TokenType tokenType = null;
|
||||
if (yachtEventData.getEventId() == YachtEventType.TOKEN_VELOCITY.getCode()) {
|
||||
tokenType = TokenType.BOOST;
|
||||
} else if (yachtEventData.getEventId() == YachtEventType.TOKEN_BUMPER.getCode()) {
|
||||
tokenType = TokenType.BUMPER;
|
||||
} else if (yachtEventData.getEventId() == YachtEventType.TOKEN_HANDLING.getCode()) {
|
||||
tokenType = TokenType.HANDLING;
|
||||
} else if (yachtEventData.getEventId() == YachtEventType.TOKEN_RANDOM.getCode()) {
|
||||
tokenType = TokenType.RANDOM;
|
||||
} else if (yachtEventData.getEventId() == YachtEventType.TOKEN_WIND_WALKER.getCode()) {
|
||||
tokenType = TokenType.WIND_WALKER;
|
||||
}
|
||||
|
||||
showTokenPickUp(tokenType);
|
||||
allBoatsMap.get(yachtEventData.getSubjectId().intValue()).setPowerUp(tokenType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +444,7 @@ public class GameClient {
|
||||
}
|
||||
|
||||
// TODO: 11/09/17 wmu16 - Add in functionality to viually indicate a pickup to a user
|
||||
private void showPickUp(YachtEventData yachtEventData) {
|
||||
private void showTokenPickUp(TokenType tokenType) {
|
||||
Sounds.playTokenPickupSound();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Point2D;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.SubScene;
|
||||
import javafx.scene.chart.LineChart;
|
||||
@@ -47,10 +49,12 @@ import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.StageStyle;
|
||||
import seng302.model.ClientYacht;
|
||||
import seng302.model.ClientYacht.PowerUpListener;
|
||||
import seng302.model.RaceState;
|
||||
import seng302.model.mark.CompoundMark;
|
||||
import seng302.model.mark.Mark;
|
||||
import seng302.model.stream.xml.parser.RaceXMLData;
|
||||
import seng302.model.token.TokenType;
|
||||
import seng302.utilities.Sounds;
|
||||
import seng302.visualiser.GameView3D;
|
||||
import seng302.visualiser.controllers.annotations.ImportantAnnotationController;
|
||||
@@ -60,6 +64,8 @@ import seng302.visualiser.controllers.dialogs.FinishDialogController;
|
||||
import seng302.visualiser.fxObjects.ChatHistory;
|
||||
import seng302.visualiser.fxObjects.assets_2D.WindArrow;
|
||||
import seng302.visualiser.fxObjects.assets_3D.BoatObject;
|
||||
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
|
||||
import seng302.visualiser.fxObjects.assets_3D.ModelType;
|
||||
|
||||
/**
|
||||
* Controller class that manages the display of a race
|
||||
@@ -110,6 +116,8 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
private Label windSpeedLabel;
|
||||
@FXML
|
||||
private Label positionLabel, boatSpeedLabel, boatHeadingLabel;
|
||||
@FXML
|
||||
private ImageView velocityIcon, handlingIcon, windWalkerIcon, bumperIcon;
|
||||
|
||||
//Race Data
|
||||
private Map<Integer, ClientYacht> participants;
|
||||
@@ -222,6 +230,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
return finishScreenDialog;
|
||||
}
|
||||
|
||||
|
||||
public void loadRace (
|
||||
Map<Integer, ClientYacht> participants, RaceXMLData raceData, RaceState raceState,
|
||||
ClientYacht player) {
|
||||
@@ -241,6 +250,25 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
}
|
||||
});
|
||||
|
||||
player.addPowerUpListener((yacht, tokenType) -> {
|
||||
if (yacht == player) {
|
||||
switch (tokenType) {
|
||||
case BOOST:
|
||||
velocityIcon.setVisible(true);
|
||||
break;
|
||||
case HANDLING:
|
||||
handlingIcon.setVisible(true);
|
||||
break;
|
||||
case WIND_WALKER:
|
||||
windWalkerIcon.setVisible(true);
|
||||
break;
|
||||
case BUMPER:
|
||||
bumperIcon.setVisible(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
updateOrder(raceState.getPlayerPositions());
|
||||
gameView = new GameView3D();
|
||||
// gameView.setFrameRateFXText(fpsDisplay);
|
||||
@@ -279,6 +307,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The important annotations have been changed, update this view
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user