PixelCrushers.DialogueSystem.UnityUIDialogueUI Class Reference

This component implements IDialogueUI using Unity UI. More...

Inheritance diagram for PixelCrushers.DialogueSystem.UnityUIDialogueUI:
Collaboration diagram for PixelCrushers.DialogueSystem.UnityUIDialogueUI:

Public Member Functions

override void Awake ()
 Sets up the component. More...
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 
OverrideUnityUIDialogueControls FindActorOverride (Transform actor)
 
void OnSceneLoaded (UnityEngine.SceneManagement.Scene scene, UnityEngine.SceneManagement.LoadSceneMode mode)
 
override void Open ()
 Opens the conversation GUI. More...
 
override void ShowAlert (string message, float duration)
 Shows an alert. More...
 
override void ShowSubtitle (Subtitle subtitle)
 Shows the subtitle (NPC or PC) based on the character type. More...
 
void CheckSubtitleAutoFocus (Subtitle subtitle)
 
override void HideSubtitle (Subtitle subtitle)
 Hides the subtitle based on its character type (PC or NPC). More...
 
override void ShowResponses (Subtitle subtitle, Response[] responses, float timeout)
 Shows the player responses menu. More...
 
void CheckResponseMenuAutoFocus ()
 
override void HideResponses ()
 Hides the player response menu. More...
 
void ClearSelection ()
 
override void Update ()
 Updates this instance by hiding the alert message when it's done. More...
 
- Public Member Functions inherited from PixelCrushers.DialogueSystem.AbstractDialogueUI
virtual void Start ()
 Starts this instance by hiding everything. More...
 
virtual void Close ()
 Closes the conversation GUI. More...
 
virtual void HideAlert ()
 Hides the alert if it's showing. More...
 
virtual void ShowContinueButton (Subtitle subtitle)
 Shows the continue button. More...
 
virtual void HideContinueButton (Subtitle subtitle)
 Hides the continue button. More...
 
virtual void ShowQTEIndicator (int index)
 Shows a QTE indicator. More...
 
virtual void HideQTEIndicator (int index)
 Hides a QTE indicator. More...
 
virtual void OnClick (object data)
 Handles response button clicks. More...
 
virtual void OnContinue ()
 Handles the continue button being clicked. More...
 
virtual void OnContinueAlert ()
 
virtual void OnContinueConversation ()
 
virtual void SetPCPortrait (Texture2D portraitTexture, string portraitName)
 Sets the PC portrait name and texture. More...
 
virtual void SetActorPortraitTexture (string actorName, Texture2D portraitTexture)
 Sets the portrait texture for an actor. More...
 

Public Attributes

UnityUIRoot unityUIRoot
 The UI root. More...
 
UnityUIDialogueControls dialogue
 The dialogue controls used in conversations. More...
 
UnityEngine.UI.Graphic[] qteIndicators
 QTE (Quick Time Event) indicators. More...
 
UnityUIAlertControls alert
 The alert message controls. More...
 
bool autoFocus = false
 Set true to always keep a control focused; useful for gamepads. More...
 
bool allowStealFocus = false
 Allow the dialogue UI to steal focus if a non-dialogue UI panel has it. More...
 
float autoFocusCheckFrequency = 0.5f
 If auto focusing, check on this frequency in seconds that the control is focused. More...
 
bool findActorOverrides = true
 Set true to look for OverrideUnityUIDialogueControls on actors. More...
 
bool addEventSystemIfNeeded = true
 Set true to add an EventSystem if one isn't in the scene. More...
 

Protected Member Functions

void SetIsShowingSubtitle (Subtitle subtitle, bool value)
 
- Protected Member Functions inherited from PixelCrushers.DialogueSystem.AbstractDialogueUI
virtual void SetSubtitle (Subtitle subtitle, bool value)
 Sets a subtitle's content and visibility. More...
 

Protected Attributes

UnityUISubtitleControls originalNPCSubtitle
 
UnityUISubtitleControls originalPCSubtitle
 
UnityUIResponseMenuControls originalResponseMenu
 
int alertQueueCount = 0
 
bool alertIsVisible
 
bool alertIsHiding
 

Properties

override AbstractUIRoot UIRoot [get]
 
override AbstractDialogueUIControls Dialogue [get]
 
override AbstractUIQTEControls QTEs [get]
 
override AbstractUIAlertControls Alert [get]
 
- Properties inherited from PixelCrushers.DialogueSystem.AbstractDialogueUI
abstract AbstractUIRoot UIRoot [get]
 Gets the user interface root. More...
 
