mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 06:05:46 +03:00
Handle inventory timeouts
This commit is contained in:
parent
14ebfbf0da
commit
cccc426d0f
@ -21,9 +21,9 @@ public bool IsPending
|
||||
{
|
||||
if ( Items != null ) 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;
|
||||
}
|
||||
}
|
||||
@ -34,10 +34,17 @@ internal bool IsSuccess
|
||||
{
|
||||
if ( Items != null ) return true;
|
||||
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 )
|
||||
{
|
||||
this.Handle = Handle;
|
||||
@ -54,12 +61,17 @@ public bool Block( float maxWait = 5.0f )
|
||||
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;
|
||||
inventory.inventory.GetResultItems( Handle, out steamItems );
|
||||
if ( !inventory.inventory.GetResultItems( Handle, out steamItems ) )
|
||||
return;
|
||||
|
||||
if ( steamItems == null )
|
||||
{
|
||||
|
@ -149,6 +149,7 @@ private void UpdateLocalRequest()
|
||||
|
||||
if ( LocalPlayerRequest.IsSuccess )
|
||||
{
|
||||
// Try again.
|
||||
RetrieveInventory();
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user