private void OnMatchGet(GetMatchResult res) { serverIp = res.ServerDetails.IPV4Address; serverPort = res.ServerDetails.Ports[0].Num; Debug.Log($"Server Details - IP:{serverIp} | Port:{serverPort}"); int enemyIdx = res.Members.FindIndex(x => x.Entity.Id != loginManager.playerData.accountInfo.entityId); var enemyEntity = res.Members[enemyIdx].Entity; // Getting enemy name from entityid -> playfabid -> profilename var entityRequest = new GetEntityProfileRequest { Entity = new PlayFab.ProfilesModels.EntityKey { Id = enemyEntity.Id, Type = enemyEntity.Type } }; PlayFabProfilesAPI.GetProfile(entityRequest, entityRes => { var enemyPlayfabId = entityRes.Profile.Lineage.MasterPlayerAccountId; var profileRequest = new GetPlayerProfileRequest { PlayFabId = enemyPlayfabId }; PlayFabClientAPI.GetPlayerProfile(profileRequest, profileRes => { enemyName = profileRes.PlayerProfile.DisplayName; StartMatch(); }, OnError); }, OnError); }
private async Task <EntityProfileBody> GetEntityProfileRequest() { var t = new TaskCompletionSource <EntityProfileBody>(); PlayFabProfilesAPI.GetProfile(new GetEntityProfileRequest(), (response) => { t.SetResult(response.Profile); }, PlayFabErrorHandler ); return(t.Task.Result); }
private Task <bool> SetDisplayName(string name) { var t = new TaskCompletionSource <bool>(); PlayFabProfilesAPI.SetDisplayName(new SetDisplayNameRequest() { DisplayName = name }, (response) => { PlayFabClientAPI.UpdateUserTitleDisplayName(new UpdateUserTitleDisplayNameRequest() { DisplayName = name }, (displayNameResponse) => { t.SetResult(true); }, PlayFabErrorHandler); }, PlayFabErrorHandler ); return(t.Task); }