// // --- IStoreListener // public void OnInitialized(IStoreController controller, IExtensionProvider extensions) { // Purchasing has succeeded initializing. Collect our Purchasing references. Debug.Log("OnInitialized: PASS"); // Overall Purchasing system, configured with products for this application. m_StoreController = controller; // Store specific subsystem, for accessing device-specific store features. m_StoreExtensionProvider = extensions; Debug.Log("Product: " + Purchaser.kProductNameAppleSubscription); Product product = m_StoreController.products.WithID(Purchaser.kProductNameAppleSubscription); Debug.Log("isoCurrencyCode: " + product.metadata.isoCurrencyCode); Debug.Log("localizedDescription: " + product.metadata.localizedDescription); Debug.Log("localizedPrice: " + product.metadata.localizedPrice); Debug.Log("localizedPriceString: " + product.metadata.localizedPriceString); Debug.Log("localizedTitle: " + product.metadata.localizedTitle); if (product.metadata.localizedTitle.Length > 0) { localizedTitle = product.metadata.localizedTitle; } if (product.metadata.localizedDescription.Length > 0) { localizedDescription = product.metadata.localizedDescription; } if (product.metadata.localizedPriceString != null) { priceReceived = true; localizedPriceString = product.metadata.localizedPriceString; } AppCentral.ShowPaywall(); }
// singleton access void Awake() { // does an AppCentral Already exist? AppCentral app = UnityEngine.Object.FindObjectOfType <AppCentral>(); if (app == null) { GameObject appGameObj = new GameObject("AppCentral"); // match bootstraps location and rotation appGameObj.transform.position = transform.position; appGameObj.transform.rotation = transform.rotation; // add appcentral app = appGameObj.AddComponent <AppCentral>(); app.buildForCardboard = buildForCardboard; app.cardboardCameraPrefab = cardboardCameraPrefab; app.oculusCameraPrefab = oculusCameraPrefab; app.reticlePrefab = reticlePrefab; app.lookdownMenuPrefab = lookdownMenuPrefab; app.lookdownNotifierPrefab = lookdownNotifierPrefab; app.cameraFadeScreenPrefab = cameraFadeScreenPrefab; app.mainScenePrefab = mainScenePrefab; app.isMainScene = isMainScene; app.mountainPrefab = mountainPrefab; app.forestPrefab = forestPrefab; app.Initialize(); } // we are done Destroy(gameObject); }
public static void ShowPaywall(MonoBehaviour m, String productID) { AppCentral.TrackInstall(); Purchaser.kProductNameAppleSubscription = productID; Purchaser.kProductIDSubscription = productID; Debug.Log("Init product " + productID); AppCentral.purchaser = m.gameObject.AddComponent <Purchaser>() as Purchaser; AppCentral.purchaser.InitializePurchasing(); }
public static void ShowPaywall() { if (AppCentral.IsUserSubscribed()) { Debug.Log("User already subscribed, not showing paywall"); return; } Debug.Log("Showing paywall"); AppCentral.purchaser.windowOpen = true; }
public static void TrackInstall() { String trackUrl = $"https://vnc412s287.execute-api.us-east-1.amazonaws.com/default/unity-tracker?v=3&action=start&appid={Application.identifier}&installID={AppCentral.GetInstallID()}&idfa={Device.advertisingIdentifier}&idfv={Device.vendorIdentifier}"; // Get Install Time, If it doesn't exist set it to be an empty string. String installTime = PlayerPrefs.GetString("installTime", ""); // Check if installTime is an empty string, if it is -> if (installTime == "") { PlayerPrefs.SetString("installTime", System.DateTime.Now.ToString("o")); } // Add installTime to trackUrl trackUrl += "&installTime=" + installTime; // Get Campaign name, If it doesn't exist set it to be an empty string. // It is fetched in the API call, so it can never happen the 1st time the app is opened. String campaignName = PlayerPrefs.GetString("campaignName", ""); // Add campaignName to trackUrl trackUrl += "&campaignName=" + campaignName; UnityWebRequest.Get(trackUrl).SendWebRequest(); }