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
|
// use this to implicitly become ready
|
||||||
|
// -> extraMessage can contain character selection, etc.
|
||||||
public static bool AddPlayer(NetworkConnection readyConn, MessageBase extraMessage)
|
public static bool AddPlayer(NetworkConnection readyConn, MessageBase extraMessage)
|
||||||
{
|
{
|
||||||
// ensure valid ready connection
|
// ensure valid ready connection
|
||||||
|
@ -518,8 +518,12 @@ internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg)
|
|||||||
|
|
||||||
if (msg.value != null && msg.value.Length > 0)
|
if (msg.value != null && msg.value.Length > 0)
|
||||||
{
|
{
|
||||||
NetworkReader reader = new NetworkReader(msg.value);
|
// convert payload to extra message and call OnServerAddPlayer
|
||||||
OnServerAddPlayer(netMsg.conn, reader);
|
// (usually for character selection information)
|
||||||
|
NetworkMessage extraMessage = new NetworkMessage();
|
||||||
|
extraMessage.reader = new NetworkReader(msg.value);
|
||||||
|
extraMessage.conn = netMsg.conn;
|
||||||
|
OnServerAddPlayer(netMsg.conn, extraMessage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -629,7 +633,7 @@ public virtual void OnServerReady(NetworkConnection conn)
|
|||||||
NetworkServer.SetClientReady(conn);
|
NetworkServer.SetClientReady(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnServerAddPlayer(NetworkConnection conn, NetworkReader extraMessageReader)
|
public virtual void OnServerAddPlayer(NetworkConnection conn, NetworkMessage extraMessage)
|
||||||
{
|
{
|
||||||
OnServerAddPlayerInternal(conn);
|
OnServerAddPlayerInternal(conn);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user