public void HideMenu(MENUACTION menuaction = MENUACTION.MA_NONE) { state = false; LastMenuAction = menuaction; ToggleButtonSettings(false); ActiveAnimation.Play(GetComponent <Animation>(), "Window - Forward", AnimationOrTween.Direction.Forward).onFinished.Add(new EventDelegate(this, "MenuActionAfterAnimationFinished")); }
/*********************** * * MENU INVOKE SCRIPTS * ***********************/ private void MenuActionAfterAnimationFinished() { switch (LastMenuAction) { case MENUACTION.MA_QUIT: GameSetting.Instance.QuitGame(); break; case MENUACTION.MA_LOADNEWLEVEL: Banner.Instance.Hide(); UILoading.SetActive(true); HideLevelSelector(); Application.LoadLevel(2); break; case MENUACTION.MA_EXIT2MENU: Banner.Instance.Hide(); Banner.Instance.ShowInterstitial(); UILoading.SetActive(true); Application.LoadLevel(1); break; case MENUACTION.MA_BACK2MENU: Banner.Instance.Hide(); GameSetting.Instance.mCurrentChapterLevel.mGameType = GAMETYPE.NOSELECTED; HideLevelSelector(); Menu.Instance.ShowMenu(); Banner.Instance.Show(); break; case MENUACTION.MA_RESTARTLEVEL: Banner.Instance.Hide(); Banner.Instance.ShowInterstitial(); UILoading.SetActive(true); Application.LoadLevel(2); break; default: PauseAnimationDone(); break; } LastMenuAction = MENUACTION.MA_NONE; }