> ## Documentation Index
> Fetch the complete documentation index at: https://docs.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\_\
类型：[XAsyncBlock\*](https://docs.xbox.com/zh-CN/reference/system/xasync/structs/xasyncblock.md)

指向传递给 [XAsyncRun](https://docs.xbox.com/zh-CN/reference/system/xasync/functions/xasyncrun.md) 的 [XAsyncBlock](https://docs.xbox.com/zh-CN/reference/system/xasync/structs/xasyncblock.md) 的指针。

*requestingUser*   \_In\_\
类型：XUserHandle

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

*promptText*   \_In\_z\_\
类型：char\*

提示显示文本。

*selectFromPlayersCount*   \_In\_\
类型：uint32\_t

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

*selectFromPlayers*   \_In\_reads\_(selectFromPlayersCount)\
类型：uint64\_t\*

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

*preSelectedPlayersCount*   \_In\_\
类型：uint32\_t

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

*preSelectedPlayers*   \_In\_reads\_opt\_(preSelectedPlayersCount)\
类型：uint64\_t\*

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

*minSelectionCount*   \_In\_\
类型：uint32\_t

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

*maxSelectionCount*   \_In\_\
类型：uint32\_t

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

### 返回值

类型：HRESULT

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

若要获取结果，请在 *AsyncBlock* 回调内或 *AsyncBlock* 完成后调用 [XGameUiShowPlayerPickerResultCount](https://docs.xbox.com/zh-CN/reference/system/xgameui/functions/xgameuishowplayerpickerresultcount.md) 和 [XGameUiShowPlayerPickerResult](https://docs.xbox.com/zh-CN/reference/system/xgameui/functions/xgameuishowplayerpickerresult.md)。

## 备注

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

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

## 要求

**标头：** XGameUI.h

**库：** xgameruntime.lib

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

## 另请参阅

[XGameUI](https://docs.xbox.com/zh-CN/reference/system/xgameui/xgameui_members.md)\
[XGameUiShowPlayerPickerResult](https://docs.xbox.com/zh-CN/reference/system/xgameui/functions/xgameuishowplayerpickerresult.md)\
[XGameUiShowPlayerPickerResultCount](https://docs.xbox.com/zh-CN/reference/system/xgameui/functions/xgameuishowplayerpickerresultcount.md)\
[XBOX 游戏生命周期（NDA 主题）](https://docs.xbox.com/zh-CN/build/console-features/console-workflows/xbox-game-life-cycle.md)


## Related topics

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