public void InitAdsManager(AdSystem adSystem) { _system = adSystem; if (_system.IsNoAds.Value) return; var interstitials = GetComponentsInChildren<IInterstitial>(true); foreach (IInterstitial inter in interstitials) { inter.InitInterstitial(); _interstitials.Add(inter); } // sort by the order _interstitials.Sort((x, y) => x.Order < y.Order ? -1 : 1); }
public void InitAdsManager(AdSystem adSystem) { _system = adSystem; if (_system.IsNoAds.Value) { return; } // observe IsNoAds value, // whenever it's true (normally when the ads have just been removed), // we hide the banner _system.IsNoAds.Subscribe(flag => { if (flag) { ShowBanner(false); } }); _banner = GetComponent <IBanner>(); Assert.Null(_banner, "cant find IBanner component in AdBannerManager"); _banner.InitBanner(() => { _bannerLoaded = true; TryShowOrHideBanner(); }); }