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:
William Muir
2017-09-19 23:04:17 +12:00
parent 78596ea111
commit 52d3cea592
5 changed files with 139 additions and 15 deletions
@@ -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();
}