Upon hosting, and then creating a new instance and connecting to that IP, button transmissions work and print out on server!! :D

Took the send method out of the Message class as it didnt make sense to have it there. This meant taking it out of all subclasses too

tags: #story[1055] pair[wmu16, zyt10]
This commit is contained in:
William Muir
2017-07-18 12:22:58 +12:00
parent 63958a6717
commit e83eaa38e1
21 changed files with 248 additions and 670 deletions
@@ -9,9 +9,8 @@ import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import seng302.models.stream.StreamParser;
import seng302.client.ClientTransmitterThread;
import seng302.client.ClientToServerThread;
import seng302.server.messages.BoatActionMessage;
import seng302.server.messages.BoatActionType;
@@ -19,7 +18,7 @@ public class Controller implements Initializable {
@FXML
private AnchorPane contentPane;
private ClientTransmitterThread clientTransmitterThread;
private ClientToServerThread clientToServerThread;
private Object setContentPane(String jfxUrl) {
try {
@@ -52,19 +51,19 @@ public class Controller implements Initializable {
switch (e.getCode()){
case SPACE: // align with vmg
boatActionMessage = new BoatActionMessage(BoatActionType.VMG);
clientTransmitterThread.sendBoatActionMessage(boatActionMessage);
clientToServerThread.sendBoatActionMessage(boatActionMessage);
break;
case PAGE_UP: // upwind
boatActionMessage = new BoatActionMessage(BoatActionType.UPWIND);
clientTransmitterThread.sendBoatActionMessage(boatActionMessage);
clientToServerThread.sendBoatActionMessage(boatActionMessage);
break;
case PAGE_DOWN: // downwind
boatActionMessage = new BoatActionMessage(BoatActionType.DOWNWIND);
clientTransmitterThread.sendBoatActionMessage(boatActionMessage);
clientToServerThread.sendBoatActionMessage(boatActionMessage);
break;
case ENTER: // tack/gybe
boatActionMessage = new BoatActionMessage(BoatActionType.TACK_GYBE);
clientTransmitterThread.sendBoatActionMessage(boatActionMessage);
clientToServerThread.sendBoatActionMessage(boatActionMessage);
break;
//TODO Allow a zoom in and zoom out methods
case Z: // zoom in
@@ -81,12 +80,12 @@ public class Controller implements Initializable {
//TODO 12/07/17 Determine the sail state and send the appropriate packet (eg. if sails are in, send a sail out packet)
case SHIFT: // sails in/sails out
BoatActionMessage boatActionMessage = new BoatActionMessage(BoatActionType.SAILS_IN);
clientTransmitterThread.sendBoatActionMessage(boatActionMessage);
clientToServerThread.sendBoatActionMessage(boatActionMessage);
break;
}
}
public void setClientTransmitterThread(ClientTransmitterThread ctt) {
clientTransmitterThread = ctt;
public void setClientToServerThread(ClientToServerThread ctt) {
clientToServerThread = ctt;
}
}