Added SteamInventory.StartPurchaseAsync

This commit is contained in:
Garry Newman 2019-05-25 14:34:59 +01:00
parent cad7edcec0
commit e4c9e9d034
2 changed files with 37 additions and 0 deletions

View File

@ -347,5 +347,26 @@ public static bool GetAllItems()
return await InventoryResult.GetAsync( sresult );
}
/// <summary>
/// Start buying a cart load of items. This will return a positive result is the purchase has
/// begun. You should listen out for SteamUser.OnMicroTxnAuthorizationResponse for a success.
/// </summary>
public static async Task<InventoryPurchaseResult?> StartPurchaseAsync( InventoryDef[] items )
{
var item_i = items.Select( x => x._id ).ToArray();
var item_q = items.Select( x => (uint)1 ).ToArray();
var r = await Internal.StartPurchase( item_i, item_q, (uint)item_i.Length );
if ( !r.HasValue ) return null;
return new InventoryPurchaseResult
{
Result = r.Value.Result,
OrderID = r.Value.OrderID,
TransID = r.Value.TransID
};
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Steamworks.Data
{
public struct InventoryPurchaseResult
{
public Result Result;
public ulong OrderID;
public ulong TransID;
}
}