Space Ad Mobile 9.5.1
Space Ad Mobile makes ads easy to add into your mobile game: one unified workflow for LevelPlay, AdMob, Yandex.Ads across banners, interstitials and rewarded.
Loading...
Searching...
No Matches
AdUnitBase.cs
1namespace SCG.SpaceAdMobile
2{
8 public abstract class AdUnitBase : AdUnitBehaviourBase
9 {
11 public abstract override AdType AdType { get; }
12
16 public abstract AdBehaviour AdBehaviour { get; }
17
21 public abstract MessageOptions MessageOptions { get; }
22
23#if LEVELPLAY_MOBILE_ADS
28#elif GOOGLE_MOBILE_ADS
33#elif YANDEX_MOBILE_ADS
38#else
40#endif
41 protected abstract string TestAndroidId { get; }
42
43#if LEVELPLAY_MOBILE_ADS
48#elif GOOGLE_MOBILE_ADS
53#elif YANDEX_MOBILE_ADS
58#else
60#endif
61 // ReSharper disable once InconsistentNaming
62 protected abstract string TestIOSId { get; }
63
67 protected abstract void OnLoadFromCache();
68
73 protected abstract void OnAttachToCache();
74
80 protected abstract void RegisterEventHandlers();
81
85 protected virtual void OnInternetNotAvailable() { }
86
87 #region Ad Events
88
89 // ReSharper disable UnusedMemberInSuper.Global
93 protected virtual void OnAdPaid(object paid) { }
94
98 protected virtual void OnAdImpressionRecorded() { }
99
103 protected virtual void OnAdLoaded() { }
104
108 protected virtual void OnAdLoadFailed(object error) { }
109
113 protected virtual void OnAdClicked() { }
114
118 protected virtual void OnAdShown() { }
119
123 protected virtual void OnAdClosed() { }
124
129 protected virtual void OnAdContentFailed(object error) { }
130
135 protected virtual void OnUserEarnedReward(AdRewardBase reward) { }
136 // ReSharper restore UnusedMemberInSuper.Global
137
138 #endregion
139
140 #region Mute API
141
142 private System.IDisposable fullscreenAdAudioLease;
143
154 protected virtual System.IDisposable AcquireFullscreenAdAudio() => FullscreenAdAudioController.Acquire(this);
155
163 {
164 var lease = fullscreenAdAudioLease;
165 fullscreenAdAudioLease = null;
166 lease?.Dispose();
167 }
168
173 {
175 fullscreenAdAudioLease = AcquireFullscreenAdAudio();
176 }
177
178 #endregion
179 }
180}
Represents a backend-agnostic description of an ad reward.
virtual void OnAdPaid(object paid)
Raised when the AdObject is estimated to have earned money.
Definition AdUnitBase.cs:93
virtual void OnAdClosed()
Raised when the AdObject closed full screen content.
override AdType AdType
Gets the common advertising format exposed by this ad unit.
Definition AdUnitBase.cs:11
virtual void OnAdImpressionRecorded()
Raised when an impression is recorded for an AdObject.
Definition AdUnitBase.cs:98
virtual void OnAdLoadFailed(object error)
Raised when loading of the AdObject is failed.
virtual void OnAdClicked()
Raised when a click is recorded for an AdObject.
virtual void OnInternetNotAvailable()
Raised when the Internet connection isn't available. Can be overridden to handle this scenario.
Definition AdUnitBase.cs:85
string TestAndroidId
Gets the Android test ad unit identifier for the active provider.
Definition AdUnitBase.cs:41
MessageOptions MessageOptions
Options for enabling Unity SendMessage methods.
Definition AdUnitBase.cs:21
virtual void OnAdContentFailed(object error)
Raised when the AdObject failed to open full screen content.
virtual void OnAdLoaded()
Raised when the AdObject is loaded.
virtual void OnAdShown()
Raised when an AdObject opened full screen content.
virtual System.IDisposable AcquireFullscreenAdAudio()
Acquires the audio policy for a fullscreen ad show.
void ReleaseFullscreenAdAudio()
Releases the audio policy for the current fullscreen ad show.
string TestIOSId
Gets the iOS test ad unit identifier for the active provider.
Definition AdUnitBase.cs:62
virtual void OnUserEarnedReward(AdRewardBase reward)
Raised when the AdObject rewarded the user.
AdBehaviour AdBehaviour
Behavior options for displaying and showing ads.
Definition AdUnitBase.cs:16
void AcquireFullscreenAdAudioLease()
Replaces the current fullscreen audio lease with a new one.
Base class for ad units. This class defines the abstract and virtual properties and methods that are ...
Definition AdUnitBase.cs:9
void RegisterEventHandlers()
To further customize the behavior of your ad, you can hook into a number of events in the ad's lifecy...
void OnAttachToCache()
Method to be called when the object is attached to the cache. It needs to unsubscribe from events it ...
void OnLoadFromCache()
Method to be called when the object is loaded from the cache. It needs to subscribe to needed events.
Base MonoBehaviour class for ad units. This class defines the abstract and virtual properties and met...