abstract AbstractDialogueUIControls Dialogue [get]
 Gets the dialogue controls. More...
 
abstract AbstractUIQTEControls QTEs [get]
 Gets the QTE (Quick Time Event) indicators. More...
 
abstract AbstractUIAlertControls Alert [get]
 Gets the alert message controls. More...
 
bool IsOpen [get, set]
 Gets or sets a value indicating whether the dialogue UI (conversation interface) is open. More...
 
virtual bool AreNonDialogueControlsVisible [get]
 Gets a value indicating whether non-conversation controls (e.g., alert message or QTEs) are visible. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from PixelCrushers.DialogueSystem.AbstractDialogueUI
static Texture2D GetValidPortraitTexture (string actorName, Texture2D portraitTexture)
 Gets a valid portrait texture. More...
 
- Events inherited from PixelCrushers.DialogueSystem.AbstractDialogueUI
EventHandler< SelectedResponseEventArgsSelectedResponseHandler
 Occurs when the player selects a response. More...
 
- Events inherited from PixelCrushers.DialogueSystem.IDialogueUI
EventHandler< SelectedResponseEventArgsSelectedResponseHandler
 Your implementation must define this event and make it public. More...
 

Detailed Description

This component implements IDialogueUI using Unity UI.

It's based on AbstractDialogueUI and compiles the Unity UI versions of the controls defined in UnityUISubtitleControls, UnityUIResponseMenuControls, UnityUIAlertControls, etc.

To use this component, build a UI layout (or drag a pre-built one in the Prefabs folder into your scene) and assign the UI control properties. You must assign a scene instance to the DialogueManager; you can't use prefabs with Unity UI dialogue UIs.

The required controls are:

  • NPC subtitle line
  • PC subtitle line
  • Response menu buttons

The other control properties are optional. This component will activate and deactivate controls as they are needed in the conversation.

Member Function Documentation

◆ Awake()

override void PixelCrushers.DialogueSystem.UnityUIDialogueUI.Awake ( )
virtual

Sets up the component.

Reimplemented from PixelCrushers.DialogueSystem.AbstractDialogueUI.

◆ CheckResponseMenuAutoFocus()

void PixelCrushers.DialogueSystem.UnityUIDialogueUI.CheckResponseMenuAutoFocus ( )

◆ CheckSubtitleAutoFocus()

void PixelCrushers.DialogueSystem.UnityUIDialogueUI.CheckSubtitleAutoFocus ( Subtitle  subtitle)

◆ ClearSelection()

void PixelCrushers.DialogueSystem.UnityUIDialogueUI.ClearSelection ( )

◆ FindActorOverride()

OverrideUnityUIDialogueControls PixelCrushers.DialogueSystem.UnityUIDialogueUI.FindActorOverride ( Transform  actor)

◆ HideResponses()

override void PixelCrushers.DialogueSystem.UnityUIDialogueUI.HideResponses ( )
virtual

Hides the player response menu.

Reimplemented from PixelCrushers.DialogueSystem.AbstractDialogueUI.

◆ HideSubtitle()

override void PixelCrushers.DialogueSystem.UnityUIDialogueUI.HideSubtitle ( Subtitle  subtitle)
virtual

Hides the subtitle based on its character type (PC or NPC).

Parameters
subtitleSubtitle to hide.

Reimplemented from PixelCrushers.DialogueSystem.AbstractDialogueUI.

◆ OnDisable()

virtual void PixelCrushers.DialogueSystem.UnityUIDialogueUI.OnDisable ( )
virtual

◆ OnEnable()

virtual void PixelCrushers.DialogueSystem.UnityUIDialogueUI.OnEnable ( )
virtual

◆ OnSceneLoaded()

void PixelCrushers.DialogueSystem.UnityUIDialogueUI.OnSceneLoaded ( UnityEngine.SceneManagement.Scene  scene,
UnityEngine.SceneManagement.LoadSceneMode  mode 
)

◆ Open()

override void PixelCrushers.DialogueSystem.UnityUIDialogueUI.Open ( )
virtual

Opens the conversation GUI.

Reimplemented from PixelCrushers.DialogueSystem.AbstractDialogueUI.

Reimplemented in PixelCrushers.DialogueSystem.RPGKit.RPGKitDialogueUI.

◆ SetIsShowingSubtitle()

void PixelCrushers.DialogueSystem.UnityUIDialogueUI.SetIsShowingSubtitle ( Subtitle  subtitle,
bool  value 
)
protected

◆ ShowAlert()

override void PixelCrushers.DialogueSystem.UnityUIDialogueUI.ShowAlert ( string  message,
float  duration 
)
virtual

