Sei sulla pagina 1di 3

using UnityEngine;

using System.Collections;
using UnityEngine.UI;
public class uitransitions : MonoBehaviour {
public Animator mainpanel;
public Animator elementarypanel;
public Animator highscorepanel;
public GameObject mainPanel;
public GameObject elementaryPanel;
public GameObject highscorePanel;
public GameObject Highscores;
public GameObject Settings;
public GameObject ParentPanel;
public GameObject SliderPanel;
public GameObject ComingSoonPanel;
//back button implementaion
public bool inElemantary;
float timeWhenBackClicked;
int backClickCount;
public void mainpaneldisappear(){
mainpanel.SetBool ("IsHidden", true);
}
public void elementarypanelappear(){
elementarypanel.SetBool ("IsHidden",false);
inElemantary = true;
Debug.Log ("elementary appear");
}
public void mainpanelappear(){
mainpanel.SetBool ("IsHidden", false);
}
public void elementarypaneldisappear(){
elementarypanel.SetBool ("IsHidden",true);
inElemantary = false;
Debug.Log ("Elementary disappear");
}
public void loadlevelone(string stage){
StaticScript.stage = stage;
//Debug.Log (stage);
//Debug.Log (StaticScript.stage);
Application.LoadLevel (1);
}
//enable panel if u click back from the list view
public void resetMainPanel()
{
mainPanel.SetActive (true);
}
public void highscoreclicked(){
StartCoroutine (hsclicked());
}
IEnumerator hsclicked(){

highscorePanel.SetActive (true);
Settings.SetActive (false);
SliderPanel.SetActive (false);
Highscores.SetActive (true);
ParentPanel.SetActive (true);
elementaryPanel.SetActive (false);
mainpanel.SetBool ("IsHidden",true);
highscorepanel.SetBool ("IsHidden",false);
yield return new WaitForSeconds (0.5f);
mainPanel.SetActive (false);
}
public void highscorebackbtnclicked(){
StartCoroutine (hsbtnclicked());
}
IEnumerator hsbtnclicked(){
highscorepanel.SetBool ("IsHidden",true);
yield return new WaitForSeconds (0.45f);
highscorePanel.SetActive (false);
Highscores.SetActive (false);
Settings.SetActive (false);
SliderPanel.SetActive (false);
ParentPanel.SetActive (false);
mainPanel.SetActive (true);
elementaryPanel.SetActive (true);
}
public void settingsclicked(){
StartCoroutine (setclicked());
}
IEnumerator setclicked(){
highscorePanel.SetActive (true);
Settings.SetActive (true);
SliderPanel.SetActive (true);
Highscores.SetActive (false);
ParentPanel.SetActive (false);
elementaryPanel.SetActive (false);
mainpanel.SetBool ("IsHidden",true);
highscorepanel.SetBool ("IsHidden",false);
yield return new WaitForSeconds (0.5f);
mainPanel.SetActive (false);
}
public void intermediateadvancedclicked(){
StartCoroutine (btnclicked());
}
IEnumerator btnclicked(){
ComingSoonPanel.SetActive (true);
yield return new WaitForSeconds (0.75f);
ComingSoonPanel.SetActive (false);
}
public void multiplayerclicked(){
Application.LoadLevel (2);
}
public void sliderChanged(float value){

StaticScript.sliderValue = ((value-1)*5)+30;
}
void Start()
{
inElemantary = false;
backClickCount = 0;
timeWhenBackClicked = 0;
}
void Update()
{
if (Input.GetKeyDown (KeyCode.Escape)) {
if(highscorePanel.activeInHierarchy && !mainPanel.active
InHierarchy)
highscorebackbtnclicked();
else if(inElemantary)
{
elementarypaneldisappear();
mainpanelappear();
resetMainPanel();
}
else if((!inElemantary && !highscorePanel.activeInHierar
chy) || (!inElemantary && highscorePanel.activeInHierarchy && mainPanel.activeIn
Hierarchy))
{
backClickCount++;
if(backClickCount == 1)
timeWhenBackClicked = Time.time;
else if((backClickCount == 2) && ((Time.time - t
imeWhenBackClicked) < 0.8f))
Application.Quit();
else
backClickCount = 0;
}
}
}
}

Potrebbero piacerti anche