Beispiel #1
0
 private void initUnityAds()
 {
     if (!AdConfig.getInstance().isEnableunityAd())
     {
         return;
     }
     unityAds = gameObject.AddComponent <UnityAds>();
 }
Beispiel #2
0
 private void initAdmob()
 {
     if (!AdConfig.getInstance().admobEnable)
     {
         return;
     }
     admober = gameObject.AddComponent <Admober>();
 }
Beispiel #3
0
 public static AdConfig getInstance()
 {
     if (instance == null)
     {
         instance = Resources.Load <AdConfig>("@AdConfig");
     }
     return(instance);
 }
Beispiel #4
0
        IEnumerator ShowAdWhenReady(string key = "", Action <bool, object> cb = null)
        {
            string zone = AdConfig.getInstance().getUnityKeyPlacement(key);
            float  stT  = Time.time;

            while (!Advertisement.IsReady(zone) && (Time.time - stT) <= AdConfig.getInstance().unityAdsWaitAdTime)
            {
                yield return(new WaitForSeconds(0.35f));
            }

            ShowOptions options = new ShowOptions();

            if (cb != null)
            {
                options.resultCallback = r => {
                    cb(r == ShowResult.Finished, r);
                };
            }
            Advertisement.Show(zone, options);
        }
Beispiel #5
0
        void Awake()
        {
            string gid = AdConfig.getInstance().getUnityAdsGameId();

            Advertisement.Initialize(gid, true);
        }