Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.DialogSystem Class Reference

Drives UI and control for showing dialogs. If there's one of these in the scene you can use it to show all dialogs or you can set up different types of dialogs by including multiple instances. Dialog triggering events will drive the DialogSystem marked as default. More...

Inheritance diagram for PlatformerPro.DialogSystem:
PlatformerPro.PlatformerProMonoBehaviour

Public Member Functions

virtual void StartDialog (Character character)
 Show the default dialog. More...
 
virtual void StartDialog (Character character, DialogGraph dialog)
 Show the specified dialog. More...
 
virtual void EndDialog ()
 
virtual void UpdateCharacterPortrait (Sprite sprite)
 Update the portrait for character. More...
 
virtual void UpdateOtherPortrait (Sprite sprite)
 Update the portrait for other. More...
 
virtual void Step (int option)
 
- Public Member Functions inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual void Validate (PlatformerProMonoBehaviour myTarget)
 Override this method if you want to provide custom validation. The actual code should be surrounded by the if UNITY_EDITOR / endif directive. More...
 

Public Attributes

DialogGraph defaultDialog
 
bool isDefault = true
 If true this is the default dialog system that will be used for default dialog actions. More...
 
GameObject visibleContent
 Content to show/hide when dialog starts/ends. More...
 
GameObject characterContent
 Content to show/hide when character is talking. Can be null. More...
 
Text characterText
 Text field which holds the character dialog. This can be the same as the other text if you want to use a shared text area. More...
 
Image characterPortrait
 If non-null dialog graphs can update the character portrait by changing this image. More...
 
GameObject otherContent
 Content to show/hide when other is talking. Can be null. More...
 
Text otherText
 Text field which holds the other dialog. This can be the same as the character text if you want to use a shared text area. More...
 
Image otherPortrait
 If non-null dialog graphs can update the character portrait by changing this image. More...
 
GameObject optionContent
 Content to show/hide when options are being displayed. Can be null. More...
 
GameObject optionTextParent
 GameObject which has child GameObjects which have a Text Component. These will be used to show options. They are often part of a grid. More...
 
Color optionColor = Color.white
 Color for text on the options. More...
 
Color selectedOptionColor = Color.yellow
 Color for text on the selected option More...
 
GameObject optionPointer
 GameObject to use as a pointer to the selected option (leave empty for no pointer). It will be moved to the same RectTransform position as the selected option. More...
 
Input input
 What animation should we trigger. Note this requires a Special Move Play Animation to be attached to each character. Use NONE to allow characters to keep moving during dialog. More...
 
AnimationState dialogAnimation = AnimationState.IDLE
 
bool dialogTriggersPause
 "If true this dialog will trigger a pause - and still be functional while the game is paused. Note: this wont who pause menu. More...
 
bool showDialogOnStartup
 If true we show this dialog on start (technically on CharacterLoad). More...
 

Protected Member Functions

void OnDialogEvent (string eventId)
 Raise the DialogEvents More...
 
virtual void Init ()
 
virtual void HandleCharacterLoaded (object sender, CharacterEventArgs e)
 If we start automtically we use this event handler to show the dialog. More...
 
IEnumerator DoEndAfterDelay ()
 Pause after one frame to delay to consume the input. More...
 
virtual void Step ()
 
virtual void CheckForInput ()
 
virtual void DoNodeActions (Node node)
 
virtual void ShowCurrentNode ()
 
virtual void ShowCharacterContent (string text)
 
virtual void ShowOptions (OptionWithCondition[] options)
 
virtual IEnumerator UpdateOptionDisplayAfterDelay (int previous, int current)
 
virtual void UpdateOptionDisplay (int previous, int current)
 
virtual void ShowOtherContent (string text)
 
virtual void HideCharacterContent ()
 
virtual void HideOtherContent ()
 
virtual void HideOptions ()
 

Protected Attributes

Character character
 Character that start dialog More...
 
Text[] optionTexts
 Cache of the texts found inside the option optionTextParent. More...
 
OptionState optionState = OptionState.NONE
 Are we about to show, or showing options? More...
 
int selectedOption
 Which option is selected? More...
 
int optionCount
 How many options in total? More...
 
List< int > optionIndexes
 Relate options to option texts (included because you can hide options with conditions so its not a 1 to 1 mapping). More...
 
DialogNode currentNode
 Where are we in the dialog graph? More...
 
UIDialogTyper characterTyper
 If we are using typers rather thn text fields, this is the typer reference for the character dialog. More...
 
