Example #1
0
    public override void OnConfigLoadComplete()
    {
        if (!_didInit)
        {
            return;
        }
        {
            InhouseSDK.AdmobConfig admobConfig = (InhouseSDK.AdmobConfig)_config.Ads.Services[TAG_ADMOB];
            if (admobConfig == null)
            {
                throw new UnityException("AdsMgr: invalid config");
            }
            AdmobAds ads = new AdmobAds(this, admobConfig);
            ads.Init();
            _ads.Add(TAG_ADMOB, ads);
        }
        {
            InhouseSDK.UnityAdsConfig unityConfig = (InhouseSDK.UnityAdsConfig)_config.Ads.Services[TAG_UNITYADS];
            if (unityConfig == null)
            {
                throw new UnityException("AdsMgr: invalid config");
            }
            UnityAds ads = new UnityAds(this, unityConfig);
            ads.Init();
            _ads.Add(TAG_UNITYADS, ads);
        }

        ShowBanner();

        _didComplete = true;
    }
Example #2
0
    public override void InitWithConfig(Hashtable data)
    {
        base.InitWithConfig(data);

        if (data == null)
        {
            return;
        }
        data = (Hashtable)data["Ads"];
        if (data == null)
        {
            return;
        }

        Hashtable dataServices = (Hashtable)data["Services"];
        Hashtable dataAdsType  = (Hashtable)data["AdsType"];

        Dictionary <string, string> types = new Dictionary <string, string> ();
        Dictionary <string, InhouseSDK.AdsBaseConfig> services = new Dictionary <string, InhouseSDK.AdsBaseConfig> ();

        foreach (DictionaryEntry item in dataAdsType)
        {
            types.Add(HDUtils.ParseString(item.Key), HDUtils.ParseString(item.Value));
        }

        {
            InhouseSDK.AdmobConfig admob = new InhouseSDK.AdmobConfig();
            Hashtable dataAdmob          = (Hashtable)dataServices ["Admob"];
            admob.BannerId      = HDUtils.ParseString(dataAdmob["BannerId"]);
            admob.IntersitialId = HDUtils.ParseString(dataAdmob["IntersitialId"]);
            services.Add(TAG_ADMOB, admob);
        }

        {
            InhouseSDK.UnityAdsConfig unityAd = new InhouseSDK.UnityAdsConfig();
            Hashtable dataAdmob = (Hashtable)dataServices ["UnityAds"];
            unityAd.AdsId       = HDUtils.ParseString(dataAdmob["AdsId"]);
            unityAd.RewardedKey = HDUtils.ParseString(dataAdmob["RewardedKey"]);
            unityAd.SkippedKey  = HDUtils.ParseString(dataAdmob["SkippedKey"]);
            services.Add(TAG_UNITYADS, unityAd);
        }

        {
            InhouseSDK.FBAdsConfig fbAd = new InhouseSDK.FBAdsConfig();
            Hashtable dataAdmob         = (Hashtable)dataServices ["FBAds"];
            fbAd.BannerId      = HDUtils.ParseString(dataAdmob["BannerId"]);
            fbAd.IntersitialId = HDUtils.ParseString(dataAdmob["IntersitialId"]);
            fbAd.NativeId      = HDUtils.ParseString(dataAdmob["NativeId"]);
            services.Add(TAG_FBADS, fbAd);
        }

        _config.Ads.DisplayFrequencyOfInterstitial = TypeConvert.ToInt(data["DisplayFrequencyOfInterstitial"]);
        _config.Ads.Services = services;
        _config.Ads.AdsType  = types;

        _didInit = true;
    }
Example #3
0
 public UnityAds(AdsMgr manager, InhouseSDK.UnityAdsConfig config) : base(manager)
 {
     _config = config;
 }