diff --git a/Facepunch.Steamworks/Interfaces/Inventory.cs b/Facepunch.Steamworks/Interfaces/Inventory.cs index a6d00bf..f612708 100644 --- a/Facepunch.Steamworks/Interfaces/Inventory.cs +++ b/Facepunch.Steamworks/Interfaces/Inventory.cs @@ -41,6 +41,8 @@ public partial class Inventory : IDisposable public event Action OnDefinitionsUpdated; + public event Action OnInventoryResultReady; + internal Inventory( BaseSteamworks steamworks, SteamNative.SteamInventory c, bool server ) { IsServer = server; @@ -113,10 +115,9 @@ private void onFullUpdate( SteamInventoryFullUpdate_t data ) /// private void onResultReady( SteamInventoryResultReady_t data ) { - if ( Result.Pending.ContainsKey( data.Handle ) ) + Result result; + if ( Result.Pending.TryGetValue( data.Handle, out result ) ) { - var result = Result.Pending[data.Handle]; - result.OnSteamResult( data ); if ( data.Result == SteamNative.Result.OK ) @@ -127,6 +128,13 @@ private void onResultReady( SteamInventoryResultReady_t data ) Result.Pending.Remove( data.Handle ); result.Dispose(); } + else + { + result = new Result(this, data.Handle, false); + result.Fill(); + } + + OnInventoryResultReady?.Invoke(result); } private void onResult( Result r, bool isFullUpdate )