Skip to content

Commit

Permalink
- update native overlay
Browse files Browse the repository at this point in the history
Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com>
  • Loading branch information
DucNV2000 and VirtueSky committed Dec 2, 2024
1 parent fd25a30 commit 1bf5bed
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions VirtueSky/Advertising/Runtime/Admob/AdmobAdClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public override void Initialize()
adSetting.AdmobRewardVariable.Init();
adSetting.AdmobRewardInterVariable.Init();
adSetting.AdmobAppOpenVariable.Init();
adSetting.AdmobNativeOverlayVariable.Init();

RegisterAppStateChange();
LoadInterstitial();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,45 +90,36 @@ public override bool IsReady()

protected override void ShowImpl()
{
#if VIRTUESKY_ADS && VIRTUESKY_ADMOB
if (_nativeOverlayAd != null)
_nativeOverlayAd.Show();
#endif
}

/// <summary>
/// destroy native overlay ads
/// </summary>
public override void Destroy()
{
#if VIRTUESKY_ADS && VIRTUESKY_ADMOB
if (_nativeOverlayAd != null)
{
_nativeOverlayAd.Destroy();
_nativeOverlayAd = null;
}
#endif
}

/// <summary>
/// Hide native overlay ads
/// </summary>
public void Hide()
{
#if VIRTUESKY_ADS && VIRTUESKY_ADMOB
if (_nativeOverlayAd != null) _nativeOverlayAd.Hide();
#endif
}

public NativeTemplateStyle Style()
{
return new NativeTemplateStyle
{
TemplateId = nativeTemplate.ToString().ToLower(),
// MainBackgroundColor = Color.red,
// CallToActionText = new NativeTemplateTextStyle
// {
// BackgroundColor = Color.green,
// TextColor = Color.white,
// FontSize = 9,
// Style = nativeTemplateFontStyle
// }
};
}

/// <summary>
/// Render native overlay ads default
Expand Down Expand Up @@ -177,6 +168,22 @@ public void RenderAd(RectTransform uiElement, Canvas canvas)
}

#if VIRTUESKY_ADS && VIRTUESKY_ADMOB
public NativeTemplateStyle Style()
{
return new NativeTemplateStyle
{
TemplateId = nativeTemplate.ToString().ToLower(),
// MainBackgroundColor = Color.red,
// CallToActionText = new NativeTemplateTextStyle
// {
// BackgroundColor = Color.green,
// TextColor = Color.white,
// FontSize = 9,
// Style = nativeTemplateFontStyle
// }
};
}

AdPosition ConvertPosition()
{
return adsPosition switch
Expand Down

0 comments on commit 1bf5bed

Please sign in to comment.