ソースを参照

Update apple login

alex_gs 3 年 前
コミット
7fbde2c812

+ 3 - 4
Unity3/Assets/2021/Scenes/Main.unity

@@ -53180,7 +53180,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0}
   m_AnchorMax: {x: 0.5, y: 0}
-  m_AnchoredPosition: {x: -450, y: 334.1}
+  m_AnchoredPosition: {x: -450, y: 334.09998}
   m_SizeDelta: {x: 512, y: 226}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1459908191
@@ -58099,7 +58099,6 @@ MonoBehaviour:
   LogoMainMenuDurexDenmark: {fileID: 0}
   LogoMainMenuDurex: {fileID: 0}
   IsGetLifeInGame: 0
-  UIDIOSMOPUB: 03e1670f699e48d2ae082159f92d785a
   curUIDMopub: 
   ActivateInvate: 1
   CurState: 0
@@ -77386,7 +77385,7 @@ Canvas:
   m_PlaneDistance: 100
   m_PixelPerfect: 0
   m_ReceivesEvents: 1
-  m_OverrideSorting: 1
+  m_OverrideSorting: 0
   m_OverridePixelPerfect: 0
   m_SortingBucketNormalizedSize: 0
   m_AdditionalShaderChannelsFlag: 25
@@ -77806,7 +77805,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0}
   m_AnchorMax: {x: 0.5, y: 0}
-  m_AnchoredPosition: {x: 450, y: 334.1}
+  m_AnchoredPosition: {x: 450, y: 334.09998}
   m_SizeDelta: {x: 512, y: 226}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1817213186

+ 3 - 1
Unity3/Assets/UI/Buttons/ButtonMenuTransitionEvent.cs

@@ -3,6 +3,7 @@ using UnityEngine;
 using System.Collections;
 using Prime31;
 using UnityEngine.UI;
+using UnityEngine.SignInWithApple;
 
 /// <summary>
 /// This component is responsible for firing a Notification for the transitioning the menu system through NotificationCenter
@@ -33,8 +34,9 @@ public class ButtonMenuTransitionEvent : MonoBehaviour
             MenuManager. _instance.scoresScreen.GetComponent<FacebookDialogManager>().noInternetDialog.Show();
 	        return;
 	    }
-        if (!WrapperFB.IsLoggedIn)
+        if (!WrapperFB.IsLoggedIn && PlayerPrefs.GetInt("GUEST") == 0 && PlayerPrefs.GetInt("APPLE") == 0)
         {
+          
             FacebookHelper.Instance.ShowFacebookLoginRequired();
             return;
         }

+ 2 - 5
Unity3/Assets/UI/Screens/ChangeLoginPopup.cs

@@ -18,11 +18,8 @@ public class ChangeLoginPopup : ScreenBase
 
     public void OnLoginGuest()
     {
-        WrapperFB.Login();
+        PlayerPrefs.SetInt("GUEST", 1);
+        PlayerPrefs.Save();
     }
 
-    public void OnLoginApple()
-    {
-        WrapperFB.Login();
-    }
 }

+ 13 - 3
Unity3/Assets/Unity Technologies/SignInWithApple/Samples/Scripts/SignInWithAppleTest_Callbacks.cs

@@ -4,7 +4,7 @@ using UnityEngine.SignInWithApple;
 
 public class SignInWithAppleTest_Callbacks : MonoBehaviour
 {
-#if UNITY_IPHONE
+
     private string userId;
     
     public void ButtonPress()
@@ -40,11 +40,21 @@ public class SignInWithAppleTest_Callbacks : MonoBehaviour
 
         // Save the userId so we can use it later for other operations.
         userId = userInfo.userId;
-        
+        var allName = userInfo.displayName.Split(' ');
+        var _name = allName[0];
+        var _surname = allName[1];
+       
         // Print out information about the user who logged in.
+        GameDatabaseManager.Instance.RegisterUser(userInfo.userId, _name, _surname, userInfo.displayName, userInfo.email, OnLoginCompleted);
         Debug.Log(
             string.Format("Display Name: {0}\nEmail: {1}\nUser ID: {2}\nID Token: {3}", userInfo.displayName ?? "",
                 userInfo.email ?? "", userInfo.userId ?? "", userInfo.idToken ?? ""));
     }
-#endif
+
+    private void OnLoginCompleted(bool arg1, string arg2)
+    {
+        Debug.Log("arg2 " + arg2);
+        PlayerPrefs.SetInt("APPLE", 1);
+        PlayerPrefs.Save();
+    }
 }