UIDialogTyper otherTyper
 If we are using typers rather thn text fields, this is the typer reference for the other dialog. More...
 
bool shouldCheckForInput
 Are we currently accepting input? More...
 
DialogGraph currentDialog
 Dialog graph we are currently showing. More...
 

Properties

override string Header [get]
 
static DialogSystem Instance [get, protected set]
 
- Properties inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual string Header [get]
 Gets the header string used to describe the component. More...
 
virtual string DocLink [get]
 Gets a link to documentation site. More...
 
virtual string VideoLink [get]
 Gets a link to a youtube video. More...
 
virtual string Deprecated [get]
 If non-null this component is deprecated. The string shows a message indicating how it should be replaced. More...
 

Events

System.EventHandler< DialogEventArgsDialogEvent
 Sender for dialog events More...
 

Detailed Description

Drives UI and control for showing dialogs. If there's one of these in the scene you can use it to show all dialogs or you can set up different types of dialogs by including multiple instances. Dialog triggering events will drive the DialogSystem marked as default.

Member Function Documentation

◆ CheckForInput()

virtual void PlatformerPro.DialogSystem.CheckForInput ( )
protectedvirtual

◆ DoEndAfterDelay()

IEnumerator PlatformerPro.DialogSystem.DoEndAfterDelay ( )
protected

Pause after one frame to delay to consume the input.

◆ DoNodeActions()

virtual void PlatformerPro.DialogSystem.DoNodeActions ( Node  node)
protectedvirtual

◆ EndDialog()

virtual void PlatformerPro.DialogSystem.EndDialog ( )
virtual

◆ HandleCharacterLoaded()

virtual void PlatformerPro.DialogSystem.HandleCharacterLoaded ( object  sender,
CharacterEventArgs  e 
)
protectedvirtual

If we start automtically we use this event handler to show the dialog.

◆ HideCharacterContent()

virtual void PlatformerPro.DialogSystem.HideCharacterContent ( )
protectedvirtual

◆ HideOptions()

virtual void PlatformerPro.DialogSystem.HideOptions ( )
protectedvirtual

◆ HideOtherContent()

virtual void PlatformerPro.DialogSystem.HideOtherContent ( )
protectedvirtual

◆ Init()

virtual void PlatformerPro.DialogSystem.Init ( )
protectedvirtual

◆ OnDialogEvent()

void PlatformerPro.DialogSystem.OnDialogEvent ( string  eventId)
protected

Raise the DialogEvents

Parameters
eventId

◆ ShowCharacterContent()

virtual void PlatformerPro.DialogSystem.ShowCharacterContent ( string  text)
protectedvirtual

◆ ShowCurrentNode()

virtual void PlatformerPro.DialogSystem.ShowCurrentNode ( )
protectedvirtual

◆ ShowOptions()

virtual void PlatformerPro.DialogSystem.ShowOptions ( OptionWithCondition[]  options)
protectedvirtual

◆ ShowOtherContent()

virtual void PlatformerPro.DialogSystem.ShowOtherContent ( string  text)
protectedvirtual

◆ StartDialog() [1/2]

virtual void PlatformerPro.DialogSystem.StartDialog ( Character  character)
virtual

Show the default dialog.

Parameters
characterCharacter who started the dialog.

◆ StartDialog() [2/2]

virtual void PlatformerPro.DialogSystem.StartDialog ( Character  character,
DialogGraph  dialog 
)
virtual

Show the specified dialog.

Parameters
characterCharacter who started the dialog.
dialogDialog to show.

◆ Step() [1/2]

virtual void PlatformerPro.DialogSystem.Step ( )
protectedvirtual

◆ Step() [2/2]

virtual void PlatformerPro.DialogSystem.Step ( int  option)
virtual

◆ UpdateCharacterPortrait()

virtual void PlatformerPro.DialogSystem.UpdateCharacterPortrait ( Sprite  sprite)
virtual

Update the portrait for character.

Parameters
spriteSprite to use.

◆ UpdateOptionDisplay()

virtual void PlatformerPro.DialogSystem.UpdateOptionDisplay ( int  previous,
int  current 
)
protectedvirtual

◆ UpdateOptionDisplayAfterDelay()

virtual IEnumerator PlatformerPro.DialogSystem.UpdateOptionDisplayAfterDelay ( int  previous,
int  current 
)
protectedvirtual

◆ UpdateOtherPortrait()

virtual void PlatformerPro.DialogSystem.UpdateOtherPortrait ( Sprite  sprite)
virtual

Update the portrait for other.

Parameters
spriteSprite to use.

Member Data Documentation

