Added Client.CurrentLanguage + AvailableLanguages

This commit is contained in:
Garry Newman 2017-04-02 10:05:48 +01:00
parent f9f18eec74
commit ca7107c8d3
2 changed files with 46 additions and 0 deletions

View File

@ -129,6 +129,38 @@ namespace Facepunch.Steamworks.Test
} }
} }
[TestMethod]
public void CurrentLanguage()
{
var sw = new Stopwatch();
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
Assert.IsTrue( client.CurrentLanguage != null );
Assert.IsTrue( client.CurrentLanguage.Length > 0 );
Console.Write( $"CurrentLanguage: {client.CurrentLanguage}" );
}
}
[TestMethod]
public void AvailableLanguages()
{
var sw = new Stopwatch();
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
Assert.IsTrue( client.AvailableLanguages != null );
Assert.IsTrue( client.AvailableLanguages.Length > 0 );
foreach ( var lang in client.AvailableLanguages )
{
Console.Write( $"AvailableLanguages: {lang}" );
}
}
}
[TestMethod] [TestMethod]
public void Cybercafe() public void Cybercafe()
{ {

View File

@ -36,6 +36,18 @@ namespace Facepunch.Steamworks
/// </summary> /// </summary>
public DirectoryInfo InstallFolder { get; private set; } public DirectoryInfo InstallFolder { get; private set; }
/// <summary>
/// The currently selected language
/// </summary>
public string CurrentLanguage { get; }
/// <summary>
/// List of languages available to the game
/// </summary>
public string[] AvailableLanguages { get; }
public Voice Voice { get; private set; } public Voice Voice { get; private set; }
public ServerList ServerList { get; private set; } public ServerList ServerList { get; private set; }
public App App { get; private set; } public App App { get; private set; }
@ -79,6 +91,8 @@ namespace Facepunch.Steamworks
OwnerSteamId = native.apps.GetAppOwner(); OwnerSteamId = native.apps.GetAppOwner();
InstallFolder = new DirectoryInfo( native.apps.GetAppInstallDir( AppId ) ); InstallFolder = new DirectoryInfo( native.apps.GetAppInstallDir( AppId ) );
BuildId = native.apps.GetAppBuildId(); BuildId = native.apps.GetAppBuildId();
CurrentLanguage = native.apps.GetCurrentGameLanguage();
AvailableLanguages = native.apps.GetAvailableGameLanguages().Split( new[] {';'}, StringSplitOptions.RemoveEmptyEntries ); // TODO: Assumed colon separated
// //
// Run update, first call does some initialization // Run update, first call does some initialization