Server Initialize fixes

This commit is contained in:
Garry Newman 2020-02-11 10:22:12 +00:00
parent 1630aaae22
commit 4daf43891a
3 changed files with 15 additions and 22 deletions

View File

@ -58,23 +58,17 @@ public static void Init( uint appid, bool asyncCallbacks = true )
internal static void AddInterface<T>() where T : SteamClass, new()
{
var t = new T();
t.InitializeInterface();
openInterfaces.Add( t );
}
static List<SteamInterface> openInterfaces = new List<SteamInterface>();
internal static void WatchInterface( SteamInterface steamInterface )
{
if ( openInterfaces.Contains( steamInterface ) )
throw new System.Exception( "openIterfaces already contains interface!" );
openInterfaces.Add( steamInterface );
}
static List<SteamClass> openInterfaces = new List<SteamClass>();
internal static void ShutdownInterfaces()
{
foreach ( var e in openInterfaces )
{
e.ShutdownInterface();
e.DestroyInterface();
}
openInterfaces.Clear();

View File

@ -85,7 +85,7 @@ public static void Init( AppId appid, SteamServerInit init, bool asyncCallbacks
throw new System.Exception( $"InitGameServer returned false ({ipaddress},{init.SteamPort},{init.GamePort},{init.QueryPort},{secure},\"{init.VersionString}\")" );
}
Install
AddInterface<SteamServer>();
//
// Initial settings
@ -107,24 +107,23 @@ public static void Init( AppId appid, SteamServerInit init, bool asyncCallbacks
}
}
static List<SteamInterface> openIterfaces = new List<SteamInterface>();
internal static void WatchInterface( SteamInterface steamInterface )
internal static void AddInterface<T>() where T : SteamClass, new()
{
if ( openIterfaces.Contains( steamInterface ) )
throw new System.Exception( "openIterfaces already contains interface!" );
openIterfaces.Add( steamInterface );
var t = new T();
t.InitializeInterface();
openInterfaces.Add( t );
}
static List<SteamClass> openInterfaces = new List<SteamClass>();
internal static void ShutdownInterfaces()
{
foreach ( var e in openIterfaces )
foreach ( var e in openInterfaces )
{
e.ShutdownInterface();
e.DestroyInterface();
}
openIterfaces.Clear();
openInterfaces.Clear();
}
public static void Shutdown()

View File

@ -31,7 +31,7 @@ internal void ShutdownInterface()
public abstract class SteamClass
{
internal abstract void InitializeInterface();
internal void DestroyInterface()
internal virtual void DestroyInterface()
{
Interface.ShutdownInterface();
}