diff --git a/Assets/Res/ui/loginPage/appleid_button@3x.png b/Assets/Res/ui/loginPage/appleid_button@3x.png new file mode 100644 index 0000000..ef20786 Binary files /dev/null and b/Assets/Res/ui/loginPage/appleid_button@3x.png differ diff --git a/Assets/Res/ui/loginPage/appleid_button@3x.png.meta b/Assets/Res/ui/loginPage/appleid_button@3x.png.meta new file mode 100644 index 0000000..c67039f --- /dev/null +++ b/Assets/Res/ui/loginPage/appleid_button@3x.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: 3f11ea3f715d6334d94f0ca5149b9e67 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Res/ui/loginPage/loginPage.prefab b/Assets/Res/ui/loginPage/loginPage.prefab index 71d4e16..ed5bedc 100644 --- a/Assets/Res/ui/loginPage/loginPage.prefab +++ b/Assets/Res/ui/loginPage/loginPage.prefab @@ -2435,7 +2435,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &6990588081933805031 RectTransform: m_ObjectHideFlags: 0 @@ -4059,7 +4059,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &8485776195494777686 RectTransform: m_ObjectHideFlags: 0 @@ -5511,8 +5511,8 @@ 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: 0, y: 322} - m_SizeDelta: {x: 80, y: 80} + m_AnchoredPosition: {x: 0, y: 310} + m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0} --- !u!222 &1675039755394526246 CanvasRenderer: @@ -5542,7 +5542,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: 0ddd579c89aad104fba3a316bd6c82fa, type: 3} + m_Sprite: {fileID: 21300000, guid: 3f11ea3f715d6334d94f0ca5149b9e67, type: 3} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -11707,7 +11707,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} m_AnchoredPosition: {x: 0, y: 454} - m_SizeDelta: {x: 144, y: 40} + m_SizeDelta: {x: 0, y: 40} m_Pivot: {x: 0.5, y: 0} --- !u!222 &7629958662375693529 CanvasRenderer: diff --git a/Assets/Scripts/Managers/DataBase.cs b/Assets/Scripts/Managers/DataBase.cs index 1b31e29..0b191b6 100644 --- a/Assets/Scripts/Managers/DataBase.cs +++ b/Assets/Scripts/Managers/DataBase.cs @@ -123,7 +123,6 @@ namespace Kill.Managers } public class BindFireBaseRequest { - public string code; public string email; public string temp_token; } diff --git a/Assets/Scripts/UI/Pages/Login/LoginPageCtrl.cs b/Assets/Scripts/UI/Pages/Login/LoginPageCtrl.cs index 1523934..948aaf3 100644 --- a/Assets/Scripts/UI/Pages/Login/LoginPageCtrl.cs +++ b/Assets/Scripts/UI/Pages/Login/LoginPageCtrl.cs @@ -539,16 +539,7 @@ namespace Kill.UI.Pages { LoadingUI.Hide(); Debug.Log($"谷歌登录成功: {result.DisplayName}, FirebaseID: {result.FirebaseUserId}"); - SetCurrentFireBaseId(result.FirebaseUserId); - FireBaseLogin(result.FirebaseUserId, onSuccess:(response) => - { - Debug.Log(response.token); - - },onError:(code,message)=> - { - Debug.Log(message); - ShowSubPage(SubPageType.ThirdPartyBind); - }); + HandleThirdPartyLogin(result); }, onError: (error) => { @@ -573,16 +564,7 @@ namespace Kill.UI.Pages { LoadingUI.Hide(); Debug.Log($"苹果登录成功: {result.DisplayName}, FirebaseID: {result.FirebaseUserId}"); - SetCurrentFireBaseId(result.FirebaseUserId); - FireBaseLogin(result.FirebaseUserId, onSuccess: (response) => - { - Debug.Log(response.token); - - }, onError: (code, message) => - { - Debug.Log(message); - ShowSubPage(SubPageType.ThirdPartyBind); - }); + HandleThirdPartyLogin(result); }, onError: (error) => { @@ -624,6 +606,53 @@ namespace Kill.UI.Pages onError?.Invoke(-1, ex.Message); } } + + /// + /// 第三方登录成功后的统一处理 + /// 新流程:邮箱直接取自第三方授权,不再强制用户输入邮箱、不再需要验证码 + /// 已绑定帐号走 firebase/login 直接登录;未绑定则用第三方邮箱调 firebase/bind 自动绑定并登录 + /// + private void HandleThirdPartyLogin(GoogleLoginResult result) + { + if (result == null || string.IsNullOrEmpty(result.FirebaseUserId)) + { + Debug.LogError("第三方登录结果无效"); + ToastUI.Show("100042"); // 登录失败提示 + return; + } + SetCurrentFireBaseId(result.FirebaseUserId); + + // 新流程:邮箱必须由第三方授权提供 + if (string.IsNullOrEmpty(result.Email)) + { + Debug.LogError("第三方登录未获取到邮箱"); + ToastUI.Show("100042"); // 登录失败提示 + return; + } + SetCurrentEmail(result.Email); + + FireBaseLogin(result.FirebaseUserId, + onSuccess: (response) => + { + Debug.Log(response.token); + }, + onError: (code, message) => + { + Debug.Log(message); + // 未绑定过第三方帐号 → 使用第三方邮箱直接绑定登录,无需验证码 + BindFireBase("", + onSuccess: (data) => + { + Debug.Log(data.token); + UIManager.Instance.OpenPage(UIManager.PageName.homePage, null, true); + }, + onError: (bindCode, bindMessage) => + { + Debug.LogError($"第三方绑定失败: {bindMessage}"); + ToastUI.Show("100042"); // 登录失败提示 + }); + }); + } @@ -634,7 +663,6 @@ namespace Kill.UI.Pages LoadingUI.Show(); var requestData = new BindFireBaseRequest { - code = code, temp_token = currentFireBaseId, email = currentEmail }; diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index fdadad2..8b13b55 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -145,7 +145,7 @@ PlayerSettings: loadStoreDebugModeEnabled: 0 visionOSBundleVersion: 1.0 tvOSBundleVersion: 1.0 - bundleVersion: 1.0.3 + bundleVersion: 1.0.4 preloadedAssets: - {fileID: 7756680987677051820, guid: 0488490a53b3eb2409be4727abdf829a, type: 2} - {fileID: 11400000, guid: d990b2e2bc28cca43863c18940a862a3, type: 2} @@ -565,10 +565,11 @@ PlayerSettings: enableInternalProfiler: 0 logObjCUncaughtExceptions: 1 enableCrashReportAPI: 0 - cameraUsageDescription: "Camera access is used to scan the QR code on your device for pairing." - locationUsageDescription: "Location access is used to detect the current WiFi network." + cameraUsageDescription: Camera access is used to scan the QR code on your device + for pairing. + locationUsageDescription: Location access is used to detect the current WiFi network. microphoneUsageDescription: - bluetoothUsageDescription: "Bluetooth is used to scan for and connect to your device." + bluetoothUsageDescription: Bluetooth is used to scan for and connect to your device. macOSTargetOSVersion: 10.13.0 switchNMETAOverride: switchNetLibKey: