public override void Test()
        {
            AN_Preloader.LockScreen("Lock Test");

            SA_Coroutine.WaitForSeconds(3f, () => {
                AN_Preloader.UnlockScreen();
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Unlocks the screen and hide a preloader spinner
        /// In case there is no preloader displayed, method does nothing
        /// </summary>
        public static void UnlockScreen()
        {
#if UNITY_EDITOR
            if (Application.isEditor)
            {
                UnityEditor.EditorUtility.ClearProgressBar();
                return;
            }
#endif

            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                AN_Preloader.UnlockScreen();
                break;

            case RuntimePlatform.IPhonePlayer:
                ISN_Preloader.UnlockScreen();
                break;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Locks the screen and displayes a preloader spinner
        /// </summary>
        public static void LockScreen()
        {
#if UNITY_EDITOR
            if (Application.isEditor)
            {
                UnityEditor.EditorUtility.DisplayProgressBar("Please Wait..", string.Empty, 0.4f);
                return;
            }
#endif

            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                AN_Preloader.LockScreen("Please Wait..");
                break;

            case RuntimePlatform.IPhonePlayer:
                ISN_Preloader.LockScreen();
                break;
            }
        }
    void Start()
    {
        m_progressButton.onClick.AddListener(() => {
            //Show the preloader
            AN_Preloader.LockScreen("Please Wait...");

            //and hide it in 2 sec
            SA_Coroutine.WaitForSeconds(2f, () => {
                AN_Preloader.UnlockScreen();
            });
        });

        m_messageButton.onClick.AddListener(() => {
            var message     = new AN_AlertDialog(AN_DialogTheme.Material);
            message.Title   = "Message";
            message.Message = "Some message text";

            message.SetPositiveButton("Okay", () => {
                AN_Logger.Log("message: ok button was clicked");
            });


            message.Show();
        });


        m_dialogButton.onClick.AddListener(() => {
            var dialog     = new AN_AlertDialog(AN_DialogTheme.Light);
            dialog.Title   = "Dialog";
            dialog.Message = "Some dialog text";

            dialog.SetPositiveButton("Yes", () => {
                AN_Logger.Log("dialog: Yes button was clicked");
            });

            dialog.SetNegativeButton("No", () => {
                AN_Logger.Log("dialog: No button was clicked");
            });

            dialog.Show();
        });


        m_rateButton.onClick.AddListener(() => {
            string appName       = Application.productName;
            string appIdentifier = Application.identifier;

            var dialog     = new AN_AlertDialog(AN_DialogTheme.Default);
            dialog.Title   = string.Format("Rate {0}!", appName);
            dialog.Message = string.Format("If you enjoy using {0}, please take a moment to rate it.Thanks for your support!", appName);

            dialog.SetPositiveButton("Rate", () => {
                AN_Logger.Log("dialog: Rate button was clicked");

                //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.SetNegativeButton("No, thanks", () => {
                AN_Logger.Log("dialog: No, thanks button was clicked");
            });


            dialog.SetNeutralButton("Remind me later", () => {
                AN_Logger.Log("dialog: Remind me later button was clicked");
            });

            dialog.Show();
        });


        m_calendarButton.onClick.AddListener(() => {
            var date  = DateTime.Now;
            int year  = date.Year;
            int month = date.Month - 1; //Compatibility with Android Calendar..
            int day   = date.Day;

            AN_DatePickerDialog picker = new AN_DatePickerDialog(year, month, day);
            picker.Show((result) => {
                if (result.IsSucceeded)
                {
                    Debug.Log("date picked result.Year: " + result.Year);
                    //Same  Android Calendar Compatibility
                    Debug.Log("date picked result.Month: " + result.Month + 1);
                    Debug.Log("date picked result.Day: " + result.Day);
                }
                else
                {
                    Debug.Log("Failed to pick a date: " + result.Error.FullMessage);
                }
            });
        });
    }