I've started again in xamarin, downloaded and installed the PlayFabClientSDK into the studio.
looking at this
I thought I would be able to just cut n paste the code across. It doesn't compile, and the result was I had to rejig the API calls region.
for example
/// Login with Facebook token. | |
/// </summary> | |
/// <param name="token">Token obtained through the FB plugin. (works on mobile and FB canvas only)</param> | |
private static void LoginWithFacebook(string token) | |
{ | |
LoginMethodUsed = LoginPathways.facebook; | |
LoginWithFacebookRequest request = new LoginWithFacebookRequest(); | |
request.AccessToken = token; | |
request.TitleId = PlayFabSettings.TitleId; | |
request.CreateAccount = false; | |
PlayFabClientAPI.LoginWithFacebook(request, OnLoginResult, OnLoginError); | |
} |
became
/// <summary>
/// Login with Facebook token.
/// </summary>
/// <param name="token">Token obtained through the FB plugin. (works on mobile and FB canvas only)</param>
async Task<Object> LoginWithFacebook(string token)
{
LoginMethodUsed = LoginPathways.facebook;
LoginWithFacebookRequest request = new LoginWithFacebookRequest();
request.AccessToken = token;
request.TitleId = PlayFabSettings.TitleId;
request.CreateAccount = false;
Object response = await PlayFabClientAPI.LoginWithFacebookAsync(request);
return response;
}
Is that correct? The API only seems to have Async versions of the calls, with no onSuccess/Onfail parameters.
I thought also perhaps
async Task<PlayFabResult<LoginResult>> LoginWithFacebook(string token)
{
LoginMethodUsed = LoginPathways.facebook;
LoginWithFacebookRequest request = new LoginWithFacebookRequest();
request.AccessToken = token;
request.TitleId = PlayFabSettings.TitleId;
request.CreateAccount = false;
PlayFabResult<LoginResult> response = await PlayFabClientAPI.LoginWithFacebookAsync(request);
return response;
}
but looking at
https://api.playfab.com/Documentation/Client/method/LoginWithFacebook
the response contains
SessionTicket | String | Unique token authorizing the user and game at the server level, for the current session. |
PlayFabId | String | Player's unique PlayFabId. |
NewlyCreated | Boolean | True if the account was newly created on this login. |
SettingsForUser | UserSettings | Settings specific to this user. |
LastLoginTime | DateTime | The time of this user's previous login. If there was no previous login, then it's DateTime.MinValue |
looking at LoginResult in the xamarin Studio shows
namespace PlayFab.ClientModels
{
public class LoginResult
{
//
// Properties
//
public bool NewlyCreated {
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
public string PlayFabId {
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
public string SessionTicket {
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
public UserSettings SettingsForUser {
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
//
// Constructors
//
public LoginResult ();
}
}
There is no LastLoginTime parameter.
help!
thanks in advance