Beispiel #1
0
        private bool ShowAd(ADGroup adInterfaceGroup, ADShowResultDelegate callback = null, bool bShowReminder = true)
        {
            ResetParams();
            bool bSuccess = false;

            m_ADInterface = ADMgr.S.GetInterface(adInterfaceGroup);
            if (m_ADInterface != null)
            {
                m_ADShowCallback = callback;
                bSuccess         = m_ADInterface.ShowAD();
            }
            if (!bSuccess && !m_IsFinish)
            {
                if (callback != null)
                {
                    callback(m_IsShowSuccess, m_IsRewardSuccess, m_IsClickAd);
                }
                if (bShowReminder)
                {
                    UIMgr.S.OpenPanel(UIID.FloatMessagePanel, "AD no prepare.");
                }
            }

            return(bSuccess);
        }
Beispiel #2
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);
                }
            }
        }
Beispiel #3
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);
            // }
        }
Beispiel #4
0
        public ADInterface GetInterface(ADGroup adInterfaceGroup)
        {
            ADInterface adInterface = null;

            if (m_ADInterfaceGroupDict.TryGetValue(adInterfaceGroup, out adInterface))
            {
                return(adInterface);
            }
            else
            {
                Log.I("No suit ADInterface.");
                return(null);
            }
        }
Beispiel #5
0
 public void RegisterADInterface(ADInterface adInterface)
 {
     m_ADInterface = adInterface;
 }