//======================================== // Self-Define //------------------------------ //---------------------- // Public Functions /// <summary> /// Hide the last open dialogue in the current scene. /// </summary> public void HideTheLastOpenDialogue() { // return if nothing in the list if (GetOpenWindow().Count == 0) { return; } JCS_DialogueObject jdo = GetOpenWindow().Last.Value; // once it hide it will remove from the list it self! jdo.HideDialogue(); }
/// <summary> /// Pop one single dialogue. /// </summary> /// <param name="obj"></param> /// <returns></returns> private JCS_DialogueObject PopDialogue(JCS_DialogueObject obj) { if (obj == null) { return(null); } obj = (JCS_DialogueObject)JCS_Utility.SpawnGameObject(obj); obj.ShowDialogue(); obj.SetKeyCode(KeyCode.None); return(obj); }
/// <summary> /// Pop one single dialogue. /// </summary> /// <param name="obj"></param> /// <returns></returns> private JCS_DialogueObject PopDialogue(JCS_DialogueObject obj) { if (obj == null) { return(null); } obj = (JCS_DialogueObject)JCS_Util.SpawnGameObject(obj); obj.Show(); obj.OpenKey = KeyCode.None; return(obj); }
//---------------------- // Protected Variables //======================================== // setter / getter //------------------------------ public void SetJCSDialogue(JCS_DialogueType type, JCS_DialogueObject jdo) { switch (type) { case JCS_DialogueType.GAME_UI: { if (mGameUI != null) { //JCS_Debug.LogError("Failed to set \"In Game Dialogue\"..."); return; } this.mGameUI = jdo; } break; case JCS_DialogueType.PLAYER_DIALOGUE: { //if (mFocusGameDialogue != null) //{ // JCS_Debug.LogError("JCS_UIManager", "Failed to set \"In Game Dialogue\"..."); // return; //} this.mFocusGameDialogue = jdo; } break; case JCS_DialogueType.SYSTEM_DIALOGUE: { if (mForceDialogue != null) { //JCS_Debug.LogError("JCS_UIManager", "Failed to set \"Force Dialogue\"..."); return; } mForceDialogue = jdo; } break; } }
/// <summary> /// Do action according to the panel action type. /// </summary> /// <param name="panel"> panel to set </param> /// <param name="type"> action type </param> private void DoActionForeachPanel(JCS_DialogueObject panel, JCS_PanelActionType type) { if (panel == null) { return; } switch (type) { case JCS_PanelActionType.HIDE: { panel.Hide(!mPlayPanelSound); } break; case JCS_PanelActionType.SHOW: { panel.Show(!mPlayPanelSound); } break; } }
/// <summary> /// Do action according to the panel action type. /// </summary> /// <param name="panel"> panel to set </param> /// <param name="type"> action type </param> private void DoActionForeachPanel(JCS_DialogueObject panel, JCS_PanelActionType type) { // check null references... if (panel == null) { return; } switch (type) { case JCS_PanelActionType.HIDE: { if (mPlayPanelSound) { panel.HideDialogue(); } else { panel.HideDialogueWithoutSound(); } } break; case JCS_PanelActionType.SHOW: { if (mPlayPanelSound) { panel.ShowDialogue(); } else { panel.ShowDialogueWithoutSound(); } } break; } }
/* Setter & Getter */ /* Functions */ public void Awake() { mDialogueObject = this.GetComponent <JCS_DialogueObject>(); }