Skip to content

Commit

Permalink
Merge pull request #28 from unity-package/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
VirtueSky authored Dec 4, 2024
2 parents 0644da5 + 8d819e7 commit 9f97aa2
Show file tree
Hide file tree
Showing 70 changed files with 559 additions and 138 deletions.
3 changes: 3 additions & 0 deletions Module/Advertising/Editor/AdSettingsEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class AdSettingsEditor : Editor
private SerializedProperty _admobInterstitialAdUnit;
private SerializedProperty _admobRewardAdUnit;
private SerializedProperty _admobRewardedInterstitialAdUnit;
private SerializedProperty _admobNativeOverlayAdUnit;
private SerializedProperty _admobAppOpenAdUnit;
private SerializedProperty _admobEnableTestMode;
private SerializedProperty _enableGDPR;
Expand Down Expand Up @@ -57,6 +58,7 @@ void Initialize()
_admobRewardAdUnit = serializedObject.FindProperty("admobRewardAdUnit");
_admobRewardedInterstitialAdUnit = serializedObject.FindProperty("admobRewardedInterstitialAdUnit");
_admobAppOpenAdUnit = serializedObject.FindProperty("admobAppOpenAdUnit");
_admobNativeOverlayAdUnit = serializedObject.FindProperty("admobNativeOverlayAdUnit");
_admobEnableTestMode = serializedObject.FindProperty("admobEnableTestMode");
_enableGDPR = serializedObject.FindProperty("enableGDPR");
_enableGDPRTestMode = serializedObject.FindProperty("enableGDPRTestMode");
Expand Down Expand Up @@ -140,6 +142,7 @@ void DrawAdmob()
EditorGUILayout.PropertyField(_admobRewardAdUnit);
EditorGUILayout.PropertyField(_admobRewardedInterstitialAdUnit);
EditorGUILayout.PropertyField(_admobAppOpenAdUnit);
EditorGUILayout.PropertyField(_admobNativeOverlayAdUnit);
EditorGUILayout.PropertyField(_admobEnableTestMode);
EditorGUILayout.PropertyField(_admobDevicesTest);
GUILayout.Space(10);
Expand Down
28 changes: 14 additions & 14 deletions Module/Advertising/Runtime/Admob/AdmobBannerAdUnit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace VirtueSky.Ads
[Serializable]
public class AdmobBannerAdUnit : AdUnit
{
public BannerSize size = BannerSize.Adaptive;
public BannerPosition position = BannerPosition.Bottom;
public AdsSize size = AdsSize.Adaptive;
public AdsPosition position = AdsPosition.Bottom;
public bool useCollapsible;
public bool useTestId;
#if VIRTUESKY_ADS && VIRTUESKY_ADMOB
Expand Down Expand Up @@ -137,12 +137,12 @@ public AdSize ConvertSize()
{
switch (size)
{
case BannerSize.Adaptive:
case AdsSize.Adaptive:
return AdSize.GetCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(
AdSize.FullWidth);
case BannerSize.MediumRectangle: return AdSize.MediumRectangle;
case BannerSize.Leaderboard: return AdSize.Leaderboard;
case BannerSize.IABBanner: return AdSize.IABBanner;
case AdsSize.MediumRectangle: return AdSize.MediumRectangle;
case AdsSize.Leaderboard: return AdSize.Leaderboard;
case AdsSize.IABBanner: return AdSize.IABBanner;
//case BannerSize.SmartBanner: return AdSize.SmartBanner;
default: return AdSize.Banner;
}
Expand All @@ -158,23 +158,23 @@ public AdPosition ConvertPosition()
{
switch (position)
{
case BannerPosition.Top: return AdPosition.Top;
case BannerPosition.Bottom: return AdPosition.Bottom;
case BannerPosition.TopLeft: return AdPosition.TopLeft;
case BannerPosition.TopRight: return AdPosition.TopRight;
case BannerPosition.BottomLeft: return AdPosition.BottomLeft;
case BannerPosition.BottomRight: return AdPosition.BottomRight;
case AdsPosition.Top: return AdPosition.Top;
case AdsPosition.Bottom: return AdPosition.Bottom;
case AdsPosition.TopLeft: return AdPosition.TopLeft;
case AdsPosition.TopRight: return AdPosition.TopRight;
case AdsPosition.BottomLeft: return AdPosition.BottomLeft;
case AdsPosition.BottomRight: return AdPosition.BottomRight;
default: return AdPosition.Bottom;
}
}

public string ConvertPlacementCollapsible()
{
if (position == BannerPosition.Top)
if (position == AdsPosition.Top)
{
return "top";
}
else if (position == BannerPosition.Bottom)
else if (position == AdsPosition.Bottom)
{
return "bottom";
}
Expand Down
9 changes: 9 additions & 0 deletions Module/Advertising/Runtime/Admob/AdmobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,23 @@ public override void Initialize()
AdSettings.AdmobRewardAdUnit.Init();
AdSettings.AdmobRewardedInterstitialAdUnit.Init();
AdSettings.AdmobAppOpenAdUnit.Init();
AdSettings.AdmobNativeOverlayAdUnit.Init();
RegisterAppStateChange();
LoadInterstitial();
LoadRewarded();
LoadRewardedInterstitial();
LoadAppOpen();
LoadNativeOverlay();
#endif
}

void LoadNativeOverlay()
{
if (!AdSettings.AdmobNativeOverlayAdUnit.IsReady())
{
AdSettings.AdmobNativeOverlayAdUnit.Load();
}
}

#if VIRTUESKY_ADS && VIRTUESKY_ADMOB
public void RegisterAppStateChange()
Expand Down
Loading

0 comments on commit 9f97aa2

Please sign in to comment.