mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
AddPlayerMessage inherits from BytesMessage
This commit is contained in:
parent
3fce3ae675
commit
d94b1a2d89
@ -106,7 +106,7 @@ public static bool AddPlayer(NetworkConnection readyConn, MessageBase extraMessa
|
||||
{
|
||||
NetworkWriter writer = new NetworkWriter();
|
||||
extraMessage.Serialize(writer);
|
||||
msg.msgData = writer.ToArray();
|
||||
msg.value = writer.ToArray();
|
||||
}
|
||||
s_ReadyConnection.Send((short)MsgType.AddPlayer, msg);
|
||||
return true;
|
||||
|
@ -145,20 +145,7 @@ public class ReadyMessage : EmptyMessage {}
|
||||
|
||||
public class NotReadyMessage : EmptyMessage {}
|
||||
|
||||
public class AddPlayerMessage : MessageBase
|
||||
{
|
||||
public byte[] msgData;
|
||||
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
msgData = reader.ReadBytesAndSize();
|
||||
}
|
||||
|
||||
public override void Serialize(NetworkWriter writer)
|
||||
{
|
||||
writer.WriteBytesAndSize(msgData);
|
||||
}
|
||||
}
|
||||
public class AddPlayerMessage : BytesMessage {}
|
||||
|
||||
public class RemovePlayerMessage : EmptyMessage
|
||||
{
|
||||
|
@ -510,9 +510,9 @@ internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg)
|
||||
|
||||
AddPlayerMessage msg = netMsg.ReadMessage<AddPlayerMessage>();
|
||||
|
||||
if (msg.msgData != null && msg.msgData.Length > 0)
|
||||
if (msg.value != null && msg.value.Length > 0)
|
||||
{
|
||||
NetworkReader reader = new NetworkReader(msg.msgData);
|
||||
NetworkReader reader = new NetworkReader(msg.value);
|
||||
OnServerAddPlayer(netMsg.conn, reader);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user