예제 #1
0
        protected override void OnPanelOpen(params object[] args)
        {
            m_Builder = args[0] as AdDisplayerBuilder;

            if (m_Builder == null)
            {
                OnAdShowFailed();
                return;
            }

            //强制去除广告
            if (!m_Builder.forceShow)
            {
                if (AdsMgr.S.isNoAdsMode)
                {
                    m_IsRewardSuccess = m_IsShowSuccess = true;
                    m_IsFinish        = true;
                    return;
                }
            }

            m_Placement = AdsMgr.S.GetAdPlacement(m_Builder.placementData.id);

            //远程配置关闭或则时间不可用
            if (!m_Placement.data.isEnable)
            {
                if (m_Placement.data.rewardWhenDisable)
                {
                    m_IsRewardSuccess = m_IsShowSuccess = true;
                }
                else
                {
                    m_IsRewardSuccess = m_IsShowSuccess = false;
                }
                m_IsFinish = true;
                return;
            }

            //广告处于冷却时间
            if (!m_Placement.IsTimeShowAble())
            {
                m_IsRewardSuccess = m_IsShowSuccess = false;
                m_IsFinish        = true;
                return;
            }

            OpenDependPanel(EngineUI.MaskPanel, -1);

            m_Builder.CustomAdTag("request");

            m_AdIndex         = 0;
            m_IsRewardSuccess = m_IsShowSuccess = false;
            m_IsFinish        = false;

            ShowAD();
        }
예제 #2
0
        protected override void OnClose()
        {
#if UNITY_EDITOR
            m_IsShowSuccess   = true;
            m_IsRewardSuccess = true;
#endif

            CancelWaitAdLoading();

            if (m_Builder != null && m_Builder.onAdShowResultCallback != null)
            {
                m_Builder.onAdShowResultCallback(m_IsShowSuccess, m_IsRewardSuccess, m_Builder.rewardID);
            }
            m_Builder = null;
        }