Added deployment options for the client
- Client can be downloaded under www.cato447.tech - Added support for numbers notated in "," and "." form
This commit is contained in:
2
.idea/artifacts/Client_jar.xml
generated
2
.idea/artifacts/Client_jar.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="Client:jar">
|
||||
<artifact type="jar" build-on-make="true" name="Client:jar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/Client_jar</output-path>
|
||||
<root id="archive" name="Client.jar">
|
||||
<element id="module-output" name="Client" />
|
||||
|
||||
@@ -55,14 +55,12 @@ public class Client {
|
||||
}
|
||||
|
||||
public void sendToServer(String message) {
|
||||
int availableBits = 0;
|
||||
try {
|
||||
out.writeUTF(message);
|
||||
out.flush();
|
||||
boolean success = in.readBoolean();
|
||||
clientLogger.printLog(String.format("Sent the message: %s", message), serverName, success, LogType.Output);
|
||||
if(in.available() > 0){
|
||||
availableBits = in.available();
|
||||
throw new Exception("More than just a boolean sent");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -35,8 +35,15 @@ public class TicTacToe_GameRules {
|
||||
}
|
||||
|
||||
public boolean makeClientMove(String input, int id) {
|
||||
int column = Double.valueOf(input.split("\\|")[0]).intValue() / 300;
|
||||
int row = Double.valueOf(input.split("\\|")[1]).intValue() / 300;
|
||||
int column = 0;
|
||||
int row = 0;
|
||||
if (input.contains(",")){
|
||||
column = Integer.valueOf(input.split("\\|")[0].split(",")[0]) / 300;
|
||||
row = Integer.valueOf(input.split("\\|")[1].split(",")[0]) / 300;
|
||||
} else {
|
||||
column = (int) Double.valueOf(input.split("\\|")[0]).doubleValue() / 300;
|
||||
row = (int) Double.valueOf(input.split("\\|")[1]).doubleValue() / 300;
|
||||
}
|
||||
int index = column * 3 + row;
|
||||
|
||||
if (isLegalMove(column, row)) {
|
||||
|
||||
6
deployment/client/deployClient
Executable file
6
deployment/client/deployClient
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
cp ~/Code/ArcadeMachine/out/artifacts/Client_jar/Client.jar ~/Code/ArcadeMachine/deployment/client/package
|
||||
cd /var/www/html
|
||||
scp * root@server:/var/www/html/
|
||||
scp files/* root@server:/var/www/html/files
|
||||
ssh root@server systemctl restart apache2
|
||||
2
deployment/client/package/startClient.bat
Normal file
2
deployment/client/package/startClient.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
set /p playerName=Gebe deinen Spielernamen ein:
|
||||
java -jar --module-path openjfx-11.012_windows-x64_bin-sdk\javafx-sdk-11.0.2\lib --add-modules javafx.controls TicTacToe_Client.jar playerName
|
||||
3
deployment/client/startClient
Executable file
3
deployment/client/startClient
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
cd ~/Code/ArcadeMachine/deployment/client
|
||||
java -jar package/TicTacToe_Client.jar linux
|
||||
Reference in New Issue
Block a user