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; }); }
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 }
// В дальнейшем будем использовать эту функцию для оборачивания C# делегата public static AndroidJavaProxy ActionToJavaObject <T>(Action <T> action) { if (!s_isInited) { SA_MainThreadDispatcher.Init(); s_isInited = true; } return(new AndroidCallbackHandler <T>(action)); }
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; }); }
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); } }
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; }); }
private void HandleBannerAdOpened(object sender, EventArgs e) { SA_MainThreadDispatcher.Enqueue(() => { m_showCallback.Invoke(); }); }