Dialogue Boxes - UQdeco2800/2021-studio-6 GitHub Wiki
Description
A dialogue box is a UIComponent that displays a pre-written set of text, primarily spoken by a character.
How to create a dialogue box
To create a dialogue box, use the DialogueBoxFactory methods to create one. Provide it with dialogue by using:
- A semicolon delimited string (Depreciated)
- A Dialogue Object (which is created by a list of strings)
To create a dialogue box with an image, create a DialogueImage in place of an ordinary dialogue and provide it with a list of text and a list of image paths from the dialogue texture atlas. The images available in the atlas are:
- player-portrait
The DialogueBoxFactory methods will return an entity which then will need to be registered with the entity service. The dialogue box will then dispose itself once all of the text in dialogue has passed.
The debug function "printDialogue" will create and display a dialogue. Example usage: "printDialogue hello world;this is me speaking" will create a dialogue that first displays "hello world", then "this is me speaking", then closes on each SPACEBAR press.
The debug function "pd" will create and display the opening dialogue of the game including the player portrait.
How users use it
The SPACEBAR is used to advance dialogue. The dialogue box will disappear after the last dialogue.
Implementation
Components
Dialogue
Dialogue is a class that provides methods to store and forward text. Text is stored in a list, and takes in a list of strings to create the dialogue. Functionality is currently similar to an iterator, until more advanced functionality is needed.
DialogueImage
An extension of dialogue which adds a list of image paths in correspondence to the current dialogue being displayed.
UI Components
TextDialogueBox
A text dialogue box has the UI structure of:
DialogueInputComponent (Depreciated)
The input component listens for user input. On SPACEBAR, the "advanceDialogue" event is broadcasted. Depreciated in favour for the StoryInputConponent.
Forwarding and Disposing Dialogue (Depreciated)
The UI component of the dialogue (i.e. TextDialogueBox) will listen to the event "advanceDialogue" to forward dialogue. It will also broadcast "closeDialogue" which is received by the entity created by DialogueBoxFactory. The dialogue box entity will then dispose itself. Depreciated in favour for StoryInputConponent