Files
Dec2017-Script-Dump/UnityEngine.Networking/ConnectionArray.cs
T
2026-06-04 11:42:34 +02:00

192 lines
4.2 KiB
C#

using System;
using System.Collections.Generic;
namespace UnityEngine.Networking
{
// Token: 0x02000006 RID: 6
internal class ConnectionArray
{
// Token: 0x0600005B RID: 91 RVA: 0x00004865 File Offset: 0x00002A65
public ConnectionArray()
{
this.m_Connections = new List<NetworkConnection>();
this.m_LocalConnections = new List<NetworkConnection>();
}
// Token: 0x1700000F RID: 15
// (get) Token: 0x0600005C RID: 92 RVA: 0x00004884 File Offset: 0x00002A84
internal List<NetworkConnection> localConnections
{
get
{
return this.m_LocalConnections;
}
}
// Token: 0x17000010 RID: 16
// (get) Token: 0x0600005D RID: 93 RVA: 0x000048A0 File Offset: 0x00002AA0
internal List<NetworkConnection> connections
{
get
{
return this.m_Connections;
}
}
// Token: 0x17000011 RID: 17
// (get) Token: 0x0600005E RID: 94 RVA: 0x000048BC File Offset: 0x00002ABC
public int Count
{
get
{
return this.m_Connections.Count;
}
}
// Token: 0x17000012 RID: 18
// (get) Token: 0x0600005F RID: 95 RVA: 0x000048DC File Offset: 0x00002ADC
public int LocalIndex
{
get
{
return -this.m_LocalConnections.Count;
}
}
// Token: 0x06000060 RID: 96 RVA: 0x00004900 File Offset: 0x00002B00
public int Add(int connId, NetworkConnection conn)
{
int num;
if (connId < 0)
{
if (LogFilter.logWarn)
{
Debug.LogWarning("ConnectionArray Add bad id " + connId);
}
num = -1;
}
else if (connId < this.m_Connections.Count && this.m_Connections[connId] != null)
{
if (LogFilter.logWarn)
{
Debug.LogWarning("ConnectionArray Add dupe at " + connId);
}
num = -1;
}
else
{
while (connId > this.m_Connections.Count - 1)
{
this.m_Connections.Add(null);
}
this.m_Connections[connId] = conn;
num = connId;
}
return num;
}
// Token: 0x06000061 RID: 97 RVA: 0x000049C4 File Offset: 0x00002BC4
public NetworkConnection Get(int connId)
{
NetworkConnection networkConnection;
if (connId < 0)
{
networkConnection = this.m_LocalConnections[Mathf.Abs(connId) - 1];
}
else if (connId < 0 || connId > this.m_Connections.Count)
{
if (LogFilter.logWarn)
{
Debug.LogWarning("ConnectionArray Get invalid index " + connId);
}
networkConnection = null;
}
else
{
networkConnection = this.m_Connections[connId];
}
return networkConnection;
}
// Token: 0x06000062 RID: 98 RVA: 0x00004A48 File Offset: 0x00002C48
public NetworkConnection GetUnsafe(int connId)
{
NetworkConnection networkConnection;
if (connId < 0 || connId > this.m_Connections.Count)
{
networkConnection = null;
}
else
{
networkConnection = this.m_Connections[connId];
}
return networkConnection;
}
// Token: 0x06000063 RID: 99 RVA: 0x00004A8C File Offset: 0x00002C8C
public void Remove(int connId)
{
if (connId < 0)
{
this.m_LocalConnections[Mathf.Abs(connId) - 1] = null;
}
else if (connId < 0 || connId > this.m_Connections.Count)
{
if (LogFilter.logWarn)
{
Debug.LogWarning("ConnectionArray Remove invalid index " + connId);
}
}
else
{
this.m_Connections[connId] = null;
}
}
// Token: 0x06000064 RID: 100 RVA: 0x00004B08 File Offset: 0x00002D08
public int AddLocal(NetworkConnection conn)
{
this.m_LocalConnections.Add(conn);
int num = -this.m_LocalConnections.Count;
conn.connectionId = num;
return num;
}
// Token: 0x06000065 RID: 101 RVA: 0x00004B40 File Offset: 0x00002D40
public bool ContainsPlayer(GameObject player, out NetworkConnection conn)
{
conn = null;
bool flag;
if (player == null)
{
flag = false;
}
else
{
for (int i = this.LocalIndex; i < this.m_Connections.Count; i++)
{
conn = this.Get(i);
if (conn != null)
{
for (int j = 0; j < conn.playerControllers.Count; j++)
{
if (conn.playerControllers[j].IsValid && conn.playerControllers[j].gameObject == player)
{
return true;
}
}
}
}
flag = false;
}
return flag;
}
// Token: 0x04000048 RID: 72
private List<NetworkConnection> m_LocalConnections;
// Token: 0x04000049 RID: 73
private List<NetworkConnection> m_Connections;
}
}