using System; using UnityEngine; using Framework.Async; namespace Framework.Dialogue2 { /// Static or animated dialogue canvas the user can interact with /// /// /// 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 speech dialogue 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. /// /// /// When choices are available, the parameter will be the zero-based index of /// the picked choice. When only speech is displayed, the parameter will have /// a value of -1. /// /// event Action Selected; #if false // Current plan was to fire a 'Selected' event instead? Good/bad? /// Triggered when the dialogue has completed its fade-out animation /// /// If you want to wait with an in-game action until the dialogue has fully /// disappeared, this event will do the trick. It may be fired instantly /// (and possibly from the call) if no animation is used. /// event Action Hidden; #endif /// Current visibility state of the canvas IDialogueCanvasVisibility Visibility { get; } /// Current placement of the canvas within the scene IDialogueCanvasPlacement Placement { get; } /// 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. /// /// /// If the canvas is animated, the change may not take place instantly /// (but you should expect the event at any time after /// this call). /// /// void ShowSpeech(IDialogueText speech); /// 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. /// /// /// If the canvas is animated, the change may not take place instantly /// (but you should expect the event at any time after /// this call). /// /// void ShowChoices(ArraySegment 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. /// /// /// If the canvas is animated, the change may not /// take place instantly (but you should expect the /// event at any time after this call). /// /// void ShowSpeechAndChoices(IDialogueText speech, ArraySegment choices); /// Hides the dialogue and choice /// /// If the canvas is animated, the change may not /// take place instantly (but you should expect the /// event at any time after this call). /// 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.Dialogue2