Small documentation changes.

tags: #story[1142]
This commit is contained in:
Alistair McIntyre
2017-08-17 12:31:15 +12:00
parent d73e4f8ec5
commit ac279583df
3 changed files with 10 additions and 4 deletions
@@ -60,7 +60,7 @@ public class GameState implements Runnable {
public static Double windDirection; public static Double windDirection;
private static Double windSpeed; private static Double windSpeed;
private static Boolean customizationFlag; private static Boolean customizationFlag; // dirty flag to tell if a player has customized their boat.
private static String hostIpAddress; private static String hostIpAddress;
private static List<Player> players; private static List<Player> players;
@@ -575,16 +575,21 @@ public class GameState implements Runnable {
return false; return false;
} }
/**
* Handles player customization.
*
* @param playerID The ID of the player being modified.
* @param requestType the type of player customization the player wants
* @param customizeData the data related to the customization (color, name, shape)
*/
public static void customizePlayer(long playerID, CustomizeRequestType requestType, public static void customizePlayer(long playerID, CustomizeRequestType requestType,
byte[] customizeData) { byte[] customizeData) {
System.out.println(playerID + " " + requestType.toString());
ServerYacht playerYacht = yachts.get((int) playerID); ServerYacht playerYacht = yachts.get((int) playerID);
if (requestType.equals(CustomizeRequestType.NAME)) { if (requestType.equals(CustomizeRequestType.NAME)) {
String name = new String(customizeData); String name = new String(customizeData);
playerYacht.setBoatName(name); playerYacht.setBoatName(name);
} else if (requestType.equals(CustomizeRequestType.COLOR)) { } else if (requestType.equals(CustomizeRequestType.COLOR)) {
System.out.println(customizeData.length);
int red = customizeData[0] & 0xFF; int red = customizeData[0] & 0xFF;
int green = customizeData[1] & 0xFF; int green = customizeData[1] & 0xFF;
int blue = customizeData[2] & 0xFF; int blue = customizeData[2] & 0xFF;
@@ -210,7 +210,7 @@ public class ServerToClientThread implements Runnable, Observer {
GameState.customizePlayer(sourceID, requestType, GameState.customizePlayer(sourceID, requestType,
Arrays.copyOfRange(payload, 6, payload.length)); Arrays.copyOfRange(payload, 6, payload.length));
GameState.setCustomizationFlag(); GameState.setCustomizationFlag();
//// TODO: 17/08/2017 ajm412: Send a response packet here. // TODO: 17/08/2017 ajm412: Send a response packet here, not really necessary until we do shapes.
break; break;
} }
} else { } else {
+1
View File
@@ -99,6 +99,7 @@ Table
-fx-text-fill: black; -fx-text-fill: black;
} }
server thread
.ui-table .column-header { .ui-table .column-header {
-fx-background-color: transparent; -fx-background-color: transparent;
} }