123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /*
- * FUNCTION: Handles what happens when the Tap to play button is tapped.
- * The button is located in the Main Menu.
- * */
- using UnityEngine;
- using System.Collections;
- public class TapToPlayHandler : MonoBehaviour {
- private InGameScriptCS hInGameScriptCS;
- private NGUIMenuScript hNGUIMenuScript;
-
- void Start()
- {
- hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
- hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript));
- }
-
- void OnClick()
- {
- //Debug.Log("OnClck");
- if (!ConnectivityPollManager.HasInternet)
- {
- LoginManager.Instance.WrongConnectMessages.Show();
- //FacebookDialogManager.Instance.ShowAppropriateDialog();
- hNGUIMenuScript.CloseMenu(NGUIMenuScript.NGUIMenus.MainMenuNew);
- return;
-
- }
- /*if (!FacebookHelper.Instance.IsLoggedIn() && ConnectivityPollManager.HasInternet)
- {
- hNGUIMenuScript.CloseMenu(NGUIMenuScript.NGUIMenus.MainMenu);
- hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.LoginFacebook);
- return;
- }*/
- if (!InstructionsHomeButtonHandler.FirstPlay)
- {
- hInGameScriptCS.launchGame(); //start the gameplay
- //hNGUIMenuScript.NGUIMenuScriptEnabled(false);//turn off the NGUI Menu Script (to improve performance)
- }
- else
- {
- hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.InstructionsMenu);
- }
- if (UISendGreetings.Visible)
- {
- return;
- }
- NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.RaceStart);
- NGUITools.SetActive(this.transform.parent.gameObject, false);//close/ disable the current menu
- }
- }
|