Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
在 PlayFab 大厅上定义搜索键以及可搜索的字符串或数字属性,让玩家能够高效地筛选并发现公共游戏会话。
static PFMultiplayerHandle g_pfmHandle; // initialized elsewhere #define PFLOBBY_SEARCH_KEY_GAME_MODE "string_key1" #define PFLOBBY_SEARCH_KEY_COMPETITION_STYLE "string_key2" #define PFLOBBY_SEARCH_KEY_SKILL "number_key1" #define GAME_MODE_DEATH_MATCH "DeathMatch" #define COMPETITION_STYLE_RANKED "Ranked" PFEntityKey m_localUser; namespace MyGame { uint32_t GetPlayerSkill(); // defined elsewhere } void CreateLobbyWithSearchProperties() { // Initialize the lobby configuration with search properties std::string playerSkill = std::to_string(MyGame::GetPlayerSkill()); const char* searchPropertyKeys[] = { PFLOBBY_SEARCH_KEY_GAME_MODE, PFLOBBY_SEARCH_KEY_COMPETITION_STYLE, PFLOBBY_SEARCH_KEY_SKILL, }; const char* searchPropertyValues[_countof(searchPropertyKeys)] = { GAME_MODE_DEATH_MATCH, COMPETITION_STYLE_RANKED, playerSkill.c_str(), }; PFLobbyCreateConfiguration lobbyConfiguration{}; lobbyConfiguration.maxMemberCount = 16; lobbyConfiguration.searchPropertyCount = _countof(searchPropertyKeys); lobbyConfiguration.searchPropertyKeys = searchPropertyKeys; lobbyConfiguration.searchPropertyValues = searchPropertyValues; // Initialize an empty join configuration. This can be optionally initialized with the creator's member properties PFLobbyJoinConfiguration creatorMemberConfiguration{}; creatorMemberConfiguration.memberPropertyCount = 0; // Create and join the lobby PFLobbyHandle lobby; HRESULT hr = PFMultiplayerCreateAndJoinLobby( g_pfmHandle, &m_localUser, &lobbyConfiguration, &creatorMemberConfiguration, nullptr, &lobby); }
相关主题
此页面对您有帮助吗?