GetMyPlayerInfo
public BackndMyPlayerReturnObject GetMyPlayerInfo();
BackndMyPlayerReturnObject
GetReturnValueByMyPlayerItem
If an error occurred, null is returned.
BackndMyPlayerReturnObject bro = Backnd.Player.GetMyPlayerInfo();
string nickname = bro.GetReturnValueByMyPlayerItem().nickname;
BackndMyPlayerItem
public class BackndMyPlayerItem
{
public string gamerId = string.Empty;
public string countryCode = string.Empty;
public string nickname = string.Empty;
public string inDate = string.Empty;
public string emailForFindPassword = string.Empty;
public string subscriptionType = string.Empty;
public string federationId = string.Empty;
}
Description
The user's metadata stored in the server is retrieved.
User's metadata
- Nickname
- User inDate
- gamer_id(the user's unique value used in the console)
- Login type(custom, federation)
- Federation account ID(Google/Apple/Facebook federation ID)
- Email to find custom account ID/PW
- Country code
Example
Synchronous
BackndMyPlayerReturnObject bro = Backnd.Player.GetMyPlayerInfo();
string nickname = bro.GetReturnValueByMyPlayerItem().nickname;
Asynchronous
Backnd.Player.GetMyPlayerInfo((callback) =>
{
string nickname = callback.GetReturnValueByMyPlayerItem().nickname;;
});
Return cases
Success cases
When loaded successfully
statusCode : 200
returnValue : refer to GetReturnValuetoJSON
GetReturnValuetoJSON
In the case of success, the information of the logged-in user is displayed.
{
"row": {
"gamerId":"123456a0-7890-11ab-22cd-33f4567fa89" // User's gamer_id
"countryCode": "KR", // null when country code is not set
"nickname": "Test User 1", // null when nickname is not set
"inDate": "2020-06-23T05:54:29.743Z", // User inDate
"emailForFindPassword": "backend@afidev.com", // Email used to find custom account ID, PW; null when it is not registered.
"subscriptionType": "customSignUp", // custom/federation type
"federationId": null // Google, Apple, Facebook federation ID'; null for custom account
}
}
Sample code
public class UserInfo
{
public string gamerId;
public string countryCode;
public string nickname;
public string inDate;
public string emailForFindPassword;
public string subscriptionType;
public string federationId;
public override string ToString()
{
return $"gamerId: {gamerId}\n" +
$"countryCode: {countryCode}\n" +
$"nickname: {nickname}\n" +
$"inDate: {inDate}\n" +
$"emailForFindPassword: {emailForFindPassword}\n" +
$"subscriptionType: {subscriptionType}\n" +
$"federationId: {federationId}\n";
}
}
public void GetMyPlayerInfoTest()
{
var bro = Backnd.Player.GetMyPlayerInfo();
if(!bro.IsSuccess())
{
Debug.LogError("An error occurred : " + bro.ToString());
return;
}
BACKND.LitJson.JsonData userInfoJson = bro.GetReturnValuetoJSON()["row"];
UserInfo userInfo = new UserInfo();
userInfo.gamerId = userInfoJson["gamerId"].ToString();
userInfo.countryCode = userInfoJson["countryCode"].ToString();
userInfo.nickname = userInfoJson["nickname"].ToString();
userInfo.inDate = userInfoJson["inDate"].ToString();
userInfo.emailForFindPassword = userInfoJson["emailForFindPassword"]?.ToString();
userInfo.subscriptionType = userInfoJson["subscriptionType"].ToString();
userInfo.federationId = userInfoJson["federationId"]?.ToString();
Debug.Log(userInfo.ToString());
}