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();
|
NetworkWriter writer = new NetworkWriter();
|
||||||
extraMessage.Serialize(writer);
|
extraMessage.Serialize(writer);
|
||||||
msg.msgData = writer.ToArray();
|
msg.value = writer.ToArray();
|
||||||
}
|
}
|
||||||
s_ReadyConnection.Send((short)MsgType.AddPlayer, msg);
|
s_ReadyConnection.Send((short)MsgType.AddPlayer, msg);
|
||||||
return true;
|
return true;
|
||||||
|
@ -145,20 +145,7 @@ public class ReadyMessage : EmptyMessage {}
|
|||||||
|
|
||||||
public class NotReadyMessage : EmptyMessage {}
|
public class NotReadyMessage : EmptyMessage {}
|
||||||
|
|
||||||
public class AddPlayerMessage : MessageBase
|
public class AddPlayerMessage : BytesMessage {}
|
||||||
{
|
|
||||||
public byte[] msgData;
|
|
||||||
|
|
||||||
public override void Deserialize(NetworkReader reader)
|
|
||||||
{
|
|
||||||
msgData = reader.ReadBytesAndSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Serialize(NetworkWriter writer)
|
|
||||||
{
|
|
||||||
writer.WriteBytesAndSize(msgData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RemovePlayerMessage : EmptyMessage
|
public class RemovePlayerMessage : EmptyMessage
|
||||||
{
|
{
|
||||||
|
@ -510,9 +510,9 @@ internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg)
|
|||||||
|
|
||||||
AddPlayerMessage msg = netMsg.ReadMessage<AddPlayerMessage>();
|
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);
|
OnServerAddPlayer(netMsg.conn, reader);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user