using System; namespace Framework.Dialogue { /// Manages UI widgets in a canvas used to display dialogue /// /// /// This interface allows dialogue APIs to be mocked and implemented on different /// systems (i.e. uGUI, immediate mode GUI, as speech bubbles, as scrolling log). /// The following scenarios are explicit design goals for this interface: /// /// /// - Speech bubbles appearing next to characters /// - Subtitles being faded in and out /// - Chatlog-like display in a rolling canvas /// - RPG dialogue boxes /// /// public interface IDialogueCanvas { /// Triggered when the user confirms the speech or picks a choice /// /// If the dialogue implementation uses clickable or otherwise interactive UI, /// this event will fire when the user either clicks the speech panel (when /// no choices are being presented) or one of the choice buttons. /// event Action Selected; /// Displays text spoken or thought by a character /// Text that will be displayed /// /// This opens the speech panel if it was hidden or replaces the text /// currently being shown in the speech panel if it was visible. /// void ShowSpeech(string text); /// Lets the player make a choice /// Choices the player can select from /// /// This displays the choice buttons and hides the speech panel if it was /// visible. Use if the player is confronted with a self-explaining choice. /// void ShowChoices(string[] choices); /// /// Displays text spoken or thought by a character (or the player) and lets /// the player make a choice /// /// Text that will be displayed /// Choices the player can select from /// /// This opens the speech panel or replaces the text in it just like /// the method, but in addition to that also /// displays choices so the player can make a choice in response or /// following the text shown in the speech panel. /// void ShowSpeechAndChoices(string speech, string[] choices); /// Hides the dialogue and choice void Hide(); /// Picks a choice as if the user had clicked on a choice button /// Index of the choice that has been selected /// /// Use this to make the dialogue canvas act as if the user had made /// a choice or clicked the speech panel. The main purpose of this method is to /// support input outside of the UI panel - i.e. keyboard shortcuts or even /// interactions with the game world. /// void Select(int choiceIndex); } } // namespace Framework.Dialogue