Text Input

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Text Input

Post by Tony Li »

Here's an example scene if it's any help:

SkillPanelExample_2018-07-16.unitypackage
MathBlade
Posts: 12
Joined: Sun Jul 15, 2018 12:32 pm

Re: Text Input

Post by MathBlade »

I have built my own couple of panels.

For some reason the "required" command still doesn't seem to want to work. The SetActive(PanelName) does.

I guess my last question is after the user clicks on a button in my panel I have a function similar to

{{It's better named than this.}}
public void ButtonClick()
{
}

If I want to hook back into the dialogue system to a new conversation
Am I better A) Trying to find the database object attached to the manager and some how using a Start conversation method
or B) Somehow making a trigger similar to the tutorial videos?

(I'm asking for which the system is designed for and would be better performance wise/is possible)
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Text Input

Post by Tony Li »

MathBlade wrote: Tue Jul 17, 2018 1:14 amFor some reason the "required" command still doesn't seem to want to work. The SetActive(PanelName) does.
Does it work in the example scene in my last post?
MathBlade wrote: Tue Jul 17, 2018 1:14 amI guess my last question is after the user clicks on a button in my panel I have a function similar to

{{It's better named than this.}}
public void ButtonClick()
{
}

If I want to hook back into the dialogue system to a new conversation
Am I better A) Trying to find the database object attached to the manager and some how using a Start conversation method
or B) Somehow making a trigger similar to the tutorial videos?

(I'm asking for which the system is designed for and would be better performance wise/is possible)
In the example scene, the original conversation is still running. In this case, you wouldn't need to start a new conversation.

However, should you need to start a new conversation at some point, you have your choice of methods. In script, use DialogueManager.StopConversation() and DialogueManager.StartConversation():

Code: Select all

using PixelCrushers.DialogueSystem;
...
DialogueManager.StopConversation(); // Stop current conversation if any.
DialogueManager.StartConversation("My Conversation");
DialogueManager.StartConversation() has several optional parameters that you can use to specify the transforms of the actor and conversant, and a dialogue entry to start at.

If you want to set this up in a DIalogue System Trigger, set the trigger to OnUse, find the component, and call its OnUse() method.
MathBlade
Posts: 12
Joined: Sun Jul 15, 2018 12:32 pm

Re: Text Input

Post by MathBlade »

I can't access that link. I use firefox and it just displays a lot of characters. It doesn't let me download anything.

I guess just go ahead and close this and if I have future questions I'll ask.
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Text Input

Post by Tony Li »

Right-click on the link and select Save As...

It's a .unitypackage file. Import it into a Unity project.
MathBlade
Posts: 12
Joined: Sun Jul 15, 2018 12:32 pm

Re: Text Input

Post by MathBlade »

For what we're talking about kind of. I'll show you what I had in mind since I've got that going with a screenshot. The demo does launch the new panel correctly.

For the screenshot below, I have a separate panel that has just a "SetActive" command. Without the latter command in the sequence in loads. It's specifically with the register the panel stays invisible.


There is also another off topic bug with your example. (If it's because this was a fast mockup please disregard but if I use the demo project and type a name and press enter it works, but if I type a name and press continue it doesn't.)

Screenshot of WIP
Question Three.png
Question Three.png (58.12 KiB) Viewed 991 times
Mainly I wanted a UI in where the user makes a choice and presses continue at the bottom. It's much more natural and intuitive, similar to making a post on a forum. Asking a user to intuitively know to press continue at the upper right is actually shown to be a "deal breaker" for most people. If a UI isn't intuitive or what they expect (even if the system doesn't support that) then they can just walk away calling it ugly or not useful. (And yes I know the UI looks a bit ugly at the moment as I say that I'll make it better later. It's more a work in progress to show buttons)

I'd want the buttons to be in the bottom and be able to stack "custom" objects other than buttons by giving them a prefab. There is a TextInput that does take a custom prefab, but that's only with the actor and conversant a certain way and then there is no continue button or forced answer with that on the bottom.

If the NPC asks the player character "How many coins do you wish to give to the church?" (a la Baldur's Gate) Then I'd like to be able to have a simple incrementer UI spawn that handles that with a continue button at the bottom. Or other more complicated questions. Or
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Text Input

Post by Tony Li »

Hi,

Here's an updated example: SkillPanelExample_2018-07-18.unitypackage
MathBlade wrote: Tue Jul 17, 2018 10:40 pmFor the screenshot below, I have a separate panel that has just a "SetActive" command. Without the latter command in the sequence in loads. It's specifically with the register the panel stays invisible.
I think I follow you, but I have a question: In your scene, does the second command (with 'required' keyword) appear to make the panel immediately go invisible again? Or does it not take effect at all, and the panel stays visible? If it immediately goes invisible, would you please post the command here? Maybe there's a typo or small syntax issue.
MathBlade wrote: Tue Jul 17, 2018 10:40 pmThere is also another off topic bug with your example. (If it's because this was a fast mockup please disregard but if I use the demo project and type a name and press enter it works, but if I type a name and press continue it doesn't.)
I didn't want to complicate the mockup with the commands to handle this, but it's a good question, so I added it to the updated example. The solution is to disable continue button mode using SetContinueMode() so the only way to progress is to press enter:

Code: Select all

SetContinueMode(false);
TextInput(Text Field UI, Name, Name)
In the next node, re-enable continue mode:

Code: Select all

SetContinueMode(true); {{default}}
(The {{default}} keyword represents the Dialogue Manager's Default Sequence. This way the node re-enables continue mode and then just does whatever nodes regularly do.)

You can optionally add an "Accept" button to the text field. Configure its OnClick() to call the text field UI's AcceptTextInput method. I also added this to the updated example. So the player can press enter or click the Accept button. I also set the text field's Cancel Key to None so the player isn't allowed to cancel out of the input.
MathBlade wrote: Tue Jul 17, 2018 10:40 pmMainly I wanted a UI in where the user makes a choice and presses continue at the bottom. It's much more natural and intuitive, similar to making a post on a forum. Asking a user to intuitively know to press continue at the upper right is actually shown to be a "deal breaker" for most people. If a UI isn't intuitive or what they expect (even if the system doesn't support that) then they can just walk away calling it ugly or not useful. (And yes I know the UI looks a bit ugly at the moment as I say that I'll make it better later. It's more a work in progress to show buttons)

I'd want the buttons to be in the bottom and be able to stack "custom" objects other than buttons by giving them a prefab. There is a TextInput that does take a custom prefab, but that's only with the actor and conversant a certain way and then there is no continue button or forced answer with that on the bottom.
The updated example does that. It turns off continue button mode and waits for a bogus message "Forever". The SkillPanel has two new "continue buttons" (Back to Classes and Accept Stats) that continue the conversation.

It uses a variable "returnToClasses" to decide whether to return to the "Choose your Class" node or end the conversation. Examine the nodes' Conditions and Script fields to see how it's set up. The "Back to Classes" button has a Dialogue System Trigger that sets this variable true when clicked.
MathBlade wrote: Tue Jul 17, 2018 10:40 pmIf the NPC asks the player character "How many coins do you wish to give to the church?" (a la Baldur's Gate) Then I'd like to be able to have a simple incrementer UI spawn that handles that with a continue button at the bottom. Or other more complicated questions.
Add another text field UI with a unique name, such as "Incrementer UI". This is why the TextInput() sequencer command lets you specify a GameObject name rather than always using the same text field UI. It lets you use different text field UIs for different purposes. In your incrementer UI, add +/- buttons that increase the value of the text field.
MathBlade
Posts: 12
Joined: Sun Jul 15, 2018 12:32 pm

Re: Text Input

Post by MathBlade »

I apologize for the delay. I've been super busy with a work project and haven't had a chance to look at this. I plan on looking at this today/Monday.
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Text Input

Post by Tony Li »

No worries. I'm here to provide support when you need it. Please take your time.
Post Reply