コード例 #1
0
 protected void HandleAdFailedToLoad(object sender, AdFailedToLoadEventArgs e)
 {
     SA_MainThreadDispatcher.Enqueue(() => {
         var error = new SA_Error(1, e.Message);
         m_loadCallback.Invoke(new SA_Result(error));
         m_loadCallback = null;
     });
 }
コード例 #2
0
        protected override void ConnectToService(string appId, Action <SA_Result> callback)
        {
#if SA_ADMOB_INSTALLED
            SA_MainThreadDispatcher.Init();

            MobileAds.Initialize(appId);
            callback.Invoke(new SA_Result());
#endif
        }
コード例 #3
0
        // В дальнейшем будем использовать эту функцию для оборачивания C# делегата
        public static AndroidJavaProxy ActionToJavaObject <T>(Action <T> action)
        {
            if (!s_isInited)
            {
                SA_MainThreadDispatcher.Init();
                s_isInited = true;
            }

            return(new AndroidCallbackHandler <T>(action));
        }
コード例 #4
0
        protected void HandleAdLoaded(object sender, EventArgs e)
        {
            Debug.Log("Ad loaded here");

            SA_MainThreadDispatcher.Enqueue(() => {
                m_isReady = true;
                m_loadCallback.Invoke(new SA_Result());
                m_loadCallback = null;
            });
        }
コード例 #5
0
            public void onHandleResult(string json, bool forceMainThread)
            {
                AN_Logger.LogCommunication("[Async] Sent to Unity ->: " + json);
                var result = JsonUtility.FromJson <T>(json);

                if (forceMainThread)
                {
                    SA_MainThreadDispatcher.Enqueue(() => {
                        m_ResultHandler.Invoke(result);
                    });
                }
                else
                {
                    m_ResultHandler.Invoke(result);
                }
            }
コード例 #6
0
        private void HandleRewardBasedVideoClosed(object sender, EventArgs e)
        {
            SA_MainThreadDispatcher.Enqueue(() => {
                if (m_isRewarded)
                {
                    m_showCallback.Invoke(UM_RewardedAdsResult.Finished);
                }
                else
                {
                    m_showCallback.Invoke(UM_RewardedAdsResult.Skipped);
                }

                m_isRewarded   = false;
                m_showCallback = null;
            });
        }
コード例 #7
0
 private void HandleBannerAdOpened(object sender, EventArgs e)
 {
     SA_MainThreadDispatcher.Enqueue(() => {
         m_showCallback.Invoke();
     });
 }