Browse Source

Fixed bugs

aleksey 3 years ago
parent
commit
dc5f582c25

+ 2 - 0
Unity3/Assets/2021/Scenes/Main.unity

@@ -58131,6 +58131,7 @@ MonoBehaviour:
   LogoMainMenuDurexDenmark: {fileID: 0}
   LogoMainMenuDurex: {fileID: 0}
   IsGetLifeInGame: 0
+  UIDIOSMOPUB: 03e1670f699e48d2ae082159f92d785a
   curUIDMopub: 
   ActivateInvate: 1
   CurState: 0
@@ -58684,6 +58685,7 @@ MonoBehaviour:
     Parent: {fileID: 0}
     AppleUserIdLabel: {fileID: 0}
     AppleUserCredentialLabel: {fileID: 0}
+  ChangeloginPopup: {fileID: 1707092697}
 --- !u!1 &1573281286
 GameObject:
   m_ObjectHideFlags: 0

+ 33 - 5
Unity3/Assets/AppleAuthSample/MainMenu.cs

@@ -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();
     }
 }

+ 1 - 1
Unity3/Assets/SignInWithAppleTest_Callbacks.cs

@@ -3,7 +3,7 @@ using Facebook.Unity.Example;
 using UnityEngine;
 #if UNITY_IOS
     using UnityEngine.iOS;
-using UnityEngine.SignInWithApple;
+//using UnityEngine.SignInWithApple;
 #endif
 
 

+ 3 - 3
Unity3/Assets/SocialNetworking/Scripts/SocialPlatform/GameDatabaseManager.cs

@@ -316,7 +316,7 @@ public class GameDatabaseManager : MonoBehaviour
 	{
 		
 	//KeyChain.BindDeleteKeyChainUser();
-		string result = "";
+		/*string result = "";
 		#if UNITY_IOS
 		string saveUUID = KeyChain.BindGetKeyChainUser();
 		#endif
@@ -342,9 +342,9 @@ public class GameDatabaseManager : MonoBehaviour
 		{
 			result = dev.uuid;
 			Debug.Log("GET " + saveUUID);
-		}
+		}*/
 		
-		return result;
+		return SystemInfo.deviceUniqueIdentifier;
 	}
 	public void CheckDeviceID(string deviceID, Action<bool, User> onComplete)
 	{