Example #1
0
        public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
        {
            // If Remove Ads and Unlock All Content Package has been purchased
            if (String.Equals(args.purchasedProduct.definition.id, kProductRemoveAdsUnlockAll, StringComparison.Ordinal))
            {
                Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
                /////////////------------------------------- DISABLE ADS FUNCTIONALITY ---------------------------------------------------------------
                Analytics.Transaction("remove_ads_unlock_all", 8.99m, "USD", null, null, true);
                adsManager.permanentNoAds = true;
                adsManager.PermanentDisableAds();
                SaveLoadManager.SaveAdsInfo(adsManager);

                //Unlock all game content

                //turn off undo counting
                //set Undos to Unlimited
                undoPerformer.IsCountable = false;
                //Save Undo State
                //--------------------------------------------------------------------------------------------------------------------------------------
                //undoPerformer.SaveGame();
                Debug.Log("DISABLE ADS AND UNLOCK ALL CONTENT HAS BEEN PURCHASED");
            }
            // If Remove Ads package has been purchased
            //else if (String.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
            else if (String.Equals(args.purchasedProduct.definition.id, kProductRemoveAds, StringComparison.Ordinal))
            {
                Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
                /////////////------------------------------- DISABLE ADS FUNCTIONALITY ---------------------------------------------------------------
                Analytics.Transaction("remove_ads_1", 2.99m, "USD", null, null, true);
                adsManager.permanentNoAds = true;
                adsManager.PermanentDisableAds();
                SaveLoadManager.SaveAdsInfo(adsManager);
                //turn off undo counting
                //set Undos to Unlimited
                undoPerformer.IsCountable = false;
                //Save Undo State
                //--------------------------------------------------------------------------------------------------------------------------------------
                //undoPerformer.SaveGame();
                Debug.Log("DISABLE ADS HAS BEEN PURCHASED");
            }
            // Or ... a subscription product has been purchased by this user.
            //else if (String.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
            //{
            //    Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            // TODO: The subscription item has been successfully purchased, grant this to the player.
            //}
            // Or ... an unknown product has been purchased by this user. Fill in additional products here....
            else
            {
                Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
            }

            // Return a flag indicating whether this product has completely been received, or if the application needs
            // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
            // saving purchased products to the cloud, and when that save is delayed.
            return(PurchaseProcessingResult.Complete);
        }
Example #2
0
        public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
        {
            //use this to check that the placement finished correctly and award stuff accordingly
            //check if finished, add undos
            if (placementId == "refillUndos")
            {
                if (showResult == ShowResult.Finished)
                {
                    //add undos
                    undoPerformer.UpdateUndoCounts();
                    adsWatched++;
                }
                else if (showResult == ShowResult.Failed)
                {
                    //inform the Player they must watch the full ad to get undos
                }
            }
            //Watch a rewarded video to temporarily disable ads
            else if (placementId == "tempDisableAds")
            {
                if (showResult == ShowResult.Finished)
                {
                    //check if finished, disable ads for 30 minutes
                    TempDisableAds();
                    adsWatched++;
                }
                else if (showResult == ShowResult.Failed)
                {
                    //inform the Player they must watch the full ad to disable ads temporarily
                }
            }

            else if (placementId == "newGameSkippable")
            {
                adsWatched++;
            }

            else if (placementId == "doubleXP")
            {
                if (showResult == ShowResult.Finished)
                {
                    //repeat XP gain sequence with same XP
                    //gameManager.StartCoroutine(HandleXPOnWin(score));
                    //StartCoroutine(gameManager.HandleXPOnWin(doubleXPScore));
                    gameManager.DoubleXPGo(doubleXPScore);
                    doubleXPButton.gameObject.SetActive(false);

                    adsWatched++;
                }
            }

            Analytics.CustomEvent("didAdFinish", new Dictionary <string, object> {
                { "adType", placementId }, { "AdResult", showResult }, { "playerID", AnalyticsSessionInfo.userId }
            });
            SaveLoadManager.SaveAdsInfo(this);
        }
Example #3
0
        public void TempAdsTimerExpired()
        {
            //enable Undo counter
            undoPerformer.IsCountable = true;
            undoPerformer.ActivateUndoButton();

            //turn ads back on
            tempNoAds = false;
            //save to AdsData
            SaveLoadManager.SaveAdsInfo(this);

            //revert NoAdsTimer to NoAdsButton
            //disable NoAdsTimer
            tempNoAdsTimer.SetActive(false);
            //enable NoAdsButton
            tempNoAdsButton.SetActive(true);
        }
Example #4
0
        public void TempDisableAds()
        {
            //disable TempDisableAdsButton
            tempNoAdsButton.SetActive(false);
            //enable TempDisabledAdsTimer
            tempNoAdsTimer.SetActive(true);

            //set timer to 30 minutes
            noAdsTimer = noAdsDurationSeconds;
            //disable ads, start timer
            tempNoAds = true;
            //Set the time that no ads was started, save to the AdsData
            tempAdsStartTime = System.DateTime.Now;
            tempNoAds        = true;

            //set Undos to Unlimited
            undoPerformer.IsCountable = false;
            undoPerformer.ActivateUndoButton();

            SaveLoadManager.SaveAdsInfo(this);
        }