Rename SocketInterface to SocketManager, ConnectionInterface to ConnectionManager

This commit is contained in:
Garry Newman 2020-02-27 12:54:23 +00:00
parent 2acbf964de
commit 09256aa4a3
7 changed files with 22 additions and 17 deletions

View File

@ -8,7 +8,7 @@ namespace Steamworks
{ {
public partial class NetworkingSocketsTest public partial class NetworkingSocketsTest
{ {
private class TestConnectionInterface : ConnectionInterface private class TestConnectionInterface : ConnectionManager
{ {
public override void OnConnectionChanged( ConnectionInfo data ) public override void OnConnectionChanged( ConnectionInfo data )
{ {

View File

@ -9,7 +9,7 @@ namespace Steamworks
{ {
public partial class NetworkingSocketsTest public partial class NetworkingSocketsTest
{ {
private class TestSocketInterface : SocketInterface private class TestSocketInterface : SocketManager
{ {
public bool HasFinished = false; public bool HasFinished = false;

View File

@ -34,4 +34,9 @@
<Import Project="Facepunch.Steamworks.targets" /> <Import Project="Facepunch.Steamworks.targets" />
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="Copy $(TargetDir)\Facepunch.Steamworks.Win64.* C:\plastic\RustMain\Assets\Plugins\Facepunch.Steamworks\" />
<Exec Command="Copy $(TargetDir)\Facepunch.Steamworks.Posix.* C:\plastic\RustMain\Assets\Plugins\Facepunch.Steamworks\" />
</Target>
</Project> </Project>

View File

@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
namespace Steamworks namespace Steamworks
{ {
public class ConnectionInterface public class ConnectionManager
{ {
public Connection Connection; public Connection Connection;
public bool Connected = false; public bool Connected = false;

View File

@ -20,7 +20,7 @@ namespace Steamworks.Data
return SteamNetworkingSockets.Internal.CloseListenSocket( Id ); return SteamNetworkingSockets.Internal.CloseListenSocket( Id );
} }
public SocketInterface Interface public SocketManager Interface
{ {
get => SteamNetworkingSockets.GetSocketInterface( Id ); get => SteamNetworkingSockets.GetSocketInterface( Id );
set => SteamNetworkingSockets.SetSocketInterface( Id, value ); set => SteamNetworkingSockets.SetSocketInterface( Id, value );

View File

@ -12,7 +12,7 @@ namespace Steamworks
/// You can override all the virtual functions to turn it into what you /// You can override all the virtual functions to turn it into what you
/// want it to do. /// want it to do.
/// </summary> /// </summary>
public class SocketInterface public class SocketManager
{ {
public List<Connection> Connecting = new List<Connection>(); public List<Connection> Connecting = new List<Connection>();
public List<Connection> Connected = new List<Connection>(); public List<Connection> Connected = new List<Connection>();

View File

@ -16,17 +16,17 @@ namespace Steamworks
{ {
SetInterface( server, new ISteamNetworkingSockets( server ) ); SetInterface( server, new ISteamNetworkingSockets( server ) );
SocketInterfaces = new Dictionary<uint, SocketInterface>(); SocketInterfaces = new Dictionary<uint, SocketManager>();
ConnectionInterfaces = new Dictionary<uint, ConnectionInterface>(); ConnectionInterfaces = new Dictionary<uint, ConnectionManager>();
InstallEvents( server ); InstallEvents( server );
} }
#region SocketInterface #region SocketInterface
static Dictionary<uint, SocketInterface> SocketInterfaces; static Dictionary<uint, SocketManager> SocketInterfaces;
internal static SocketInterface GetSocketInterface( uint id ) internal static SocketManager GetSocketInterface( uint id )
{ {
if ( SocketInterfaces == null ) return null; if ( SocketInterfaces == null ) return null;
if ( id == 0 ) throw new System.ArgumentException( "Invalid Socket" ); if ( id == 0 ) throw new System.ArgumentException( "Invalid Socket" );
@ -37,7 +37,7 @@ namespace Steamworks
return null; return null;
} }
internal static void SetSocketInterface( uint id, SocketInterface iface ) internal static void SetSocketInterface( uint id, SocketManager iface )
{ {
if ( id == 0 ) throw new System.ArgumentException( "Invalid Socket" ); if ( id == 0 ) throw new System.ArgumentException( "Invalid Socket" );
SocketInterfaces[id] = iface; SocketInterfaces[id] = iface;
@ -45,10 +45,10 @@ namespace Steamworks
#endregion #endregion
#region ConnectionInterface #region ConnectionInterface
static Dictionary<uint, ConnectionInterface> ConnectionInterfaces; static Dictionary<uint, ConnectionManager> ConnectionInterfaces;
internal static ConnectionInterface GetConnectionInterface( uint id ) internal static ConnectionManager GetConnectionInterface( uint id )
{ {
if ( ConnectionInterfaces == null ) return null; if ( ConnectionInterfaces == null ) return null;
if ( id == 0 ) return null; if ( id == 0 ) return null;
@ -59,7 +59,7 @@ namespace Steamworks
return null; return null;
} }
internal static void SetConnectionInterface( uint id, ConnectionInterface iface ) internal static void SetConnectionInterface( uint id, ConnectionManager iface )
{ {
if ( id == 0 ) throw new System.ArgumentException( "Invalid Connection" ); if ( id == 0 ) throw new System.ArgumentException( "Invalid Connection" );
ConnectionInterfaces[id] = iface; ConnectionInterfaces[id] = iface;
@ -100,7 +100,7 @@ namespace Steamworks
/// Creates a "server" socket that listens for clients to connect to by calling /// Creates a "server" socket that listens for clients to connect to by calling
/// Connect, over ordinary UDP (IPv4 or IPv6) /// Connect, over ordinary UDP (IPv4 or IPv6)
/// </summary> /// </summary>
public static T CreateNormalSocket<T>( NetAddress address ) where T : SocketInterface, new() public static T CreateNormalSocket<T>( NetAddress address ) where T : SocketManager, new()
{ {
var t = new T(); var t = new T();
var options = Array.Empty<NetKeyValue>(); var options = Array.Empty<NetKeyValue>();
@ -114,7 +114,7 @@ namespace Steamworks
/// <summary> /// <summary>
/// Connect to a socket created via <method>CreateListenSocketIP</method> /// Connect to a socket created via <method>CreateListenSocketIP</method>
/// </summary> /// </summary>
public static T ConnectNormal<T>( NetAddress address ) where T : ConnectionInterface, new() public static T ConnectNormal<T>( NetAddress address ) where T : ConnectionManager, new()
{ {
var t = new T(); var t = new T();
var options = Array.Empty<NetKeyValue>(); var options = Array.Empty<NetKeyValue>();
@ -126,7 +126,7 @@ namespace Steamworks
/// <summary> /// <summary>
/// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping) /// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping)
/// </summary> /// </summary>
public static T CreateRelaySocket<T>( int virtualport = 0 ) where T : SocketInterface, new() public static T CreateRelaySocket<T>( int virtualport = 0 ) where T : SocketManager, new()
{ {
var t = new T(); var t = new T();
var options = Array.Empty<NetKeyValue>(); var options = Array.Empty<NetKeyValue>();
@ -138,7 +138,7 @@ namespace Steamworks
/// <summary> /// <summary>
/// Connect to a relay server /// Connect to a relay server
/// </summary> /// </summary>
public static T ConnectRelay<T>( SteamId serverId, int virtualport = 0 ) where T : ConnectionInterface, new() public static T ConnectRelay<T>( SteamId serverId, int virtualport = 0 ) where T : ConnectionManager, new()
{ {
var t = new T(); var t = new T();
NetIdentity identity = serverId; NetIdentity identity = serverId;