PixelCrushers.DialogueSystem.CSVConverterWindow Class Reference

This is an example converter that demonstrates how to make a subclass of AbstractConverterWindow to make your own converter for the Dialogue System. More...

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

Static Public Member Functions

static void Init ()
 Menu item code to create a CSVConverterWindow. More...
 

Protected Member Functions

override void DrawDestinationSection ()
 Draws the destination section. More...
 
override void CopySourceToDialogueDatabase (DialogueDatabase database)
 Copies the source CSV file to a dialogue database. More...
 
override void LoadSourceFile ()
 Loads the source file into memory. More...
 
- Protected Member Functions inherited from PixelCrushers.DialogueSystem.AbstractConverterWindow
virtual void ClearPrefs ()
 
virtual void LoadPrefs ()
 
virtual void SavePrefs ()
 
virtual void DrawControls ()
 Draws the contents of the converter window. More...
 
virtual void DrawSourceSection ()
 Draws the source section. More...
 
virtual void DrawOutputFolder ()
 Draws the output folder selection field. More...
 
virtual void DrawDatabaseFilename ()
 Draws the dialogue database save-to filename. More...
 
virtual void DrawEncodingPopup ()
 Draws the encoding type popup. More...
 
virtual void DrawOverwriteCheckbox ()
 Draws the overwrite checkbox, and merge checkbox if overwrite is ticked. More...
 
virtual void DrawConversionButtons ()
 Draws the conversion buttons. More...
 
virtual void DrawClearButton ()
 Draws the Clear button that clears the prefs. More...
 
virtual void DrawConvertButton ()
 Draws the Convert button that calls Convert(). More...
 
virtual bool IsReadyToConvert ()
 Determines whether the window is ready to convert. More...
 
virtual bool IsSourceAssigned ()
 Determines whether the source is assigned. More...
 
virtual void Convert ()
 Converts the source into a dialogue database. More...
 
virtual DialogueDatabase LoadOrCreateDatabase ()
 Loads the dialogue database if it already exists and overwrite is ticked; otherwise creates a new one. More...
 
virtual void TouchUpDialogueDatabase (DialogueDatabase database)
 Touches up dialogue database after conversion. More...
 
virtual void SetStartCutscenesToNone (DialogueDatabase database)
 Sets the START dialogue entries' Sequences to None(). More...
 
virtual void SetConversationStartCutsceneToNone (Conversation conversation)
 Sets a conversation's START entry's Sequence to None(). More...
 
virtual void FindPortraitTextures (DialogueDatabase database, string portraitFolder)
 Finds the actors' portrait textures, given a source portrait folder. More...
 
virtual void FindPortraitTexture (Actor actor, string portraitFolder)
 Finds an actor's portrait texture. More...
 
virtual bool IsSourceAtEnd ()
 Determines whether the source data's memory buffer is at the end. More...
 
virtual string PeekNextSourceLine ()
 Peeks the next source line without removing it from the buffer. More...
 
virtual string GetNextSourceLine ()
 Gets the next source line and removes it from the buffer. More...
 

Properties

override string SourceFileExtension [get]
 Gets the source file extension (CSV). More...
 
override string PrefsKey [get]
 Gets the EditorPrefs key to save the converter window's settings under. More...
 
- Properties inherited from PixelCrushers.DialogueSystem.AbstractConverterWindow
virtual string SourceFileExtension [get]
 Gets the source file extension. More...
 
virtual string PrefsKey [get]
 Gets the EditorPrefs key to save the converter window's settings under. More...
 
string currentSourceLine [get]
 The most recent line retrieved through the GetNextSourceLine() method. More...
 
int currentLineNumber [get]
 The line number in the source file of the current source line. More...
 

Additional Inherited Members

- Public Member Functions inherited from PixelCrushers.DialogueSystem.AbstractConverterWindow
virtual void OnEnable ()
 
virtual void OnDisable ()
 
virtual void OnGUI ()
 
- Protected Attributes inherited from PixelCrushers.DialogueSystem.AbstractConverterWindow
Prefs prefs = null
 The prefs for the converter window. More...
 
Template template = null
 A reference to the Dialogue System template, used to create new dialogue database assets such as Actors, Items, and Conversations. More...
 
Vector2 scrollPosition = Vector2.zero
 The current scroll position of the converter window. More...
 
