diff --git a/PlayFabClientSDK/source/PlayFabClientAPI.cs b/PlayFabClientSDK/source/PlayFabClientAPI.cs index cbdc6242..ff564ea6 100644 --- a/PlayFabClientSDK/source/PlayFabClientAPI.cs +++ b/PlayFabClientSDK/source/PlayFabClientAPI.cs @@ -181,6 +181,40 @@ public static async Task> LoginWithFacebookAsync(Logi AuthKey = result.SessionTicket ?? AuthKey; + return new PlayFabResult + { + Result = result + }; + } + + /// + /// Signs the user in using an iOS Game Center player identifier, returning a session identifier that can subsequently be used for API calls which require an authenticated user + /// + public static async Task> LoginWithGameCenterAsync(LoginWithGameCenterRequest request) + { + request.TitleId = PlayFabSettings.TitleId ?? request.TitleId; + if(request.TitleId == null) throw new Exception ("Must be have PlayFabSettings.TitleId set to call this method"); + + object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/LoginWithGameCenter", request, null, null); + if(httpResult is PlayFabError) + { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler(error); + return new PlayFabResult + { + Error = error, + }; + } + string resultRawJson = (string)httpResult; + + var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings); + var resultData = serializer.Deserialize>(new JsonTextReader(new StringReader(resultRawJson))); + + LoginResult result = resultData.data; + AuthKey = result.SessionTicket ?? AuthKey; + + return new PlayFabResult { Result = result @@ -1222,6 +1256,38 @@ public static async Task> GetFriendLeaderboa }; } + /// + /// Retrieves a list of ranked friends of the current player for the given statistic, centered on the currently signed-in user + /// + public static async Task> GetFriendLeaderboardAroundCurrentUserAsync(GetFriendLeaderboardAroundCurrentUserRequest request) + { + if (AuthKey == null) throw new Exception ("Must be logged in to call this method"); + + object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/GetFriendLeaderboardAroundCurrentUser", request, "X-Authorization", AuthKey); + if(httpResult is PlayFabError) + { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler(error); + return new PlayFabResult + { + Error = error, + }; + } + string resultRawJson = (string)httpResult; + + var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings); + var resultData = serializer.Deserialize>(new JsonTextReader(new StringReader(resultRawJson))); + + GetFriendLeaderboardAroundCurrentUserResult result = resultData.data; + + + return new PlayFabResult + { + Result = result + }; + } + /// /// Retrieves a list of ranked users for the given statistic, starting from the indicated point in the leaderboard /// diff --git a/PlayFabClientSDK/source/PlayFabClientModels.cs b/PlayFabClientSDK/source/PlayFabClientModels.cs index b3103822..8c5526e6 100644 --- a/PlayFabClientSDK/source/PlayFabClientModels.cs +++ b/PlayFabClientSDK/source/PlayFabClientModels.cs @@ -1368,6 +1368,49 @@ public class GetContentDownloadUrlResult + public class GetFriendLeaderboardAroundCurrentUserRequest + { + + + /// + /// Statistic used to rank players for this leaderboard. + /// + public string StatisticName { get; set;} + + /// + /// Maximum number of entries to retrieve. + /// + public int MaxResultsCount { get; set;} + + /// + /// Indicates whether Steam service friends should be included in the response. Default is true. + /// + public bool? IncludeSteamFriends { get; set;} + + /// + /// Indicates whether Facebook friends should be included in the response. Default is true. + /// + public bool? IncludeFacebookFriends { get; set;} + + + } + + + + public class GetFriendLeaderboardAroundCurrentUserResult + { + + + /// + /// Ordered listing of users and their positions in the requested leaderboard. + /// + public List Leaderboard { get; set;} + + + } + + + public class GetFriendLeaderboardRequest { @@ -2869,6 +2912,30 @@ public class LoginWithFacebookRequest + public class LoginWithGameCenterRequest + { + + + /// + /// Unique identifier for the title, found in the Settings > Game Properties section of the PlayFab developer site when a title has been selected + /// + public string TitleId { get; set;} + + /// + /// Unique Game Center player id. + /// + public string PlayerId { get; set;} + + /// + /// Automatically create a PlayFab account if one is not currently linked to this Game Center id. + /// + public bool? CreateAccount { get; set;} + + + } + + + public class LoginWithGoogleAccountRequest { diff --git a/PlayFabSDK/source/PlayFabClientAPI.cs b/PlayFabSDK/source/PlayFabClientAPI.cs index cbdc6242..ff564ea6 100644 --- a/PlayFabSDK/source/PlayFabClientAPI.cs +++ b/PlayFabSDK/source/PlayFabClientAPI.cs @@ -181,6 +181,40 @@ public static async Task> LoginWithFacebookAsync(Logi AuthKey = result.SessionTicket ?? AuthKey; + return new PlayFabResult + { + Result = result + }; + } + + /// + /// Signs the user in using an iOS Game Center player identifier, returning a session identifier that can subsequently be used for API calls which require an authenticated user + /// + public static async Task> LoginWithGameCenterAsync(LoginWithGameCenterRequest request) + { + request.TitleId = PlayFabSettings.TitleId ?? request.TitleId; + if(request.TitleId == null) throw new Exception ("Must be have PlayFabSettings.TitleId set to call this method"); + + object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/LoginWithGameCenter", request, null, null); + if(httpResult is PlayFabError) + { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler(error); + return new PlayFabResult + { + Error = error, + }; + } + string resultRawJson = (string)httpResult; + + var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings); + var resultData = serializer.Deserialize>(new JsonTextReader(new StringReader(resultRawJson))); + + LoginResult result = resultData.data; + AuthKey = result.SessionTicket ?? AuthKey; + + return new PlayFabResult { Result = result @@ -1222,6 +1256,38 @@ public static async Task> GetFriendLeaderboa }; } + /// + /// Retrieves a list of ranked friends of the current player for the given statistic, centered on the currently signed-in user + /// + public static async Task> GetFriendLeaderboardAroundCurrentUserAsync(GetFriendLeaderboardAroundCurrentUserRequest request) + { + if (AuthKey == null) throw new Exception ("Must be logged in to call this method"); + + object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/GetFriendLeaderboardAroundCurrentUser", request, "X-Authorization", AuthKey); + if(httpResult is PlayFabError) + { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler(error); + return new PlayFabResult + { + Error = error, + }; + } + string resultRawJson = (string)httpResult; + + var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings); + var resultData = serializer.Deserialize>(new JsonTextReader(new StringReader(resultRawJson))); + + GetFriendLeaderboardAroundCurrentUserResult result = resultData.data; + + + return new PlayFabResult + { + Result = result + }; + } + /// /// Retrieves a list of ranked users for the given statistic, starting from the indicated point in the leaderboard /// diff --git a/PlayFabSDK/source/PlayFabClientModels.cs b/PlayFabSDK/source/PlayFabClientModels.cs index b3103822..8c5526e6 100644 --- a/PlayFabSDK/source/PlayFabClientModels.cs +++ b/PlayFabSDK/source/PlayFabClientModels.cs @@ -1368,6 +1368,49 @@ public class GetContentDownloadUrlResult + public class GetFriendLeaderboardAroundCurrentUserRequest + { + + + /// + /// Statistic used to rank players for this leaderboard. + /// + public string StatisticName { get; set;} + + /// + /// Maximum number of entries to retrieve. + /// + public int MaxResultsCount { get; set;} + + /// + /// Indicates whether Steam service friends should be included in the response. Default is true. + /// + public bool? IncludeSteamFriends { get; set;} + + /// + /// Indicates whether Facebook friends should be included in the response. Default is true. + /// + public bool? IncludeFacebookFriends { get; set;} + + + } + + + + public class GetFriendLeaderboardAroundCurrentUserResult + { + + + /// + /// Ordered listing of users and their positions in the requested leaderboard. + /// + public List Leaderboard { get; set;} + + + } + + + public class GetFriendLeaderboardRequest { @@ -2869,6 +2912,30 @@ public class LoginWithFacebookRequest + public class LoginWithGameCenterRequest + { + + + /// + /// Unique identifier for the title, found in the Settings > Game Properties section of the PlayFab developer site when a title has been selected + /// + public string TitleId { get; set;} + + /// + /// Unique Game Center player id. + /// + public string PlayerId { get; set;} + + /// + /// Automatically create a PlayFab account if one is not currently linked to this Game Center id. + /// + public bool? CreateAccount { get; set;} + + + } + + + public class LoginWithGoogleAccountRequest {