/// <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; } }
private IEnumerator DieCoroutine() { yield return(new WaitForSeconds(1.5f)); Time.timeScale = 0f; if (MusicControllerScript.Instance.On) { _musicOffImage.SetActive(false); } else { _musicOffImage.SetActive(true); } if (SoundsControllerScript.Instance.On) { _soundsOffImage.SetActive(false); } else { _soundsOffImage.SetActive(true); } MusicControllerScript.Instance.FadeOut(); _hudPanel.SetActive(false); _informationPanelLabel.text = "GAME OVER"; _resumeButton.SetActive(false); _continueWithAdButton.SetActive(true); _continueWithAdButton.GetComponent <Button>().interactable = _continueCount < 2 && Monetization.IsReady(GameControllerScript.ADS_REWARDED_PLACEMENTID); //TODO: Continue with Facebook //_continueWithFacebookButton.SetActive(true); //_continueWithFacebookButton.GetComponent<Button>().interactable = _continueCount < 2 && Monetization.IsReady(GameControllerScript.ADS_REWARDED_PLACEMENTID); _informationPanel.SetActive(true); #if UNITY_IOS yield return(new WaitForSeconds(2F)); if (GameControllerScript.Instance.ReviewRequestedVersion != Application.version.ToString()) { ISN_SKStoreReviewController.RequestReview(); GameControllerScript.Instance.ReviewRequestedVersion = Application.version.ToString(); } #endif }
void OnGUI() { UpdateToStartPos(); GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "In-App Purchases", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Load Store")) { s_paymentManager.init(); } if (ISN_SKPaymentQueue.IsReady) { GUI.enabled = true; } else { GUI.enabled = false; } StartX = XStartPos; StartY += YButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Perform Buy #1")) { var CurrencySymbol = ISN_SKPaymentQueue.GetProductById(ISN_PaymentManagerExample.SMALL_PACK).PriceLocale.CurrencySymbol; Debug.Log(CurrencySymbol); //ISN_SKPaymentQueue.AddPayment(ISN_PaymentManagerExample.SMALL_PACK); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Perform Buy #2")) { ISN_SKPaymentQueue.AddPayment(ISN_PaymentManagerExample.NC_PACK); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Restore Purchases")) { ISN_SKPaymentQueue.RestoreCompletedTransactions(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Is Payments Enabled On device")) { Debug.Log("Is Payments Enabled: " + ISN_SKPaymentQueue.CanMakePayments); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; GUI.enabled = true; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Local Receipt Validation", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth + 10, buttonHeight), "Print Load Receipt")) { var receipt = ISN_SKPaymentQueue.AppStoreReceipt; Debug.Log("Receipt loaded, byte array length: " + receipt.Data.Length + " Would you like to veriday it with Apple Sandbox server?"); Debug.Log("Receipt As Base64 String" + receipt.AsBase64String); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Refresh Receipt")) { //Thiss is optional values for test evironment, //for production evironment use properties = null var properties = new ISN_SKReceiptDictionary(); properties.Add(ISN_SKReceiptProperty.IsExpired, 0); properties.Add(ISN_SKReceiptProperty.IsRevoked, 1); var request = new ISN_SKReceiptRefreshRequest(properties); request.Start((result) => { Debug.Log("Receipt Refresh Result: " + result.IsSucceeded); if (result.HasError) { Debug.Log(result.Error.Code + " / " + result.Error.Message); } }); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; GUI.enabled = true; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Store Review Controller", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth + 10, buttonHeight), "Request Review")) { ISN_SKStoreReviewController.RequestReview(); } }