public UM_AndroidNativeDialogImpl(UM_NativeDialogBuilder builder)
        {
            m_dialog = new AN_AlertDialog(AN_DialogTheme.Light);

            m_dialog.Title   = builder.Title;
            m_dialog.Message = builder.Message;

            if (builder.PositiveButton != null)
            {
                m_dialog.SetPositiveButton(builder.PositiveButton.Title, builder.PositiveButton.ButtonAction);
            }

            if (builder.NegativeButton != null)
            {
                m_dialog.SetNegativeButton(builder.NegativeButton.Title, builder.NegativeButton.ButtonAction);
            }

            if (builder.DestructiveButton != null)
            {
                m_dialog.SetNegativeButton(builder.DestructiveButton.Title, builder.DestructiveButton.ButtonAction);
            }

            if (builder.NeutralButton != null)
            {
                m_dialog.SetNeutralButton(builder.NeutralButton.Title, builder.NeutralButton.ButtonAction);
            }
        }
        /// <summary>
        /// Creates new simple alert and immediately shows it.
        /// </summary>
        /// <param name="title">Alert title.</param>
        /// <param name="message">Alert message.</param>
        public static void ShowMessage(string title, string message)
        {
            var builder = new UM_NativeDialogBuilder(title, message);

            builder.SetPositiveButton("Okay", () => {});

            var dialog = builder.Build();

            dialog.Show();
        }
Exemplo n.º 3
0
        public static UM_iUIDialog CreateDialog(UM_NativeDialogBuilder builder)
        {
            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                return(new UM_AndroidNativeDialogImpl(builder));

            case RuntimePlatform.IPhonePlayer:
                return(new UM_IOSNativeDialogImpl(builder));

            default:
                return(new UM_EditorNativeDialogImpl(builder));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Use the <see cref="RequestReview"/>  method to indicate when it makes sense
        /// within the logic of your app to ask the user for ratings and reviews within your app.
        /// </summary>
        public static void RequestReview()
        {
            string appName       = Application.productName;
            string appIdentifier = Application.identifier;

            string title     = string.Format("Rate {0}!", appName);
            string message   = string.Format("If you enjoy using {0}, please take a moment to rate it.Thanks for your support!", appName);
            string noTitle   = "No, thanks";
            string rateTitle = "Rate";

            if (Application.isEditor)
            {
                var builder = new UM_NativeDialogBuilder(title, message);
                builder.SetPositiveButton(rateTitle, () => {});
                builder.SetNegativeButton(noTitle, () => {});

                var dialog = builder.Build();
                dialog.Show();
            }

            switch (Application.platform)
            {
            case RuntimePlatform.IPhonePlayer:
                ISN_SKStoreReviewController.RequestReview();
                break;

            case RuntimePlatform.Android:


                var dialog = new AN_AlertDialog(AN_DialogTheme.Default);
                dialog.Title   = title;
                dialog.Message = message;

                dialog.SetNegativeButton(noTitle, () => {
                });

                dialog.SetPositiveButton(rateTitle, () => {
                    //This code will take user to your app Play Market page
                    System.Uri uri       = new System.Uri("market://details?id=" + appIdentifier);
                    AN_Intent viewIntent = new AN_Intent(AN_Intent.ACTION_VIEW, uri);
                    AN_MainActivity.Instance.StartActivity(viewIntent);
                });

                dialog.Show();
                break;
            }
        }
Exemplo n.º 5
0
        public UM_IOSNativeDialogImpl(UM_NativeDialogBuilder builder)
        {
            m_dialog = new ISN_UIAlertController(builder.Title, builder.Message, ISN_UIAlertControllerStyle.Alert);

            if (builder.PositiveButton != null)
            {
                m_dialog.AddAction(new ISN_UIAlertAction(builder.PositiveButton.Title, ISN_UIAlertActionStyle.Default, builder.PositiveButton.ButtonAction));
            }

            if (builder.NeutralButton != null)
            {
                m_dialog.AddAction(new ISN_UIAlertAction(builder.NeutralButton.Title, ISN_UIAlertActionStyle.Default, builder.NeutralButton.ButtonAction));
            }

            if (builder.NegativeButton != null)
            {
                m_dialog.AddAction(new ISN_UIAlertAction(builder.NegativeButton.Title, ISN_UIAlertActionStyle.Cancel, builder.NegativeButton.ButtonAction));
            }

            if (builder.DestructiveButton != null)
            {
                m_dialog.AddAction(new ISN_UIAlertAction(builder.DestructiveButton.Title, ISN_UIAlertActionStyle.Destructive, builder.DestructiveButton.ButtonAction));
            }
        }
Exemplo n.º 6
0
 public UM_EditorNativeDialogImpl(UM_NativeDialogBuilder builder)
 {
     #if UNITY_EDITOR
     m_builder = builder;
     #endif
 }