diff --git a/Facepunch.Steamworks/Redux/Apps.cs b/Facepunch.Steamworks/Redux/Apps.cs new file mode 100644 index 0000000..70026d7 --- /dev/null +++ b/Facepunch.Steamworks/Redux/Apps.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Steamworks +{ + /// + /// Exposes a wide range of information and actions for applications and Downloadable Content (DLC). + /// + public static class Apps + { + static Internal.ISteamApps _steamapps; + internal static Internal.ISteamApps steamapps + { + get + { + if ( _steamapps == null ) + _steamapps = new Internal.ISteamApps(); + + return _steamapps; + } + } + + /// + /// Checks if the active user is subscribed to the current App ID + /// + public static bool IsSubscribed => steamapps.BIsSubscribed(); + + /// + /// Checks if the license owned by the user provides low violence depots. + /// Low violence depots are useful for copies sold in countries that have content restrictions + /// + public static bool IsLowVoilence => steamapps.BIsLowViolence(); + + /// + /// Checks whether the current App ID license is for Cyber Cafes. + /// + public static bool IsCybercafe => steamapps.BIsCybercafe(); + + /// + /// CChecks if the user has a VAC ban on their account + /// + public static bool IsVACBanned => steamapps.BIsVACBanned(); + + /// + /// Gets the current language that the user has set. + /// This falls back to the Steam UI language if the user hasn't explicitly picked a language for the title. + /// + public static string GameLangauge => steamapps.GetCurrentGameLanguage(); + + /// + /// Gets a list of the languages the current app supports. + /// + public static string[] AvailablLanguages => steamapps.GetAvailableGameLanguages().Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries ); + } +} \ No newline at end of file diff --git a/Facepunch.Steamworks/Redux/Steam.cs b/Facepunch.Steamworks/Redux/Steam.cs new file mode 100644 index 0000000..3ab5005 --- /dev/null +++ b/Facepunch.Steamworks/Redux/Steam.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Steamworks +{ + public static class Steam + { + internal static int HUser; + + public static void Init( uint appid ) + { + System.Environment.SetEnvironmentVariable( "SteamAppId", appid.ToString() ); + System.Environment.SetEnvironmentVariable( "SteamGameId", appid.ToString() ); + + if ( !SteamApi.Init() ) + { + throw new System.Exception( "SteamApi_Init returned false. Steam isn't running, couldn't find Steam, AppId is ureleased, Don't own AppId." ); + } + + HUser = SteamApi.GetHSteamUser(); + if ( HUser == 0 ) + { + throw new System.Exception( "GetHSteamUser returned 0" ); + } + } + } +} \ No newline at end of file