mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 22:58:01 +03:00
Handle inventory timeouts
This commit is contained in:
parent
14ebfbf0da
commit
cccc426d0f
@ -21,9 +21,9 @@ namespace Facepunch.Steamworks
|
|||||||
{
|
{
|
||||||
if ( Items != null ) return false;
|
if ( Items != null ) return false;
|
||||||
if ( Handle == -1 ) return false;
|
if ( Handle == -1 ) return false;
|
||||||
if ( inventory.inventory.GetResultStatus( Handle ) == 22 ) return true;
|
if ( Status() == Callbacks.Result.Pending ) return true;
|
||||||
|
|
||||||
Fill();
|
TryFill();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,10 +34,17 @@ namespace Facepunch.Steamworks
|
|||||||
{
|
{
|
||||||
if ( Items != null ) return true;
|
if ( Items != null ) return true;
|
||||||
if ( Handle == -1 ) return false;
|
if ( Handle == -1 ) return false;
|
||||||
return inventory.inventory.GetResultStatus( Handle ) == 1;
|
return Status() == Callbacks.Result.OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal Callbacks.Result Status()
|
||||||
|
{
|
||||||
|
if ( Handle == -1 ) return Callbacks.Result.InvalidParam;
|
||||||
|
return (Callbacks.Result)inventory.inventory.GetResultStatus( Handle );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
internal Result( Inventory inventory, int Handle )
|
internal Result( Inventory inventory, int Handle )
|
||||||
{
|
{
|
||||||
this.Handle = Handle;
|
this.Handle = Handle;
|
||||||
@ -54,12 +61,17 @@ namespace Facepunch.Steamworks
|
|||||||
return IsSuccess;
|
return IsSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Fill()
|
internal void TryFill()
|
||||||
{
|
{
|
||||||
if ( Items != null ) return;
|
if ( Items != null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( !IsSuccess )
|
||||||
|
return;
|
||||||
|
|
||||||
Valve.Steamworks.SteamItemDetails_t[] steamItems = null;
|
Valve.Steamworks.SteamItemDetails_t[] steamItems = null;
|
||||||
inventory.inventory.GetResultItems( Handle, out steamItems );
|
if ( !inventory.inventory.GetResultItems( Handle, out steamItems ) )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( steamItems == null )
|
if ( steamItems == null )
|
||||||
{
|
{
|
||||||
|
@ -149,6 +149,7 @@ namespace Facepunch.Steamworks
|
|||||||
|
|
||||||
if ( LocalPlayerRequest.IsSuccess )
|
if ( LocalPlayerRequest.IsSuccess )
|
||||||
{
|
{
|
||||||
|
// Try again.
|
||||||
RetrieveInventory();
|
RetrieveInventory();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user