Example #1
0
        /// <summary>
        /// Display an info message dialog in the center of the screen
        /// </summary>
        ///
        /// <param name="title">Dialog title.</param>
        /// <param name="message">Dialog body text.</param>
        private static void MessageBoxPanel(string title, string message)
        {
            Action prompt = () => {
                MessageBoxPanel messageBoxPanel = UIView.library
                                                  .ShowModal <MessageBoxPanel>("MessageBoxPanel");
                messageBoxPanel.Find <UILabel>("Message").text = message;
                messageBoxPanel.Find <UILabel>("Caption").text = title;
                UIButton uiButton = messageBoxPanel.Find <UIButton>("Close");
                if (!uiButton)
                {
                    return;
                }
                uiButton.isVisible = false;
            };

            try {
                if (TMPELifecycle.InGameOrEditor())
                {
                    Singleton <SimulationManager> .instance.m_ThreadingWrapper.QueueMainThread(prompt);
                }
                else
                {
                    prompt();
                }
            } catch (Exception e) {
                Log.ErrorFormat(
                    "Error displaying a Prompt:\n{0}",
                    e.ToString());
            }
        }