BoxSecurity.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using AppUI.Manager.View;
  2. using AppUI.Util.Input;
  3. using JCUnityLib;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using UnityEngine;
  7. using UnityEngine.SceneManagement;
  8. namespace AppUI.View.Home.UserCenter
  9. {
  10. public class BoxSecurity : MonoBehaviour
  11. {
  12. [SerializeField] AppUITMPInputField inputFieldEmail;
  13. [SerializeField] AppUITMPInputField inputFieldPassword;
  14. void OnEnable()
  15. {
  16. InitInfo();
  17. }
  18. void OnDisable()
  19. {
  20. }
  21. void InitInfo()
  22. {
  23. if (inputFieldEmail != null)
  24. inputFieldEmail.SetText(LoginMgr.myUserInfo.email);
  25. }
  26. // 点击绑定邮箱
  27. public void OnClick_BindEmail() {
  28. AudioMgr.ins.PlayBtn();
  29. RelateValidateView relateValidateView = ViewManager.ShowView(UIViewType.RelateValidateView).GetComponent<RelateValidateView>();
  30. //CanvasUtils.PlusSortOrder(gameObject.GetComponentInParent<Canvas>().gameObject, relateValidateView.gameObject, 1);
  31. relateValidateView.InitForEmail2();
  32. relateValidateView.onValidateSuccess = (a, b, c) => {
  33. relateValidateView?.BanButtons();
  34. StartCoroutine(UserController.Instance.SaveEmail(a, b, c, (res) => {
  35. if (res.code == 0)
  36. {
  37. PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByKey("RelateValidateView-pass1"));
  38. LoginMgr.myUserInfo.email = a;
  39. inputFieldEmail.SetText(a);
  40. relateValidateView?.CloseView();
  41. }
  42. }));
  43. };
  44. }
  45. public void OnClick_SignOut()
  46. {
  47. AudioMgr.ins.PlayBtn();
  48. //logic
  49. PlayerPrefs.DeleteKey(LoginMgr.LoginTokenKey);
  50. UserPlayer.ins?.Close();
  51. //SceneManager.LoadScene("Login", LoadSceneMode.Single);
  52. if (AppleLoginHelper.ins.HasAppleKey())
  53. AppleLoginHelper.ins.DeleteAppleKey();
  54. SceneManager.LoadScene("Login", LoadSceneMode.Single);
  55. //CommonConfig.StandaloneMode = true;
  56. //SceneManager.LoadScene("Home", LoadSceneMode.Single);
  57. }
  58. // Start is called before the first frame update
  59. void Start()
  60. {
  61. }
  62. // Update is called once per frame
  63. void Update()
  64. {
  65. }
  66. }
  67. }