mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Fixed bug to let multiple people play at the same time.
This commit is contained in:
@@ -239,12 +239,13 @@ public class LobbyController implements Initializable, Observer{
|
|||||||
|
|
||||||
private void playTheme() {
|
private void playTheme() {
|
||||||
Random random = new Random(System.currentTimeMillis());
|
Random random = new Random(System.currentTimeMillis());
|
||||||
if(random.nextInt(11) == 10) {
|
Integer rand = random.nextInt();
|
||||||
|
if(rand == 10) {
|
||||||
URL file = getClass().getResource("/music/Disturbed - down with the sickness.mp3");
|
URL file = getClass().getResource("/music/Disturbed - down with the sickness.mp3");
|
||||||
Media hit = new Media(file.toString());
|
Media hit = new Media(file.toString());
|
||||||
mediaPlayer = new MediaPlayer(hit);
|
mediaPlayer = new MediaPlayer(hit);
|
||||||
mediaPlayer.play();
|
mediaPlayer.play();
|
||||||
} else if(random.nextInt(11) == 9) {
|
} else if(rand == 9) {
|
||||||
URL file = getClass().getResource("/music/Owl City - Fireflies.mp3");
|
URL file = getClass().getResource("/music/Owl City - Fireflies.mp3");
|
||||||
Media hit = new Media(file.toString());
|
Media hit = new Media(file.toString());
|
||||||
mediaPlayer = new MediaPlayer(hit);
|
mediaPlayer = new MediaPlayer(hit);
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ public class ServerToClientThread implements Runnable, Observer {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: 24/07/17 zyt10 - fix a logic here when a client disconnected
|
// TODO: 24/07/17 zyt10 - fix a logic here when a client disconnected
|
||||||
serverLog("ERROR OCCURRED, CLOSING SERVER CONNECTION: " + socket.getRemoteSocketAddress().toString(), 1);
|
serverLog("ERROR OCCURRED, CLOSING SERVER CONNECTION: " + socket.getRemoteSocketAddress().toString(), 1);
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSocket();
|
closeSocket();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -364,7 +364,7 @@ public class ServerToClientThread implements Runnable, Observer {
|
|||||||
// System.out.println("[SERVER] Lat: " + yacht.getLocation().getLat() + " Lon: " + yacht.getLocation().getLng());
|
// System.out.println("[SERVER] Lat: " + yacht.getLocation().getLat() + " Lon: " + yacht.getLocation().getLng());
|
||||||
BoatLocationMessage boatLocationMessage =
|
BoatLocationMessage boatLocationMessage =
|
||||||
new BoatLocationMessage(
|
new BoatLocationMessage(
|
||||||
sourceId,
|
yacht.getSourceId(),
|
||||||
getSeqNo(),
|
getSeqNo(),
|
||||||
yacht.getLocation().getLat(),
|
yacht.getLocation().getLat(),
|
||||||
yacht.getLocation().getLng(),
|
yacht.getLocation().getLng(),
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets left="5.0" right="5.0" />
|
<Insets left="5.0" right="5.0" />
|
||||||
</GridPane.margin></Button>
|
</GridPane.margin></Button>
|
||||||
<TextField fx:id="ipTextField" alignment="CENTER" maxWidth="-Infinity" prefHeight="25.0" prefWidth="148.0" promptText="Host IP" text="132.181.14." GridPane.halignment="RIGHT" GridPane.rowIndex="4">
|
<TextField fx:id="ipTextField" alignment="CENTER" maxWidth="-Infinity" prefHeight="25.0" prefWidth="148.0" promptText="Host IP" text="localhost" GridPane.halignment="RIGHT" GridPane.rowIndex="4">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="10.0" left="5.0" right="85.0" top="10.0" />
|
<Insets bottom="10.0" left="5.0" right="85.0" top="10.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
|
|||||||
Reference in New Issue
Block a user