Beispiel #1
0
        /// <summary>
        /// Call <see cref="PaperPlaneTools.RateBox.Init"/> function
        /// </summary>
        void Start()
        {
            string rateUrl = RateBox.GetStoreUrl(appStoreAppId, playMarketAppBundleId);

            //Debug settings are only allowed inside development environment
                        #if (UNITY_EDITOR)
            if (clearOnStart)
            {
                RateBox.Instance.ClearStatistics();
            }
            RateBox.Instance.DebugMode = logDebugMessages;
                        #else
            RateBox.Instance.DebugMode = false;
                        #endif

            var rejectButtonTrimmed = rejectButton.Trim();
            RateBox.Instance.Init(
                rateUrl,
                new RateBoxConditions()
            {
                MinSessionCount            = minSessionCount,
                MinCustomEventsCount       = minCustomEventsCount,
                DelayAfterInstallInSeconds = Mathf.CeilToInt(delayAfterInstallInHours * 3600),
                DelayAfterLaunchInSeconds  = Mathf.CeilToInt(delayAfterLaunchInHours * 3600),
                PostponeCooldownInSeconds  = Mathf.CeilToInt(postponeCooldownInHours * 3600),
                RequireInternetConnection  = requireInternetConnection
            },
                new RateBoxTextSettings()
            {
                Title               = title.Trim(),
                Message             = message.Trim(),
                RateButtonTitle     = rateButton.Trim(),
                PostponeButtonTitle = postponeButton.Trim(),
                RejectButtonTitle   = rejectButtonTrimmed.Length > 0 ? rejectButtonTrimmed.Trim() : null
            },
                new RateBoxSettings()
            {
                UseIOSReview = useIOSReview
            }
                );

            // Custom alertAdapter allows to display custom UI windows instead of native alerts
            IAlertPlatformAdapter alertAdapter = null;
            if (customUIWindow != null)
            {
                customUIWindow.SetActive(false);
                alertAdapter = customUIWindow.GetComponent <IAlertPlatformAdapter>();
            }

            RateBox.Instance.AlertAdapter = alertAdapter;
        }
 private void ShowNext()
 {
     if (currentAdapter == null && queue.Count > 0)
     {
         currentAlert = queue[0];
         queue.RemoveAt(0);
         if (currentAlert != null)
         {
             currentAdapter = currentAlert.Adapter != null ? currentAlert.Adapter : CreateAdapter();
             currentAdapter.SetOnDismiss(this.OnDismiss);
             currentAdapter.Show(currentAlert);
         }
     }
 }
Beispiel #3
0
    /// <summary>
    /// Call <see cref="PaperPlaneTools.RateBox.Init"/> function
    /// </summary>
    void Start()
    {
        GameManager.SafeAddListener <AppRateMessage>(AppRateHandler);

        string[] texts = new string[] {
            LocaliseText.Get("Ratebox.FirstText"),
            //LocaliseText.Get ("Ratebox.SecondText"),
            //LocaliseText.Get ("Ratebox.ThirdText"),
        };

        //#if UNITY_ANDROID
        //if ( Utils.AndroidSDKVersion () < 23 ) {
        //	texts = new string[] {
        //		LocaliseText.Get ("Ratebox.FirstTextNoEmoji"),
        //		LocaliseText.Get ("Ratebox.SecondTextNoEmoji"),
        //		LocaliseText.Get ("Ratebox.ThirdTextNoEmoji"),
        //	};
        //}
        //#endif

        int    index = UnityEngine.Random.Range(0, texts.Length);
        string msg   = texts [index];

        title = LocaliseText.Get("GameFeedback.RateTitle");

        string rateUrl = RateBox.GetStoreUrl(appStoreAppId, playMarketAppBundleId);

        //Debug settings are only allowed inside development environment
                #if (UNITY_EDITOR)
        if (clearOnStart)
        {
            RateBox.Instance.ClearStatistics();
        }
        RateBox.Instance.DebugMode = logDebugMessages;
                #else
        RateBox.Instance.DebugMode = false;
                #endif

        var rejectButtonTrimmed = rejectButton.Trim();
        RateBox.Instance.Init(
            rateUrl,
            new RateBoxConditions()
        {
            MinSessionCount            = minSessionCount,
            MinCustomEventsCount       = minCustomEventsCount,
            DelayAfterInstallInSeconds = Mathf.CeilToInt(delayAfterInstallInHours * 3600),
            DelayAfterLaunchInSeconds  = Mathf.CeilToInt(delayAfterLaunchInHours * 3600),
            PostponeCooldownInSeconds  = Mathf.CeilToInt(postponeCooldownInHours * 3600),
            RequireInternetConnection  = requireInternetConnection
        },
            new RateBoxTextSettings()
        {
            Title               = title.Trim(),
            Message             = msg.Trim(),
            RateButtonTitle     = rateButton.Trim(),
            PostponeButtonTitle = postponeButton.Trim(),
            RejectButtonTitle   = rejectButtonTrimmed.Length > 0 ? rejectButtonTrimmed.Trim() : null
        },
            new RateBoxSettings()
        {
            UseIOSReview = useIOSReview
        }
            );

        // Custom alertAdapter allows to display custom UI windows instead of native alerts
        IAlertPlatformAdapter alertAdapter = null;
        if (customUIWindow != null)
        {
            customUIWindow.SetActive(false);
            alertAdapter = customUIWindow.GetComponent <IAlertPlatformAdapter>();
        }

        RateBox.Instance.AlertAdapter = alertAdapter;
    }
 private void OnDismiss()
 {
     currentAdapter = null;
     currentAlert   = null;
     ShowNext();
 }
