show other names
This commit is contained in:
@@ -48,6 +48,7 @@ public class Server
|
||||
//[0] = 8: player rotation update
|
||||
//[0] = 9: Save the World
|
||||
//[0] = 10: Player died
|
||||
//[0] = 11: name request
|
||||
|
||||
private void Receive()
|
||||
{
|
||||
@@ -256,6 +257,20 @@ public class Server
|
||||
{
|
||||
Console.WriteLine(playerNames[GetPlayerID(endPoint)] + " died! \n");
|
||||
}
|
||||
|
||||
//name request
|
||||
if(data[0] == 11)
|
||||
{
|
||||
int id = data[1];
|
||||
List<byte> send = new List<byte>();
|
||||
send.Add(11);
|
||||
byte[] nameASCII = Encoding.ASCII.GetBytes(playerNames[id]);
|
||||
foreach (byte b in nameASCII)
|
||||
{
|
||||
send.Add(b);
|
||||
}
|
||||
Send(send.ToArray(), endPoint);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -166,5 +166,5 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 5457f26f725053d46bffb9885acfd7d8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
worldSize: 60
|
||||
worldSize: 10
|
||||
transferDelay: 5
|
||||
|
||||
Reference in New Issue
Block a user