using UnityEngine;
using System.Collections;

public class PanelManager : MonoBehaviour
{
		
		[HideInInspector]
		public string
				currentScreen;
		
		public static PanelManager instance;
		
		void Start ()
		{
				foreach (Transform child in this.transform) {
						if (child.gameObject.activeInHierarchy && child.tag == "Screen") {
								currentScreen = child.name;
						}
				}
				instance = this;

		}
		
		void Update ()
		{
#if UNITY_ANDROID
				if (Input.GetKeyUp (KeyCode.Home)) {
						OnHomeButton ();
				} 
				if (Input.GetKeyUp (KeyCode.Escape)) {
						OnBackButton ();
				}
				if (Input.GetKeyUp (KeyCode.Menu)) {
						OnMenuButton ();
				}	
#endif
		}
	
		public void OpenScreen (string screenName)
		{
				this.transform.Find (currentScreen).gameObject.SetActive (false);
				this.transform.Find (screenName).gameObject.SetActive (true);		
				currentScreen = screenName;	
		}
		
		public void OpenGame ()
		{
				OpenScreen ("Game");
		}	
		
		public void OpenHelp ()
		{
				OpenScreen ("HelpPanel");
		} 
		
		public void OpenMainMenu ()
		{
				OpenScreen ("MainMenuPanel");
		}
		
		public void OnBackButton ()
		{
				
		}
		
		public void OnHomeButton ()
		{
				
		
		}
		
		public void OnMenuButton ()
		{
				
		}
		

}
