i want to display a friend list??
image:
i have 15 player
i want to send a request player1->player2 before display a friend list??
i alreay login successfully.
Code:
PlayFabLogin.cs
List<FriendInfo> _friends = null; public void Login(string username, string password)//login(2) { LoginWithPlayFabRequest request = new LoginWithPlayFabRequest(); //playerprefs for login //PlayerPrefs.GetString("Username", username); PlayerPrefs.GetString("Password", password); PlayerPrefs.GetString("Email", username); request.Username = username; request.Password = password; PlayFabClientAPI.LoginWithPlayFab(request, OnLoginSuccess, OnError); DisplayFriends(_friends); //when player login then display a friend list GetFriends(); } void DisplayFriends(List<FriendInfo> friendsCache) { friendsCache.ForEach(f => Debug.Log(f.FriendPlayFabId)); } void DisplayPlayFabError(PlayFabError error) { Debug.Log(error.GenerateErrorReport()); } void DisplayError(string error) { Debug.LogError(error); } void GetFriends() { PlayFabClientAPI.GetFriendsList(new GetFriendsListRequest { IncludeSteamFriends = false, IncludeFacebookFriends = false }, result => { _friends = result.Friends; DisplayFriends(_friends); // triggers your UI }, DisplayPlayFabError); }
code:
PlayFabSharedSettings.cs
using UnityEngine; using PlayFab; #if UNITY_5_3_OR_NEWER [CreateAssetMenu(fileName = "PlayFabSharedSettings", menuName = "PlayFab/CreateSharedSettings", order = 1)] #endif public class PlayFabSharedSettings : ScriptableObject { public string TitleId=""; //here which title id enter internal string VerticalName = null; #if ENABLE_PLAYFABSERVER_API || ENABLE_PLAYFABADMIN_API || UNITY_EDITOR public string DeveloperSecretKey; #endif public string ProductionEnvironmentUrl = ""; #if UNITY_2017_2_OR_NEWER public WebRequestType RequestType = WebRequestType.UnityWebRequest; #else public WebRequestType RequestType = WebRequestType.UnityWww; #endif public string AdvertisingIdType; public string AdvertisingIdValue; public bool DisableAdvertising; public bool DisableDeviceInfo; public bool DisableFocusTimeCollection; public int RequestTimeout = 2000; public bool RequestKeepAlive = true; public bool CompressApiData = true; public PlayFabLogLevel LogLevel = PlayFabLogLevel.Warning | PlayFabLogLevel.Error; public string LoggerHost = ""; public int LoggerPort = 0; public bool EnableRealTimeLogging = false; public int LogCapLimit = 30; }