示例#1
0
 /// <summary>
 /// Displays a rewarded ad.
 ///
 /// If the display was successful, the event `RewardedDisplayedEvent` will be called when the ad closes.
 /// Otherwise, the event `RewardedNotDisplayedEvent` will be called.
 /// </summary>
 /// <param name="tag">The game tag from where the ad will be displayed (like menu or store).</param>
 public void ShowRewarded(string tag)
 {
     RunIfInitialized(() =>
     {
         AdsLogger.LogWithFormat("{0} | Show rewarded at tag {1}", _label, tag);
         _adsBinding.ShowRewarded(tag);
     });
 }
示例#2
0
 /// <summary>
 /// Displays a banner ad.
 ///
 /// If the display was successful, the event `BannerCompletedDisplayedEvent` will be called.
 /// Otherwise, the event `BannerFailedDisplayedEvent` will be called.
 /// </summary>
 /// <param name="tag">The game tag from where the ad will be displayed (like menu or store).</param>
 /// <param name="bannerSize">The bannerSize of the Ad.</param>
 /// <param name="bannerPosition">The bannerPosition where the ad will be displayed.</param>
 public void ShowBanner(string tag, BannerSize bannerSize, BannerPosition bannerPosition)
 {
     RunIfInitialized(() =>
     {
         AdsLogger.LogWithFormat("{0} | Show banner at tag {1}", _label, tag);
         _adsBinding.ShowBanner(tag, bannerSize, bannerPosition);
     });
 }
示例#3
0
 /// <summary>
 /// Displays an interstitial ad.
 ///
 /// If the display was successful, the event `InterstitialDisplayedEvent` will be called when the ad closes.
 /// Otherwise, the event `InterstitialNotDisplayedEvent` will be called.
 /// </summary>
 /// <param name="tag">The game tag from where the ad will be displayed (like menu or store).</param>
 public void ShowInterstitial(string tag)
 {
     RunIfInitialized(() =>
     {
         AdsLogger.LogWithFormat("{0} | Show interstitial at tag {1}", _label, tag);
         _adsBinding.ShowInterstitial(tag);
     });
 }
示例#4
0
 /// <summary>
 /// Stops a banner ad.
 ///
 /// </summary>
 /// <param name="tag">The game tag from where the ad will be removed from (like menu or store).</param>
 public void StopBanner(string tag)
 {
     RunIfInitialized(() =>
     {
         AdsLogger.LogWithFormat("{0} | Stop banner at tag {1}", _label, tag);
         _adsBinding.StopBanner(tag);
     });
 }
示例#5
0
        private static void RunIfInitialized(Action action)
        {
            if (!_isInitialized)
            {
                AdsLogger.LogError("ScaleMonk SDK must be initialized. Make sure to call ScaleMonkAds.Initialize()");
                return;
            }

            action();
        }
示例#6
0
        /// <summary>
        /// Initialize ScaleMonk SDK
        ///
        /// <param name="callback">The callback that will be called after the ScaleMonk SDK is initialized</param>
        /// </summary>
        public static void Initialize(Action callback)
        {
            if (_isInitialized)
            {
                AdsLogger.LogWarning("{0} | Ads SDK already initialized", _label);
                return;
            }

            AdsLogger.LogWithFormat("{0} | Initializing Ads SDK", _label);

            _instance               = SharedInstance;
            _isInitialized          = true;
            _initializationCallback = callback;

            ScaleMonkAdsMonoBehavior.Initialize(_instance);
            _instance.InitializeInternal();
        }
示例#7
0
 public void CompletedBannerDisplay(string tag)
 {
     AdsLogger.LogWithFormat("{0} | Banner displayed at tag {1}", _label, tag);
     CallAction(BannerCompletedDisplayedEvent);
 }
示例#8
0
 public void RewardedNotReady()
 {
     AdsLogger.LogWithFormat("{0} | Rewarded ad not ready to be displayed", _label);
     CallAction(RewardedNotReadyEvent);
 }
 public void InitializationCompleted()
 {
     AdsLogger.LogWithFormat("{0} | Completed initialization", _label);
     _adsInstance.InitializationCompleted();
 }
示例#10
0
 public void FailedInterstitialDisplay(string tag)
 {
     AdsLogger.LogWithFormat("{0} | Interstitial not displayed at tag {1}", _label, tag);
     CallAction(InterstitialNotDisplayedEvent);
 }
示例#11
0
 public void InterstitialNotReady()
 {
     AdsLogger.LogWithFormat("{0} | Interstitial not ready to be displayed", _label);
     CallAction(InterstitialNotReadyEvent);
 }
 public void InterstitialNotReady()
 {
     AdsLogger.LogWithFormat("{0} | Interstitial not ready to display", _label);
     _adsInstance.InterstitialNotReady();
 }
示例#13
0
 public void ClickedInterstitial(string tag)
 {
     AdsLogger.LogWithFormat("{0} | Clicked interstitial at tag {1}", _label, tag);
     CallAction(InterstitialClickedEvent);
 }
示例#14
0
 public void StartedRewardedDisplay(string tag)
 {
     AdsLogger.LogWithFormat("{0} | Started rewarded at tag {1}", _label, tag);
     CallAction(RewardedStartedEvent);
 }
示例#15
0
 public void ClickedRewarded(string tag)
 {
     AdsLogger.LogWithFormat("{0} | Clicked rewarded at tag {1}", _label, tag);
     CallAction(RewardedClickedEvent);
 }
 public void ClickedRewarded(string location)
 {
     AdsLogger.LogWithFormat("{0} | Clicked video at location \"{1}\"", _label, location);
     _adsInstance.ClickedRewarded(location);
 }
 public void CompletedBannerDisplay(string location)
 {
     AdsLogger.LogWithFormat("{0} | Completed banner display at location \"{1}\"", _label, location);
     _adsInstance.CompletedBannerDisplay(location);
 }
 public void FailedRewardedDisplay(string location)
 {
     AdsLogger.LogWithFormat("{0} | Failed video display at location \"{1}\"", _label, location);
     _adsInstance.FailedRewardedDisplay(location);
 }
 public void ClickedInterstitial(string location)
 {
     AdsLogger.LogWithFormat("{0} | Clicked interstitial at location \"{1}\"", _label, location);
     _adsInstance.ClickedInterstitial(location);
 }
        public static EditorPosition toEditorPosition(this BannerPosition position)
        {
            Vector2 anchorMin;
            Vector2 anchorMax;
            Vector2 pivot;

            switch (position)
            {
            case BannerPosition.TopCenter:
                anchorMin = new Vector2(0.5f, 1);
                anchorMax = new Vector2(0.5f, 1);
                pivot     = new Vector2(0.5f, 1);
                break;

            case BannerPosition.TopLeft:
                anchorMin = new Vector2(0, 1);
                anchorMax = new Vector2(0, 1);
                pivot     = new Vector2(0, 1);
                break;

            case BannerPosition.TopRight:
                anchorMin = new Vector2(1, 1);
                anchorMax = new Vector2(1, 1);
                pivot     = new Vector2(1, 1);
                break;

            case BannerPosition.Centered:
                anchorMin = new Vector2(0.5f, 0.5f);
                anchorMax = new Vector2(0.5f, 0.5f);
                pivot     = new Vector2(0.5f, 0.5f);
                break;

            case BannerPosition.CenterLeft:
                anchorMin = new Vector2(0, 0.5f);
                anchorMax = new Vector2(0, 0.5f);
                pivot     = new Vector2(0, 0.5f);
                break;

            case BannerPosition.CenterRight:
                anchorMin = new Vector2(1, 0.5f);
                anchorMax = new Vector2(1, 0.5f);
                pivot     = new Vector2(1, 0.5f);
                break;

            case BannerPosition.BottomLeft:
                anchorMin = new Vector2(0, 0);
                anchorMax = new Vector2(0, 0);
                pivot     = new Vector2(0, 0);
                break;

            case BannerPosition.BottomCenter:
                anchorMin = new Vector2(0.5f, 0);
                anchorMax = new Vector2(0.5f, 0);
                pivot     = new Vector2(0.5f, 0);
                break;

            case BannerPosition.BottomRight:
                anchorMin = new Vector2(1, 0);
                anchorMax = new Vector2(1, 0);
                pivot     = new Vector2(1, 0);
                break;

            default:
                AdsLogger.LogError("Position is not valid");
                throw new Exception("Position is not valid");
            }

            return(new EditorPosition(anchorMin, anchorMax, pivot));
        }
示例#21
0
 public void InitializationCompleted()
 {
     AdsLogger.LogWithFormat("{0} | SDK Initialization Completed", _label);
     CallAction(_initializationCallback);
 }
示例#22
0
 public void FailedRewardedDisplay(string tag)
 {
     AdsLogger.LogWithFormat("{0} | Rewarded not displayed at tag {1}", _label, tag);
     CallAction(RewardedNotDisplayedEvent);
 }
 public void RewardedNotReady()
 {
     AdsLogger.LogWithFormat("{0} | Rewarded not ready to display", _label);
     _adsInstance.RewardedNotReady();
 }
 public void FailedInterstitialDisplay(string location)
 {
     AdsLogger.LogWithFormat("{0} | Failed interstitial display at location \"{1}\"", _label, location);
     _adsInstance.FailedInterstitialDisplay(location);
 }