GameOverButtonHandler.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using UnityEngine;
  2. using System.Collections;
  3. public class GameOverButtonHandler : MonoBehaviour {
  4. private NGUIMenuScript hNGUIMenuScript;
  5. void Start()
  6. {
  7. hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript));
  8. }
  9. void OnClick()
  10. {
  11. if (LoginManager.Instance.OverCoupone())
  12. {
  13. if (LoginManager.Instance.CouponGetEnterNumber != null)
  14. {
  15. Destroy(LoginManager.Instance.CouponGetEnterNumber.gameObject);
  16. }
  17. NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.GameOver;
  18. hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.GameOver);
  19. this.transform.parent.parent.gameObject.GetComponent<ScreenBase>().Hide();
  20. foreach (var l in LoginManager.Instance.CouponeObjects)
  21. {
  22. l.gameObject.SetActive(false);
  23. }
  24. LoginManager.Instance.AnchorGameOverBack.relativeOffset = new Vector2(0.0f, 0.08f);
  25. }
  26. else
  27. {
  28. if (PlayerPrefs.GetInt("GetCoupon") == 1)
  29. {
  30. // Debug.Log("CouponGetEnterNumber.Show()");
  31. LoginManager.Instance.CouponGetEnterNumber.Show();
  32. NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.GameOver;
  33. hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.GameOver);
  34. this.transform.parent.parent.parent.parent.gameObject.GetComponent<ScreenBase>().Hide();
  35. }
  36. else
  37. {
  38. NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.GameOver;
  39. hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.GameOver);
  40. this.transform.parent.parent.parent.parent.gameObject.GetComponent<ScreenBase>().Hide();
  41. }
  42. }
  43. }
  44. }