mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Renamed netIdPool to netIdQueue
This commit is contained in:
parent
387be93703
commit
8de9789faa
@ -267,7 +267,7 @@ internal static void ResetServerStatics()
|
|||||||
reuseNetworkIds = true;
|
reuseNetworkIds = true;
|
||||||
reuseDelay = 1;
|
reuseDelay = 1;
|
||||||
|
|
||||||
netIdPool.Clear();
|
netIdQueue.Clear();
|
||||||
nextNetworkId = 1;
|
nextNetworkId = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,14 +286,14 @@ internal struct NetworkIdPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pool of NetworkIds that can be reused
|
// pool of NetworkIds that can be reused
|
||||||
internal static readonly Queue<NetworkIdPool> netIdPool = new Queue<NetworkIdPool>();
|
internal static readonly Queue<NetworkIdPool> netIdQueue = new Queue<NetworkIdPool>();
|
||||||
static uint nextNetworkId = 1;
|
static uint nextNetworkId = 1;
|
||||||
|
|
||||||
internal static uint GetNextNetworkId()
|
internal static uint GetNextNetworkId()
|
||||||
{
|
{
|
||||||
if (reuseNetworkIds && netIdPool.Count > 0 && netIdPool.Peek().timeAvailable < NetworkTime.time)
|
if (reuseNetworkIds && netIdQueue.Count > 0 && netIdQueue.Peek().timeAvailable < NetworkTime.time)
|
||||||
{
|
{
|
||||||
NetworkIdPool entry = netIdPool.Dequeue();
|
NetworkIdPool entry = netIdQueue.Dequeue();
|
||||||
//Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, $"[GetNextNetworkId] Reusing NetworkId {entry.poolNetId}.");
|
//Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, $"[GetNextNetworkId] Reusing NetworkId {entry.poolNetId}.");
|
||||||
return entry.poolNetId;
|
return entry.poolNetId;
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ internal static uint GetNextNetworkId()
|
|||||||
/// <summary>Resets nextNetworkId = 1</summary>
|
/// <summary>Resets nextNetworkId = 1</summary>
|
||||||
public static void ResetNextNetworkId()
|
public static void ResetNextNetworkId()
|
||||||
{
|
{
|
||||||
netIdPool.Clear();
|
netIdQueue.Clear();
|
||||||
nextNetworkId = 1;
|
nextNetworkId = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -663,7 +663,7 @@ void OnDestroy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isServer && reuseNetworkIds && netId > 0)
|
if (isServer && reuseNetworkIds && netId > 0)
|
||||||
netIdPool.Enqueue(new NetworkIdPool { poolNetId = netId, timeAvailable = NetworkTime.time + reuseDelay });
|
netIdQueue.Enqueue(new NetworkIdPool { poolNetId = netId, timeAvailable = NetworkTime.time + reuseDelay });
|
||||||
|
|
||||||
if (isLocalPlayer)
|
if (isLocalPlayer)
|
||||||
{
|
{
|
||||||
@ -1338,7 +1338,7 @@ internal void Reset()
|
|||||||
if (netId > 0)
|
if (netId > 0)
|
||||||
{
|
{
|
||||||
if (reuseNetworkIds)
|
if (reuseNetworkIds)
|
||||||
netIdPool.Enqueue(new NetworkIdPool { poolNetId = netId, timeAvailable = NetworkTime.time + reuseDelay });
|
netIdQueue.Enqueue(new NetworkIdPool { poolNetId = netId, timeAvailable = NetworkTime.time + reuseDelay });
|
||||||
|
|
||||||
netId = 0;
|
netId = 0;
|
||||||
}
|
}
|
||||||
|
@ -195,13 +195,13 @@ float DrawObservers(NetworkIdentity identity, float initialX, float Y)
|
|||||||
|
|
||||||
float DrawNetworkIDPool(float initialX, float Y)
|
float DrawNetworkIDPool(float initialX, float Y)
|
||||||
{
|
{
|
||||||
if (NetworkIdentity.netIdPool.Count > 0)
|
if (NetworkIdentity.netIdQueue.Count > 0)
|
||||||
{
|
{
|
||||||
Rect poolRect = new Rect(initialX, Y + 10, 200, 20);
|
Rect poolRect = new Rect(initialX, Y + 10, 200, 20);
|
||||||
GUI.Label(poolRect, new GUIContent("Network ID Pool"), styles.componentName);
|
GUI.Label(poolRect, new GUIContent("Network ID Queue"), styles.componentName);
|
||||||
poolRect.x += 20;
|
poolRect.x += 20;
|
||||||
poolRect.y += poolRect.height;
|
poolRect.y += poolRect.height;
|
||||||
foreach (var entry in NetworkIdentity.netIdPool)
|
foreach (var entry in NetworkIdentity.netIdQueue)
|
||||||
{
|
{
|
||||||
GUI.Label(poolRect, $"[{entry.poolNetId}] {entry.timeAvailable:0.000}", styles.labelStyle);
|
GUI.Label(poolRect, $"[{entry.poolNetId}] {entry.timeAvailable:0.000}", styles.labelStyle);
|
||||||
poolRect.y += poolRect.height;
|
poolRect.y += poolRect.height;
|
||||||
|
Loading…
Reference in New Issue
Block a user