Character Selection Menu (Removed Monkey, he is looks ugly)

This commit is contained in:
brausjonas
2023-04-03 00:40:21 +02:00
parent d626b8e263
commit c5ae1bd162
24 changed files with 2502 additions and 344 deletions
+1
View File
@@ -97,6 +97,7 @@
<workItem from="1680295523012" duration="646000" />
<workItem from="1680352829832" duration="680000" />
<workItem from="1680353695912" duration="624000" />
<workItem from="1680470998642" duration="1402000" />
</task>
<servers />
</component>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3 -1
View File
@@ -12,16 +12,18 @@ public class Client
public Socket socket;
public String name;
public int characterID;
public long lastTimeSendTimeOutCheck = -1;
public Client(DataOutputStream output, DataInputStream input, Socket socket, String name)
public Client(DataOutputStream output, DataInputStream input, Socket socket, String name, int characterID)
{
this.output = output;
this.input = input;
this.socket = socket;
this.name = name;
this.characterID = characterID;
}
public void close()
+2 -2
View File
@@ -273,7 +273,7 @@ public class Room
try
{
//sends the inital message to the player
players[j].output.write(new byte[]{1, 1, (byte) startPositions[k].x, (byte) startPositions[k].y, (byte) startPositions[k].z, (byte) k, 0, 0, 0, 0});
players[j].output.write(new byte[]{1, 1, (byte) startPositions[k].x, (byte) startPositions[k].y, (byte) startPositions[k].z, (byte) k, 0, 0, 0, (byte)players[k].characterID});
//sends the name of the player (ASCII encoding)............................................................................
byte[] name = players[k].name.substring(0, 8).getBytes(StandardCharsets.US_ASCII);
@@ -298,7 +298,7 @@ public class Room
{
try
{
players[j].output.write(new byte[]{1, 0, (byte) startPositions[k].x, (byte) startPositions[k].y, (byte) startPositions[k].z, (byte) k, 0, 0, 0, 0});
players[j].output.write(new byte[]{1, 0, (byte) startPositions[k].x, (byte) startPositions[k].y, (byte) startPositions[k].z, (byte) k, 0, 0, 0, (byte)players[k].characterID});
byte[] name = players[k].name.substring(0, 8).getBytes(StandardCharsets.US_ASCII);
byte[] send = new byte[10];
send[0] = 5;
+5 -1
View File
@@ -134,11 +134,15 @@ public class Server
String name = new String(readData, StandardCharsets.US_ASCII);
name = name.replace("?", " ");
input.read(readData);
int characterID = readData[0];
//check if the room exists
if (rooms.containsKey(roomCode))
{
//create the reference to the client
Client client1 = new Client(output, input, client, name);
Client client1 = new Client(output, input, client, name, characterID);
//move the client to the room
rooms.get(roomCode).addClient(client1);