using UnityEngine; using System.Collections; public class ChangeLevelButtonHandler : MonoBehaviour { private InGameScriptCS hInGameScriptCS; private NGUIMenuScript hNGUIMenuScript; public GameObject Plane; public int curLevel; public Material SkyLevel; public Color ColorFog; public float StartFog; public float EndFog; void Start() { hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS)); hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript)); } void OnClick() { Plane.SetActive(false); if (!ConnectivityPollManager.HasInternet) { LoginManager.Instance.WrongConnectMessages.Show(); //FacebookDialogManager.Instance.ShowAppropriateDialog(); LoginManager.Instance.WrongMessages.Show(); return; } hInGameScriptCS.Level = curLevel; TooltipLastterController.Instance.InitLevelWord(); hInGameScriptCS.GetComponent().GetCurLevelState(curLevel); //NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.Bunner; //NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.Banner); RenderSettings.fogColor = ColorFog; RenderSettings.skybox = SkyLevel; RenderSettings.fogMode = FogMode.Linear; RenderSettings.fogStartDistance = StartFog; RenderSettings.fogEndDistance = EndFog; if (!InstructionButtonHandler.FirstPlay) { NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.None; hInGameScriptCS.launchGame(); } else { NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.None; hInGameScriptCS.launchGame(); } NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.RaceStart); if (curLevel == 1) { Plane.SetActive(true); } //NGUIMenuScript.Instance.toggleHUDGroupState(false); //hInGameScriptCS.launchGame(); //start the gameplay if (UISendGreetings.Visible) { return; } //NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.RaceStart); NGUITools.SetActive(this.transform.parent.parent.parent.gameObject, false);//close/ disable the current menu*/ hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.Banner); } }