mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
4.x syntax
This commit is contained in:
parent
ca6224d238
commit
306f974e0c
@ -51,7 +51,7 @@ public class NetworkManager : MonoBehaviour
|
|||||||
public bool clientLoadedScene;
|
public bool clientLoadedScene;
|
||||||
|
|
||||||
// only really valid on the server
|
// only really valid on the server
|
||||||
public int numPlayers { get { return NetworkServer.connections.Count(kv => kv.Value.playerController != null); } }
|
public int numPlayers => NetworkServer.connections.Count(kv => kv.Value.playerController != null);
|
||||||
|
|
||||||
// runtime data
|
// runtime data
|
||||||
public static string networkSceneName = ""; // this is used to make sure that all scene changes are initialized by UNET. loading a scene manually wont set networkSceneName, so UNET would still load it again on start.
|
public static string networkSceneName = ""; // this is used to make sure that all scene changes are initialized by UNET. loading a scene manually wont set networkSceneName, so UNET would still load it again on start.
|
||||||
@ -261,8 +261,10 @@ public NetworkClient StartClient(ushort hostPort=0)
|
|||||||
|
|
||||||
isNetworkActive = true;
|
isNetworkActive = true;
|
||||||
|
|
||||||
client = new NetworkClient();
|
client = new NetworkClient
|
||||||
client.hostPort = hostPort;
|
{
|
||||||
|
hostPort = hostPort
|
||||||
|
};
|
||||||
|
|
||||||
RegisterClientMessages(client);
|
RegisterClientMessages(client);
|
||||||
|
|
||||||
@ -529,9 +531,11 @@ internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg)
|
|||||||
{
|
{
|
||||||
// convert payload to extra message and call OnServerAddPlayer
|
// convert payload to extra message and call OnServerAddPlayer
|
||||||
// (usually for character selection information)
|
// (usually for character selection information)
|
||||||
NetworkMessage extraMessage = new NetworkMessage();
|
NetworkMessage extraMessage = new NetworkMessage
|
||||||
extraMessage.reader = new NetworkReader(msg.value);
|
{
|
||||||
extraMessage.conn = netMsg.conn;
|
reader = new NetworkReader(msg.value),
|
||||||
|
conn = netMsg.conn
|
||||||
|
};
|
||||||
OnServerAddPlayer(netMsg.conn, extraMessage);
|
OnServerAddPlayer(netMsg.conn, extraMessage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user