Editor Node - Dialog
7 years 2 weeks ago #2626
by pete
Replied by pete on topic Editor Node - Dialog
Hi Frank,
So I've attached the result from what I've done.
I've created a new script with your example above, but that is not under the Editor folder. I've put it outside of your folder too, in case you update, or I need to delete it to install a new version. The namespace is still yours in my script.
I had to add the Filter and DisplayOptions methods in my script (you have references).
And I finally used only that line (removed the Rect and GUILayout.Label).
this line didn't work:Do I also need to duplicate the script for that option? What is it doing?
Thanks for your help! That sounds so easy for you
So I've attached the result from what I've done.
I've created a new script with your example above, but that is not under the Editor folder. I've put it outside of your folder too, in case you update, or I need to delete it to install a new version. The namespace is still yours in my script.
I had to add the Filter and DisplayOptions methods in my script (you have references).
And I finally used only that line (removed the Rect and GUILayout.Label).
ShowDialogNodeGUI.ShowGUI(ref DialogLine, new GUIContent("Dialog"), null);
this line didn't work:
//LocalizationEditor.OnGUI_Keys_Languages(DialogLine, null, true);
Thanks for your help! That sounds so easy for you
Please Log in or Create an account to join the conversation.
7 years 2 weeks ago - 7 years 2 weeks ago #2627
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Editor Node - Dialog
Hi,
Well, the issue there is that your code is been compiled before the Editor code, so it doesn't have access to that function.
You can implement a proxy function.
- create an static event with the same signature
static Action<string, Localize, bool> proxyOnGUI_Keys_Languages;
- then inside the editor folder, create an empty script with [InitializeOnLoad] and register the OnGUI_Keys_Languages function into that event. similar to this:That way, whenever you call the event, it will call the OnGUI_Keys_Languages function even though its compiled after.
instead of
LocalizationEditor.OnGUI_Keys_Languages(DialogLine, null, true);
You now do:
NodeDialog.proxyOnGUI_Keys_Languages(DialogLine, null, true);
That should work fine. Although its a bit more involved.
Another easy solution is to skip that inspector part and just put a button that opens the I2Languages.prefab to allow you creating a term.
Hope that helps,
Frank
Well, the issue there is that your code is been compiled before the Editor code, so it doesn't have access to that function.
You can implement a proxy function.
- create an static event with the same signature
static Action<string, Localize, bool> proxyOnGUI_Keys_Languages;
- then inside the editor folder, create an empty script with [InitializeOnLoad] and register the OnGUI_Keys_Languages function into that event. similar to this:
[InitializeOnLoad]
public class ProxyRegister
{
static ProxyRegister()
{
NodeDialog.proxyOnGUI_Keys_Languages = I2.Loc.LocalizationEditor.OnGUI_Keys_Languages;
}
instead of
LocalizationEditor.OnGUI_Keys_Languages(DialogLine, null, true);
You now do:
NodeDialog.proxyOnGUI_Keys_Languages(DialogLine, null, true);
That should work fine. Although its a bit more involved.
Another easy solution is to skip that inspector part and just put a button that opens the I2Languages.prefab to allow you creating a term.
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Open Source"))
{
Selection.activeObject = I2.Loc.LocalizationManager.Sources[0];
}
GUILayout.EndHorizontal();
Hope that helps,
Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
To get the betas as soon as they are ready,
check this out
Last edit: 7 years 2 weeks ago by Frank.
Please Log in or Create an account to join the conversation.
7 years 2 weeks ago #2631
by pete
Replied by pete on topic Editor Node - Dialog
Hi Frank,
Something doesn't work on my end.
I created the static action in the variable declartion section in my DialogStartNode.cs script
Then I created the script in the editor folder.
But, the OnGUI_Keys_Languages has the wrong return type.
There is probably something missing on my side.
The button is working as intended though!
Thanks for the help, almost there.
Something doesn't work on my end.
I created the static action in the variable declartion section in my DialogStartNode.cs script
public static Action<string, Localize, bool> proxyOnGUI_Keys_Languages;
Then I created the script in the editor folder.
using UnityEditor;
[InitializeOnLoad]
public class ProxyRegister {
static ProxyRegister()
{
DialogStartNode.proxyOnGUI_Keys_Languages = I2.Loc.LocalizationEditor.OnGUI_Keys_Languages;
}
}
But, the OnGUI_Keys_Languages has the wrong return type.
There is probably something missing on my side.
The button is working as intended though!
Thanks for the help, almost there.
Please Log in or Create an account to join the conversation.
7 years 2 weeks ago #2632
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Editor Node - Dialog
You dont need the return value, so you can call a wrapper instead:
or make it anonymous
Hope that helps,
Frank
using UnityEditor;
[InitializeOnLoad]
public class ProxyRegister {
static ProxyRegister()
{
DialogStartNode.proxyOnGUI_Keys_Languages = VoidCall;
}
static void VoidCall(string key, Localize cmp, bool primary)
{
I2.Loc.LocalizationEditor.OnGUI_Keys_Languages(key,cmp,primary);
}
}
or make it anonymous
DialogStartNode.proxyOnGUI_Keys_Languages = (key, cmp, primary)=>I2.Loc.LocalizationEditor.OnGUI_Keys_Languages(key,cmp,primary);
Hope that helps,
Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
To get the betas as soon as they are ready,
check this out
The following user(s) said Thank You: pete
Please Log in or Create an account to join the conversation.
7 years 2 weeks ago #2633
by pete
Replied by pete on topic Editor Node - Dialog
I think it works
Let me know if you see anything wrong!
Huge thanks for your help!
Let me know if you see anything wrong!
Huge thanks for your help!
Please Log in or Create an account to join the conversation.
6 years 11 months ago #2655
by funbaker
Replied by funbaker on topic Editor Node - Dialog
Hello, I see this thread is the most relevant to “i2 + Dialogue System” topic.
We need help to connect our Dialogue System Database with i2 prefab. Right now i2 doesn’t update Dialogye System database.
Hope here is someone with experience of using i2 with Dialogue System from Pixel Crushers.
We need help to connect our Dialogue System Database with i2 prefab. Right now i2 doesn’t update Dialogye System database.
Hope here is someone with experience of using i2 with Dialogue System from Pixel Crushers.
Please Log in or Create an account to join the conversation.
Time to create page: 0.251 seconds