LoginPassWordManager.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using DG.Tweening;
  4. using TMPro;
  5. public class LoginPassWordManager : MonoSingleton<LoginPassWordManager>
  6. {
  7. public TextMeshProUGUI nameText;
  8. public GameObject errorGo;
  9. int MAXINPUT = 8;
  10. public TMP_InputField tmpField;
  11. public GameObject passWordGo;
  12. public GameObject iconGo;
  13. private void OnEnable()
  14. {
  15. errorGo.SetActive(false);
  16. passWordGo.SetActive(false);
  17. try
  18. {
  19. UserManager.Instance.MoveIcon(Vector3.zero, iconGo.transform, ()=> {
  20. nameText.text = UserManager.Instance.NowChoose.name;
  21. passWordGo.SetActive(true);
  22. });
  23. }
  24. catch
  25. {
  26. }
  27. }
  28. public void toError()
  29. {
  30. errorGo.SetActive(true);
  31. tmpField.transform.DOShakePosition(0.5f,2);
  32. }
  33. public void GoBack()
  34. {
  35. LoginWindowsManager.Instance.gotologin();
  36. }
  37. public void setNum(string num)
  38. {
  39. errorGo.SetActive(false);
  40. if (num!="R"&& num != "")
  41. {
  42. if(tmpField.text.Length<= MAXINPUT)
  43. {
  44. tmpField.text = tmpField.text + num;
  45. }
  46. }else if(num == "R")
  47. {
  48. if (tmpField.text.Length > 0)
  49. tmpField.text = tmpField.text.Remove(tmpField.text.Length - 1);
  50. }
  51. }
  52. }