public override void OnInspectorGUI() { IAPModule iap = (IAPModule)target; var catalog = iap.allProducts; if (catalog.Count > 0) { EditorGUILayout.LabelField(new GUIContent("NoAds ID:", "Select a product from the IAP catalog")); m_ValidIDs.Clear(); m_ValidIDs.Add(kNoProduct); foreach (var product in catalog) { m_ValidIDs.Add(product.id); } int currentIndex = string.IsNullOrEmpty(iap.noAdsProductId) ? 0 : m_ValidIDs.IndexOf(iap.noAdsProductId); int newIndex = EditorGUILayout.Popup(currentIndex, m_ValidIDs.ToArray()); if (newIndex > 0 && newIndex < m_ValidIDs.Count) { m_ProductIDProperty.stringValue = m_ValidIDs[newIndex]; } else { m_ProductIDProperty.stringValue = string.Empty; } EditorGUILayout.HelpBox(new GUIContent("Id продукта, который отключает рекламу")); EditorGUILayout.Space(); EditorGUILayout.PropertyField(m_AppCaption); EditorGUILayout.HelpBox(new GUIContent("Корректировка заголовка, для правильного отображения названия продукта. Product(GameName)->Product")); EditorGUILayout.Space(); EditorGUILayout.LabelField(new GUIContent("Каталог продуктов:")); } else { EditorGUILayout.HelpBox(new GUIContent("Добавьте все продукты из магазинов GooglePlay и AppStore")); } DrawPropertiesExcluding(serializedObject, catalog.Count == 0 ? restoreExcludedFields : excludedFields); serializedObject.ApplyModifiedProperties(); }
private static IExtensionProvider storeExtensionProvider; // The store-specific Purchasing subsystems. // Product identifiers for all products capable of being purchased: // "convenience" general identifiers for use with Purchasing, and their store-specific identifier // counterparts for use with and outside of Unity Purchasing. Define store-specific identifiers // also on each platform's publisher dashboard (iTunes Connect, Google Play Developer Console, etc.) // General product identifiers for the consumable, non-consumable, and subscription products. // Use these handles in the code to reference which product to purchase. Also use these values // when defining the Product Identifiers on the store. Except, for illustration purposes, the // kProductIDSubscription - it has custom Apple and Google identifiers. We declare their store- // specific mapping to Unity Purchasing's AddProduct, below. // public static string kProductIDConsumable = "consumable"; // public static string kProductIDNonConsumable = "nonconsumable"; // public static string kProductIDSubscription = "subscription"; // Apple App Store-specific product identifier for the subscription product. // private static string kProductNameAppleSubscription = "com.unity3d.subscription.new"; // Google Play Store-specific product identifier subscription product. // private static string kProductNameGooglePlaySubscription = "com.unity3d.subscription.original"; void Awake() { //if (instance == null) //{ // Экземпляр менеджера был найден instance = this; // Задаем ссылку на экземпляр объекта //} //else if (instance == this) //{ // Экземпляр объекта уже существует на сцене // Destroy(gameObject); // Удаляем объект //} if (removeAppCaption == "Game Name") { removeAppCaption = Application.productName; } removeAppCaption = "(" + removeAppCaption + ")"; DontDestroyOnLoad(gameObject); }