CouponUsed.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using UnityEngine;
  2. using System.Collections;
  3. public class CouponUsed : MonoBehaviour {
  4. public UILabel LabelMessage;
  5. public UIButton CloseButton;
  6. void Start()
  7. {
  8. StartCoroutine(AlphaActive());
  9. CloseButton.onClick.Add(new EventDelegate(OnClose));
  10. }
  11. public IEnumerator AlphaActive()
  12. {
  13. yield return new WaitForSeconds(1f);
  14. GetComponent<UIPanel>().alpha = 1;
  15. GetComponent<ScreenBase>().Hide();
  16. yield return new WaitForSeconds(1f);
  17. LoginManager.Instance.BackMessageCoupone.SetActive(true);
  18. }
  19. private void OnClose()
  20. {
  21. if (NGUIMenuScript.Instance.CurStatePopup == NGUIMenuScript.StatesMenuForPopup.Menu)
  22. {
  23. foreach (var b in LoginManager.Instance.ButtonsCoupon)
  24. {
  25. if (b.gameObject.activeSelf)
  26. {
  27. b.DeactivateButton();
  28. }
  29. }
  30. PlayerPrefs.SetInt("CloseEnterNumber", 0);
  31. PlayerPrefs.SetInt("GetCoupon", 0);
  32. Debug.LogWarning("SendCouponFlse");
  33. }
  34. else if (NGUIMenuScript.Instance.CurStatePopup == NGUIMenuScript.StatesMenuForPopup.GameOver)
  35. {
  36. foreach (var b in LoginManager.Instance.ButtonsCoupon)
  37. {
  38. if (b.gameObject.activeSelf)
  39. {
  40. b.DeactivateButton();
  41. }
  42. }
  43. PlayerPrefs.SetInt("CloseEnterNumber", 0);
  44. PlayerPrefs.SetInt("GetCoupon", 0);
  45. Debug.LogWarning("SendCouponFlse");
  46. }
  47. else
  48. {
  49. //GetComponent<ButtonWithTwoStates>().DeactivateButton();
  50. //NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.SendCoupone);
  51. foreach (var b in LoginManager.Instance.ButtonsCoupon)
  52. {
  53. if (b.gameObject.activeSelf)
  54. {
  55. b.DeactivateButton();
  56. }
  57. }
  58. PlayerPrefs.SetInt("CloseEnterNumber", 0);
  59. PlayerPrefs.SetInt("GetCoupon", 0);
  60. LoginManager.Instance.OnClickOkLevelDone();
  61. }
  62. GetComponent<ScreenBase>().Hide();
  63. }
  64. }