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

# 大厅所有权

> 了解 PlayFab 大厅的所有权模型(客户端、服务器和共享),以及所有者特权、迁移策略以及所有者断开连接的处理方式。

本文介绍大厅所有权及其带来的特权。

## 大厅所有者与成员

PlayFab 实体作为所有者或成员与大厅进行交互。

PlayFab 大厅当前支持的 PlayFab 实体为:面向玩家的 `title_player_account` 和面向游戏服务器的 `game_server`。有关这些实体类型的更多信息,请参阅[可用的内置实体类型](/services/playfab/live-service-management/game-configuration/entities/available-built-in-entity-types)。

大厅成员是加入了大厅的玩家。每个成员都有一个隔离的成员数据属性包。

大厅所有者是可以修改全局大厅属性和拥有其他[特殊特权](#owner-privileges)的玩家或游戏服务器。由玩家拥有的大厅称为客户端所拥有的大厅。由游戏服务器拥有的大厅称为服务器所拥有的大厅。

玩家可以同时是大厅的所有者和成员。

游戏服务器可以是大厅的所有者,但不能作为成员。

## 建立与更改所有权

大厅的所有权最初在大厅首次创建时被授予。如果玩家创建了大厅,则该玩家拥有该大厅。如果游戏服务器创建了大厅,则该游戏服务器拥有该大厅。有关创建大厅的更多信息,请参阅[创建大厅](/services/playfab/multiplayer/lobby/create-a-lobby)。

同一时刻只能有一个实体拥有大厅,但在大厅的整个生命周期中,所有权可能会发生变化。有关所有权变更的更多信息,请参阅[大厅所有权变更](/services/playfab/multiplayer/lobby/ownership-changes)。

## 所有者特权

大厅所有者拥有非所有者成员所没有的特权。

1. 所有者可以设置预定义的全局大厅属性(例如大厅的访问策略)和自定义的全局大厅属性。有关这些属性的更多信息,请参阅[大厅属性](/services/playfab/multiplayer/lobby/lobby-properties)。
2. 所有者可以从大厅中移除成员。
3. 所有者可以指定另一个所有者来代替自己。
   * 在服务器所拥有的大厅中,所有者只能指定另一台服务器作为新所有者。
   * 在客户端所拥有的大厅中,所有者只能指定另一位成员作为新所有者。

## 从 game\_server 访问客户端所拥有的大厅

在使用客户端所拥有的大厅时,你可能需要从服务器安全地将数据写入大厅。为此新增或修改了一些 API,让你能够为此目的使用 'game\_server' 实体来加入并更新大厅。'ServerData' 类似于 'LobbyData',但只能由 'game\_server' 实体添加。这样你就可以存储重要信息供其他客户端读取,例如服务器连接数据,你可以信任该数据的来源,即使是客户端大厅所有者也无法修改它。

| REST API                                                                                                           | C++ SDK                                                                                                              | 说明                                                                                      |
| ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| [JoinLobbyAsServer](https://learn.microsoft.com/en-us/rest/api/playfab/multiplayer/lobby/join-lobby-as-server)     | [PFMultiplayerJoinLobbyAsServer](playfabmultiplayerreference-cpp/pflobby/functions/pfmultiplayerjoinlobbyasserver)   | 从 'game\_server' 加入一个客户端所拥有的大厅。大厅所有者无法移除已连接的 'game\_server',并且同一时间只能加入一个 'game\_server' |
| [UpdateLobbyAsServer](https://learn.microsoft.com/en-us/rest/api/playfab/multiplayer/lobby/update-lobby-as-server) | [PFLobbyServerPostUpdateAsServer](playfabmultiplayerreference-cpp/pflobby/functions/pflobbyserverpostupdateasserver) | 从已连接的 'game\_server' 更新大厅的 ServerData 对象                                                |
| [LeaveLobbyAsServer](https://learn.microsoft.com/en-us/rest/api/playfab/multiplayer/lobby/leave-lobby-as-server)   | [PFLobbyServerLeaveServer](playfabmultiplayerreference-cpp/pflobby/functions/pflobbyserverleaveasserver)             | 从 'game\_server' 优雅地离开客户端所拥有的大厅,ServerData 内容将保留                                        |
| [GetLobby](https://learn.microsoft.com/en-us/rest/api/playfab/multiplayer/lobby/get-lobby)                         | 无需调用,在加入时发生                                                                                                          | 在 'game\_server' 已加入大厅时获取该大厅                                                            |
| [FindLobbies](https://learn.microsoft.com/en-us/rest/api/playfab/multiplayer/lobby/find-lobbies)                   | [PFMultiplayerFindLobbies](playfabmultiplayerreference-cpp/pflobby/functions/pfmultiplayerfindlobbies)               | 查找与该 'game\_server' 关联的大厅                                                               |

## 另请参阅

* [大厅属性](/services/playfab/multiplayer/lobby/lobby-properties)
* [创建大厅](/services/playfab/multiplayer/lobby/create-a-lobby)
* [大厅所有权变更](/services/playfab/multiplayer/lobby/ownership-changes)


## Related topics

- [大厅所有权变更](/zh-CN/services/playfab/multiplayer/lobby/ownership-changes.md)
- [创建大厅](/zh-CN/services/playfab/multiplayer/lobby/create-a-lobby.md)
- [PFLobbyOwnerMigrationPolicy](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/enums/pflobbyownermigrationpolicy.md)
- [PFMultiplayerClaimServerLobby](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pfmultiplayerclaimserverlobby.md)
- [大厅与匹配实时消息](/zh-CN/services/playfab/multiplayer/lobby/lobby-and-matchmaking-real-time-messages.md)
