AuthLoginMask.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. //遮罩-认证登录时用到
  6. public class AuthLoginMask : MonoBehaviour
  7. {
  8. public static AuthLoginMask ins;
  9. void Awake()
  10. {
  11. ins = this;
  12. SetVisiable(false);
  13. }
  14. void OnDestroy()
  15. {
  16. if (ins == this) ins = null;
  17. }
  18. public bool IsVisiable() {
  19. return gameObject.activeSelf;
  20. }
  21. public void SetVisiable(bool visiable) {
  22. gameObject.SetActive(visiable);
  23. if (visiable) {
  24. GetComponentInChildren<Text>().text =
  25. TextAutoLanguage2.GetTextByKey("home_loginAuth");
  26. }
  27. transform.Find("BtnRetry").gameObject.SetActive(false);
  28. }
  29. public void SetRetryCount(int count) {
  30. if (gameObject.activeSelf) {
  31. GetComponentInChildren<Text>().text =
  32. string.Format(TextAutoLanguage2.GetTextByKey("home_loginAuthRetry"), count);
  33. }
  34. }
  35. public void SetAutoRetryFail()
  36. {
  37. if (gameObject.activeSelf) {
  38. GetComponentInChildren<Text>().text =
  39. TextAutoLanguage2.GetTextByKey("home_loginAuthFail");
  40. transform.Find("BtnRetry").gameObject.SetActive(true);
  41. }
  42. }
  43. public void OnClick_Retry()
  44. {
  45. AudioMgr.ins.PlayBtn();
  46. SetVisiable(true);
  47. if (UserPlayer.ins == null) UserPlayer.LoginByToken();
  48. else UserPlayer.ins.GetUserInfo();
  49. }
  50. public void SetText(string text) {
  51. GetComponentInChildren<Text>().text = text;
  52. }
  53. }