Shows an alert.

Parameters
messageMessage to show.
durationDuration in seconds.

Reimplemented from PixelCrushers.DialogueSystem.AbstractDialogueUI.

Reimplemented in PixelCrushers.DialogueSystem.RPGKit.RPGKitDialogueUI.

◆ ShowResponses()

override void PixelCrushers.DialogueSystem.UnityUIDialogueUI.ShowResponses ( Subtitle  subtitle,
Response[]  responses,
float  timeout 
)
virtual

Shows the player responses menu.

Parameters
subtitleThe last subtitle, shown as a reminder.
responsesResponses.
timeoutIf 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.

Reimplemented from PixelCrushers.DialogueSystem.AbstractDialogueUI.

◆ ShowSubtitle()

override void PixelCrushers.DialogueSystem.UnityUIDialogueUI.ShowSubtitle ( Subtitle  subtitle)
virtual

Shows the subtitle (NPC or PC) based on the character type.

Parameters
subtitleSubtitle to show.

Reimplemented from PixelCrushers.DialogueSystem.AbstractDialogueUI.

◆ Update()

override void PixelCrushers.DialogueSystem.UnityUIDialogueUI.Update ( )
virtual

Updates this instance by hiding the alert message when it's done.

Reimplemented from PixelCrushers.DialogueSystem.AbstractDialogueUI.

Member Data Documentation

◆ addEventSystemIfNeeded

bool PixelCrushers.DialogueSystem.UnityUIDialogueUI.addEventSystemIfNeeded = true

Set true to add an EventSystem if one isn't in the scene.

◆ alert

UnityUIAlertControls PixelCrushers.DialogueSystem.UnityUIDialogueUI.alert

The alert message controls.

◆ alertIsHiding

bool PixelCrushers.DialogueSystem.UnityUIDialogueUI.alertIsHiding
protected

◆ alertIsVisible

bool PixelCrushers.DialogueSystem.UnityUIDialogueUI.alertIsVisible
protected

◆ alertQueueCount

int PixelCrushers.DialogueSystem.UnityUIDialogueUI.alertQueueCount = 0
protected

◆ allowStealFocus

bool PixelCrushers.DialogueSystem.UnityUIDialogueUI.allowStealFocus = false

Allow the dialogue UI to steal focus if a non-dialogue UI panel has it.

◆ autoFocus

bool PixelCrushers.DialogueSystem.UnityUIDialogueUI.autoFocus = false

Set true to always keep a control focused; useful for gamepads.

◆ autoFocusCheckFrequency

float PixelCrushers.DialogueSystem.UnityUIDialogueUI.autoFocusCheckFrequency = 0.5f

If auto focusing, check on this frequency in seconds that the control is focused.

◆ dialogue

UnityUIDialogueControls PixelCrushers.DialogueSystem.UnityUIDialogueUI.dialogue

The dialogue controls used in conversations.

◆ findActorOverrides

bool PixelCrushers.DialogueSystem.UnityUIDialogueUI.findActorOverrides = true

Set true to look for OverrideUnityUIDialogueControls on actors.

◆ originalNPCSubtitle

UnityUISubtitleControls PixelCrushers.DialogueSystem.UnityUIDialogueUI.originalNPCSubtitle
protected

◆ originalPCSubtitle

UnityUISubtitleControls PixelCrushers.DialogueSystem.UnityUIDialogueUI.originalPCSubtitle
protected

◆ originalResponseMenu

UnityUIResponseMenuControls PixelCrushers.DialogueSystem.UnityUIDialogueUI.originalResponseMenu
protected

◆ qteIndicators

UnityEngine.UI.Graphic [] PixelCrushers.DialogueSystem.UnityUIDialogueUI.qteIndicators

QTE (Quick Time Event) indicators.

◆ unityUIRoot

UnityUIRoot PixelCrushers.DialogueSystem.UnityUIDialogueUI.unityUIRoot

The UI root.

Property Documentation

◆ Alert

override AbstractUIAlertControls PixelCrushers.DialogueSystem.UnityUIDialogueUI.Alert
get

◆ Dialogue

override AbstractDialogueUIControls PixelCrushers.DialogueSystem.UnityUIDialogueUI.Dialogue
get

◆ QTEs

override AbstractUIQTEControls PixelCrushers.DialogueSystem.UnityUIDialogueUI.QTEs
get

◆ UIRoot

override AbstractUIRoot PixelCrushers.DialogueSystem.UnityUIDialogueUI.UIRoot
get

The documentation for this class was generated from the following file: