diff --git a/popcorn/Assets/MyGame/Scripts/AdManager.cs b/popcorn/Assets/MyGame/Scripts/AdManager.cs new file mode 100644 index 00000000..e08c04fa --- /dev/null +++ b/popcorn/Assets/MyGame/Scripts/AdManager.cs @@ -0,0 +1,74 @@ +using System; +using UnityEngine; + +public sealed class AdManager : SingletonMonoBehaviour { + + //-- ironSource --// +#if UNITY_IOS + private static readonly string IRONSOURCE_APP_KEY = ""; +#else + private static readonly string IRONSOURCE_APP_KEY = ""; +#endif + + void Awake(){ +#if DEVELOPMENT_BUILD + // IronSource.Agent.validateIntegration (); + // IronSource.Agent.setAdaptersDebug(true); +#endif + // IronSource.Agent.init (IRONSOURCE_APP_KEY); + } + + void Start(){ + LoadBannerAds(); + ShowBannerAd(); + } + + void Update (){ + } + + void OnApplicationPause(bool isPaused) { + // IronSource.Agent.onApplicationPause(isPaused); + } + + //-- Banners Ads --// + + public void LoadBannerAds(){ + // IronSource.Agent.loadBanner(IronSourceBannerSize.SMART, IronSourceBannerPosition.BOTTOM); + + } + public void ShowBannerAd(){ + // IronSource.Agent.displayBanner(); + } + public void HideBanner(){ + // IronSource.Agent.hideBanner(); + } + + + public bool IsLoadedRewardVideo(){ + return true; +// #if UNITY_EDITOR +// return true; +// #else +// return IronSource.Agent.isRewardedVideoAvailable(); +// #endif + } + public void ShowRewardVideo(Action callback){ + callback(true); +// #if UNITY_EDITOR +// callback(true); +// #else +// _rewardAdCallback = callback; +// if(_rewardAdCallback == null){ +// return; +// }else if(IsLoadedRewardVideo()){ +// _rewardAdOpen = false; +// _rewardAdFinish = false; +// _rewardAdClose = false; +// _async_frame_count = 0; +// IronSource.Agent.showRewardedVideo(); +// }else{ +// _rewardAdCallback(false); +// } +// #endif + } +} \ No newline at end of file diff --git a/popcorn/Assets/MyGame/Scripts/AdManager.cs.meta b/popcorn/Assets/MyGame/Scripts/AdManager.cs.meta new file mode 100644 index 00000000..edc955be --- /dev/null +++ b/popcorn/Assets/MyGame/Scripts/AdManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8e2021f1b8ce47f79191ab8732fba298 +timeCreated: 1634545756 \ No newline at end of file