#if UNITY_PURCHASING using UnityEngine.Events; using UnityEngine.UI; using System.IO; using System.Collections.Generic; namespace UnityEngine.Purchasing { [RequireComponent(typeof(Button))] [AddComponentMenu("Unity IAP/IAP Button")] [HelpURL("https://docs.unity3d.com/Manual/UnityIAP.html")] public class IAPButton : MonoBehaviour { public enum ButtonType { Purchase, Restore } [System.Serializable] public class OnPurchaseCompletedEvent : UnityEvent { }; [System.Serializable] public class OnPurchaseFailedEvent : UnityEvent { }; [HideInInspector] public string productId; [Tooltip("The type of this button, can be either a purchase or a restore button")] public ButtonType buttonType = ButtonType.Purchase; [Tooltip("Consume the product immediately after a successful purchase")] public bool consumePurchase = true; [Tooltip("Event fired after a successful purchase of this product")] public OnPurchaseCompletedEvent onPurchaseComplete; [Tooltip("Event fired after a failed purchase of this product")] public OnPurchaseFailedEvent onPurchaseFailed; [Tooltip("[Optional] Displays the localized title from the app store")] public Text titleText; [Tooltip("[Optional] Displays the localized description from the app store")] public Text descriptionText; [Tooltip("[Optional] Displays the localized price from the app store")] public Text priceText; void Start() { Button button = GetComponent