From 82808c30def542db2792cc09d57d62dade8d85d9 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Mon, 29 May 2023 20:54:52 -0500 Subject: [PATCH] Test --- sig/App.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sig/App.java b/sig/App.java index c034fc1..95c0cdf 100644 --- a/sig/App.java +++ b/sig/App.java @@ -5,6 +5,8 @@ import java.io.File; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; +import java.util.Timer; +import java.util.TimerTask; import java.util.Map.Entry; import javax.imageio.ImageIO; @@ -92,14 +94,27 @@ class Client { System.out.println(event); } }); + // establish a connection try { socket = new Socket(address, port); System.out.println("Connected"); - // takes input from terminal input = new DataInputStream(System.in); + + Timer updateTimer=new Timer(); + updateTimer.schedule(new TimerTask(){ + @Override + public void run() { + try { + out.writeUTF("UPDATE"); + } catch (IOException e) { + e.printStackTrace(); + } + throw new UnsupportedOperationException("Unimplemented method 'run'"); + } + },100,100); // sends output to the socket out = new DataOutputStream( socket.getOutputStream()); @@ -324,6 +339,9 @@ class Server System.out.println("Mythra's Health: "+GetMythraHealth()+"%"); System.out.println("Aya's Health: "+GetAyaHealth()+"%"); System.out.println("Target's Health: "+GetTargetHealth()+"%"); + }break; + case "UPDATE":{ + }break; default:{ System.out.println("Unknown command: "+line); @@ -404,7 +422,6 @@ class Server break fightLoop; } long difference=System.currentTimeMillis()-lastFrame; - System.out.println("Difference:"+difference); bioTimer=Math.max(0,bioTimer-difference); lucidDreamingTimer=Math.max(0,lucidDreamingTimer-difference); nextActionTimer=Math.max(0,nextActionTimer-difference);