> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XPackageMountWithUiAsync

> XPackageMountWithUiAsync

# XPackageMountWithUiAsync

指定されたコンテンツのインストールを非同期でマウントし、そのマウント ハンドルを返します。
サインインしているすべてのユーザーのペアレンタル設定に基づいてコンテンツが年齢制限されている場合、ユーザーのペアレンタル同意 UI を表示します。

## Syntax

```cpp theme={null}
HRESULT XPackageMountWithUiAsync(
  const char * packageIdentifier,
  XAsyncBlock * async
) noexcept;
```

### Parameters

*packageIdentifier*  \_In\_z\_\
型: const char \*

ディスク上のインストール済みパッケージを一意に識別する文字列。
[XPackageEnumerationCallback](/reference/system/xpackage/functions/xpackageenumerationcallback) から返される [XPackageDetails](/reference/system/xpackage/structs/xpackagedetails) 構造体の packageIdentifier フィールドを渡します。
パッケージ識別子の詳細については、[ダウンロード可能なコンテンツ (DLC) の管理およびライセンス](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-manage-and-license-optional-packages) を参照してください。

*async*  \_Inout\_\
型: XAsyncBlock \*

非同期呼び出しの状態を監視するための **XAsyncBlock**。

### Return value

型: HRESULT

HRESULT の成功またはエラー コード。

## Remarks

この API は、API がサインインしているすべてのユーザーの年齢に適さないコンテンツをマウントする場合、ユーザーにペアレンタル同意プロンプトを表示します。
プロンプトで大人のユーザーがペアレンタル同意を承認した場合、API はパッケージのマウントを試みます。
プロンプトで大人のユーザーがペアレンタル同意を拒否した場合、API はパッケージのマウントに失敗します。

この API は、[XStoreAcquireLicenseForPackageAsync](/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync) / [Result](/reference/system/xstore/functions/xstoreacquirelicenseforpackageresult) および [XStoreIsLicenseValid](/reference/system/xstore/functions/xstoreislicensevalid) を自動的に呼び出します。
API が DLC の有効なライセンスを取得できない場合、マウントは失敗します。

このコード例では、コンテンツが年齢制限されている場合、ゲームは DLC を白黒でレンダリングします。
ユーザーが使用する DLC の一部を選択したとき、ゲーム内の外部コードは `MountDlc` を呼び出します。

```cpp theme={null}
extern void RenderDlc(const char* packageId, const char* displayName, bool monochrome); 

void ShowDlc() 
{ 
// Enumerate all DLC for the game and render it to the user 
XPackageEnumeratePackages(XPackageKind::Content, XPackageEnumerationScope::ThisAndRelated, nullptr,
 [](void*, const XPackageDetails* details) 
  {     
        RenderDlc(details->packageIdentifier,
                  details->displayName, 
                  details->ageRestricted);
  }); 
} 

 HRESULT MountDlc(const char* packageId, XPackageMountHandle* handle)
 {  
    XAsync async{};  
    RETURN_IF_FAILED(XPackageMountWithUiAsync(packageId, &async));
    RETURN_IF_FAILED(XAsyncGetStatus(&async, true));
    RETURN_IF_FAILED(XPackageMountWithUiResult(&async, handle));  
    return S_OK; 
} 
```

## Requirements

**ヘッダー:** XPackage.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体、および XBOX Series 本体

## Conceptual documentation

* [Games-as-a-Service (GaaS) のサポート](/build/core-features/common/packaging/supporting-games-as-a-service)

## See also

[XPackageMountWithUiResult](/reference/system/xpackage/functions/xpackagemountwithuiresult)
[XPackage](/reference/system/xpackage/xpackage_members)\
[XPackageEnumeratePackages](/reference/system/xpackage/functions/xpackageenumeratepackages)\
[XPackageEnumerationCallback](/reference/system/xpackage/functions/xpackageenumerationcallback)\
[XPackageDetails](/reference/system/xpackage/structs/xpackagedetails)\
[XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath)\
[XPackageGetMountPathSize](/reference/system/xpackage/functions/xpackagegetmountpathsize)\
[PC および XBOX One 用のダウンロード可能コンテンツ パッケージ (DLC) を作成および使用する方法](/build/core-features/common/packaging/packaging-downloadable-content-dlc)


## Related topics

- [[DEPRECATED] XPackageMount](/ja-jp/reference/system/xpackage/functions/xpackagemount.md)
- [Games-as-a-Service (GaaS) のサポート](/ja-jp/build/core-features/common/packaging/supporting-games-as-a-service.md)
- [XPackage](/ja-jp/reference/system/xpackage/xpackage_members.md)
- [XStoreAcquireLicenseForPackageAsync](/ja-jp/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md)
- [GDK 向け Unity C# API ラッパー](/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
