78 lines
2.4 KiB
C#
78 lines
2.4 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);
|
|
await LoginPageCtrl.Instance.SendCode(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;
|
|
}
|
|
);
|
|
|
|
}
|
|
}
|
|
}
|