Skip to content

Commit

Permalink
Merge pull request #41 from PlayFab/nightly
Browse files Browse the repository at this point in the history
Weekly SDK Publish
  • Loading branch information
Paul Gilmore committed Dec 1, 2015
2 parents e6a3423 + df1aeee commit 8f765be
Show file tree
Hide file tree
Showing 10 changed files with 320 additions and 6 deletions.
66 changes: 66 additions & 0 deletions PlayFabClientSDK/source/PlayFabClientAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,40 @@ public static async Task<PlayFabResult<LoginResult>> LoginWithFacebookAsync(Logi
AuthKey = result.SessionTicket ?? AuthKey;


return new PlayFabResult<LoginResult>
{
Result = result
};
}

/// <summary>
/// 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
/// </summary>
public static async Task<PlayFabResult<LoginResult>> 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<LoginResult>
{
Error = error,
};
}
string resultRawJson = (string)httpResult;

var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings);
var resultData = serializer.Deserialize<PlayFabJsonSuccess<LoginResult>>(new JsonTextReader(new StringReader(resultRawJson)));

LoginResult result = resultData.data;
AuthKey = result.SessionTicket ?? AuthKey;


return new PlayFabResult<LoginResult>
{
Result = result
Expand Down Expand Up @@ -1222,6 +1256,38 @@ public static async Task<PlayFabResult<GetLeaderboardResult>> GetFriendLeaderboa
};
}

/// <summary>
/// Retrieves a list of ranked friends of the current player for the given statistic, centered on the currently signed-in user
/// </summary>
public static async Task<PlayFabResult<GetFriendLeaderboardAroundCurrentUserResult>> 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<GetFriendLeaderboardAroundCurrentUserResult>
{
Error = error,
};
}
string resultRawJson = (string)httpResult;

var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings);
var resultData = serializer.Deserialize<PlayFabJsonSuccess<GetFriendLeaderboardAroundCurrentUserResult>>(new JsonTextReader(new StringReader(resultRawJson)));

GetFriendLeaderboardAroundCurrentUserResult result = resultData.data;


return new PlayFabResult<GetFriendLeaderboardAroundCurrentUserResult>
{
Result = result
};
}

/// <summary>
/// Retrieves a list of ranked users for the given statistic, starting from the indicated point in the leaderboard
/// </summary>
Expand Down
88 changes: 88 additions & 0 deletions PlayFabClientSDK/source/PlayFabClientModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,49 @@ public class GetContentDownloadUrlResult



public class GetFriendLeaderboardAroundCurrentUserRequest
{


/// <summary>
/// Statistic used to rank players for this leaderboard.
/// </summary>
public string StatisticName { get; set;}

/// <summary>
/// Maximum number of entries to retrieve.
/// </summary>
public int MaxResultsCount { get; set;}

/// <summary>
/// Indicates whether Steam service friends should be included in the response. Default is true.
/// </summary>
public bool? IncludeSteamFriends { get; set;}

/// <summary>
/// Indicates whether Facebook friends should be included in the response. Default is true.
/// </summary>
public bool? IncludeFacebookFriends { get; set;}


}



public class GetFriendLeaderboardAroundCurrentUserResult
{


/// <summary>
/// Ordered listing of users and their positions in the requested leaderboard.
/// </summary>
public List<PlayerLeaderboardEntry> Leaderboard { get; set;}


}



public class GetFriendLeaderboardRequest
{

Expand Down Expand Up @@ -2753,6 +2796,11 @@ public class LoginResult
/// </summary>
public bool NewlyCreated { get; set;}

/// <summary>
/// Settings specific to this user.
/// </summary>
public UserSettings SettingsForUser { get; set;}


}

Expand Down Expand Up @@ -2864,6 +2912,30 @@ public class LoginWithFacebookRequest



public class LoginWithGameCenterRequest
{


/// <summary>
/// Unique identifier for the title, found in the Settings > Game Properties section of the PlayFab developer site when a title has been selected
/// </summary>
public string TitleId { get; set;}

/// <summary>
/// Unique Game Center player id.
/// </summary>
public string PlayerId { get; set;}

/// <summary>
/// Automatically create a PlayFab account if one is not currently linked to this Game Center id.
/// </summary>
public bool? CreateAccount { get; set;}


}



public class LoginWithGoogleAccountRequest
{

Expand Down Expand Up @@ -3608,6 +3680,11 @@ public class RegisterPlayFabUserResult
/// </summary>
public string Username { get; set;}

/// <summary>
/// Settings specific to this user.
/// </summary>
public UserSettings SettingsForUser { get; set;}


}

Expand Down Expand Up @@ -4747,6 +4824,17 @@ public class UserPrivateAccountInfo



public class UserSettings
{


public bool NeedsAttribution { get; set;}


}



public class UserSteamInfo
{

Expand Down
4 changes: 3 additions & 1 deletion PlayFabClientSDK/source/PlayFabErrors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ public enum PlayFabErrorCode
DeleteKeyConflict = 1187,
InvalidXboxLiveToken = 1188,
ExpiredXboxLiveToken = 1189,
ResettableStatisticVersionRequired = 1190
ResettableStatisticVersionRequired = 1190,
NotAuthorizedByTitle = 1191,
NoPartnerEnabled = 1192
}

public class PlayFabError
Expand Down
2 changes: 1 addition & 1 deletion PlayFabClientSDK/source/PlayFabVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace PlayFab.Internal
{
public class PlayFabVersion
{
public static string SdkRevision = "0.11.151123";
public static string SdkRevision = "0.12.151130";

public static string getVersionString()
{
Expand Down
66 changes: 66 additions & 0 deletions PlayFabSDK/source/PlayFabClientAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,40 @@ public static async Task<PlayFabResult<LoginResult>> LoginWithFacebookAsync(Logi
AuthKey = result.SessionTicket ?? AuthKey;


return new PlayFabResult<LoginResult>
{
Result = result
};
}

/// <summary>
/// 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
/// </summary>
public static async Task<PlayFabResult<LoginResult>> 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<LoginResult>
{
Error = error,
};
}
string resultRawJson = (string)httpResult;

var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings);
var resultData = serializer.Deserialize<PlayFabJsonSuccess<LoginResult>>(new JsonTextReader(new StringReader(resultRawJson)));

LoginResult result = resultData.data;
AuthKey = result.SessionTicket ?? AuthKey;


return new PlayFabResult<LoginResult>
{
Result = result
Expand Down Expand Up @@ -1222,6 +1256,38 @@ public static async Task<PlayFabResult<GetLeaderboardResult>> GetFriendLeaderboa
};
}

/// <summary>
/// Retrieves a list of ranked friends of the current player for the given statistic, centered on the currently signed-in user
/// </summary>
public static async Task<PlayFabResult<GetFriendLeaderboardAroundCurrentUserResult>> 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<GetFriendLeaderboardAroundCurrentUserResult>
{
Error = error,
};
}
string resultRawJson = (string)httpResult;

var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings);
var resultData = serializer.Deserialize<PlayFabJsonSuccess<GetFriendLeaderboardAroundCurrentUserResult>>(new JsonTextReader(new StringReader(resultRawJson)));

GetFriendLeaderboardAroundCurrentUserResult result = resultData.data;


return new PlayFabResult<GetFriendLeaderboardAroundCurrentUserResult>
{
Result = result
};
}

/// <summary>
/// Retrieves a list of ranked users for the given statistic, starting from the indicated point in the leaderboard
/// </summary>
Expand Down
Loading

0 comments on commit 8f765be

Please sign in to comment.