mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-03-30 22:29:04 +03:00
Singleton accessors for Client/Server
This commit is contained in:
parent
d417f22336
commit
67fd7fe00a
@ -6,6 +6,11 @@ namespace Facepunch.Steamworks
|
|||||||
{
|
{
|
||||||
public partial class Client : BaseSteamworks
|
public partial class Client : BaseSteamworks
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A singleton accessor to get the current client instance.
|
||||||
|
/// </summary>
|
||||||
|
public static Client Instance { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current user's Username
|
/// Current user's Username
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -56,6 +61,7 @@ namespace Facepunch.Steamworks
|
|||||||
|
|
||||||
public Client( uint appId )
|
public Client( uint appId )
|
||||||
{
|
{
|
||||||
|
Instance = this;
|
||||||
native = new Interop.NativeInterface();
|
native = new Interop.NativeInterface();
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -162,6 +168,11 @@ namespace Facepunch.Steamworks
|
|||||||
Achievements = null;
|
Achievements = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( Instance == this )
|
||||||
|
{
|
||||||
|
Instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,11 @@ namespace Facepunch.Steamworks
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Server : BaseSteamworks
|
public partial class Server : BaseSteamworks
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A singleton accessor to get the current client instance.
|
||||||
|
/// </summary>
|
||||||
|
public static Server Instance { get; private set; }
|
||||||
|
|
||||||
internal override bool IsGameServer { get { return true; } }
|
internal override bool IsGameServer { get { return true; } }
|
||||||
|
|
||||||
public ServerQuery Query { get; internal set; }
|
public ServerQuery Query { get; internal set; }
|
||||||
@ -31,6 +36,7 @@ namespace Facepunch.Steamworks
|
|||||||
/// <param name="VersionString">A string defining version, ie "1001"</param>
|
/// <param name="VersionString">A string defining version, ie "1001"</param>
|
||||||
public Server( uint appId, uint IpAddress, ushort SteamPort, ushort GamePort, ushort QueryPort, bool Secure, string VersionString )
|
public Server( uint appId, uint IpAddress, ushort SteamPort, ushort GamePort, ushort QueryPort, bool Secure, string VersionString )
|
||||||
{
|
{
|
||||||
|
Instance = this;
|
||||||
native = new Interop.NativeInterface();
|
native = new Interop.NativeInterface();
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -284,6 +290,11 @@ namespace Facepunch.Steamworks
|
|||||||
Auth = null;
|
Auth = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( Instance == this )
|
||||||
|
{
|
||||||
|
Instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user