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
CollapsibleBanner.cs
1using System;
2using GoogleMobileAds.Api;
3using UnityEngine;
4
5namespace SCG.SpaceAdMobile
6{
10 [Serializable]
11 public class CollapsibleBanner
12 {
22 public const string CollapsibleExtraKey = "collapsible";
23
28 public const string CollapsibleRefreshExtraKey = "collapsible_request_id";
29
31 [SerializeField]
32 [Tooltip("Enables or disables the collapsible banner. When set to true, the banner can be expanded or collapsed based on user interaction or other conditions.\n" +
33 "This is applicable only for banners of type Top or Bottom.")]
34 public bool Enabled = false;
35
36#if UNITY_EDITOR
37 [Editor.ShowIf(nameof(Enabled))]
38#endif
44 [Tooltip("Indicates whether the ads refreshing behavior is enabled for the collapsible banner.")]
45 public bool AdsRefreshingBehaviourEnabled = false;
46
53 public bool IsCollapsibleBannerTypeAvailable(AdPosition adPosition, out string position)
54 {
55 position = adPosition switch
56 {
57 AdPosition.Top => "top",
58 AdPosition.Bottom => "bottom",
59 AdPosition.TopLeft or
60 AdPosition.TopRight or
61 AdPosition.BottomLeft or
62 AdPosition.BottomRight or
63 AdPosition.Center => null,
64 _ => throw new ArgumentOutOfRangeException(nameof(adPosition), adPosition, null)
65 };
66 return position != null;
67 }
68
75 // Doxygen 1.17 cannot associate documentation with a C# tuple-return method.
77 public (string Key, string Value) GetRefreshableExtra() =>
78 (CollapsibleRefreshExtraKey, Guid.NewGuid().ToString());
80 }
81}
bool IsCollapsibleBannerTypeAvailable(AdPosition adPosition, out string position)
Determines if a specific ad position supports being collapsible and returns the position as a string ...
bool AdsRefreshingBehaviourEnabled
Indicates whether the ads refreshing behavior is enabled for the collapsible banner....
bool Enabled
Enables or disables the collapsible banner. When set to true, the banner can be expanded or collapsed...
const string CollapsibleRefreshExtraKey
Represents the key used for identifying a unique request ID for refreshable collapsible banner ads....
const string CollapsibleExtraKey
Defines the key for specifying the alignment of an expanded ad relative to the collapsible banner....
Defines the properties and behavior of a collapsible banner.