//private buy private void Start() { if (_instance != null && _instance != this) { Destroy(this.gameObject); return; } _instance = this; Main.onSceneChange.AddListener(SceneChanging); InAppBilling.onProBuy.AddListener(ProBought); if (!InAppBilling.ProIsOwned()) { Debug.Log("is not owned"); animator.SetTrigger("fadeBuy"); } else { Debug.Log("is owned"); animator.SetTrigger("fadeOwned"); } // check if the item is bought or not and then fade the correct ui in // else: animator.SetTrigger("fadeThanks"); }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { Console.WriteLine("OnActivityResult {0}: {1}, {2}, {3}", requestCode, resultCode, (int)resultCode, data); if (requestCode == TTS.TTS_REQUEST_DATA || requestCode == TTS.TTS_INSTALLED_DATA || requestCode == TTS.TTS_CHECK_DATA) { TTS.OnTTSResult(requestCode, resultCode, data); } else if (requestCode == STT.STT_REQUEST) { STT.SpeechRecognitionCompleted(resultCode, data); } else if (requestCode == InAppBilling.IAP_REQUEST) { InAppBilling.OnIAPCallback(requestCode, resultCode, data); } else if (requestCode == ImageEditor.SELECT_FROM_GALLERY || requestCode == ImageEditor.SELECT_FROM_CAMERA) { ImageEditor.OnActivityResult(requestCode, resultCode, data); } base.OnActivityResult(requestCode, resultCode, data); }
public void ProButtonClicked() { // pro not bought yet if (!IsProUnlocked()) { // try to buy if (InAppBilling.BuyPro()) { // change scene to a "thank you" notice } } SoundManager.ButtonClicked(); }
public static void LoadProgressData() { ProgressData progressLoading; string savePath; #if UNITY_ANDROID && !UNITY_EDITOR savePath = SavePathAndroid; #else savePath = SavePath; #endif if (File.Exists(savePath)) { try { progressLoading = JsonUtility.FromJson <ProgressData>(File.ReadAllText(savePath, Encoding.UTF8)); // check object integrity - aka were objects added or removed - not effected by object attribute changes string loadedChecksum = progressLoading.checksum; string generatedChecksum = progressLoading.GenerateChecksum(); Debug.Log("loadedChecksum " + loadedChecksum); Debug.Log("generatedChecksum " + generatedChecksum); //if (loadedChecksum == generatedChecksum) //{ Debug.Log("Progress checksums are the same, have fun!"); progress = progressLoading; progress.proVersion = InAppBilling.ProIsOwned(); //} //else // { Debug.LogError("Progress checksums mismatching. Someone tried to mess with the it!"); // SaveProgressData(); //} } catch (SerializationException e) { Debug.LogError("[LevelLoader]: Failed to deserialize progress. Reason: " + e.Message); throw; } IsLoaded = true; } else { SaveProgressData(); } }
private static string kGooglePlayItem = "flipfall.pro"; // Google Play Store identifier for the consumable product. private void Start() { Debug.Log("IN APP BILLING - Start"); if (_instance != null && _instance != this) { Destroy(this.gameObject); return; } _instance = this; DontDestroyOnLoad(this); if (m_StoreController == null && initialized == false) { Debug.Log("IN APP BILLING - both null, initialize"); // Begin to configure our connection to Purchasing InitializePurchasing(); } if (IsInitialized()) { Product product = m_StoreController.products.WithID(kItem); if (product != null && product.hasReceipt) { // Owned Non Consumables and Subscriptions should always have receipts. // So here the Non Consumable product has already been bought. ProgressManager.GetProgress().proVersion = true; } else { ProgressManager.GetProgress().proVersion = false; } } Debug.Log("ProgressManager: Owns Pro Version: " + ProgressManager.GetProgress().proVersion); //ZPlayerPrefs.Initialize("----------------", SystemInfo.deviceUniqueIdentifier); // If we haven't set up the Unity Purchasing reference }