

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 适用于 Amazon GameLift Servers 4.x 的 C\$1\$1 服务器 SDK – 数据类型
<a name="integration-server-sdk-cpp-ref-datatypes"></a>

使用服务器 SDK 参考，将要托管的多人游戏与 Amazon GameLift Servers 集成。有关集成过程的指南，请参阅[借助服务器 SDK 将 Amazon GameLift Servers 添加到游戏服务器](gamelift-sdk-server-api.md)。

**注意**  
本参考适用于 Amazon GameLift Servers 服务器 SDK 的早期版本。有关最新版本，请参阅[适用于 Amazon GameLift Servers 的 C\$1\$1 服务器 SDK 5.x – 数据类型](integration-server-sdk5-cpp-datatypes.md)。

此 API 在 `GameLiftServerAPI.h`、`LogParameters.h` 和 `ProcessParameters.h` 中定义。

[适用于 Amazon GameLift Servers 4.x 的 C\$1\$1 服务器 SDK – 操作](integration-server-sdk-cpp-ref-actions.md)

## DescribePlayerSessionsRequest
<a name="integration-server-sdk-cpp-ref-dataypes-playersessions"></a>

此数据类型用于指定检索哪些玩家会话。您可以按如下方式使用它：
+ 提供 a PlayerSessionId 以请求特定的玩家会话。
+ 提供 a GameSessionId 以请求指定游戏会话中的所有玩家会话。
+ 提供 a PlayerId 以请求指定玩家的所有玩家会话。

对于大型玩家会话集合，请使用分页参数以在有序数据块中检索结果。

### 内容
<a name="integration-server-sdk-cpp-ref-dataypes-playersessions-contents"></a>

**GameSessionId**  
游戏会话的唯一标识符。使用此参数可请求指定游戏会话的所有玩家会话。游戏会话 ID 的格式如下所示：`arn:aws:gamelift:<region>::gamesession/fleet-<fleet ID>/<ID string>`。<ID string> 的值为自定义 ID 字符串（如果在创建游戏会话时指定了一个）或者是生成的字符串。  
类型：字符串  
必需：否

**限制**  
要返回的最大结果数量。将此参数与一起*NextToken*使用可将结果作为一组连续页面获取。如果指定玩家会话 ID，将忽略此参数。  
类型：整数  
必需：否

**NextToken**  
令牌指示结果的下一个连续页面的开头。使用之前的调用返回此操作的令牌。要指定结果集的开始，请不要指定值。如果指定玩家会话 ID，将忽略此参数。  
类型：字符串  
必需：否

**PlayerId**  
玩家的唯一标识符。玩家 IDs 由开发者定义。请参阅[生成玩家 ID](player-sessions-player-identifiers.md)。  
类型：字符串  
必需：否

**PlayerSessionId**  
玩家会话的唯一标识符。  
类型：字符串  
必需：否

**PlayerSessionStatusFilter**  
用于筛选结果的玩家会话状态。可能的玩家会话状态包括以下内容：  
+ RESERVED — 已收到玩家会话请求，但玩家尚未连接到服务器进程 and/or 已通过验证。
+ ACTIVE - 服务器进程已验证玩家，当前已连接。
+ COMPLETED - 玩家连接已断开。
+ TIMEDOUT — 已收到玩家会话请求，但未在超时限制（60 秒）内验证未连接 and/or 的玩家。
类型：字符串  
必需：否

## LogParameters
<a name="integration-server-sdk-cpp-ref-dataypes-log"></a>

