Exemplo n.º 1
0
    IEnumerator ShowInterstitialAdsRunner(Action <AdFactory.RewardResult> OnFinish, string placement)
    {
        //顯示讀取,如果有的話
        OnBeforeAdShow?.Invoke();
        yield return(new WaitForSecondsRealtime(1f));

        AdFactory.RewardResult result = AdFactory.RewardResult.Faild;
#if UNITY_EDITOR
        result = EditorTestResult;
#else
        if (CheckInit() && IsInternetAvaliable)
        {
            yield return(adManager.ShowInterstitialAds(placement, (r) => {
                result = r;
            }));
        }
        else
        {
            yield return(new WaitForSecondsRealtime(1.5f));

            Debug.Log("Video is not ready please check your network or try again later.");
        }
#endif
        OnFinish?.Invoke(result);
        //關閉讀取,如果有的話
        OnAfterAdShow?.Invoke();
        OnAdResult?.Invoke(AdType.Interstitial, result, placement);
    }