Definition.Type and Definition.IsGenerator

This commit is contained in:
Garry Newman 2016-11-10 10:58:54 +00:00
parent 5c62314f96
commit 0e63be99c0
2 changed files with 20 additions and 1 deletions

View File

@ -215,7 +215,7 @@ namespace Facepunch.Steamworks.Test
foreach ( var i in client.Inventory.Definitions ) foreach ( var i in client.Inventory.Definitions )
{ {
Console.WriteLine( "{0}: {1}", i.Id, i.Name ); Console.WriteLine( "{0}: {1} ({2})", i.Id, i.Name, i.Type );
Console.WriteLine( " itemshortname: {0}", i.GetStringProperty( "itemshortname" ) ); Console.WriteLine( " itemshortname: {0}", i.GetStringProperty( "itemshortname" ) );
Console.WriteLine( " workshopdownload: {0}", i.GetStringProperty( "workshopdownload" ) ); Console.WriteLine( " workshopdownload: {0}", i.GetStringProperty( "workshopdownload" ) );
Console.WriteLine( " IconUrl: {0}", i.IconUrl ); Console.WriteLine( " IconUrl: {0}", i.IconUrl );

View File

@ -20,9 +20,22 @@ namespace Facepunch.Steamworks
public int Id { get; private set; } public int Id { get; private set; }
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
/// <summary>
/// URL to an image specified by the schema, else empty
/// </summary>
public string IconUrl { get; set; } public string IconUrl { get; set; }
/// <summary>
/// URL to an image specified by the schema, else empty
/// </summary>
public string IconLargeUrl { get; set; } public string IconLargeUrl { get; set; }
/// <summary>
/// Type can be whatever the schema defines.
/// </summary>
public string Type { get; set; }
/// <summary> /// <summary>
/// If this item can be created using other items this string will contain a comma seperated /// If this item can be created using other items this string will contain a comma seperated
/// list of definition ids that can be used, ie "100,101;102x5;103x3,104x3" /// list of definition ids that can be used, ie "100,101;102x5;103x3,104x3"
@ -42,6 +55,11 @@ namespace Facepunch.Steamworks
public DateTime Created { get; set; } public DateTime Created { get; set; }
public DateTime Modified { get; set; } public DateTime Modified { get; set; }
public bool IsGenerator
{
get { return Type == "generator"; }
}
private Dictionary<string, string> customProperties; private Dictionary<string, string> customProperties;
internal Definition( SteamNative.SteamInventory i, int id ) internal Definition( SteamNative.SteamInventory i, int id )
@ -107,6 +125,7 @@ namespace Facepunch.Steamworks
ExchangeSchema = GetStringProperty( "exchange" ); ExchangeSchema = GetStringProperty( "exchange" );
IconUrl = GetStringProperty( "icon_url" ); IconUrl = GetStringProperty( "icon_url" );
IconLargeUrl = GetStringProperty( "icon_url_large" ); IconLargeUrl = GetStringProperty( "icon_url_large" );
Type = GetStringProperty( "type" );
} }
/// <summary> /// <summary>