> ## 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.

# XGameUiShowPlayerPickerAsync

> XGameUiShowPlayerPickerAsync

# XGameUiShowPlayerPickerAsync

显示一个选取器 UI，允许玩游戏的人从呈现的人员列表中选择玩家。

## 语法

```cpp theme={null}
HRESULT XGameUiShowPlayerPickerAsync(  
         XAsyncBlock* async,  
         XUserHandle requestingUser,  
         const char* promptText,  
         uint32_t selectFromPlayersCount,  
         const uint64_t* selectFromPlayers,  
         uint32_t preSelectedPlayersCount,  
         const uint64_t* preSelectedPlayers,  
         uint32_t minSelectionCount,  
         uint32_t maxSelectionCount  
)  
```

### 参数

*async*   \_In\_<br />类型：[XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

指向传递给 [XAsyncRun](/reference/system/xasync/functions/xasyncrun) 的 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) 的指针。

*requestingUser*   \_In\_<br />类型：XUserHandle

请求玩家选取器 UI 的用户的句柄。

*promptText*   \_In\_z\_<br />类型：char\*

提示显示文本。

*selectFromPlayersCount*   \_In\_<br />类型：uint32\_t

调用方可以选择的玩家数量。

*selectFromPlayers*   \_In\_reads\_(selectFromPlayersCount)<br />类型：uint64\_t\*

指向调用方可以选择的玩家 ID 列表的指针。

*preSelectedPlayersCount*   \_In\_<br />类型：uint32\_t

呈现 UI 时预先选择的玩家数量。

*preSelectedPlayers*   \_In\_reads\_opt\_(preSelectedPlayersCount)<br />类型：uint64\_t\*

指向呈现 UI 时预先选择的玩家 ID 列表的指针。

*minSelectionCount*   \_In\_<br />类型：uint32\_t

调用方必须选择的最少人数。

*maxSelectionCount*   \_In\_<br />类型：uint32\_t

调用方可以选择的最多人数。

### 返回值

类型：HRESULT

异步调用的 HRESULT 成功或错误代码。

若要获取结果，请在 *AsyncBlock* 回调内或 *AsyncBlock* 完成后调用 [XGameUiShowPlayerPickerResultCount](/reference/system/xgameui/functions/xgameuishowplayerpickerresultcount) 和 [XGameUiShowPlayerPickerResult](/reference/system/xgameui/functions/xgameuishowplayerpickerresult)。

## 备注

玩家 ID 必须是 XBOX 用户 ID (XUID)，这是 *uint64\_t* 值。

调用 UI 将使游戏进入\_受限模式\_。在受限模式下，当你的游戏处于所调用 UI 的后台时，它将获得较少的系统资源。若要详细了解受限模式和游戏的其他运行模式，请阅读 [XBOX 游戏生命周期（NDA 主题）](/build/console-features/console-workflows/xbox-game-life-cycle)。

## 要求

**标头：** XGameUI.h

**库：** xgameruntime.lib

**支持的平台：** Windows、Steam Deck、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

[XGameUI](/reference/system/xgameui/xgameui_members)<br />[XGameUiShowPlayerPickerResult](/reference/system/xgameui/functions/xgameuishowplayerpickerresult)<br />[XGameUiShowPlayerPickerResultCount](/reference/system/xgameui/functions/xgameuishowplayerpickerresultcount)<br />[XBOX 游戏生命周期（NDA 主题）](/build/console-features/console-workflows/xbox-game-life-cycle)


## Related topics

- [XGameUiShowPlayerPickerResult](/zh-CN/reference/system/xgameui/functions/xgameuishowplayerpickerresult.md)
- [XGameUiShowPlayerPickerUiCallback](/zh-CN/reference/system/xgameui/functions/xgameuishowplayerpickeruicallback.md)
- [XGameUiShowPlayerPickerResultCount](/zh-CN/reference/system/xgameui/functions/xgameuishowplayerpickerresultcount.md)
- [XGameUiSetPlayerPickerUiResponse](/zh-CN/reference/system/xgameui/functions/xgameuisetplayerpickeruiresponse.md)
- [XGameUiUiCallbacks](/zh-CN/reference/system/xgameui/structs/xgameuiuicallbacks.md)
