//======================================== // Self-Define //------------------------------ //---------------------- // Public Functions /// <summary> /// Start the dialogue, in other word same as start a conversation. /// </summary> /// <param name="script"> /// Script to use to run the dialogue. /// </param> public void ActiveDialogue(JCS_DialogueScript script) { mDialogueScript = script; if (mActive) { JCS_Debug.LogError( "Dialogue System is already active... Failed to active another one."); return; } // check if the script attached is available? if (DialogueScript == null) { return; } // reset the action, so it will always start // from the beginning. mDialogueScript.ResetAction(); // active panel PanelActive(true); // otherwise active the dialogue mActive = true; // run the first action. RunAction(); // Play the active dialogue sound. JCS_SoundManager.instance.GetGlobalSoundPlayer().PlayOneShot(mActiveSound); }
/// <summary> /// Call this to end the dialogue status. /// </summary> public void Dispose() { NextBtnActive(false); PrevBtnActive(false); YesBtnActive(false); NoBtnActive(false); AcceptBtnActive(false); DeclineBtnActive(false); OkBtnActive(false); // disable the exit button! ExitBtnActive(false); // dis-attach the script. mDialogueScript = null; ResetStats(); // de-active the panel transform. PanelActive(false); // de-active dialogue system. mActive = false; // Play the dispose dialogue sound. JCS_SoundManager.instance.GetGlobalSoundPlayer().PlayOneShot(mDisposeSound); }
/// <summary> /// Call this to end the dialogue status. /// </summary> public void Dispose() { NextBtnActive(false); PrevBtnActive(false); YesBtnActive(false); NoBtnActive(false); AcceptBtnActive(false); DeclineBtnActive(false); OkBtnActive(false); // disable the exit button! ExitBtnActive(false); // dis-attach the script. mDialogueScript = null; ResetStats(); // de-active the panel transform. PanelActive(false); // de-active dialogue system. mActive = false; // Check initialize to ignore dispose called at the very beginning! if (JCS_GameManager.instance.GAME_DONE_INITIALIZE && callback_dispose != null) { callback_dispose.Invoke(); } // Play the dispose dialogue sound. JCS_SoundManager.instance.GetGlobalSoundPlayer().PlayOneShot(mDisposeSound); }