It was rejected from the Asset Store for requiring a beta version of Unity, but I figured I’d post it here to see if anyone was interested in purchasing it early. Please reply or message me.
I just bought your asset and it works fine so far. The only thing I am missing is the lack for internationalisation. I don’t want to make changes that will be overwritten on the next update.
An easy way could be providing a member variable:
public static Dictionary<DialogResult, string> labelDict = new Dictionary<DialogResult, string> ();
Fill this with English defaults in the static constructor and just read the label text from this dictionary. A user can then provide his own dictionary. Not very sophisticated but pretty quick to implement.
I’ve implemented a hook for you and emailed you a new build.
Instead of adding a new string table I just created a localize function hook that get’s called on the strings. I figure it’s easier for the developers to keep all their strings in their existing systems.
Here’s how it works:
MessageBox.Localize =
(originalString) =>
{
// You would normally hook into your existing localization system here to lookup and return a translated string using the original as a key.
// For instance using "Localization package" from the asset store you would do this:
// return Language.Get(originalString);
// Current text strings that need to be localized are "OK", "Yes", "No", "Cancel", "Abort", "Retry", "Ignore"
// This function only needs to be set once at game startup.
// For test example replace the original string with X's, so "Hello World" becomes "XXXXXXXXXXX"
return new String('X', originalString.Length);
};
Will that work well for you?
One other question, would you like me to call that localize function on all the text that is sent to the message box, so that you don’t have to remember to localize the message and title text? I don’t think it would hurt if the text got sent thru the function twice on accident.
I just created a flag to let you control the localizing of the message and title text like this:
// Set LocalizeTitleAndMessage to true to send the title and message of message boxes and menu boxes thru the Localize function.
MessageBox.LocalizeTitleAndMessage = true;
I’ll submit the new version to the asset store now.
I’ve also received a feature request to create a set of dialogs that can contain a number spinner, text input field, and name and password fields. Would anyone else here use those?
Thank you for the support and I apologize once again for the delay.
Yes that’s cool so everything can be connected to arbitrary localisation systems and the calling code only operates with keys.
“Yeah, I need all cool stuff” would be the typical answer But to be honest I don’t need it - at the moment. On the long run I think these are exciting features to make modal dialogs an even more powerful tool. Regarding the text input field it would be great to consider different input types like email, phone,… Especially on mobile devices it is very useful to get the corresponding keyboard layout popping up.