mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-04-26 23:09:37 +03:00
Try to define whether interfaces are shared/client/server only a bit better
This commit is contained in:
parent
c80421e9a9
commit
8b2599be98
@ -11,7 +11,7 @@ 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<SteamApps>
|
public class SteamApps : SteamSharedClass<SteamApps>
|
||||||
{
|
{
|
||||||
internal static ISteamApps Internal => Interface as ISteamApps;
|
internal static ISteamApps Internal => Interface as ISteamApps;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamFriends : SteamClass<SteamFriends>
|
public class SteamFriends : SteamClientClass<SteamFriends>
|
||||||
{
|
{
|
||||||
internal static ISteamFriends Internal => Interface as ISteamFriends;
|
internal static ISteamFriends Internal => Interface as ISteamFriends;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamInput : SteamClass<SteamInput>
|
public class SteamInput : SteamClientClass<SteamInput>
|
||||||
{
|
{
|
||||||
internal static ISteamInput Internal => Interface as ISteamInput;
|
internal static ISteamInput Internal => Interface as ISteamInput;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamInventory : SteamClass<SteamInventory>
|
public class SteamInventory : SteamSharedClass<SteamInventory>
|
||||||
{
|
{
|
||||||
internal static ISteamInventory Internal => Interface as ISteamInventory;
|
internal static ISteamInventory Internal => Interface as ISteamInventory;
|
||||||
|
|
||||||
@ -28,12 +28,9 @@ namespace Steamworks
|
|||||||
if ( !server )
|
if ( !server )
|
||||||
{
|
{
|
||||||
Dispatch.Install<SteamInventoryFullUpdate_t>( x => InventoryUpdated( x ) );
|
Dispatch.Install<SteamInventoryFullUpdate_t>( x => InventoryUpdated( x ) );
|
||||||
Dispatch.Install<SteamInventoryDefinitionUpdate_t>( x => LoadDefinitions() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Dispatch.Install<SteamInventoryDefinitionUpdate_t>( x => LoadDefinitions(), true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dispatch.Install<SteamInventoryDefinitionUpdate_t>( x => LoadDefinitions(), server );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InventoryUpdated( SteamInventoryFullUpdate_t x )
|
private static void InventoryUpdated( SteamInventoryFullUpdate_t x )
|
||||||
|
@ -10,7 +10,7 @@ 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<SteamMatchmaking>
|
public class SteamMatchmaking : SteamClientClass<SteamMatchmaking>
|
||||||
{
|
{
|
||||||
internal static ISteamMatchmaking Internal => Interface as ISteamMatchmaking;
|
internal static ISteamMatchmaking Internal => Interface as ISteamMatchmaking;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ 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<SteamMatchmakingServers>
|
public class SteamMatchmakingServers : SteamClientClass<SteamMatchmakingServers>
|
||||||
{
|
{
|
||||||
internal static ISteamMatchmakingServers Internal => Interface as ISteamMatchmakingServers;
|
internal static ISteamMatchmakingServers Internal => Interface as ISteamMatchmakingServers;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ 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<SteamMusic>
|
public class SteamMusic : SteamClientClass<SteamMusic>
|
||||||
{
|
{
|
||||||
internal static ISteamMusic Internal => Interface as ISteamMusic;
|
internal static ISteamMusic Internal => Interface as ISteamMusic;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ using Steamworks.Data;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamNetworking : SteamClass<SteamNetworking>
|
public class SteamNetworking : SteamSharedClass<SteamNetworking>
|
||||||
{
|
{
|
||||||
internal static ISteamNetworking Internal => Interface as ISteamNetworking;
|
internal static ISteamNetworking Internal => Interface as ISteamNetworking;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ using Steamworks.Data;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamNetworkingSockets : SteamClass<SteamNetworkingSockets>
|
public class SteamNetworkingSockets : SteamSharedClass<SteamNetworkingSockets>
|
||||||
{
|
{
|
||||||
internal static ISteamNetworkingSockets Internal => Interface as ISteamNetworkingSockets;
|
internal static ISteamNetworkingSockets Internal => Interface as ISteamNetworkingSockets;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamNetworkingUtils : SteamClass<SteamNetworkingUtils>
|
public class SteamNetworkingUtils : SteamSharedClass<SteamNetworkingUtils>
|
||||||
{
|
{
|
||||||
internal static ISteamNetworkingUtils Internal => Interface as ISteamNetworkingUtils;
|
internal static ISteamNetworkingUtils Internal => Interface as ISteamNetworkingUtils;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamParental : SteamClass<SteamParental>
|
public class SteamParental : SteamSharedClass<SteamParental>
|
||||||
{
|
{
|
||||||
internal static ISteamParentalSettings Internal => Interface as ISteamParentalSettings;
|
internal static ISteamParentalSettings Internal => Interface as ISteamParentalSettings;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ using Steamworks.Data;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamParties : SteamClass<SteamParties>
|
public class SteamParties : SteamClientClass<SteamParties>
|
||||||
{
|
{
|
||||||
internal static ISteamParties Internal => Interface as ISteamParties;
|
internal static ISteamParties Internal => Interface as ISteamParties;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamRemoteStorage : SteamClass<SteamRemoteStorage>
|
public class SteamRemoteStorage : SteamClientClass<SteamRemoteStorage>
|
||||||
{
|
{
|
||||||
internal static ISteamRemoteStorage Internal => Interface as ISteamRemoteStorage;
|
internal static ISteamRemoteStorage Internal => Interface as ISteamRemoteStorage;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamScreenshots : SteamClass<SteamScreenshots>
|
public class SteamScreenshots : SteamClientClass<SteamScreenshots>
|
||||||
{
|
{
|
||||||
internal static ISteamScreenshots Internal => Interface as ISteamScreenshots;
|
internal static ISteamScreenshots Internal => Interface as ISteamScreenshots;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ 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<SteamServer>
|
public partial class SteamServer : SteamServerClass<SteamServer>
|
||||||
{
|
{
|
||||||
internal static ISteamGameServer Internal => Interface as ISteamGameServer;
|
internal static ISteamGameServer Internal => Interface as ISteamGameServer;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ using Steamworks.Data;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamServerStats : SteamClass<SteamServerStats>
|
public class SteamServerStats : SteamServerClass<SteamServerStats>
|
||||||
{
|
{
|
||||||
internal static ISteamGameServerStats Internal => Interface as ISteamGameServerStats;
|
internal static ISteamGameServerStats Internal => Interface as ISteamGameServerStats;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ 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<SteamUGC>
|
public class SteamUGC : SteamSharedClass<SteamUGC>
|
||||||
{
|
{
|
||||||
internal static ISteamUGC Internal => Interface as ISteamUGC;
|
internal static ISteamUGC Internal => Interface as ISteamUGC;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ 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<SteamUser>
|
public class SteamUser : SteamClientClass<SteamUser>
|
||||||
{
|
{
|
||||||
internal static ISteamUser Internal => Interface as ISteamUser;
|
internal static ISteamUser Internal => Interface as ISteamUser;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ using Steamworks.Data;
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public class SteamUserStats : SteamClass<SteamUserStats>
|
public class SteamUserStats : SteamClientClass<SteamUserStats>
|
||||||
{
|
{
|
||||||
internal static ISteamUserStats Internal => Interface as ISteamUserStats;
|
internal static ISteamUserStats Internal => Interface as ISteamUserStats;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ 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<SteamUtils>
|
public class SteamUtils : SteamSharedClass<SteamUtils>
|
||||||
{
|
{
|
||||||
internal static ISteamUtils Internal => Interface as ISteamUtils;
|
internal static ISteamUtils Internal => Interface as ISteamUtils;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace Steamworks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Undocumented Parental Settings
|
/// Undocumented Parental Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SteamVideo : SteamClass<SteamVideo>
|
public class SteamVideo : SteamClientClass<SteamVideo>
|
||||||
{
|
{
|
||||||
internal static ISteamVideo Internal => Interface as ISteamVideo;
|
internal static ISteamVideo Internal => Interface as ISteamVideo;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ namespace Steamworks
|
|||||||
internal abstract void DestroyInterface( bool server );
|
internal abstract void DestroyInterface( bool server );
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SteamClass<T> : SteamClass
|
public class SteamSharedClass<T> : SteamClass
|
||||||
{
|
{
|
||||||
internal static SteamInterface Interface => InterfaceClient != null ? InterfaceClient : InterfaceServer;
|
internal static SteamInterface Interface => InterfaceClient != null ? InterfaceClient : InterfaceServer;
|
||||||
internal static SteamInterface InterfaceClient;
|
internal static SteamInterface InterfaceClient;
|
||||||
@ -90,4 +90,52 @@ namespace Steamworks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SteamClientClass<T> : SteamClass
|
||||||
|
{
|
||||||
|
internal static SteamInterface Interface => InterfaceClient;
|
||||||
|
internal static SteamInterface InterfaceClient;
|
||||||
|
|
||||||
|
internal override void InitializeInterface( bool server )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal virtual void SetInterface( bool server, SteamInterface iface )
|
||||||
|
{
|
||||||
|
if ( server )
|
||||||
|
throw new System.NotSupportedException();
|
||||||
|
|
||||||
|
InterfaceClient = iface;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DestroyInterface( bool server )
|
||||||
|
{
|
||||||
|
InterfaceClient = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SteamServerClass<T> : SteamClass
|
||||||
|
{
|
||||||
|
internal static SteamInterface Interface => InterfaceServer;
|
||||||
|
internal static SteamInterface InterfaceServer;
|
||||||
|
|
||||||
|
internal override void InitializeInterface( bool server )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal virtual void SetInterface( bool server, SteamInterface iface )
|
||||||
|
{
|
||||||
|
if ( !server )
|
||||||
|
throw new System.NotSupportedException();
|
||||||
|
|
||||||
|
InterfaceServer = iface;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DestroyInterface( bool server )
|
||||||
|
{
|
||||||
|
InterfaceServer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user