mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 22:58:01 +03:00
Parental settings
This commit is contained in:
parent
a2cd4b099c
commit
2d2be118d3
@ -0,0 +1,97 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using SteamNative;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Steamworks.Internal
|
||||||
|
{
|
||||||
|
public class ISteamParentalSettings : BaseSteamInterface
|
||||||
|
{
|
||||||
|
public override string InterfaceName => "STEAMPARENTALSETTINGS_INTERFACE_VERSION001";
|
||||||
|
|
||||||
|
public override void InitInternals()
|
||||||
|
{
|
||||||
|
BIsParentalLockEnabledDelegatePointer = Marshal.GetDelegateForFunctionPointer<BIsParentalLockEnabledDelegate>( Marshal.ReadIntPtr( VTable, 0) );
|
||||||
|
BIsParentalLockLockedDelegatePointer = Marshal.GetDelegateForFunctionPointer<BIsParentalLockLockedDelegate>( Marshal.ReadIntPtr( VTable, 8) );
|
||||||
|
BIsAppBlockedDelegatePointer = Marshal.GetDelegateForFunctionPointer<BIsAppBlockedDelegate>( Marshal.ReadIntPtr( VTable, 16) );
|
||||||
|
BIsAppInBlockListDelegatePointer = Marshal.GetDelegateForFunctionPointer<BIsAppInBlockListDelegate>( Marshal.ReadIntPtr( VTable, 24) );
|
||||||
|
BIsFeatureBlockedDelegatePointer = Marshal.GetDelegateForFunctionPointer<BIsFeatureBlockedDelegate>( Marshal.ReadIntPtr( VTable, 32) );
|
||||||
|
BIsFeatureInBlockListDelegatePointer = Marshal.GetDelegateForFunctionPointer<BIsFeatureInBlockListDelegate>( Marshal.ReadIntPtr( VTable, 40) );
|
||||||
|
}
|
||||||
|
|
||||||
|
#region FunctionMeta
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
|
public delegate bool BIsParentalLockEnabledDelegate( IntPtr self );
|
||||||
|
private BIsParentalLockEnabledDelegate BIsParentalLockEnabledDelegatePointer;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
public bool BIsParentalLockEnabled()
|
||||||
|
{
|
||||||
|
return BIsParentalLockEnabledDelegatePointer( Self );
|
||||||
|
}
|
||||||
|
|
||||||
|
#region FunctionMeta
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
|
public delegate bool BIsParentalLockLockedDelegate( IntPtr self );
|
||||||
|
private BIsParentalLockLockedDelegate BIsParentalLockLockedDelegatePointer;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
public bool BIsParentalLockLocked()
|
||||||
|
{
|
||||||
|
return BIsParentalLockLockedDelegatePointer( Self );
|
||||||
|
}
|
||||||
|
|
||||||
|
#region FunctionMeta
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
|
public delegate bool BIsAppBlockedDelegate( IntPtr self, AppId_t nAppID );
|
||||||
|
private BIsAppBlockedDelegate BIsAppBlockedDelegatePointer;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
public bool BIsAppBlocked( AppId_t nAppID )
|
||||||
|
{
|
||||||
|
return BIsAppBlockedDelegatePointer( Self, nAppID );
|
||||||
|
}
|
||||||
|
|
||||||
|
#region FunctionMeta
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
|
public delegate bool BIsAppInBlockListDelegate( IntPtr self, AppId_t nAppID );
|
||||||
|
private BIsAppInBlockListDelegate BIsAppInBlockListDelegatePointer;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
public bool BIsAppInBlockList( AppId_t nAppID )
|
||||||
|
{
|
||||||
|
return BIsAppInBlockListDelegatePointer( Self, nAppID );
|
||||||
|
}
|
||||||
|
|
||||||
|
#region FunctionMeta
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
|
public delegate bool BIsFeatureBlockedDelegate( IntPtr self, ParentalFeature eFeature );
|
||||||
|
private BIsFeatureBlockedDelegate BIsFeatureBlockedDelegatePointer;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
public bool BIsFeatureBlocked( ParentalFeature eFeature )
|
||||||
|
{
|
||||||
|
return BIsFeatureBlockedDelegatePointer( Self, eFeature );
|
||||||
|
}
|
||||||
|
|
||||||
|
#region FunctionMeta
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
|
public delegate bool BIsFeatureInBlockListDelegate( IntPtr self, ParentalFeature eFeature );
|
||||||
|
private BIsFeatureInBlockListDelegate BIsFeatureInBlockListDelegatePointer;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
public bool BIsFeatureInBlockList( ParentalFeature eFeature )
|
||||||
|
{
|
||||||
|
return BIsFeatureInBlockListDelegatePointer( Self, eFeature );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
68
Facepunch.Steamworks/Redux/Parental.cs
Normal file
68
Facepunch.Steamworks/Redux/Parental.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using SteamNative;
|
||||||
|
|
||||||
|
namespace Steamworks
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Undocumented Parental Settings
|
||||||
|
/// </summary>
|
||||||
|
public static class Parental
|
||||||
|
{
|
||||||
|
static Internal.ISteamParentalSettings _internal;
|
||||||
|
internal static Internal.ISteamParentalSettings parentalsettings
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ( _internal == null )
|
||||||
|
_internal = new Internal.ISteamParentalSettings();
|
||||||
|
|
||||||
|
return _internal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void InstallEvents()
|
||||||
|
{
|
||||||
|
new Event<SteamParentalSettingsChanged_t>( x => OnSettingsChanged?.Invoke() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parental Settings Changed
|
||||||
|
/// </summary>
|
||||||
|
public static event Action OnSettingsChanged;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsParentalLockEnabled => parentalsettings.BIsParentalLockEnabled();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsParentalLockLocked => parentalsettings.BIsParentalLockLocked();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsAppBlocked( AppId app ) => parentalsettings.BIsAppBlocked( app.Value );
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static bool BIsAppInBlockList( AppId app ) => parentalsettings.BIsAppInBlockList( app.Value );
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsFeatureBlocked( ParentalFeature feature ) => parentalsettings.BIsFeatureBlocked( feature );
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static bool BIsFeatureInBlockList( ParentalFeature feature ) => parentalsettings.BIsFeatureInBlockList( feature );
|
||||||
|
}
|
||||||
|
}
|
@ -94,6 +94,7 @@ namespace Generator
|
|||||||
{
|
{
|
||||||
GenerateVTableClass( "ISteamApps", $"{folder}../Generated/Interfaces/ISteamApps.cs" );
|
GenerateVTableClass( "ISteamApps", $"{folder}../Generated/Interfaces/ISteamApps.cs" );
|
||||||
GenerateVTableClass( "ISteamUtils", $"{folder}../Generated/Interfaces/ISteamUtils.cs" );
|
GenerateVTableClass( "ISteamUtils", $"{folder}../Generated/Interfaces/ISteamUtils.cs" );
|
||||||
|
GenerateVTableClass( "ISteamParentalSettings", $"{folder}../Generated/Interfaces/ISteamParentalSettings.cs" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user