示例#1
0
    private void StartGame()
    {
        // showing interstitial
        if (lastAddsTime + gameSettings.interstitialShowingDelay < Time.realtimeSinceStartup)
        {
            AdsManager.ShowInterstitial(interstitialType);

            lastAddsTime = Time.realtimeSinceStartup;
        }

        reviveUsed           = false;
        firstStageCompleted  = false;
        currentItemsAbsorbed = 0;
        currentLevel         = GameSettingsPrefs.Get <int>("current level");

        levelState = LevelState.First;
        LevelController.instance.LoadLevel(currentLevel);
        UIController.instance.InitLevel(currentLevel);
        CameraController.instance.InitCameraOnFirstStage();
        ColorsController.SetRandomPreset();

        GroundGenerator.InitPlayground();

        waitingForTap = true;

        // ads
        bannerType        = AdsManager.GetBannerType();
        interstitialType  = AdsManager.GetInterstitialType();
        rewardedVideoType = AdsManager.GetRewardedVideoType();

        AdsManager.RequestInterstitial(interstitialType);
        AdsManager.RequestRewardBasedVideo(rewardedVideoType);

        AdsManager.ShowBanner(bannerType);
    }
示例#2
0
    private static String GetTypeString(InterstitialType type)
    {
        String result = null;

        switch (type)
        {
        case InterstitialType.Scratch:          result = "Scratch";             break;

        case InterstitialType.Lightweight:      result = "Light";               break;

        case InterstitialType.Gift:             result = "Gifts";               break;

        case InterstitialType.SlotMachine:      result = "SlotMachine"; break;

        case InterstitialType.Memory:           result = "Memory";              break;

        case InterstitialType.CoverFlow:        result = "CoverFlow";   break;

        case InterstitialType.GameList:         result = "GameList";    break;

        case InterstitialType.Smart:            result = "Smart";               break;
        }

        return(result);
    }
示例#3
0
 public static void Cache(InterstitialType interstitialType)
 {
     PlayAdsSDK.EnsureInstance();
     if (!PlayAdsSDK.ready)
     {
         PlayAdsSDK.Start(ACTION_CACHE, interstitialType);
         return;
     }
     PlayAdsSDK.PlayAdsSDKCache(PlayAdsSDK.GetTypeString(interstitialType));
 }
示例#4
0
 public static void Show(InterstitialType interstitialType)
 {
     PlayAdsSDK.EnsureInstance();
     if (!PlayAdsSDK.ready)
     {
         PlayAdsSDK.Start(ACTION_SHOW, interstitialType);
         return;
     }
     PlayAdsSDK.PlayAdsSDKShow(PlayAdsSDK.GetTypeString(interstitialType));
 }
示例#5
0
        public static InterstitialType GetInterstitialType()
        {
            InterstitialType interstitialType = instance.settings.interstitialType;

            if (interstitialType == InterstitialType.Interstitial_Random)
            {
                interstitialType = Random.Range(0, 1.0f) > 0.5f ? InterstitialType.Interstitial_ADMOB : InterstitialType.Interstitial_UNITYADS;
            }

            return(interstitialType);
        }
示例#6
0
        public static bool IsInterstitialLoaded(InterstitialType interstitialType)
        {
            switch (interstitialType)
            {
            case InterstitialType.Interstitial_ADMOB:
#if MODULE_ADMOB
                return(instance.interstitial != null && instance.interstitial.IsLoaded());
#endif
                break;

            case InterstitialType.Interstitial_UNITYADS:
#if MODULE_UNITYADS
                return(instance.interstitialUnityAds != null && Monetization.IsReady(instance.settings.GetUnityAdsInterstitialID()));
#endif
                break;
            }

            return(false);
        }
示例#7
0
        private void ShowAD_Handler(object sender, GameEventArgs args)
        {
            currentInterstitial = (InterstitialType)args.intParam.Value;
            //Debug.Log("start interstitial");
            OkReward        = args.okAction;
            CancelledReward = args.cancelAction;
            ShowInterstitial();
            //Debug.Log("end interstitial");

            interstitialReg.Destroy();
            interstitialVideo.Destroy();

            interstitialReg    = new InterstitialAd(adData.InterstitialRegID);
            interstitialVideo  = new InterstitialAd(adData.InterstitialVideoID);
            interstitialReward = new RewardedAd(adData.InterstitialRewardID);

            LoadInterstitial(interstitialReg);
            LoadInterstitial(interstitialVideo);
            LoadInterstitial(interstitialReward);
        }
示例#8
0
        public static void RequestInterstitial(InterstitialType interstitialType)
        {
            if (IsInterstitialLoaded(interstitialType))
            {
                return;
            }

            switch (interstitialType)
            {
            case InterstitialType.Interstitial_ADMOB:
#if MODULE_ADMOB
                string adUnitId = instance.settings.GetInterstitialID();

                // Clean up interstitial ad before creating a new one.
                if (instance.interstitial != null)
                {
                    instance.interstitial.Destroy();
                }

                // Create an interstitial.
                instance.interstitial = new InterstitialAd(adUnitId);

                // Register for ad events.
                instance.interstitial.OnAdLoaded             += instance.HandleInterstitialLoaded;
                instance.interstitial.OnAdFailedToLoad       += instance.HandleInterstitialFailedToLoad;
                instance.interstitial.OnAdOpening            += instance.HandleInterstitialOpened;
                instance.interstitial.OnAdClosed             += instance.HandleInterstitialClosed;
                instance.interstitial.OnAdLeavingApplication += instance.HandleInterstitialLeftApplication;

                // Load an interstitial ad.
                instance.interstitial.LoadAd(instance.settings.CreateAdRequest());
#endif
                break;

            case InterstitialType.Interstitial_UNITYADS:
#if MODULE_UNITYADS
                instance.interstitialUnityAds = Monetization.GetPlacementContent(instance.settings.GetUnityAdsInterstitialID()) as ShowAdPlacementContent;
#endif
                break;
            }
        }
示例#9
0
        public static void ShowInterstitial(InterstitialType interstitialType)
        {
            if (!IsInterstitialLoaded(interstitialType))
            {
                return;
            }

            switch (interstitialType)
            {
            case InterstitialType.Interstitial_ADMOB:
#if MODULE_ADMOB
                instance.interstitial.Show();
#endif
                break;

            case InterstitialType.Interstitial_UNITYADS:
#if MODULE_UNITYADS
                instance.interstitialUnityAds.Show();
#endif
                break;
            }
        }
示例#10
0
    private static void Start(string action, InterstitialType type)
    {
        PlayAdsSDK.EnsureInstance();
        if (!PlayAdsSDK.initializing)
        {
            PlayAdsSDK.initializing  = true;
            PlayAdsSDK.waitingAction = action;
            PlayAdsSDK.waitingType   = type;

            string appID       = "";
            string secretToken = "";

                        #if UNITY_IPHONE
            appID       = PlayAdsSDKSettings.IOSAppID;
            secretToken = PlayAdsSDKSettings.IOSSecretToken;
                        #elif UNITY_ANDROID
            appID       = PlayAdsSDKSettings.AndroidAppID;
            secretToken = PlayAdsSDKSettings.AndroidSecretToken;
                        #endif

            PlayAdsSDK.PlayAdsSDKStart(appID, secretToken, INSTANCE_NAME);
        }
    }
示例#11
0
 private void ResetCurrentInterstitial(object sender, GameEventArgs args)
 {
     currentInterstitial = 0;
 }