Hi Mo,
Usually it goes the other way if at all, where a dev points the Dialogue System's engine output to their own custom UI. However, this is similar to what the Dialogue System's Ink integration does, so it's certainly possible.
First get a reference to your dialogue UI (i.e.,
StandardDialogueUI class).
Call its Open() method to open the dialogue UI.
To show a subtitle, call ShowSubtitle(Subtitle subtitle). You'll need to create a
Subtitle object. To hide it, call HideSubtitle(Subtitle subtitle) with the same object.
To show a response menu, call ShowResponses(Subtitle subtitle, Response[] responses, float timeout). You'll need to create an array of
Response objects. If you don't want the menu to be timed, pass zero for timeout. To hide the menu, call HideResponses().
When the player clicks on a response button, it normally calls back to the engine to decide what to show next. You'll want to tell it to call back to your own method instead. To do this, assign your method to the dialogue UI's SelectedResponseHandler delegate. For example, something like this:
Code: Select all
void OnConversationStart(Transform actor)
{
var dialogueUI = DialogueManager.dialogueUI as StandardDialogueUI;
dialogueUI.SelectedResponseHandler = OnSelectedResponse;
}
void OnSelectedResponse(object sender, SelectedResponseEventArgs args)
{
Debug.Log("Player selected response: " + args.response);
}
When you're done with the conversation, call the dialogue UI's Close() method.