mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
breaking: NetworkServer.dontListen renamed to 'listen' to avoid double negative "dontListen=false" to listen
This commit is contained in:
parent
13db82b347
commit
7ab1b394be
@ -55,7 +55,7 @@ void StartButtons()
|
||||
// cant be a server in webgl build
|
||||
if (GUILayout.Button("Single Player"))
|
||||
{
|
||||
NetworkServer.dontListen = true;
|
||||
NetworkServer.listen = false;
|
||||
manager.StartHost();
|
||||
}
|
||||
#else
|
||||
|
@ -70,9 +70,21 @@ public static partial class NetworkServer
|
||||
public static readonly Dictionary<uint, NetworkIdentity> spawned =
|
||||
new Dictionary<uint, NetworkIdentity>();
|
||||
|
||||
/// <summary>Single player mode can use dontListen to not accept incoming connections</summary>
|
||||
// see also: https://github.com/vis2k/Mirror/pull/2595
|
||||
public static bool dontListen;
|
||||
/// <summary>Single player mode can set listen=false to not accept incoming connections.</summary>
|
||||
static bool _listen = true;
|
||||
public static bool listen
|
||||
{
|
||||
get { return _listen; }
|
||||
set { _listen = value; }
|
||||
}
|
||||
|
||||
// DEPRECATED 2024-10-14
|
||||
[Obsolete("NetworkServer.dontListen was replaced with NetworkServer.listen. The new value is the opposite, and avoids double negatives like 'dontListen=false'")]
|
||||
public static bool dontListen
|
||||
{
|
||||
get => !listen;
|
||||
set => listen = !value;
|
||||
}
|
||||
|
||||
/// <summary>active checks if the server has been started either has standalone or as host server.</summary>
|
||||
public static bool active { get; internal set; }
|
||||
@ -137,7 +149,7 @@ public static void Listen(int maxConns)
|
||||
maxConnections = maxConns;
|
||||
|
||||
// only start server if we want to listen
|
||||
if (!dontListen)
|
||||
if (listen)
|
||||
{
|
||||
Transport.active.ServerStart();
|
||||
|
||||
@ -241,7 +253,7 @@ public static void Shutdown()
|
||||
}
|
||||
|
||||
// Reset all statics here....
|
||||
dontListen = false;
|
||||
listen = true;
|
||||
isLoadingScene = false;
|
||||
lastSendTime = 0;
|
||||
actualTickRate = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user