/// <summary>
        /// Shows an alert dialog with 3 buttons.
        /// </summary>
        /// <returns>The three buttons alert.</returns>
        /// <param name="title">Title.</param>
        /// <param name="message">Message.</param>
        /// <param name="button1">Button1.</param>
        /// <param name="button2">Button2.</param>
        /// <param name="button3">Button3.</param>
        internal static MobileNativeAlert ShowThreeButtonAlert(string title, string message, string button1, string button2, string button3)
        {
            #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
            if (Instance != null)
            {
                return(null);    // only allow one alert at a time
            }
            // Create a Unity game object to receive messages from native side
            Instance = new GameObject(ALERT_GAMEOBJECT).AddComponent <MobileNativeAlert>();

            // Show the native platform-specific alert
            #if UNITY_IOS
            iOSNativeAlert.ShowThreeButtonsAlert(title, message, button1, button2, button3);
            #elif UNITY_ANDROID
            AndroidNativeAlert.ShowThreeButtonsAlert(title, message, button1, button2, button3);
            #endif

            return(Instance);
            #else
            // Platform not supported
            if (Debug.isDebugBuild)
            {
                Debug.Log("Show 3-button alert with message: " + message);
            }

            return(null);
            #endif
        }
Exemple #2
0
            /// <summary>
            /// Shows an alert dialog with 3 buttons.
            /// </summary>
            /// <returns>The three buttons alert.</returns>
            /// <param name="title">Title.</param>
            /// <param name="message">Message.</param>
            /// <param name="button1">Button1.</param>
            /// <param name="button2">Button2.</param>
            /// <param name="button3">Button3.</param>
            internal static AlertPopup ShowThreeButtonAlert(string title, string message, string button1, string button2, string button3)
            {
                #if UNITY_EDITOR
                Debug.Log("Show 3-button alert with message: " + message);
                return(null);
                #elif UNITY_IOS
                if (Instance != null)
                {
                    return(null);    // only allow one alert at a time
                }
                // Create a Unity game object to receive messages from native side
                Instance = new GameObject(ALERT_GAMEOBJECT).AddComponent <AlertPopup>();

                // Show iOS 3-button alert
                iOSNativeAlert.ShowThreeButtonsAlert(title, message, button1, button2, button3);

                return(Instance);
                #elif UNITY_ANDROID
                if (Instance != null)
                {
                    return(null); // only allow one alert at a time
                }
                // Create a Unity game object to receive messages from native side
                Instance = new GameObject(ALERT_GAMEOBJECT).AddComponent <AlertPopup>();

                // Show Android 3-button alert
                AndroidNativeAlert.ShowThreeButtonsAlert(title, message, button1, button2, button3);

                return(Instance);
                #else
                Debug.Log("Native alert is not supported on this platform.");
                return(null);
                #endif
            }