UIThanks.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using UnityEngine;
  2. using System.Collections;
  3. using System;
  4. public class UIThanks : MonoBehaviour {
  5. public GameObject First;
  6. public GameObject Second;
  7. public static UIThanks Instance { get; private set; }
  8. private float _wait = -1;
  9. internal void Awake()
  10. {
  11. Instance = this;
  12. }
  13. internal void Start()
  14. {
  15. Instance = this;
  16. }
  17. private void OnEnable()
  18. {
  19. if (PlayerPrefs.GetInt("GetCoupon") == 1)
  20. {
  21. // Debug.Log(PlayerPrefs.GetInt("GetCoupon"));
  22. StartCoroutine(CouponePopup());
  23. }
  24. }
  25. IEnumerator CouponePopup()
  26. {
  27. yield return new WaitForSeconds(0.5f);
  28. ServerGiftManager.Instance.GetCouponeInfo(onDone);
  29. LoginManager.Instance.CouponGetEnterNumber.Show();
  30. }
  31. private void onDone()
  32. {
  33. }
  34. void Update()
  35. {
  36. if (_wait > 0.1f && Time.timeSinceLevelLoad > _wait)
  37. {
  38. _wait = -1;
  39. //First.SetActive(false);
  40. //Second.SetActive(true);
  41. }
  42. }
  43. public void OnShow()
  44. {
  45. /*if (AdwareRequest.HasAdware)
  46. {
  47. AdwareRequest.Show();
  48. First.SetActive(true);
  49. Second.SetActive(false);
  50. StartCoroutine(ShowNext());
  51. }
  52. else
  53. {
  54. StartCoroutine(ShowNext());
  55. }*/
  56. // First.SetActive(true);
  57. //Second.SetActive(true);
  58. //_wait = Time.timeSinceLevelLoad + 3;
  59. // StartCoroutine(ShowNext());
  60. }
  61. /* private IEnumerator ShowNext()
  62. {
  63. yield return new WaitForSeconds(3f);
  64. First.SetActive(false);
  65. Second.SetActive(true);
  66. }*/
  67. }