The dialogue system is responsible for delivering information to the player, it’s responsible to show story dialogues, hints and controls assisting messages.
The dialogue system is divided into 3 sections
- The dialogue popup panel
- The dialogue popup manager
- The dialogue popup library (Contains story characters data, hints data and visual library)
First: The dialogue Popup Panel
The dialogue popup panel is the visual object prefab shows the injected data and behave differently depends on the type of the panel, we can use a single prefab for all types or have different prefab variants for the different types of the popup panel type.
Using prefab variants we can have multiple visual representation of the dialogue popup as for the dialogue popup data that can be injected through the manager which we will cover in a bit.
The dialogue popup prefab visual is divided into 2 main parts:
- Main Box
Shows the icon of the speaker (mainly would be the ship AI “Sylvia”), The name of the speaker and the actual speech, hint or any information we want to deliver to the player
- Side Box
Shows a supporting visual that explains the contents in the main box, the visual could be a video or an image. the visual is being queried from the library depends on the key for the content of the main box
The panel also plays Audio SFX/VO if provided and can be dismiss-able depends on type or data supplied from the manager.
Second: The dialogue popup manager
The manager controls the dialogue panel, inject it with the required data as well as instruct it to unique behaviors based on type. The manager allows instances for the dialogue panel based on type, that means we can display multiple panels at the same type as long as they are of different type.
The manager is also responsible for getting the correct info and visuals from the library to populate the panel as needed such as icon, title, text, audio, side box visual (image or video) based on the type of the popup.
The manager also trigger events on showing and hiding panels instances as well as passes the type and state of the panel instance. this is used for follow ups or add specific behaviors or actions depends on the panel instance state.
Third: The dialogue popup library
The popup library is a collection of multiple mappings for story characters data, hints data as well as a media/visual library that reference images and videos that’s used by the side box in the popup panel.
The library is divided into 2 main sections/mappings:
- The Dialogue data library
The data library is mapping for story character data which represents a character and it’s data (name, visual keys, speech keys, audio keys), and a hints data which represents a hint (the title, the content and the visuals).
The library allows adding entries through inspector and will be persisted to the `DialoguePopupDataLibrary.json` under streaming assets path.
we can also add info or edit the json directly and the inspector will refresh it self using the json as base.
- The dialogue visual library
The visual library is a collection for VisualDataEntries that is referenced via key for each dialogue key, the visual data entry contains an icon for the main box, a visual image and a video for the side box the image or video for the side box doesn’t need to be both populated only one will be shown anyway by default the image. so either can be null.
as for the icon if null will fall back to default icon instead.
The visual library is fully from inspector only just lick the ‘+‘ sign to add new entry and assign the values. and just supply the key to the popup manager to get the correct visuals. the Json only maps the visual entry keys, but the actual entries (icon, image and video) are only edited through the inspector later we can have the library as scriptable object and exported and edited as asset bundle
To use the Dialogue popup via code use: `UIManager.AimingSceneUI.DialoguePopupManager`
Comments are closed.