Class DialogueTopic
- Namespace
- SkyrimForge
- Assembly
- SkyrimForge.dll
A player dialogue topic in a dialogue branch that IDialogueBranchFactory creates.
public sealed class DialogueTopic
- Inheritance
-
DialogueTopic
- Inherited Members
Remarks
After a topic with no Choices that pass and with IsGoodbye false, the menu shows the branch's starting topic again.
Constructors
DialogueTopic(Func<Actor, string>)
Creates a topic whose text is computed each time the branch shows it, with no responses.
public DialogueTopic(Func<Actor, string> text)
Parameters
textFunc<Actor, string>Returns the text the dialogue menu shows for the speaker. It is called as computed responses are, and on each frame Condition is called. The game never frees the record created for each distinct text, so return few distinct texts.
Exceptions
- ArgumentNullException
textisnull.
DialogueTopic(Func<Actor, string>, IEnumerable<TopicResponse>)
Creates a topic whose text is computed each time the branch shows it, and whose responses are fixed.
public DialogueTopic(Func<Actor, string> text, IEnumerable<TopicResponse> responses)
Parameters
textFunc<Actor, string>Returns the text the dialogue menu shows, as DialogueTopic(Func<Actor, string>) describes.
responsesIEnumerable<TopicResponse>The responses, as DialogueTopic(string, IEnumerable<TopicResponse>) describes.
Exceptions
- ArgumentNullException
textorresponsesisnull.
DialogueTopic(Func<Actor, string>, Func<Actor, IEnumerable<TopicResponse>>)
Creates a topic whose text and responses are computed each time the branch shows it.
public DialogueTopic(Func<Actor, string> text, Func<Actor, IEnumerable<TopicResponse>> responses)
Parameters
textFunc<Actor, string>Returns the text the dialogue menu shows, as DialogueTopic(Func<Actor, string>) describes.
responsesFunc<Actor, IEnumerable<TopicResponse>>Returns the responses, as DialogueTopic(string, Func<Actor, IEnumerable<TopicResponse>>) describes.
Exceptions
- ArgumentNullException
textorresponsesisnull.
DialogueTopic(string)
Creates a topic with no responses.
public DialogueTopic(string text)
Parameters
textstringThe text the dialogue menu shows.
Exceptions
- ArgumentNullException
textisnull.
DialogueTopic(string, IEnumerable<TopicResponse>)
Creates a topic whose responses are fixed.
public DialogueTopic(string text, IEnumerable<TopicResponse> responses)
Parameters
textstringThe text the dialogue menu shows.
responsesIEnumerable<TopicResponse>The responses. A string converts to an unvoiced response.
Exceptions
- ArgumentNullException
textorresponsesisnull.
DialogueTopic(string, Func<Actor, IEnumerable<TopicResponse>>)
Creates a topic whose responses are computed each time the branch shows it.
public DialogueTopic(string text, Func<Actor, IEnumerable<TopicResponse>> responses)
Parameters
textstringThe text the dialogue menu shows.
responsesFunc<Actor, IEnumerable<TopicResponse>>Returns the responses for the speaker. It is called each time the branch shows the topic, which for a choice follows the chosen topic's OnBegin.
Exceptions
- ArgumentNullException
textorresponsesisnull.
Properties
Choices
The topics shown once the player chooses this one, in the order the menu shows them.
public IList<DialogueTopic> Choices { get; }
Property Value
Remarks
Add choices before Create(string, DialogueTopic, Func<Actor, IEnumerable<TopicResponse>>?, Func<Actor, IEnumerable<TopicResponse>>?, bool, Quest?) is called. A change after it throws InvalidOperationException.
Condition
Returns whether the menu shows the topic for the speaker. A null value always shows the topic.
public Func<Actor, bool>? Condition { get; init; }
Property Value
Remarks
It is called on each frame for a topic the branch shows with no conversation open. For a choice, it is called once the topic before it is chosen, after that topic's OnBegin.
HidesOtherTopics
Whether the speaker's other topics are hidden while the branch shows this topic for that speaker.
public bool HidesOtherTopics { get; init; }
Property Value
Remarks
It hides the starting topics of the data files' top-level and blocking branches and the topics of every other branch a plugin creates. The topics of each branch that shows such a topic for the same speaker at the same time remain.
IsGoodbye
Whether the conversation ends after the speaker's responses, with no goodbye line from the game.
public bool IsGoodbye { get; init; }
Property Value
Remarks
The menu shows goodbye topics below all others, and each group in the order of Choices.
IsSaidOnce
Whether the topic is shown only until the player chooses it with the speaker, in this save and every later one.
public bool IsSaidOnce { get; init; }
Property Value
Remarks
The saved state records the speaker and the text shown when it was chosen, so a topic whose text changes is shown again, and it is shown again with another speaker. A chosen topic without this is shown again, dimmed as one the player has heard the response to.
OnBegin
Runs on the game's thread when the player chooses the topic, as the speaker's responses start.
public Func<DialogueTopicContext, Task>? OnBegin { get; init; }
Property Value
Remarks
The conditions of Choices are evaluated when it returns its task, so only state changed before its first await affects them. The branch awaits the task before OnEnd runs.
OnEnd
Runs once OnBegin has completed and the speaker's responses have ended or the conversation has closed, on the thread that completed the later of the two.
public Func<DialogueTopicContext, Task>? OnEnd { get; init; }
Property Value
Text
The text the dialogue menu shows. The value is null for a computed text.
public string? Text { get; }