List< string > sourceLines = new List<string>()
 The source lines. More...
 

Detailed Description

This is an example converter that demonstrates how to make a subclass of AbstractConverterWindow to make your own converter for the Dialogue System.

It converts CSV (comma-separated value) files in a specific format into a dialogue database.

In the CSV file, each section is optional. The sections are:

  • Database
  • Actors
  • Items (also used for quests)
  • Locations
  • Variables
  • Conversations (high level information about each conversation)
  • DialogueEntries (individual dialogue entries in the conversations)
  • OutgoingLinks (links between dialogue entries)

The Database section must contain:

Database
Name,Version,Author,Description,Emphasis1,Emphasis2,Emphasis3,Emphasis4
(name),(version),(author),(description),(emphasis setting 1 in format #rrggbbaa biu),(emphasis2),(emphasis3),(emphasis4)
Global User Script
(luacode)

The Actors section must contain:

Actors
ID,Portrait,AltPortraits,Name,Pictures,Description,IsPlayer
Number,Special,Special,Text,Files,Text,Boolean
(id),(texturename),[(texturenames)],(name),[(picturenames)],(description),(isplayer)
...

The Items, Locations, Variables, and Conversations section must contain:

(Heading) -- where this is Items, Locations, Variables, or Conversations
ID,(field),(field),(field)...
Number,(fieldtype),(fieldtype),(fieldtype)...
(id),(fieldvalue),(fieldvalue),(fieldvalue)...

The Variables section may have a final column InitialValueType that specifies the type (Text, Number, or Boolean).

The DialogueEntries section must contain:

DialogueEntries
entrytag,ConvID,ID,Actor,Conversant,MenuText,DialogueText,IsGroup,FalseConditionAction,ConditionPriority,Conditions,Script,Sequence,(field),(field)...,canvasRect
Text,Number,Number,Number,Number,Text,Text,Boolean,Special,Special,Text,Text,Text,(fieldtype),(fieldtype),...,Text
(entrytag),(ConvID),(ID),(ActorID),(ConversantID),(MenuText),(DialogueText),(IsGroup),(FalseConditionAction),(ConditionPriority),(Conditions),(Script),(Sequence),(fieldvalue),(fieldvalue)...,#;#

However canvasRect (the last column) is optional.

The OutgoingLinks section must contain:

OutgoingLinks
OriginConvID,OriginID,DestConvID,DestID,ConditionPriority
Number,Number,Number,Number,Special
#,#,#,#,(priority)

Omitted values in any particular asset should be tagged with "{{omit}}".

Member Function Documentation

◆ CopySourceToDialogueDatabase()

override void PixelCrushers.DialogueSystem.CSVConverterWindow.CopySourceToDialogueDatabase ( DialogueDatabase  database)
protectedvirtual

Copies the source CSV file to a dialogue database.

This method demonstrates the helper methods LoadSourceFile(), IsSourceAtEnd(), PeekNextSourceLine(), and GetNextSourceLine().

Parameters
databaseDialogue database to copy into.

Reimplemented from PixelCrushers.DialogueSystem.AbstractConverterWindow.

◆ DrawDestinationSection()

override void PixelCrushers.DialogueSystem.CSVConverterWindow.DrawDestinationSection ( )
protectedvirtual

Draws the destination section.

You can override this if you want to draw more than the default controls.

Reimplemented from PixelCrushers.DialogueSystem.AbstractConverterWindow.

◆ Init()

static void PixelCrushers.DialogueSystem.CSVConverterWindow.Init ( )
static

Menu item code to create a CSVConverterWindow.

◆ LoadSourceFile()

override void PixelCrushers.DialogueSystem.CSVConverterWindow.LoadSourceFile ( )
protectedvirtual

Loads the source file into memory.

Reimplemented from PixelCrushers.DialogueSystem.AbstractConverterWindow.

Property Documentation

◆ PrefsKey

override string PixelCrushers.DialogueSystem.CSVConverterWindow.PrefsKey
get

Gets the EditorPrefs key to save the converter window's settings under.

The EditorPrefs key.

◆ SourceFileExtension

override string PixelCrushers.DialogueSystem.CSVConverterWindow.SourceFileExtension
get

Gets the source file extension (CSV).

The source file extension (e.g., 'xml' for XML files).


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