Ejemplo n.º 1
0
        protected void InitAdHandlerList()
        {
            var adDataList = TDAdConfigTable.GetAdDataByInterface(m_AdInterfaceName);

            if (adDataList.Count <= 0)
            {
                Log.w("Not Find AdConfig For Interface:" + m_AdInterfaceName);
                return;
            }

            for (int i = 0; i < adDataList.Count; ++i)
            {
                var handler = AdsMgr.S.CreateAdHandler(adDataList[i]);
                if (handler != null)
                {
                    m_AdHandler.Add(handler);
                }
            }

            m_AdHandler.Sort(AdHandlerSorter);

            for (int i = 0; i < m_AdHandler.Count; ++i)
            {
                m_AdHandler[i].SetAdInterface(this);
            }
        }
Ejemplo n.º 2
0
        protected override void LoadAdInner()
        {
#if UNITY_EDITOR
            return;
#endif

            TDAdConfig data = TDAdConfigTable.GetData(m_AdName);
            if (data == null)
            {
                return;
            }

            m_AdUnitID = data.unitID;

            m_NativeAd = new AudienceNetwork.NativeAd(m_AdUnitID);

            m_NativeAd.RegisterGameObjectForImpression(gameObject, null);

            m_NativeAd.NativeAdDidLoad = (delegate()
            {
                if (On_AdTextLoadFinish != null)
                {
                    OnTextLoadFinish();
                }

                StartCoroutine(LoadIconImage());
                StartCoroutine(LoadCoverImage());
            });

            m_NativeAd.NativeAdDidFailWithError = (delegate(string error)
            {
                Log.w("Native ad failed to load with error: ");
            });

            m_NativeAd.NativeAdWillLogImpression = (delegate()
            {
                Log.i("Native ad logged impression.");
            });

            m_NativeAd.NativeAdDidClick = (delegate()
            {
                Log.i("Native ad clicked.");
            });

            m_NativeAd.LoadAd();
            return;
        }