Way for a client to manually create an ItemDefinition

playtimegenerator types aren't sent to the client
This commit is contained in:
Garry Newman 2016-09-28 15:13:31 +01:00
parent a908a9b994
commit 503e0529c0
2 changed files with 20 additions and 9 deletions

View File

@ -112,8 +112,6 @@ namespace Facepunch.Steamworks.Test
} }
} }
[TestMethod] [TestMethod]
public void InventoryDefinitions() public void InventoryDefinitions()
{ {
@ -121,7 +119,12 @@ namespace Facepunch.Steamworks.Test
{ {
Assert.IsNotNull( client.Inventory.Definitions ); Assert.IsNotNull( client.Inventory.Definitions );
Assert.AreNotEqual( 0, client.Inventory.Definitions.Length ); Assert.AreNotEqual( 0, client.Inventory.Definitions.Length );
}
foreach ( var i in client.Inventory.Definitions )
{
Console.WriteLine( "{0}: {1}", i.Id, i.Name );
}
}
} }
[TestMethod] [TestMethod]

View File

@ -66,6 +66,14 @@ namespace Facepunch.Steamworks
} }
} }
public Definition CreateDefinition( int id )
{
return new Definition( id )
{
client = client
};
}
internal void LoadItemDefinitions() internal void LoadItemDefinitions()
{ {
// //
@ -79,12 +87,7 @@ namespace Facepunch.Steamworks
Definitions = ids.Select( x => Definitions = ids.Select( x =>
{ {
var d = new Definition() var d = CreateDefinition( x );
{
client = client,
Id = x
};
d.SetupCommonProperties(); d.SetupCommonProperties();
return d; return d;
@ -229,6 +232,11 @@ namespace Facepunch.Steamworks
public DateTime Created; public DateTime Created;
public DateTime Modified; public DateTime Modified;
internal Definition( int id )
{
Id = id;
}
public T GetProperty<T>( string name ) public T GetProperty<T>( string name )
{ {
string val = string.Empty; string val = string.Empty;