re-implemented existing functionality in UI

- Correct player count is shown in server list
- Servers now advertise their capacity and number of players connected
- Players can click join on the servers in the server list
- Direct connect works
- Can set max players / server name in host dialog
- Server starts correctly when host clicked
- Implemented boat customization
- Implemented 'begin race button', and disabled it for players that aren't hosts
- Added countdown timer in lobby
- Fixed bug where app wouldn't close

Tags: #story[1245]
This commit is contained in:
Michael Rausch
2017-09-08 18:00:09 +12:00
parent b35126ff4e
commit cf4f8813d2
23 changed files with 509 additions and 346 deletions
@@ -41,6 +41,8 @@ public class ServerAdvertiser {
props = new Hashtable<>();
props.put("map", "");
props.put("spacesLeft", "0");
props.put("capacity", "0");
props.put("players", "0");
}
/**
@@ -72,12 +74,27 @@ public class ServerAdvertiser {
}
/**
* Set the spaces left on the server and broadcast an update on the network
* @param spacesLeft The number of spaces left on the server
* Set the number of players on the server and broadcast an update on the network
* @param numPlayers The number of players on the server
* @return The current ServerAdvertiser instance
*/
public ServerAdvertiser setSpacesLeft(Integer spacesLeft){
props.replace("spacesLeft", spacesLeft.toString());
public ServerAdvertiser setNumberOfPlayers(Integer numPlayers){
props.replace("players", numPlayers.toString());
if (serviceInfo != null){
serviceInfo.setText(props);
}
return instance;
}
/**
* Set the max capacity of the server and broadcast an update on the network
* @param capacity The maximum capacity of the server
* @return The current ServerAdvertiser instance
*/
public ServerAdvertiser setCapacity(Integer capacity){
props.replace("capacity", capacity.toString());
if (serviceInfo != null){
serviceInfo.setText(props);