// Update is called once per frame protected void Update() { if (x <= 0f && myImage.enabled) { myImage.enabled = false; } if (STATE == MENUSTATE.PREBEGIN && x > 0f) { x -= 0.8f * Time.deltaTime; } else if (STATE == MENUSTATE.PREBEGIN && x <= 0f) { STATE = MENUSTATE.BEGIN; } if (STATE == MENUSTATE.FINISHED && x < 1f) { if (!myImage.enabled) { myImage.enabled = true; } x += 0.8f * Time.deltaTime; } else if (STATE == MENUSTATE.FINISHED && x >= 1f) { if (!loading) { StartCoroutine(LoadingScreen()); loading = true; } } myImage.color = Color.Lerp(Color.clear, Color.black, x); }
/// <summary> /// 开始按钮监听器 /// </summary> public void OnClick() { m_State = MENUSTATE.MS_STARTGAME; // 销毁所有的GameObject foreach(GameObject go in GameObject.FindObjectsOfType(typeof(GameObject))) { if( go != gameObject ) { Destroy(go); } } Application.LoadLevel(Global.g_LoadingScene); }
public void DeleteButton() { // if transitioning from copystate to delete state make sure we reset values if a file to copy alredy have been selected if (_currentState == MENUSTATE.COPYING) { if (_buttonOfFileToCopy != null) { _buttonOfFileToCopy.transform.localScale = _standardScale; _buttonOfFileToCopy.GetComponent <Image>().color = _standardColor; _buttonOfFileToCopy = null; _fileToCopy = ""; } } // change state to deleting and change color of current button _currentState = MENUSTATE.DELETING; _usingColor = _deleteColor; EventSystem.current.currentSelectedGameObject.GetComponent <Image>().color = _usingColor; }
public void FinishScene(string x) { STATE = MENUSTATE.FINISHED; nextScene = x; }