// Copyright (c) Pixel Crushers. All rights reserved. using System; namespace PixelCrushers.DialogueSystem { /// /// Interface for dialogue UI components. A dialogue UI is responsible for displaying /// subtitles, presenting the player response menu, and showing alerts. /// /// See UnityDialogueUI for a reference implementation that uses Unity GUI. /// public interface IDialogueUI { /// /// Your implementation must define this event and make it public. Example: /// /// public event EventHandler SelectedResponseHandler; /// event EventHandler SelectedResponseHandler; /// /// Called when a conversation starts, use Open() to do any setup -- for example, to show /// the conversation GUI controls. /// void Open(); /// /// Called when a conversation ends, use Close() to clean up -- for example, to hide the /// conversation GUI controls. /// void Close(); /// /// Shows a subtitle. /// /// /// The subtitle to show. Subtitles contain information such as the player type (PC or /// NPC), portrait texture, and the formatted text of the line. /// void ShowSubtitle(Subtitle subtitle); /// /// Hides a subtitle. /// /// /// The subtitle to hide. /// void HideSubtitle(Subtitle subtitle); /// /// Shows the player response menu. When the player selects a response, your /// implementation must call the SelectedResponseHandler event and pass along a /// SelectedResponseEventArgs object containing the selected response. /// /// Example: /// /// private void OnResponseClicked(Response response) { /// SelectedResponseHandler(this, new SelectedResponseEventArgs(response)); /// } /// /// /// /// The most recently displayed subtitle. Your implementation might show this subtitle to /// remind the player what he or she is responding to. /// /// /// The responses. /// /// /// If not 0, the duration in seconds that the player has to choose a response; /// otherwise the currently-focused response is auto-selected. If no response is /// focused (e.g., hovered over), the first response is auto-selected. If 0, /// there is no timeout; the player can take as long as desired to choose a response. /// void ShowResponses(Subtitle subtitle, Response[] responses, float timeout); /// /// Hides the player response menu. /// void HideResponses(); /// /// Shows a QTE (Quick Time Event) indicator. /// /// /// Index number of the QTE indicator. /// /// /// If your project doesn't use QTEs, you can just create an empty method. /// void ShowQTEIndicator(int index); /// /// Hides a QTE (Quick Time Event) indicator. /// /// /// Index number of the QTE indicator. /// /// /// If your project doesn't use QTEs, you can just create an empty method. /// void HideQTEIndicator(int index); /// /// Shows an alert message. The dialogue system will *not* call Open() before ShowAlert(), /// nor Close() afterward, since alert messages are intended to be shown outside of /// conversations. /// /// /// The message to show. /// /// /// The duration in seconds to show the message. /// void ShowAlert(string message, float duration); /// /// Hides the alert message if it's showing. /// void HideAlert(); } }