mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50: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;
|
||||
|
||||
// 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
|
||||
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;
|
||||
|
||||
client = new NetworkClient();
|
||||
client.hostPort = hostPort;
|
||||
client = new NetworkClient
|
||||
{
|
||||
hostPort = hostPort
|
||||
};
|
||||
|
||||
RegisterClientMessages(client);
|
||||
|
||||
@ -529,9 +531,11 @@ internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg)
|
||||
{
|
||||
// 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;
|
||||
NetworkMessage extraMessage = new NetworkMessage
|
||||
{
|
||||
reader = new NetworkReader(msg.value),
|
||||
conn = netMsg.conn
|
||||
};
|
||||
OnServerAddPlayer(netMsg.conn, extraMessage);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user