2using UIButton = UnityEngine.UI.Button;
11 [DisallowMultipleComponent]
12 [AddComponentMenu(
"SCG/SpaceAdMobile/" + nameof(
AdButton))]
15 #region Serialized fields
18 [Tooltip(
"Invoke AdUnit.Load() when clicked.")]
19 [SerializeField]
private bool load;
22 [Tooltip(
"Invoke AdUnit.Show() when clicked.")]
23 [SerializeField]
private bool show;
26 [Tooltip(
"Invoke Hide() on the controller if it implements IConcealableAd.")]
27 [SerializeField]
private bool hide;
30 [Tooltip(
"Ad controller that hosts the current AdUnit (auto-filled in Editor).")]
34 [Tooltip(
"Specific AdUnit handler; if null, will be taken from controller.Ad (auto-filled in Editor).")]
38 [Tooltip(
"UGUI Button to bind; auto-filled in Editor via GetComponent.")]
39 [SerializeField]
private UIButton button;
43 #region Unity lifecycle
52 protected virtual void OnValidate()
54 unitController = unitController ? unitController : GetComponent<AdControllerBase>();
55 adUnit = adUnit ? adUnit : GetComponent<AdUnitHandlerBase>();
56 button = button ? button : GetComponent<UIButton>();
92 if (adUnit ==
null && unitController !=
null)
96 throw new System.NullReferenceException(nameof(adUnit));
98 if (load) adUnit.
Load();
99 if (show) adUnit.Show();
Base class for controlling ad units within Unity, providing the foundation for specific ad functional...
Serves as a base handler for ad unit operations, abstracting common functionality for different types...
Provides a mechanism for hiding advertisements. This interface should be implemented by ads that can ...