Beispiel #5
0
        /// <summary>
        /// Call <see cref="PaperPlaneTools.RateBox.Init"/> function
        /// </summary>
        void Start()
        {
            string CurrentLanguage           = Lean.Localization.LeanLocalization.CurrentLanguage;
            string TitleString               = "";
            string MessageString             = "";
            string RateButtonTitleString     = "";
            string PostponeButtonTitleString = "";

            if (CurrentLanguage == "French")
            {
                TitleString               = "Tu apprécies le jeu?";
                MessageString             = "Prends un moment pour nous noter!";
                RateButtonTitleString     = "Noter";
                PostponeButtonTitleString = "Plus tard";
            }
            if (CurrentLanguage == "English")
            {
                TitleString               = "Do you like the game?";
                MessageString             = "Take a moment to rate us !";
                RateButtonTitleString     = "Rate";
                PostponeButtonTitleString = "Later";
            }
            if (CurrentLanguage == "German")
            {
                TitleString               = "Magst du das Spiel?";
                MessageString             = "Nimm einen Augenblick Zeit und bewerte uns!";
                RateButtonTitleString     = "Bewerten";
                PostponeButtonTitleString = "Später";
            }
            string rateUrl = RateBox.GetStoreUrl(appStoreAppId, playMarketAppBundleId);

            //Debug settings are only allowed inside development environment
                        #if (UNITY_EDITOR)
            if (clearOnStart)
            {
                RateBox.Instance.ClearStatistics();
            }
            RateBox.Instance.DebugMode = logDebugMessages;
                        #else
            RateBox.Instance.DebugMode = false;
                        #endif

            var rejectButtonTrimmed = rejectButton.Trim();
            RateBox.Instance.Init(
                rateUrl,
                new RateBoxConditions()
            {
                MinSessionCount            = minSessionCount,
                MinCustomEventsCount       = minCustomEventsCount,
                DelayAfterInstallInSeconds = Mathf.CeilToInt(delayAfterInstallInHours * 3600),
                DelayAfterLaunchInSeconds  = Mathf.CeilToInt(delayAfterLaunchInHours * 3600),
                PostponeCooldownInSeconds  = Mathf.CeilToInt(postponeCooldownInHours * 3600),
                RequireInternetConnection  = requireInternetConnection
            },
                new RateBoxTextSettings()
            {
                Title               = TitleString.Trim(),
                Message             = MessageString.Trim(),
                RateButtonTitle     = RateButtonTitleString.Trim(),
                PostponeButtonTitle = PostponeButtonTitleString.Trim(),
                RejectButtonTitle   = rejectButtonTrimmed.Length > 0 ? rejectButtonTrimmed.Trim() : null
            },
                new RateBoxSettings()
            {
                UseIOSReview = useIOSReview
            }
                );

            // Custom alertAdapter allows to display custom UI windows instead of native alerts
            IAlertPlatformAdapter alertAdapter = null;
            if (customUIWindow != null)
            {
                customUIWindow.SetActive(false);
                alertAdapter = customUIWindow.GetComponent <IAlertPlatformAdapter>();
            }

            RateBox.Instance.AlertAdapter = alertAdapter;
        }
Beispiel #6
0
 /// <summary>
 /// Set <see cref="PaperPlaneTools.Alert.Adapter"/>.
 /// </summary>
 public Alert SetAdapter(IAlertPlatformAdapter adaper)
 {
     Adapter = adaper;
     return(this);
 }