Hello all!
I have been working on creating a matchmaker where the players can look at the opponent's variable to see if they are set up (by having the player look at the other player's ready key to see if it is 1 or 0).
I know I need to find the other player's MasterPlayerAccountId in order to look at the data, but have been having trouble with seeing how to write it.
I am a visual learner and work best with examples, and although I have been looking at the API, I haven't seen any examples which can lead me to the solution.
Here are the key methods I have so far, and thank you in advance:
private void StartMatchmaking() { PlayFabMultiplayerAPI.CreateMatchmakingTicket( new CreateMatchmakingTicketRequest { Creator = new MatchmakingPlayer { Entity = new PlayFab.MultiplayerModels.EntityKey { Id = EntityId, Type = "title_player_account" }, Attributes = new MatchmakingPlayerAttributes { DataObject = new { } } }, GiveUpAfterSeconds = 60, QueueName = QUEUE }, OnMatchMakingTicketCreated, OnMatchmakingError ); } //Where I assume I should be getting the player's MasterPlayerAccountId private void OnMatchMakingTicketCreated(CreateMatchmakingTicketResult result) { /*var request = PlayFabProfileModels.GetEntityProfileRequest {Entity = EntityKey}; PlayFabProfilesAPI.GetProfile(request, response => { Debug.Log(response.Profile.Lineage.MasterPlayerAccountId); }, GetProfileError);*/ ticketId = result.TicketId; pollTicketCoroutine = StartCoroutine(PollTicket()); leaveBtn.gameObject.SetActive(true); } //Where the opponent's ready status can be searched public void GetReady() { PlayFabServerAPI.GetUserData(new PlayFab.ServerModels.GetUserDataRequest { //PlayFabId = opponent's playFabId }, result => { if (result.Data != null && result.Data.ContainsKey("Ship")) { ready = int.Parse(result.Data["Ship"].Value); } }, error => { Debug.LogError(error.GenerateErrorReport()); }); },
Hello all!
I have been working on creating a matchmaker where the players can look at the opponent's variable to see if they are set up (by having the player look at the other player's ready key to see if it is 1 or 0).
I know I need to find the other player's MasterPlayerAccountId in order to look at the data, but have been having trouble with seeing how to write it.
I am a visual learner and work best with examples, and although I have been looking at the API, I haven't seen any examples which can lead me to the solution.
Here are the key methods I have so far, and thank you in advance:
private void StartMatchmaking() { PlayFabMultiplayerAPI.CreateMatchmakingTicket( new CreateMatchmakingTicketRequest { Creator = new MatchmakingPlayer { Entity = new PlayFab.MultiplayerModels.EntityKey { Id = EntityId, Type = "title_player_account" }, Attributes = new MatchmakingPlayerAttributes { DataObject = new { } } }, GiveUpAfterSeconds = 60, QueueName = QUEUE }, OnMatchMakingTicketCreated, OnMatchmakingError ); } //Where I assume I should be getting the player's MasterPlayerAccountId private void OnMatchMakingTicketCreated(CreateMatchmakingTicketResult result) { /*var request = PlayFabProfileModels.GetEntityProfileRequest {Entity = EntityKey}; PlayFabProfilesAPI.GetProfile(request, response => { Debug.Log(response.Profile.Lineage.MasterPlayerAccountId); }, GetProfileError);*/ ticketId = result.TicketId; pollTicketCoroutine = StartCoroutine(PollTicket()); leaveBtn.gameObject.SetActive(true); } //Where the opponent's ready status can be searched public void GetReady() { PlayFabServerAPI.GetUserData(new PlayFab.ServerModels.GetUserDataRequest { //PlayFabId = opponent's playFabId }, result => { if (result.Data != null && result.Data.ContainsKey("Ship")) { ready = int.Parse(result.Data["Ship"].Value); } }, error => { Debug.LogError(error.GenerateErrorReport()); }); }