public partial class Steam
{
[System.NonSerialized] static System.Collections.Generic.Dictionary<CSteamID, TcpProtocol
> mOpen
= new System.Collections.Generic.Dictionary<CSteamID, TcpProtocol
>(); [System.NonSerialized] static System.Collections.Generic.HashSet<CSteamID
> mClosed
= new System.Collections.Generic.HashSet<CSteamID
>();
class P2PConnection : IConnection
{
public CSteamID id;
public bool connecting = false;
public bool disconnected = false;
public bool isConnected { get { return !disconnected; } }
public bool SendPacket (Buffer buffer) { return SteamNetworking.SendP2PPacket(id, buffer.buffer, (uint)buffer.size, EP2PSend.k_EP2PSendReliable); }
public void ReceivePacket (out Buffer buffer) { buffer = null; }
public void OnDisconnect ()
{
if (!disconnected)
{
disconnected = true;
var buffer = Buffer.Create();
buffer.BeginPacket(Packet.Disconnect);
buffer.EndPacket();
SteamNetworking.SendP2PPacket(id, buffer.buffer, (uint)buffer.size, EP2PSend.k_EP2PSendReliable);
buffer.Recycle();
lock (mOpen)
{
mOpen.Remove(id);
if (!mClosed.Contains(id)) mClosed.Add(id);
}
if (TNManager.custom == this) TNManager.custom = null;
}
}
}
}