XStoreReportConsumableFulfillmentAsync
指定された数量の消耗品アイテムを消費します。 消耗品の実装と使用の詳細については、「消費ベースのエコシステム」を参照してください。
構文
HRESULT XStoreReportConsumableFulfillmentAsync(
const XStoreContextHandle storeContextHandle,
const char* storeProductId,
uint32_t quantity,
GUID trackingId,
XAsyncBlock* async
)
パラメーター
storeContextHandle _In_
型: XStoreContextHandle
XStoreCreateContext によって返されるユーザーの Microsoft Store コンテキスト ハンドル。
storeProductId _In_z_
型: char*
達成済みとして報告する消耗品アイテム追加コンテンツの Store ID。
quantity _In_
型: uint32_t
フルフィルメント済みとして報告する消耗品アイテム追加コンテンツの単位数。 Microsoft Store によって管理される消耗品アイテム (つまり、Microsoft が残量を追跡する消耗品アイテム) の場合、消費された単位数を指定します。 ゲームで管理される消耗品アイテム (つまり、デベロッパーが残量を追跡する消耗品アイテム) の場合は、1 を指定します。
trackingId _In_
型: GUID
追跡目的でフルフィルメント操作が関連付けられている特定のトランザクションを示す、デベロッパーが指定した GUID。
async _Inout_
型: XAsyncBlock*
行われている非同期処理が定義されている XAsyncBlock。 XAsyncBlock を使用して、呼び出しのステータスをポーリングし、呼び出しの結果を取得できます。 詳細については、「XAsyncBlock」を参照してください。
戻り値
型: HRESULT
HRESULT 成功またはエラー コード。
解説
この関数の結果を取得するには、この関数を呼び出した後で XStoreReportConsumableFulfillmentResult を呼び出します。
次のコード スニペットでは、消耗品アイテムの数量を使用する例を示します。
void CALLBACK ReportConsumableFulfillmentCallback(XAsyncBlock* asyncBlock)
{
XStoreConsumableResult result{};
HRESULT hr = XStoreReportConsumableFulfillmentResult(
asyncBlock,
&result);
if (FAILED(hr))
{
printf("Failed retrieve the consumable balance remaining: 0x%x\r\n", hr);
return;
}
printf("quantity: %d\r\n", result.quantity);
}
void ReportConsumableFulfillment(XStoreContextHandle storeContextHandle, XTaskQueueHandle taskQueueHandle, const char* storeId, uint32_t quantity, GUID trackingId)
{
auto asyncBlock = std::make_unique<XAsyncBlock>();
ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
asyncBlock->queue = taskQueueHandle;
asyncBlock->callback = ReportConsumableFulfillmentCallback;
HRESULT hr = XStoreReportConsumableFulfillmentAsync(
storeContextHandle,
storeId,
quantity,
trackingId,
asyncBlock.get());
if (FAILED(hr))
{
printf("Failed to report consumable fulfillment: 0x%x\r\n", hr);
return;
}
}
要件
ヘッダー: XStore.h (XGameRuntime.h に含まれます)
ライブラリ: xgameruntime.lib
サポートされているプラットフォーム: Windows、Xbox One ファミリー本体、Xbox Series 本体