A line of text including formatting. More...
Public Member Functions | |
FormattedText (string text=null, Emphasis[] emphases=null, bool italic=false, int position=NoAssignedPosition, bool forceMenu=true, int pic=NoPicOverride, int picActor=NoPicOverride, int picConversant=NoPicOverride, string variableInputPrompt=null) | |
Initializes a new FormattedText. More... | |
Static Public Member Functions | |
static FormattedText | Parse (string rawText, EmphasisSetting[] emphasisSettings) |
Parses the text from a dialogue entry, which may contain formatting codes, and returns a FormattedText. More... | |
static string | ParseCode (string rawText) |
Replaces var and lua markup tags in text. More... | |
static FontStyle | GetFontStyle (Emphasis emphasis) |
Gets the Unity FonyStyle represented by an emphasis. More... | |
Static Public Attributes | |
static readonly FormattedText | empty = new FormattedText() |
Represents an empty line. More... | |
static readonly Emphasis[] | noEmphases = new Emphasis[0] |
Represents an empty set of emphases. More... | |
const int | NoAssignedPosition = -1 |
Constant: indicates that the response has no specifically-assigned position and can be placed anywhere in the player response menu. More... | |
const int | NoPicOverride = 0 |
Constant: indicates that there is no picture override for this pic tag. More... | |
Properties | |
string | text [get, set] |
Gets or sets the "clean" line of text, without formatting codes. More... | |
Emphasis[] | emphases [get, set] |
Gets or sets the list of emphases. More... | |
bool | italic [get, set] |
Gets or sets a value indicating to display the entire line in italics. More... | |
int | position [get, set] |
Gets or sets the response button position, for response text. More... | |
bool | forceMenu [get, set] |
Gets or sets a value indicating whether this response forces display of the response menu, even if there's only one response. More... | |
int | pic [get, set] |
Gets or sets the [pic=#] value. More... | |
int | picActor [get, set] |
Gets or sets the [pica=#] value. More... | |
int | picConversant [get, set] |
Gets or sets the [picc=#] value. More... | |
string | variableInputPrompt [get, set] |
Gets or sets the variable input prompt. More... | |
bool | hasVariableInputPrompt [get] |
Returns true if the formatted text includes a variable input prompt. More... | |
A line of text including formatting.
Chat Mapper and the dialogue system support formatting codes inside lines of dialogue. This class represents a line where the formatting codes have been extracted and stored in separate formatting variables (emphases and italic).
PixelCrushers.DialogueSystem.FormattedText.FormattedText | ( | string | text = null , |
Emphasis[] | emphases = null , |
||
bool | italic = false , |
||
int | position = NoAssignedPosition , |
||
bool | forceMenu = true , |
||
int | pic = NoPicOverride , |
||
int | picActor = NoPicOverride , |
||
int | picConversant = NoPicOverride , |
||
string | variableInputPrompt = null |
||
) |
Initializes a new FormattedText.
text | The clean line of text, without formatting codes. |
emphases | Emphases. |
italic | Italic. |
position | Position. |
forceMenu | Force menu. |
pic | The [pic] value, or 0 for unused. |
picActor | The [pica] value, or 0 for unused. |
picConversant | The [picc] value, or 0 for unused. |
|
static |
Gets the Unity FonyStyle represented by an emphasis.
emphasis | Emphasis. |
|
static |
Parses the text from a dialogue entry, which may contain formatting codes, and returns a FormattedText.
The Parse() method handles these tags:
"Hello, [varName=Actor]."
."Hello, [lua(Variable['Actor'])]."
. Lua tags are processed first, so your Lua code can return other formatting codes that will then be parsed properly.rawText | The raw text to parse. |
emphasisSettings | The emphasis settings to use (usually from DialogueManager.MasterDatabase) when parsing [em#] tags. |
|
static |
Replaces var and lua markup tags in text.
rawText | The raw text. |
|
static |
Represents an empty line.
|
static |
Constant: indicates that the response has no specifically-assigned position and can be placed anywhere in the player response menu.
Represents an empty set of emphases.
|
static |
Constant: indicates that there is no picture override for this pic tag.
|
getset |
Gets or sets the list of emphases.
An Emphasis specifies special formatting for a substring of the text.
The emphases.
|
getset |
Gets or sets a value indicating whether this response forces display of the response menu, even if there's only one response.
true
to force the response menu; otherwise, false
.
|
get |
Returns true
if the formatted text includes a variable input prompt.
true
if has variable input prompt; otherwise, false
.
|
getset |
Gets or sets a value indicating to display the entire line in italics.
true
if italic; otherwise, false
.
|
getset |
Gets or sets the [pic=#] value.
The pic index, where 0<c/c> means unused.
|
getset |
Gets or sets the [pica=#] value.
The pica index, where 0<c/c> means unused.
|
getset |
Gets or sets the [picc=#] value.
The picc index, where 0
means unused.
|
getset |
Gets or sets the response button position, for response text.
The position, or NoAssignedPosition if there's no [position #] tag in the text.
|
getset |
Gets or sets the "clean" line of text, without formatting codes.
The text.
|
getset |
Gets or sets the variable input prompt.
If this is set, the value is the name of the variable to prompt for input.
The variable name.