mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-02-05 10:10:46 +03:00
Prefer use client interface if both exist (this might need a big change at some point)
This commit is contained in:
parent
8f36f0c939
commit
bc9801c36a
@ -11,16 +11,14 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Exposes a wide range of information and actions for applications and Downloadable Content (DLC).
|
/// Exposes a wide range of information and actions for applications and Downloadable Content (DLC).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamApps : SteamClass
|
public class SteamApps : SteamClass<SteamApps>
|
||||||
{
|
{
|
||||||
internal static ISteamApps Internal;
|
internal static ISteamApps Internal => Interface as ISteamApps;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamApps( server );
|
SetInterface( server, new ISteamApps( server ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents()
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ namespace Steamworks
|
|||||||
{
|
{
|
||||||
foreach ( var e in openInterfaces )
|
foreach ( var e in openInterfaces )
|
||||||
{
|
{
|
||||||
e.DestroyInterface();
|
e.DestroyInterface( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
openInterfaces.Clear();
|
openInterfaces.Clear();
|
||||||
|
@ -10,14 +10,13 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamFriends : SteamClass
|
public class SteamFriends : SteamClass<SteamFriends>
|
||||||
{
|
{
|
||||||
internal static ISteamFriends Internal;
|
internal static ISteamFriends Internal => Interface as ISteamFriends;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamFriends( server );
|
SetInterface( server, new ISteamFriends( server ) );
|
||||||
|
|
||||||
richPresence = new Dictionary<string, string>();
|
richPresence = new Dictionary<string, string>();
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,13 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamInput : SteamClass
|
public class SteamInput : SteamClass<SteamInput>
|
||||||
{
|
{
|
||||||
internal static ISteamInput Internal;
|
internal static ISteamInput Internal => Interface as ISteamInput;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamInput( server );
|
SetInterface( server, new ISteamInput( server ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal const int STEAM_CONTROLLER_MAX_COUNT = 16;
|
internal const int STEAM_CONTROLLER_MAX_COUNT = 16;
|
||||||
|
@ -12,23 +12,28 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamInventory : SteamClass
|
public class SteamInventory : SteamClass<SteamInventory>
|
||||||
{
|
{
|
||||||
internal static ISteamInventory Internal;
|
internal static ISteamInventory Internal => Interface as ISteamInventory;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamInventory( server );
|
SetInterface( server, new ISteamInventory( server ) );
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents( server );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents( bool server )
|
||||||
{
|
{
|
||||||
Dispatch.Install<SteamInventoryFullUpdate_t>( x => InventoryUpdated( x ) );
|
if ( !server )
|
||||||
Dispatch.Install<SteamInventoryDefinitionUpdate_t>( x => LoadDefinitions() );
|
{
|
||||||
Dispatch.Install<SteamInventoryDefinitionUpdate_t>( x => LoadDefinitions(), true );
|
Dispatch.Install<SteamInventoryFullUpdate_t>( x => InventoryUpdated( x ) );
|
||||||
|
Dispatch.Install<SteamInventoryDefinitionUpdate_t>( x => LoadDefinitions() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dispatch.Install<SteamInventoryDefinitionUpdate_t>( x => LoadDefinitions(), true );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InventoryUpdated( SteamInventoryFullUpdate_t x )
|
private static void InventoryUpdated( SteamInventoryFullUpdate_t x )
|
||||||
|
@ -10,18 +10,16 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Functions for clients to access matchmaking services, favorites, and to operate on game lobbies
|
/// Functions for clients to access matchmaking services, favorites, and to operate on game lobbies
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamMatchmaking : SteamClass
|
public class SteamMatchmaking : SteamClass<SteamMatchmaking>
|
||||||
{
|
{
|
||||||
internal static ISteamMatchmaking Internal;
|
internal static ISteamMatchmaking Internal => Interface as ISteamMatchmaking;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamMatchmaking( server );
|
SetInterface( server, new ISteamMatchmaking( server ) );
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum number of characters a lobby metadata key can be
|
/// Maximum number of characters a lobby metadata key can be
|
||||||
|
@ -10,14 +10,13 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Functions for clients to access matchmaking services, favorites, and to operate on game lobbies
|
/// Functions for clients to access matchmaking services, favorites, and to operate on game lobbies
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamMatchmakingServers : SteamClass
|
public class SteamMatchmakingServers : SteamClass<SteamMatchmakingServers>
|
||||||
{
|
{
|
||||||
internal static ISteamMatchmakingServers Internal;
|
internal static ISteamMatchmakingServers Internal => Interface as ISteamMatchmakingServers;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamMatchmakingServers( server );
|
SetInterface( server, new ISteamMatchmakingServers( server ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,14 +13,13 @@ namespace Steamworks
|
|||||||
/// when an important cut scene is shown, and start playing afterwards.
|
/// when an important cut scene is shown, and start playing afterwards.
|
||||||
/// Nothing uses Steam Music though so this can probably get fucked
|
/// Nothing uses Steam Music though so this can probably get fucked
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamMusic : SteamClass
|
public class SteamMusic : SteamClass<SteamMusic>
|
||||||
{
|
{
|
||||||
internal static ISteamMusic Internal;
|
internal static ISteamMusic Internal => Interface as ISteamMusic;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamMusic( server );
|
SetInterface( server, new ISteamMusic( server ) );
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
}
|
}
|
||||||
|
@ -8,22 +8,21 @@ using Steamworks.Data;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamNetworking : SteamClass
|
public class SteamNetworking : SteamClass<SteamNetworking>
|
||||||
{
|
{
|
||||||
internal static ISteamNetworking Internal;
|
internal static ISteamNetworking Internal => Interface as ISteamNetworking;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamNetworking( server );
|
SetInterface( server, new ISteamNetworking( server ) );
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents( server );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents( bool server )
|
||||||
{
|
{
|
||||||
Dispatch.Install<P2PSessionRequest_t>( x => OnP2PSessionRequest?.Invoke( x.SteamIDRemote ) );
|
Dispatch.Install<P2PSessionRequest_t>( x => OnP2PSessionRequest?.Invoke( x.SteamIDRemote ), server );
|
||||||
Dispatch.Install<P2PSessionConnectFail_t>( x => OnP2PConnectionFailed?.Invoke( x.SteamIDRemote, (P2PSessionError) x.P2PSessionError ) );
|
Dispatch.Install<P2PSessionConnectFail_t>( x => OnP2PConnectionFailed?.Invoke( x.SteamIDRemote, (P2PSessionError) x.P2PSessionError ), server );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -8,21 +8,20 @@ using Steamworks.Data;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamNetworkingSockets : SteamClass
|
public class SteamNetworkingSockets : SteamClass<SteamNetworkingSockets>
|
||||||
{
|
{
|
||||||
internal static ISteamNetworkingSockets Internal;
|
internal static ISteamNetworkingSockets Internal => Interface as ISteamNetworkingSockets;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamNetworkingSockets( server );
|
SetInterface( server, new ISteamNetworkingSockets( server ) );
|
||||||
|
|
||||||
SocketInterfaces = new Dictionary<uint, SocketInterface>();
|
SocketInterfaces = new Dictionary<uint, SocketInterface>();
|
||||||
ConnectionInterfaces = new Dictionary<uint, ConnectionInterface>();
|
ConnectionInterfaces = new Dictionary<uint, ConnectionInterface>();
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents( server );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region SocketInterface
|
#region SocketInterface
|
||||||
|
|
||||||
static Dictionary<uint, SocketInterface> SocketInterfaces;
|
static Dictionary<uint, SocketInterface> SocketInterfaces;
|
||||||
@ -69,7 +68,7 @@ namespace Steamworks
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
internal static void InstallEvents( bool server = false )
|
internal static void InstallEvents( bool server )
|
||||||
{
|
{
|
||||||
Dispatch.Install<SteamNetConnectionStatusChangedCallback_t>( ConnectionStatusChanged, server );
|
Dispatch.Install<SteamNetConnectionStatusChangedCallback_t>( ConnectionStatusChanged, server );
|
||||||
}
|
}
|
||||||
|
@ -10,22 +10,22 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamNetworkingUtils : SteamClass
|
public class SteamNetworkingUtils : SteamClass<SteamNetworkingUtils>
|
||||||
{
|
{
|
||||||
internal static ISteamNetworkingUtils Internal;
|
internal static ISteamNetworkingUtils Internal => Interface as ISteamNetworkingUtils;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamNetworkingUtils( server );
|
SetInterface( server, new ISteamNetworkingUtils( server ) );
|
||||||
|
InstallCallbacks( server );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InstallCallbacks()
|
static void InstallCallbacks( bool server )
|
||||||
{
|
{
|
||||||
Dispatch.Install<SteamRelayNetworkStatus_t>( x =>
|
Dispatch.Install<SteamRelayNetworkStatus_t>( x =>
|
||||||
{
|
{
|
||||||
Status = x.Avail;
|
Status = x.Avail;
|
||||||
} );
|
}, server );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SteamNetworkingAvailability Status { get; private set; }
|
public static SteamNetworkingAvailability Status { get; private set; }
|
||||||
|
@ -10,21 +10,19 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamParental : SteamClass
|
public class SteamParental : SteamClass<SteamParental>
|
||||||
{
|
{
|
||||||
internal static ISteamParentalSettings Internal;
|
internal static ISteamParentalSettings Internal => Interface as ISteamParentalSettings;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamParentalSettings( server );
|
SetInterface( server, new ISteamParentalSettings( server ) );
|
||||||
InstallEvents();
|
InstallEvents( server );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void InstallEvents( bool server )
|
||||||
internal static void InstallEvents()
|
|
||||||
{
|
{
|
||||||
Dispatch.Install<SteamParentalSettingsChanged_t>( x => OnSettingsChanged?.Invoke() );
|
Dispatch.Install<SteamParentalSettingsChanged_t>( x => OnSettingsChanged?.Invoke(), server );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -7,21 +7,20 @@ using Steamworks.Data;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamParties : SteamClass
|
public class SteamParties : SteamClass<SteamParties>
|
||||||
{
|
{
|
||||||
internal static ISteamParties Internal;
|
internal static ISteamParties Internal => Interface as ISteamParties;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamParties( server );
|
SetInterface( server, new ISteamParties( server ) );
|
||||||
InstallEvents();
|
InstallEvents( server );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents( bool server )
|
||||||
{
|
{
|
||||||
Dispatch.Install<AvailableBeaconLocationsUpdated_t>( x => OnBeaconLocationsUpdated?.Invoke() );
|
Dispatch.Install<AvailableBeaconLocationsUpdated_t>( x => OnBeaconLocationsUpdated?.Invoke(), server );
|
||||||
Dispatch.Install<ActiveBeaconsUpdated_t>( x => OnActiveBeaconsUpdated?.Invoke() );
|
Dispatch.Install<ActiveBeaconsUpdated_t>( x => OnActiveBeaconsUpdated?.Invoke(), server );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -10,15 +10,15 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamRemoteStorage : SteamClass
|
public class SteamRemoteStorage : SteamClass<SteamRemoteStorage>
|
||||||
{
|
{
|
||||||
internal static ISteamRemoteStorage Internal;
|
internal static ISteamRemoteStorage Internal => Interface as ISteamRemoteStorage;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamRemoteStorage( server );
|
SetInterface( server, new ISteamRemoteStorage( server ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new file, writes the bytes to the file, and then closes the file.
|
/// Creates a new file, writes the bytes to the file, and then closes the file.
|
||||||
|
@ -10,14 +10,13 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamScreenshots : SteamClass
|
public class SteamScreenshots : SteamClass<SteamScreenshots>
|
||||||
{
|
{
|
||||||
internal static ISteamScreenshots Internal;
|
internal static ISteamScreenshots Internal => Interface as ISteamScreenshots;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamScreenshots( server );
|
SetInterface( server, new ISteamScreenshots( server ) );
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,14 +10,13 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides the core of the Steam Game Servers API
|
/// Provides the core of the Steam Game Servers API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class SteamServer : SteamClass
|
public partial class SteamServer : SteamClass<SteamServer>
|
||||||
{
|
{
|
||||||
internal static ISteamGameServer Internal;
|
internal static ISteamGameServer Internal => Interface as ISteamGameServer;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamGameServer( server );
|
SetInterface( server, new ISteamGameServer( server ) );
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,9 +27,6 @@ namespace Steamworks
|
|||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents()
|
||||||
{
|
{
|
||||||
SteamInventory.InstallEvents();
|
|
||||||
//SteamNetworkingSockets.InstallEvents(true);
|
|
||||||
|
|
||||||
Dispatch.Install<ValidateAuthTicketResponse_t>( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true );
|
Dispatch.Install<ValidateAuthTicketResponse_t>( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true );
|
||||||
Dispatch.Install<SteamServersConnected_t>( x => OnSteamServersConnected?.Invoke(), true );
|
Dispatch.Install<SteamServersConnected_t>( x => OnSteamServersConnected?.Invoke(), true );
|
||||||
Dispatch.Install<SteamServerConnectFailure_t>( x => OnSteamServerConnectFailure?.Invoke( x.Result, x.StillRetrying ), true );
|
Dispatch.Install<SteamServerConnectFailure_t>( x => OnSteamServerConnectFailure?.Invoke( x.Result, x.StillRetrying ), true );
|
||||||
@ -141,7 +137,7 @@ namespace Steamworks
|
|||||||
{
|
{
|
||||||
foreach ( var e in openInterfaces )
|
foreach ( var e in openInterfaces )
|
||||||
{
|
{
|
||||||
e.DestroyInterface();
|
e.DestroyInterface( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
openInterfaces.Clear();
|
openInterfaces.Clear();
|
||||||
@ -149,8 +145,6 @@ namespace Steamworks
|
|||||||
|
|
||||||
public static void Shutdown()
|
public static void Shutdown()
|
||||||
{
|
{
|
||||||
Internal = null;
|
|
||||||
|
|
||||||
ShutdownInterfaces();
|
ShutdownInterfaces();
|
||||||
SteamGameServer.Shutdown();
|
SteamGameServer.Shutdown();
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,15 @@ using Steamworks.Data;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamServerStats : SteamClass
|
public class SteamServerStats : SteamClass<SteamServerStats>
|
||||||
{
|
{
|
||||||
internal static ISteamGameServerStats Internal;
|
internal static ISteamGameServerStats Internal => Interface as ISteamGameServerStats;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamGameServerStats( server );
|
SetInterface( server, new ISteamGameServerStats( server ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Downloads stats for the user
|
/// Downloads stats for the user
|
||||||
|
@ -12,20 +12,19 @@ namespace Steamworks
|
|||||||
/// Functions for accessing and manipulating Steam user information.
|
/// Functions for accessing and manipulating Steam user information.
|
||||||
/// This is also where the APIs for Steam Voice are exposed.
|
/// This is also where the APIs for Steam Voice are exposed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamUGC : SteamClass
|
public class SteamUGC : SteamClass<SteamUGC>
|
||||||
{
|
{
|
||||||
internal static ISteamUGC Internal;
|
internal static ISteamUGC Internal => Interface as ISteamUGC;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamUGC( server );
|
SetInterface( server, new ISteamUGC( server ) );
|
||||||
InstallEvents();
|
InstallEvents( server );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents( bool server )
|
||||||
{
|
{
|
||||||
Dispatch.Install<DownloadItemResult_t>( x => OnDownloadItemResult?.Invoke( x.Result ) );
|
Dispatch.Install<DownloadItemResult_t>( x => OnDownloadItemResult?.Invoke( x.Result ), server );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -13,14 +13,13 @@ namespace Steamworks
|
|||||||
/// Functions for accessing and manipulating Steam user information.
|
/// Functions for accessing and manipulating Steam user information.
|
||||||
/// This is also where the APIs for Steam Voice are exposed.
|
/// This is also where the APIs for Steam Voice are exposed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamUser : SteamClass
|
public class SteamUser : SteamClass<SteamUser>
|
||||||
{
|
{
|
||||||
internal static ISteamUser Internal;
|
internal static ISteamUser Internal => Interface as ISteamUser;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamUser( server );
|
SetInterface( server, new ISteamUser( server ) );
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
|
|
||||||
richPresence = new Dictionary<string, string>();
|
richPresence = new Dictionary<string, string>();
|
||||||
|
@ -7,15 +7,13 @@ using Steamworks.Data;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamUserStats : SteamClass
|
public class SteamUserStats : SteamClass<SteamUserStats>
|
||||||
{
|
{
|
||||||
internal static ISteamUserStats Internal;
|
internal static ISteamUserStats Internal => Interface as ISteamUserStats;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamUserStats( server );
|
SetInterface( server, new ISteamUserStats( server ) );
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
RequestCurrentStats();
|
RequestCurrentStats();
|
||||||
}
|
}
|
||||||
|
@ -10,24 +10,22 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface which provides access to a range of miscellaneous utility functions
|
/// Interface which provides access to a range of miscellaneous utility functions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamUtils : SteamClass
|
public class SteamUtils : SteamClass<SteamUtils>
|
||||||
{
|
{
|
||||||
internal static ISteamUtils Internal;
|
internal static ISteamUtils Internal => Interface as ISteamUtils;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamUtils( server );
|
SetInterface( server, new ISteamUtils( server ) );
|
||||||
|
InstallEvents( server );
|
||||||
InstallEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents()
|
internal static void InstallEvents( bool server )
|
||||||
{
|
{
|
||||||
Dispatch.Install<IPCountry_t>( x => OnIpCountryChanged?.Invoke() );
|
Dispatch.Install<IPCountry_t>( x => OnIpCountryChanged?.Invoke(), server );
|
||||||
Dispatch.Install<LowBatteryPower_t>( x => OnLowBatteryPower?.Invoke( x.MinutesBatteryLeft ) );
|
Dispatch.Install<LowBatteryPower_t>( x => OnLowBatteryPower?.Invoke( x.MinutesBatteryLeft ), server );
|
||||||
Dispatch.Install<SteamShutdown_t>( x => SteamClosed() );
|
Dispatch.Install<SteamShutdown_t>( x => SteamClosed(), server );
|
||||||
Dispatch.Install<GamepadTextInputDismissed_t>( x => OnGamepadTextInputDismissed?.Invoke( x.Submitted ) );
|
Dispatch.Install<GamepadTextInputDismissed_t>( x => OnGamepadTextInputDismissed?.Invoke( x.Submitted ), server );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SteamClosed()
|
private static void SteamClosed()
|
||||||
|
@ -10,15 +10,13 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamVideo : SteamClass
|
public class SteamVideo : SteamClass<SteamVideo>
|
||||||
{
|
{
|
||||||
internal static ISteamVideo Internal;
|
internal static ISteamVideo Internal => Interface as ISteamVideo;
|
||||||
internal override SteamInterface Interface => Internal;
|
|
||||||
|
|
||||||
internal override void InitializeInterface( bool server )
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Internal = new ISteamVideo( server );
|
SetInterface( server, new ISteamVideo( server ) );
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,20 +16,33 @@ namespace Steamworks
|
|||||||
public virtual IntPtr GetGlobalInterfacePointer() => IntPtr.Zero;
|
public virtual IntPtr GetGlobalInterfacePointer() => IntPtr.Zero;
|
||||||
|
|
||||||
public IntPtr Self;
|
public IntPtr Self;
|
||||||
|
public IntPtr SelfGlobal;
|
||||||
|
public IntPtr SelfServer;
|
||||||
|
public IntPtr SelfClient;
|
||||||
|
|
||||||
public bool IsValid => Self != IntPtr.Zero;
|
public bool IsValid => Self != IntPtr.Zero;
|
||||||
|
|
||||||
internal void SetupInterface( bool gameServer )
|
internal void SetupInterface( bool gameServer )
|
||||||
{
|
{
|
||||||
Self = GetGlobalInterfacePointer();
|
if ( Self != IntPtr.Zero )
|
||||||
|
return;
|
||||||
|
|
||||||
|
SelfGlobal = GetGlobalInterfacePointer();
|
||||||
|
Self = SelfGlobal;
|
||||||
|
|
||||||
if ( Self != IntPtr.Zero )
|
if ( Self != IntPtr.Zero )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( gameServer )
|
if ( gameServer )
|
||||||
Self = GetServerInterfacePointer();
|
{
|
||||||
|
SelfServer = GetServerInterfacePointer();
|
||||||
|
Self = SelfServer;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Self = GetUserInterfacePointer();
|
{
|
||||||
|
SelfClient = GetUserInterfacePointer();
|
||||||
|
Self = SelfClient;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ShutdownInterface()
|
internal void ShutdownInterface()
|
||||||
@ -41,12 +54,38 @@ namespace Steamworks
|
|||||||
public abstract class SteamClass
|
public abstract class SteamClass
|
||||||
{
|
{
|
||||||
internal abstract void InitializeInterface( bool server );
|
internal abstract void InitializeInterface( bool server );
|
||||||
internal virtual void DestroyInterface()
|
internal abstract void DestroyInterface( bool server );
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SteamClass<T> : SteamClass
|
||||||
|
{
|
||||||
|
internal static SteamInterface Interface => InterfaceClient != null ? InterfaceClient : InterfaceServer;
|
||||||
|
internal static SteamInterface InterfaceClient;
|
||||||
|
internal static SteamInterface InterfaceServer;
|
||||||
|
|
||||||
|
internal override void InitializeInterface( bool server )
|
||||||
{
|
{
|
||||||
Interface.ShutdownInterface();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal abstract SteamInterface Interface { get; }
|
internal virtual void SetInterface( bool server, SteamInterface iface )
|
||||||
|
{
|
||||||
|
if ( server )
|
||||||
|
{
|
||||||
|
InterfaceServer = iface;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !server )
|
||||||
|
{
|
||||||
|
InterfaceClient = iface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DestroyInterface( bool server )
|
||||||
|
{
|
||||||
|
InterfaceClient = null;
|
||||||
|
InterfaceServer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user