Fixed bug infopanel and added send method for PRI
This commit is contained in:
+20
-11
@@ -13,19 +13,19 @@ import control.joystick.JoystickHandler;
|
||||
|
||||
public class NetworkHandler implements Runnable{
|
||||
|
||||
DatagramSocket udp;
|
||||
private DatagramSocket udp;
|
||||
|
||||
String host;
|
||||
int port;
|
||||
private String host;
|
||||
private int port;
|
||||
|
||||
boolean running;
|
||||
Thread t;
|
||||
private boolean running;
|
||||
private Thread t;
|
||||
|
||||
byte[] send;
|
||||
byte[] receive;
|
||||
private byte[] send,
|
||||
receive;
|
||||
|
||||
ButtonHandler bth;
|
||||
JoystickHandler jth;
|
||||
private ButtonHandler bth;
|
||||
private JoystickHandler jth;
|
||||
|
||||
public NetworkHandler(String host, int port, ButtonHandler bth, JoystickHandler jth)
|
||||
{
|
||||
@@ -64,7 +64,14 @@ public class NetworkHandler implements Runnable{
|
||||
|
||||
private void send(String str)
|
||||
{
|
||||
|
||||
try {
|
||||
DatagramPacket sendPacket = new DatagramPacket(str.getBytes(), str.length(), InetAddress.getByName(host), 1113);
|
||||
udp.send(sendPacket);
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void close()
|
||||
@@ -160,8 +167,10 @@ public class NetworkHandler implements Runnable{
|
||||
jth.onJoystickMoved(JoystickHandler.j);
|
||||
}
|
||||
}else {
|
||||
if(JoystickHandler.j.getPos() != Position.CENTER){
|
||||
JoystickHandler.j.setPosition(Position.CENTER);
|
||||
|
||||
jth.onJoystickMoved(JoystickHandler.j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class InfoPanel {
|
||||
// time = progress + ":" + time;
|
||||
|
||||
long progress = (sh.getProgress() / 1000);
|
||||
String millis = ((progress) % 1000) + "".length() > 3 ? ("" +((progress) % 1000)).substring(0, 2) : "" + ((progress) % 1000);
|
||||
String millis = (((progress) % 1000) + "").length() > 3 ? ("" +((progress) % 1000)).substring(0, 2) : "" + ((progress) % 1000);
|
||||
String second = ((progress / 1000) % 60 + "").length() <= 1 ? "0" +((progress / 1000) % 60) : "" + ((progress / 1000) % 60);
|
||||
String minute = ((progress / (1000 * 60)) % 60 + "").length() <= 1 ? "0" +((progress / (1000 * 60)) % 60) : "" + ((progress / (1000 * 60)) % 60);
|
||||
time = minute + ":" + second + ":" + millis;
|
||||
|
||||
Reference in New Issue
Block a user