◆ character

Character PlatformerPro.DialogSystem.character
protected

Character that start dialog

◆ characterContent

GameObject PlatformerPro.DialogSystem.characterContent

Content to show/hide when character is talking. Can be null.

◆ characterPortrait

Image PlatformerPro.DialogSystem.characterPortrait

If non-null dialog graphs can update the character portrait by changing this image.

◆ characterText

Text PlatformerPro.DialogSystem.characterText

Text field which holds the character dialog. This can be the same as the other text if you want to use a shared text area.

◆ characterTyper

UIDialogTyper PlatformerPro.DialogSystem.characterTyper
protected

If we are using typers rather thn text fields, this is the typer reference for the character dialog.

◆ currentDialog

DialogGraph PlatformerPro.DialogSystem.currentDialog
protected

Dialog graph we are currently showing.

◆ currentNode

DialogNode PlatformerPro.DialogSystem.currentNode
protected

Where are we in the dialog graph?

◆ defaultDialog

DialogGraph PlatformerPro.DialogSystem.defaultDialog

◆ dialogAnimation

AnimationState PlatformerPro.DialogSystem.dialogAnimation = AnimationState.IDLE

◆ dialogTriggersPause

bool PlatformerPro.DialogSystem.dialogTriggersPause

"If true this dialog will trigger a pause - and still be functional while the game is paused. Note: this wont who pause menu.

◆ input

Input PlatformerPro.DialogSystem.input

What animation should we trigger. Note this requires a Special Move Play Animation to be attached to each character. Use NONE to allow characters to keep moving during dialog.

◆ isDefault

bool PlatformerPro.DialogSystem.isDefault = true

If true this is the default dialog system that will be used for default dialog actions.

◆ optionColor

Color PlatformerPro.DialogSystem.optionColor = Color.white

Color for text on the options.

◆ optionContent

GameObject PlatformerPro.DialogSystem.optionContent

Content to show/hide when options are being displayed. Can be null.

◆ optionCount

int PlatformerPro.DialogSystem.optionCount
protected

How many options in total?

◆ optionIndexes

List<int> PlatformerPro.DialogSystem.optionIndexes
protected

Relate options to option texts (included because you can hide options with conditions so its not a 1 to 1 mapping).

◆ optionPointer

GameObject PlatformerPro.DialogSystem.optionPointer

GameObject to use as a pointer to the selected option (leave empty for no pointer). It will be moved to the same RectTransform position as the selected option.

◆ optionState

OptionState PlatformerPro.DialogSystem.optionState = OptionState.NONE
protected

Are we about to show, or showing options?

◆ optionTextParent

GameObject PlatformerPro.DialogSystem.optionTextParent

GameObject which has child GameObjects which have a Text Component. These will be used to show options. They are often part of a grid.

◆ optionTexts

Text [] PlatformerPro.DialogSystem.optionTexts
protected

Cache of the texts found inside the option optionTextParent.

◆ otherContent

GameObject PlatformerPro.DialogSystem.otherContent

Content to show/hide when other is talking. Can be null.

◆ otherPortrait

Image PlatformerPro.DialogSystem.otherPortrait

If non-null dialog graphs can update the character portrait by changing this image.

◆ otherText

Text PlatformerPro.DialogSystem.otherText

Text field which holds the other dialog. This can be the same as the character text if you want to use a shared text area.

◆ otherTyper

UIDialogTyper PlatformerPro.DialogSystem.otherTyper
protected

If we are using typers rather thn text fields, this is the typer reference for the other dialog.


◆ selectedOption

int PlatformerPro.DialogSystem.selectedOption
protected

Which option is selected?

◆ selectedOptionColor

Color PlatformerPro.DialogSystem.selectedOptionColor = Color.yellow

Color for text on the selected option

◆ shouldCheckForInput

bool PlatformerPro.DialogSystem.shouldCheckForInput
protected

Are we currently accepting input?

◆ showDialogOnStartup

bool PlatformerPro.DialogSystem.showDialogOnStartup

If true we show this dialog on start (technically on CharacterLoad).

◆ visibleContent

GameObject PlatformerPro.DialogSystem.visibleContent

Content to show/hide when dialog starts/ends.

Property Documentation

◆ Header

override string PlatformerPro.DialogSystem.Header
get

◆ Instance

DialogSystem PlatformerPro.DialogSystem.Instance
staticgetprotected set

Event Documentation

◆ DialogEvent

System.EventHandler<DialogEventArgs> PlatformerPro.DialogSystem.DialogEvent

Sender for dialog events


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