Search Unity

[Asset] uGUI Message Box Modal Dialog and Menu

Discussion in 'UGUI & TextMesh Pro' started by Bryan-Legend, Sep 3, 2014.

  1. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    80
    This is a message box and menu system for the new uGUI system in Unity 4.6.

    As simple and easy to use as writing MessageBox.Show("Your message here!"); anywhere in your code.

    Web Demo
    Online Manual

    Big Store Image.png

    Features
    • Fully customizable prefabs.
    • Single prefabs are instantiated to maximize simplicity.
    • Similar API to the traditional .net WinForms MessageBox.
    • Generate quick and flexible menus from code for pause menu, save and load game menus, options, etc.
    • Modal dialog that block all other GUI input until the user selects an option, using dimmers that can be configured in the prefabs.
    • Commented C# source code included.
    Message Box Example.png Review Form.png Delete Save Game.png Abort Retry Ignore.png

    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.
     
    Last edited: Sep 10, 2014
    ngothanhtai, Costco, jebi and 2 others like this.
  2. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    80
    Here are some additional screenshots:

    Dialog Menu Example.png 10 Item Menu.png

    Here's how the asset is used:
    Usage Example.PNG
     
    StarManta likes this.
  3. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Cool message box system :)
     
  4. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    80
    Thanks Tim. If it does well I can't wait to add more controls.
     
  5. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Very nice work!
     
  6. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    80
    I forgot to mention the price. I'll be selling it for $10 in the asset store, but if anyone wants to try it now I'll send them a free copy.
     
  7. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    80
    I've sent it to a few people now. If you'd like to try it, be sure to include your email when you message me.
     
  8. tong2528

    tong2528

    Joined:
    Oct 9, 2014
    Posts:
    4
    very interesting !!
     
  9. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    80
  10. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    glad to see it on the asset store im still using the "beta version" that was free but i will be picking this up again great work
     
  11. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    110
    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:
    Code (CSharp):
    1. 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.
     
  12. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    110
    Bump: Seems like contacting the developer is not that easy and I have to do the changes on my own.
     
  13. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    80
    Hi Kay,

    Sorry for not getting back to you.

    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:

    Code (CSharp):
    1.         MessageBox.Localize =
    2.             (originalString) =>
    3.             {
    4.                 // You would normally hook into your existing localization system here to lookup and return a translated string using the original as a key.
    5.                 // For instance using "Localization package" from the asset store you would do this:
    6.                 // return Language.Get(originalString);
    7.  
    8.                 // Current text strings that need to be localized are "OK", "Yes", "No", "Cancel", "Abort", "Retry", "Ignore"
    9.  
    10.                 // This function only needs to be set once at game startup.
    11.  
    12.                 // For test example replace the original string with X's, so "Hello World" becomes "XXXXXXXXXXX"
    13.                 return new String('X', originalString.Length);
    14.             };
    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.

    Bryan
     
  14. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    80
    I just created a flag to let you control the localizing of the message and title text like this:

    Code (CSharp):
    1.         // Set LocalizeTitleAndMessage to true to send the title and message of message boxes and menu boxes thru the Localize function.
    2.         MessageBox.LocalizeTitleAndMessage = true;
    3.  
    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.

    Bryan
     
  15. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    110
    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.
     
  16. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    Are these modal popup windows compatible with iOS and Android and Blackberry?
     
  17. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    80
    I haven't tried them but they should work fine.
     
  18. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    110
    I used them on iOS and Android - working fine
     
  19. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    Okay great... Just purchased!
     
  20. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    A few questions:

    Can I make a truly modal box that disables all other input/clicks on elements underneath?
    EDIT: Never mind... I think it does this by default.

    How do I center the box? The box appears in the bottom half but I want it up in the center.

    How do I change the size of the box?

    Can I change the colors of the box?

    How do I customize the text on the buttons?

    Thanks