mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Add Inventory.EnableItemProperties to turn off per-item properties (not all games need it and it's a bit slow)
There could be a whitelist Func or something added later for more control if anyone wants to do that
This commit is contained in:
parent
6c4a83800a
commit
12e26e3f5d
@ -116,6 +116,9 @@ public Result SplitStack( int quantity = 1 )
|
|||||||
|
|
||||||
private void UpdatingProperties()
|
private void UpdatingProperties()
|
||||||
{
|
{
|
||||||
|
if (!Inventory.EnableItemProperties)
|
||||||
|
throw new InvalidOperationException("Item properties are disabled.");
|
||||||
|
|
||||||
if (updateHandle != 0) return;
|
if (updateHandle != 0) return;
|
||||||
|
|
||||||
updateHandle = Inventory.inventory.StartUpdateProperties();
|
updateHandle = Inventory.inventory.StartUpdateProperties();
|
||||||
|
@ -185,10 +185,12 @@ public void Dispose()
|
|||||||
|
|
||||||
internal Item ItemFrom( SteamInventoryResult_t handle, SteamItemDetails_t detail, int index )
|
internal Item ItemFrom( SteamInventoryResult_t handle, SteamItemDetails_t detail, int index )
|
||||||
{
|
{
|
||||||
var props = new Dictionary<string, string>();
|
Dictionary<string, string> props = null;
|
||||||
|
|
||||||
if ( inventory.GetResultItemProperty(handle, (uint) index, null, out string propertyNames) )
|
if ( EnableItemProperties && inventory.GetResultItemProperty(handle, (uint) index, null, out string propertyNames) )
|
||||||
{
|
{
|
||||||
|
props = new Dictionary<string, string>();
|
||||||
|
|
||||||
foreach ( var propertyName in propertyNames.Split( ',' ) )
|
foreach ( var propertyName in propertyNames.Split( ',' ) )
|
||||||
{
|
{
|
||||||
if ( inventory.GetResultItemProperty(handle, (uint)index, propertyName, out string propertyValue ) )
|
if ( inventory.GetResultItemProperty(handle, (uint)index, propertyName, out string propertyValue ) )
|
||||||
|
@ -33,6 +33,12 @@ public partial class Inventory : IDisposable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime SerializedExpireTime;
|
public DateTime SerializedExpireTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Controls whether per-item properties (<see cref="Item.Properties"/>) are available or not. Default true.
|
||||||
|
/// This can improve performance of full inventory updates.
|
||||||
|
/// </summary>
|
||||||
|
public bool EnableItemProperties = true;
|
||||||
|
|
||||||
internal uint LastTimestamp = 0;
|
internal uint LastTimestamp = 0;
|
||||||
|
|
||||||
internal SteamNative.SteamInventory inventory;
|
internal SteamNative.SteamInventory inventory;
|
||||||
|
Loading…
Reference in New Issue
Block a user