PFMultiplayerJoinLobbyAsServer

以服务器身份加入客户端拥有的大厅。

语法

HRESULT PFMultiplayerJoinLobbyAsServer(  
    PFMultiplayerHandle handle,  
    const PFEntityKey* server,  
    const char* connectionString,  
    const PFLobbyServerJoinConfiguration* configuration,  
    void* asyncContext,  
    PFLobbyHandle* lobby  
)  

参数

handle PFMultiplayerHandle

PFMultiplayer API 实例的句柄。

serverPFEntityKey*

加入大厅的服务器的 PlayFab 实体密钥。 它的实体类型必须为“game_server”。

connectionString char*
以 null 结尾

服务器用于加入大厅的连接字符串。

configurationPFLobbyServerJoinConfiguration*

加入大厅时要存储的初始服务器拥有的数据。

asyncContext void*
可选

一个可选应用定义的指针大小的上下文值,可用于将完成状态更改与此调用关联起来。

lobby PFLobbyHandle*
可选、库分配的输出

可用于将操作排队以立即执行此操作的可选输出大厅对象完成。

返回值

类型:HRESULT

如果调用成功,则为 S_OK,否则为错误代码。 可通过 PFMultiplayerGetErrorMessage() 检索错误代码的可读形式。

备注

若要使用此功能,必须在包含 PFLobby.h 之前定义PFMULTIPLAYER_INCLUDE_SERVER_APIS。

这是一个异步操作。 完成此方法的执行不一定要完成操作。

成功完成后,会向游戏提供 PFLobbyUpdatedStateChange 并适当填充 PFLobbyUpdatedStateChange::serverUpdate,提供 PFLobbyJoinLobbyAsServerCompletedStateChange 并将 PFLobbyJoinLobbyAsServerCompletedStateChange::result 字段设置为 S_OK

完成失败后,会向游戏提供 PFLobbyJoinLobbyAsServerCompletedStateChange 并将 PFLobbyJoinLobbyAsServerCompletedStateChange::result 字段设置为“失败”。

此操作仅限于使用连接的客户端拥有的大厅。

要求

标头: PFLobby.h

另请参阅

PFLobby 成员