Esempio n. 1
0
        private void RegisterADInterface(SDKADAdapterConfig config)
        {
            for (int i = 0; i < config.adParamsList.Count; i++)
            {
                ADInterface adInterface = null;
                if (m_ADInterfaceGroupDict.TryGetValue(config.adParamsList[i].adInterfaceGroup, out adInterface))
                {
                    continue;
                }
                switch (config.adParamsList[i].adType)
                {
                case ADType.Banner:
                    adInterface = new ADBannerInterface();
                    break;

                case ADType.Interstitial:
                    adInterface = new ADInterstitialInterface();
                    break;

                case ADType.Reward:
                    adInterface = new ADInterstitialInterface();
                    break;

                default:
                    break;
                }
                if (adInterface != null)
                {
                    adInterface.Init(config.adParamsList[i].adInterfaceGroup);
                    m_ADInterfaceGroupDict.Add(config.adParamsList[i].adInterfaceGroup, adInterface);
                }
            }
        }
Esempio n. 2
0
        public void RegisterADHandler2Interface(ADGroup groupName, ADHandler handler, ADType adType)
        {
            if (!m_ADHandlerList.Contains(handler))
            {
                m_ADHandlerList.Add(handler);
            }

            ADInterface adInterface = null;

            if (m_ADInterfaceGroupDict.TryGetValue(groupName, out adInterface))
            {
                adInterface.RegisterHandler(handler);
            }
            else
            {
                switch (adType)
                {
                case ADType.Banner:
                    adInterface = new ADBannerInterface();
                    break;

                case ADType.Interstitial:
                    adInterface = new ADInterstitialInterface();
                    break;

                case ADType.Reward:
                    adInterface = new ADInterstitialInterface();
                    break;

                default:
                    break;
                }
                if (adInterface != null)
                {
                    adInterface.Init(groupName);
                    m_ADInterfaceGroupDict.Add(groupName, adInterface);
                    adInterface.RegisterHandler(handler);
                }
                else
                {
                    Log.I("No suit ADInterface.");
                }
            }

            //test
            // foreach (var item in m_ADInterfaceGroupDict.Values)
            // {
            //     foreach (var v in item.m_ADHandlerList)
            //         Log.I("////////////////" + v.m_ADParams.name);
            // }
        }