Beispiel #1
0
    // Use this for initialization
    void Awake()
    {
        if (instance != null)
        {
            Destroy(this.gameObject);
            return;
        }



        DontDestroyOnLoad(this.gameObject);

        instance   = this;
        adsEnabled = true;

        if (areAdsAlreadyRemoved())
        {
            disableAds();
        }

        admobHandler = gameObject.AddComponent <AdmobHandler>();

        chartboostHandler = gameObject.AddComponent <ChartboostHandler>();

        if (InitializeNetworksOnStart)
        {
            InitializeNetworks();
        }
    }
Beispiel #2
0
 private static ChartboostHandler getInstance()
 {
     if (m_instance == null)
     {
         m_instance = new ChartboostHandler();
     }
     return(m_instance);
 }
Beispiel #3
0
    public void showInterstatial()
    {
        if (ZPlayerPrefs.GetInt("ads", 1) == 0)
        {
            return;
        }

        if (showInterstatialAdmob)
        {
            AdMobHandler.showAdmobInterstatial();
        }
        else if (ChartboostHandler.isCached() && showInterstatialChartBoost)
        {
            ChartboostHandler.showInterstatialAd();
        }
    }
Beispiel #4
0
    void InitailizeAdNetworks()
    {
        if (showInterstatialChartBoost)
        {
            ChartboostHandler.initialize();
        }

        if (showBannerAdmob && showInterstatialAdmob)
        {
                        #if UNITY_IOS
            AdMobHandler.initialize(ad_mob_banner_id_ios, ad_mob_interstatial_id_ios);
                        #endif
                        #if UNITY_ANDROID
            AdMobHandler.initialize(ad_mob_banner_id_android, ad_mob_interstatial_id_android);
                        #endif
        }
        else
        {
            if (showBannerAdmob)
            {
                                #if UNITY_IOS
                AdMobHandler.initialize(ad_mob_banner_id_ios, "");
                                #endif
                                #if UNITY_ANDROID
                AdMobHandler.initialize(ad_mob_banner_id_android, "");
                                #endif
            }
            else if (showInterstatialAdmob)
            {
                                #if UNITY_IOS
                AdMobHandler.initialize("", ad_mob_interstatial_id_ios);
                                #endif
                                #if UNITY_ANDROID
                AdMobHandler.initialize("", ad_mob_interstatial_id_android);
                                #endif
            }
        }
    }