mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
OnServerAddPlayer uses NetworkMessage parameter instead of NetworkReader. Removes last dependency on NetworkReader.ReadMessage (#307)
This commit is contained in:
parent
183afac99a
commit
ce8ede3db3
@ -78,6 +78,7 @@ public static bool AddPlayer(NetworkConnection readyConn)
|
||||
}
|
||||
|
||||
// use this to implicitly become ready
|
||||
// -> extraMessage can contain character selection, etc.
|
||||
public static bool AddPlayer(NetworkConnection readyConn, MessageBase extraMessage)
|
||||
{
|
||||
// ensure valid ready connection
|
||||
|
@ -518,8 +518,12 @@ internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg)
|
||||
|
||||
if (msg.value != null && msg.value.Length > 0)
|
||||
{
|
||||
NetworkReader reader = new NetworkReader(msg.value);
|
||||
OnServerAddPlayer(netMsg.conn, reader);
|
||||
// convert payload to extra message and call OnServerAddPlayer
|
||||
// (usually for character selection information)
|
||||
NetworkMessage extraMessage = new NetworkMessage();
|
||||
extraMessage.reader = new NetworkReader(msg.value);
|
||||
extraMessage.conn = netMsg.conn;
|
||||
OnServerAddPlayer(netMsg.conn, extraMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -629,7 +633,7 @@ public virtual void OnServerReady(NetworkConnection conn)
|
||||
NetworkServer.SetClientReady(conn);
|
||||
}
|
||||
|
||||
public virtual void OnServerAddPlayer(NetworkConnection conn, NetworkReader extraMessageReader)
|
||||
public virtual void OnServerAddPlayer(NetworkConnection conn, NetworkMessage extraMessage)
|
||||
{
|
||||
OnServerAddPlayerInternal(conn);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user