StartButtonHandler.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using UnityEngine;
  2. using System.Collections;
  3. public class StartButtonHandler : MonoBehaviour
  4. {
  5. private InGameScriptCS hInGameScriptCS;
  6. private NGUIMenuScript hNGUIMenuScript;
  7. void Start()
  8. {
  9. hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
  10. hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript));
  11. }
  12. void OnClick()
  13. {
  14. if (!ConnectivityPollManager.HasInternet)
  15. {
  16. //FacebookDialogManager.Instance.ShowAppropriateDialog();
  17. LoginManager.Instance.WrongConnectMessages.Show();
  18. return;
  19. }
  20. //if (LoginManager.Instance.OVERGAME)
  21. //{
  22. // LoginManager.Instance.OverGameMessage.Show();
  23. // return;
  24. //}
  25. //if (!LoginManager.Instance.Age /*|| LoginManager.Instance.OVERGAME*/)
  26. //{
  27. // return;
  28. //}
  29. // if (WrapperFB.IsLoggedIn)
  30. // {
  31. // //NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.LeaderBoardNew);
  32. // //NGUITools.SetActive(this.transform.parent.gameObject, false);//close/ disable the current menu
  33. // }
  34. // else
  35. // {
  36. //#if !UNITY_EDITOR
  37. // LoginManager.Instance.WrongMessages.Show();
  38. // return;
  39. //#endif
  40. // }
  41. //Debug.Log(!InstructionsHomeButtonHandler.FirstPlay);
  42. /*if (!InstructionsHomeButtonHandler.FirstPlay)
  43. {
  44. NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.None;
  45. hInGameScriptCS.launchGame(); //start the gameplay
  46. //hNGUIMenuScript.NGUIMenuScriptEnabled(false);//turn off the NGUI Menu Script (to improve performance)
  47. }
  48. else
  49. {
  50. NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.None;
  51. hInGameScriptCS.launchGame(); //start the gameplay
  52. }*/
  53. NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.ChangeLevel;
  54. NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.ChangeLevel);
  55. //NGUIMenuScript.Instance.toggleHUDGroupState(false);
  56. //hInGameScriptCS.launchGame(); //start the gameplay
  57. if (UISendGreetings.Visible)
  58. {
  59. return;
  60. }
  61. //NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.RaceStart);
  62. NGUITools.SetActive(this.transform.parent.gameObject, false);//close/ disable the current menu*/
  63. }
  64. }