此数据类型用于标识您希望 Amazon GameLift Servers 在游戏会话结束时上传并存储游戏会话期间生成的哪些文件。此信息在 [ProcessReady()](integration-server-sdk-cpp-ref-actions.md#integration-server-sdk-cpp-ref-processready) 调用中传递给 Amazon GameLift Servers 服务。

### 内容
<a name="integration-server-sdk-cpp-ref-dataypes-log-contents"></a>

**logPaths**  
您希望 Amazon GameLift Servers 用于存储供以后访问的游戏服务器日志文件的目录路径。这些文件将在每个游戏会话期间生成。文件路径和名称在游戏服务器中定义并存储在根游戏构建目录中。日志路径必须是绝对的。例如，如果您的游戏构建在类似于 `MyGame\sessionlogs\` 的路径中存储游戏会话日志，则日志路径将为 `c:\game\MyGame\sessionLogs` (在 Windows 实例上) 或 `/local/game/MyGame/sessionLogs` (在 Linux 实例上)。  
类型：std:vector<std::string>  
必需：否

## ProcessParameters
<a name="integration-server-sdk-cpp-ref-dataypes-process"></a>

此数据类型包含一组在 [ProcessReady()](integration-server-sdk-cpp-ref-actions.md#integration-server-sdk-cpp-ref-processready) 调用中发送到 Amazon GameLift Servers 服务的参数。

### 内容
<a name="integration-server-sdk-cpp-ref-dataypes-process-contents"></a>

**端口**  
服务器进程用于侦听新玩家连接的端口号。该值必须在部署此游戏服务器构建的任意实例集上所配置的端口范围内。此端口号包含在游戏会话和玩家会话对象中，游戏会话在连接到服务器进程时会使用该端口号。  
类型：整数   
是否必需：是

**logParameters**  
包含游戏会话日志文件目录路径列表的对象。  
类型：Aws::GameLift:: 服务器:: [LogParameters](#integration-server-sdk-cpp-ref-dataypes-log)  
必需：否

**onStartGameSession**  
Amazon GameLift Servers服务为激活新游戏会话而调用的回调函数的名称。 Amazon GameLift Servers调用此函数是为了响应客户端的请求[CreateGameSession](https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreateGameSession.html)。回调函数传递一个[GameSession](https://docs.aws.amazon.com/gamelift/latest/apireference/API_GameSession.html)对象（在*Amazon GameLift Servers服务 API 参考*中定义）。  
类型：`const std::function<void(Aws::GameLift::Model::GameSession)> onStartGameSession`  
是否必需：是

**onProcessTerminate**  
Amazon GameLift Servers 服务为强制关闭服务器进程而调用的回调函数的名称。调用此函数之后，Amazon GameLift Servers 等待五分钟以便服务器进程关闭，然后使用 [ProcessEnding()](integration-server-sdk-cpp-ref-actions.md#integration-server-sdk-cpp-ref-processending) 调用来进行响应。如果没有收到响应，它会关闭该服务器进程。  
类型：`std::function<void()> onProcessTerminate`  
必需：否

**onHealthCheck**  
Amazon GameLift Servers 服务为向服务器进程请求运行状况报告而调用的回调函数的名称。Amazon GameLift Servers 每隔 60 秒调用此函数一次。调用此函数后，Amazon GameLift Servers 将等待 60 秒接收响应，如果未收到响应，则会将服务器进程记录为不正常。  
类型：`std::function<bool()> onHealthCheck`  
必需：否

**onUpdateGameSession**  
Amazon GameLift Servers 服务为向服务器进程传递更新的游戏会话对象而调用的回调函数的名称。当[对战回填](https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-backfill.html)请求处理完毕时，Amazon GameLift Servers 会调用此函数以提供更新的对战构建器数据。它将传递一个 [GameSession](https://docs.aws.amazon.com/gamelift/latest/apireference/API_GameSession.html) 对象、一个状态更新（`updateReason`）以及对战回填票证 ID。  
类型：`std::function<void(Aws::GameLift::Server::Model::UpdateGameSession)> onUpdateGameSession`  
必需：否

## StartMatchBackfillRequest
<a name="integration-server-sdk-cpp-ref-dataypes-startmatchbackfillrequest"></a>

此数据类型用于发送对战回填请求。此信息在 [StartMatchBackfill()](integration-server-sdk-cpp-ref-actions.md#integration-server-sdk-cpp-ref-startmatchbackfill) 调用中传递给 Amazon GameLift Servers 服务。

### 内容
<a name="integration-server-sdk-cpp-ref-dataypes-startbackfill-contents"></a>

**GameSessionArn**  
 游戏会话的唯一标识符。此 API 操作 [GetGameSessionId()](integration-server-sdk-cpp-ref-actions.md#integration-server-sdk-cpp-ref-getgamesessionid) 返回采用 ARN 格式的标识符。  
类型：字符串  
是否必需：是

**MatchmakingConfigurationArn**  
采用 ARN 格式的唯一标识符，适用于用于此请求的对战构建器。要查找用于创建原始游戏会话的对战构建器，请查看对战构建器数据属性中的游戏会话对象。[使用对战构建器数据](https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-server.html#match-server-data)详细了解 Word 中的对战构建器数据。  
类型：字符串  
是否必需：是

**玩家**  
一组表示当前正在游戏会话中的所有玩家的数据。对战构建器使用此信息搜索与当前玩家非常匹配的新玩家。有关玩家对象格式的描述，请参阅《Amazon GameLift Servers API 参考指南》**。要查找玩家属性和团队分配，请在游戏会话对象的匹配器数据属性中查找。 IDs如果对战构建器使用了延迟，则收集当前区域中更新的延迟并将其包含在每个玩家的数据中。  
类型：std:vector[<Player>](https://docs.aws.amazon.com/gamelift/latest/apireference/API_Player.html)  
是否必需：是

**TicketId**  
对战或匹配回填请求票证的唯一标识符。如果此处未提供任何值，则 Amazon GameLift Servers 将生成一个采用 UUID 形式的值。使用此标识符可跟踪对战回填票证状态或取消请求（如需要）。  
类型：字符串  
必需：否

## StopMatchBackfillRequest
<a name="integration-server-sdk-cpp-ref-dataypes-stopmatchbackfillrequest"></a>

此数据类型用于取消对战回填请求。此信息在 [StopMatchBackfill()](integration-server-sdk-cpp-ref-actions.md#integration-server-sdk-cpp-ref-stopmatchbackfill) 调用中传递给 Amazon GameLift Servers 服务。

### 内容
<a name="integration-server-sdk-cpp-ref-dataypes-stopbackfill-contents"></a>

**GameSessionArn**  
与被取消的请求关联的唯一游戏会话标识符。  
类型：字符串  
是否必需：是

**MatchmakingConfigurationArn**  
此请求发送到的对战构建器的唯一标识符。  
类型：字符串  
是否必需：是

**TicketId**  
要取消的回填请求票证的唯一标识符。  
类型：字符串  
是否必需：是