|
@@ -218,7 +218,17 @@ public class MainMenu : MonoBehaviour
|
|
|
// You should save the user ID somewhere in the device
|
|
|
var userId = appleIdCredential.User;
|
|
|
PlayerPrefs.SetString(AppleUserIdKey, userId);
|
|
|
+ if (appleIdCredential.FullName == null)
|
|
|
+ {
|
|
|
+ PlayerPrefs.SetString("UserID", userId);
|
|
|
+ PlayerPrefs.SetInt("Login", 1);
|
|
|
+ PlayerPrefs.SetInt("APPLE", 1);
|
|
|
+ PlayerPrefs.Save();
|
|
|
+ GameDatabaseManager.Instance.RegisterUser(userId, "old User", "old User", "old User" + " " + "old User", "old User", GameDatabaseManager.Instance.GetDevice(), OnLoginCompleted);
|
|
|
|
|
|
+ Debug.Log("Login second enter");
|
|
|
+ return;
|
|
|
+ }
|
|
|
// Email (Received ONLY in the first login)
|
|
|
var email = appleIdCredential.Email;
|
|
|
|
|
@@ -236,18 +246,28 @@ public class MainMenu : MonoBehaviour
|
|
|
appleIdCredential.AuthorizationCode,
|
|
|
0,
|
|
|
appleIdCredential.AuthorizationCode.Length);
|
|
|
- Debug.Log(userId + " " + fullName + " " + email);
|
|
|
-
|
|
|
- var _name = fullName.GivenName;
|
|
|
- var _surname = fullName.MiddleName;
|
|
|
-
|
|
|
+ Debug.Log(userId + " " + fullName.GivenName + " " + fullName.FamilyName + " "+ " " + email);
|
|
|
+
|
|
|
+ var _name = "";
|
|
|
+ var _surname = "";
|
|
|
+ if (fullName != null)
|
|
|
+ {
|
|
|
+ _name = fullName.GivenName;
|
|
|
+ _surname = fullName.FamilyName;
|
|
|
+ }
|
|
|
// Print out information about the user who logged in.
|
|
|
SocialManager.Instance.userID = userId;
|
|
|
+ Debug.Log("1");
|
|
|
SocialManager.Instance._name = _name;
|
|
|
+ Debug.Log("2");
|
|
|
SocialManager.Instance._surname = _surname;
|
|
|
+ Debug.Log("3");
|
|
|
SocialManager.Instance._usermail = email;
|
|
|
+ Debug.Log("4");
|
|
|
SocialManager.Instance._username = userId;
|
|
|
+ Debug.Log("5");
|
|
|
SocialManager.Instance._deviceId = GameDatabaseManager.Instance.GetDevice();
|
|
|
+ Debug.Log("6");
|
|
|
PlayerPrefs.SetString("UserID", userId);
|
|
|
PlayerPrefs.SetInt("Login", 1);
|
|
|
PlayerPrefs.Save();
|
|
@@ -273,5 +293,13 @@ public class MainMenu : MonoBehaviour
|
|
|
Debug.Log("arg2 " + arg2);
|
|
|
PlayerPrefs.SetInt("APPLE", 1);
|
|
|
PlayerPrefs.Save();
|
|
|
+ CloseChangeLogin();
|
|
|
+ }
|
|
|
+
|
|
|
+ public ScreenBase ChangeloginPopup;
|
|
|
+
|
|
|
+ void CloseChangeLogin()
|
|
|
+ {
|
|
|
+ ChangeloginPopup.Hide();
|
|
|
}
|
|
|
}
|