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 Lobby 上定義搜尋索引鍵和可搜尋的字串或數字屬性,讓玩家能夠有效率地篩選和探索公開遊戲工作階段。
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); }
這個頁面有幫助嗎?