public void BeginFadein(SubSceneManager previousScene, ObjectTransitionAnimation previousNote) { m_rPreviousScene = previousScene; m_rPreviousNotePage = previousNote; if (!SupressPlugWindow) { // Show Vignette VignetteManager.TransitionVignette(m_oVignetteInfo); if (SettingsMenuManager.Opened) { SettingsMenuManager.Close(); } // Toggle animation and disable user input for now ShowFirstAnimationFrames(); m_eTransitionPhase = TransitionPhase.SETTINGS_MENU; m_bFadeinResults = true; ButtonManager.ToggleAllButtons(false); } else { if (previousNote != null) { previousNote.Reveal(false); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: On Trigger //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void OnTrigger() { base.OnTrigger(); m_oMenuLabelDisplay.ApplyEffects(m_rMenuTextLabel); if (GameManager.CurrentSubscene != null) { GameManager.CurrentSubscene.HideSubscene(); } else if (ObjectTransitionAnimation.CurrentlyActive != null && !ObjectTransitionAnimation.CurrentlyActive.IsLocked) { ObjectTransitionAnimation.CurrentlyActive.Disappear(); } else { if (SettingsMenuManager.Opened) { ShowUnpressedSprite(); SettingsMenuManager.Close(); } else { ShowPressedSprite(); SettingsMenuManager.Open(); m_oExitLabelDisplay.ApplyEffects(m_rMenuTextLabel); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: On Disabled //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected void OnDisable() { if (sm_rCurrentlyActiveNotes == this) { sm_rCurrentlyActiveNotes = null; } SettingsMenuManager.UpdateMenuLabel(); }
private void LeaveState() { /* This is the code to run when you are transitioning OUT of a state * Used to neatly clean up any data necessary between states */ switch (m_State) { case MenuState.Loading: { break; } case MenuState.MainMenu: { // close the main menu canvas m_mainCanvas.gameObject.SetActive(false); break; } case MenuState.AboutMenu: { // close the about menu canvas m_aboutCanvas.gameObject.SetActive(false); break; } case MenuState.SettingsMenu: { m_SettingsManager = null; // close the settings menu canvas m_settingsCanvas.gameObject.SetActive(false); break; } case MenuState.PlayerSelect: { m_PlayerSelectManager = null; // close the player select canvas m_playerSelectCanvas.gameObject.SetActive(false); // hide any players? break; } case MenuState.QuickStart: { m_QuickStartCanvas.gameObject.SetActive(false); break; } default: { // THROW ERROR! throw new System.NotImplementedException("State missing in MenuManager.LeaveState()"); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: On Trigger //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void OnTrigger() { base.OnTrigger(); if (m_rTutorialManager != null) { SettingsMenuManager.Close(); m_rTutorialManager.BeginTutorial(m_iTutorialStartPointID); } }
void Start() { if (resText == null) { Debug.LogError("No resText referenced."); } settingsMenuManager = SettingsMenuManager.ins; if (settingsMenuManager == null) { Debug.LogError("No SettingsMenuManager in the scene?"); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: On Trigger //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void OnTrigger() { base.OnTrigger(); if (m_rInstrumentManager.CurrentInstrumentMode != m_eSelectedInstrument) { m_rInstrumentManager.CurrentInstrumentMode = m_eSelectedInstrument; if (!TutorialManager_Base.TutorialOpened) { SettingsMenuManager.Close(); } } }
void Awake() { if (_ins == null) { // Populate with first instance _ins = this; } else { // Another instance exists, destroy if (this != _ins) Destroy(this.gameObject); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: On Trigger //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void OnTrigger() { base.OnTrigger(); if (GameManager.CurrentSubscene != null) { GameManager.CurrentSubscene.HideSubscene(); ButtonManager.ToggleAllButtons(true); } else if (m_rNotesReveal != null) { m_rNotesReveal.Disappear(m_bOpenSettingsMenu); ButtonManager.ToggleAllButtons(true); } SettingsMenuManager.UpdateMenuLabel(); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Reveal //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// <summary> /// Forces the object to appear using a predefined animation. /// </summary> /// <param name="a_bCloseSettingsMenuFirst">Close Settings Menu (if opened) before proceeding?</param> /// <param name="a_bAssignSelfToSettings">Assign Self To Settings Menu? Doing so will cause the settings button to call this script's 'Disappear' Method when pressed.</param> /// <param name="a_bReverseDisappearAnimation">Play the Disappear Animation in reverse?</param> public virtual void Reveal(bool a_bCloseSettingsMenuFirst = true, bool a_bAssignSelfToSettings = true, bool a_bReverseDisappearAnimation = false) { if (IsLocked) { return; } // Close the Settings Menu if Opened m_bAssignToSettingsButton = a_bAssignSelfToSettings; m_bWaitForSettingsMenu = a_bCloseSettingsMenuFirst; if (m_bWaitForSettingsMenu && SettingsMenuManager.Opened) { SettingsMenuManager.Close(); } if (m_bAssignToSettingsButton) { // Assign self to SubScene if active if (GameManager.CurrentSubscene != null) { GameManager.CurrentSubscene.SetCurrentSceneObject(this); } if (sm_rCurrentlyActiveNotes != null) { sm_rCurrentlyActiveNotes.Disappear(false); } } // Setup Reveal variables and make this gameobject active in the Scene if (a_bReverseDisappearAnimation) { m_iCurrentAnimationElement = m_aDisappearAnimationEffect.Length - 1; m_eCurrentState = CurrentState.REVERSE_DISAPPEARING; m_aDisappearAnimationEffect[m_iCurrentAnimationElement].Reset(); } else { m_iCurrentAnimationElement = 0; m_eCurrentState = CurrentState.REVEAL; m_aRevealAnimationEffect[m_iCurrentAnimationElement].Reset(); } this.enabled = true; this.gameObject.SetActive(true); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: On Disappeared //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected virtual void OnDisappeared() { // Once Disappeared, this note is no longer active m_bOpened = false; if (m_bAssignToSettingsButton && sm_rCurrentlyActiveNotes == this) { sm_rCurrentlyActiveNotes = null; } this.enabled = false; this.gameObject.SetActive(false); // Reactivate Player Input ButtonManager.ToggleAllButtons(true); TambourineShakeDetector.CheckForShake = true; // If we came from the Settings Menu, make it open up once again if (m_bShowSettingsMenuOnClose && SettingsMenuManager.Available) { SettingsMenuManager.Open(); } SettingsMenuManager.UpdateMenuLabel(); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: On Disappeared //---------------------------------------------------- // : Pretty much the exact same as the base version // of this function. Except that the player input // is only reactivated if there is no other note // to display. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void OnDisappeared() { sm_rCurrentlyActiveNotes = null; m_bOpened = false; this.gameObject.SetActive(false); if (m_rTransitioningNote != null) { m_rTransitioningNote.Reveal(); } else { TambourineShakeDetector.CheckForShake = true; if (m_bShowSettingsMenuOnClose && SettingsMenuManager.Available) { SettingsMenuManager.Open(); } else { ButtonManager.ToggleAllButtons(true); } } }
private void SetState(MenuState new_state) { /* This will be called to change the MenuManager to a new state. * Here you should write the code to set up any data needed in the new state. */ // leave old state LeaveState(); // change state m_State = new_state; switch (m_State) { case MenuState.Loading: { break; } case MenuState.MainMenu: { // open the main menu canvas m_mainCanvas.gameObject.SetActive(true); EventSystem.current.SetSelectedGameObject(EventSystem.current.firstSelectedGameObject); #if UNITY_STANDALONE_WIN Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; #endif break; } case MenuState.AboutMenu: { // open the about menu canvas m_aboutCanvas.gameObject.SetActive(true); break; } case MenuState.SettingsMenu: { // open the settings menu canvas m_settingsCanvas.gameObject.SetActive(true); //sets selected item to first in the settings menu EventSystem.current.SetSelectedGameObject(GameObject.Find("Quality").GetComponent <Dropdown>().gameObject); m_SettingsManager = new SettingsMenuManager(this, m_GameManager); break; } case MenuState.PlayerSelect: { // open the player select menu canvas m_playerSelectCanvas.gameObject.SetActive(true); m_PlayerSelectManager = new PlayerSelectManager(this, m_GameManager, m_Controllers); m_GameManager.Clear_Players(); break; } case MenuState.QuickStart: { m_QuickStartCanvas.gameObject.SetActive(true); m_QuickStartMenu = new QuickStartManager(m_GameManager, m_Controllers); break; } default: { // THROW ERROR! throw new System.NotImplementedException("State missing in MenuManager.SetState()"); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: On Trigger //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void OnTrigger() { base.OnTrigger(); SettingsMenuManager.Close(); }
void Awake() { instance = this; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Awake //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Awake() { sm_rInstance = this; }