killapp/Assets/Scripts/UI/Pages/Login/SubPages/ThirdPartyBindPanel.cs
“虞渠成” 8972a69e86 chore: 更新firebase配置并修复部分代码问题
1.  更新安卓端google-services.json配置,新增第三方登录客户端信息
2.  修复Firebase登录时错误日志打印不详细的问题,添加完整错误信息输出
3.  完善第三方绑定流程,保存当前登录邮箱
4.  修复ConnectDevice页面的代码缩进和语法问题
2026-07-23 14:22:35 +08:00

76 lines
2.3 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using Kill.Managers;
using Kill.UI.Components;
using Kill.Utils;
namespace Kill.UI.Pages
{
/// <summary>
/// 第三方登录绑定页面
/// </summary>
public class ThirdPartyBindPanel : LoginSubPageBase
{
[Header("输入组件")]
public InputField emailInput;
[Header("显示组件")]
public Text errorText;
[Header("按钮")]
public Button nextBtn;
protected override void OnInitialize()
{
// 绑定按钮事件
if (nextBtn != null)
nextBtn.onClick.AddListener(OnGetCodeAsync);
}
protected override void OnShow()
{
errorText.text = "";
emailInput.text = "";
}
private async void OnGetCodeAsync()
{
string email = emailInput != null ? emailInput.text : "";
if (string.IsNullOrEmpty(email) || !ValidationUtils.IsValidEmailStrict(email))
{
errorText.text = LanguageManager.Instance.GetLanguage("100006");
return;
}
await LoginPageCtrl.Instance.CheckEmailRegisteredFireBase(email,
onSuccess: async (data) =>
{
if (data)
{
errorText.text = LanguageManager.Instance.GetLanguage("100041");
return;
}
else
{
// 保存邮箱到登录控制器
LoginPageCtrl.Instance.SetCurrentEmail(email);
// 设置验证码页面为注册场景
var verifyPanel = GetSubPage(LoginPageCtrl.SubPageType.VerificationCode) as VerificationCodePanel;
if (verifyPanel != null)
{
verifyPanel.SetSceneType(VerificationCodePanel.CodeSceneType.bindThirdParty);
}
ShowPage(LoginPageCtrl.SubPageType.VerificationCode);
}
},
onError: (code, message) =>
{
errorText.text = message;
return;
}
);
}
}
}