This commit is contained in:
juncong lee 2025-09-04 17:19:28 +08:00
commit d1eab95510
3 changed files with 61 additions and 25 deletions

View File

@ -270,19 +270,26 @@ namespace WZ
//4.判断skip(次安装跳过几次触发不展示广告) //4.判断skip(次安装跳过几次触发不展示广告)
int skipLevel = ivRulesData.skipLevel; int skipLevel = ivRulesData.skipLevel;
int currentSkipLevel = PlayerPrefsUtils.GetPlayerPrefsInt($"{IvRulesKey.KEY_SKIPLEVEL}_{ivadType.ToString()}", 0); int currentSkipLevel = PlayerPrefsUtils.GetPlayerPrefsInt($"{IvRulesKey.KEY_SKIPLEVEL}_{ivadType.ToString()}", 0);
LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 前N次不展示插屏, 本地次数是{currentSkipLevel} 远程参数是{skipLevel}"); LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 前N次不展示插屏, 本地次数是{currentSkipLevel + 1} 远程参数是{skipLevel}");
if (currentSkipLevel < skipLevel) if (currentSkipLevel < skipLevel)
{ {
PlayerPrefsUtils.SavePlayerPrefsInt($"{IvRulesKey.KEY_SKIPLEVEL}_{ivadType.ToString()}", currentSkipLevel + 1); PlayerPrefsUtils.SavePlayerPrefsInt($"{IvRulesKey.KEY_SKIPLEVEL}_{ivadType.ToString()}", currentSkipLevel + 1);
return false; return false;
} }
//5.判断overLevel(每跳过几次触发) //5.判断overLevel(每跳过几次触发) 第一次会展示 之后每展示一次间隔+1
int overLevel = ivRulesData.overLevel; int overLevel = ivRulesData.overLevel;
int currentOverLevel = IvRulesConst.OverLevels.ContainsKey(ivadType.ToString()) ? IvRulesConst.OverLevels[ivadType.ToString()] : 0; int currentOverLevel = IvRulesConst.OverLevels.ContainsKey(ivadType.ToString()) ? IvRulesConst.OverLevels[ivadType.ToString()] : 0;
LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 当前间隔次数: 本地次数是{currentOverLevel} 远程参数是{overLevel}"); LoggerUtils.Debug($"[SDK] {ivadType.ToString()} 当前间隔次数: 本地次数是{currentOverLevel + 1} 远程参数是{overLevel}");
if (currentOverLevel < overLevel) if (currentOverLevel != 0)
{ {
IvRulesConst.OverLevels[ivadType.ToString()] = currentOverLevel + 1; if (currentOverLevel >= overLevel)
{
IvRulesConst.OverLevels[ivadType.ToString()] = 0;
}
else
{
IvRulesConst.OverLevels[ivadType.ToString()] += 1;
}
return false; return false;
} }

View File

@ -106,7 +106,7 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
AdsSDKManager.Instance.ShowInterstitialAd(position, ivadType, (revenue) => AdsSDKManager.Instance.ShowInterstitialAd(position, ivadType, (revenue) =>
{ {
//展示完一个插屏之后调用 //展示完一个插屏之后调用
IvRulesConst.OverLevels[ivadType.ToString()] = 0; IvRulesConst.OverLevels[ivadType.ToString()] = 1;
IvRulesConst.Intervals[ivadType.ToString()] = TimeUtils.GetLocalTimestamp(); IvRulesConst.Intervals[ivadType.ToString()] = TimeUtils.GetLocalTimestamp();
AdsSplashManager.Instance.backgroundTime = Time.realtimeSinceStartup; AdsSplashManager.Instance.backgroundTime = Time.realtimeSinceStartup;
callback?.Invoke(revenue); callback?.Invoke(revenue);
@ -366,6 +366,7 @@ public class AppSDKManager : D_MonoSingleton<AppSDKManager>
return; return;
} }
EFSdkManager.Instance.AddUrl(id, url);
EFSdkManager.Instance.SetOkspinShowPos(pos); EFSdkManager.Instance.SetOkspinShowPos(pos);
EFSdk.get().ShowWebView(id, url, pRect, pCam); EFSdk.get().ShowWebView(id, url, pRect, pCam);
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using EFSDK; using EFSDK;
using Firebase.Analytics; using Firebase.Analytics;
using UnityEngine; using UnityEngine;
@ -14,6 +15,9 @@ namespace WZ
private Action<string> _webviewShowSuccessAction; private Action<string> _webviewShowSuccessAction;
//保存的链接
private List<string> urls = new List<string>();
public void Init() public void Init()
{ {
if (Application.isEditor) if (Application.isEditor)
@ -24,7 +28,6 @@ namespace WZ
{ {
if (actionType == EFSdk.ActionType.H5_Load_Succ) if (actionType == EFSdk.ActionType.H5_Load_Succ)
{ {
//webview展示成功
_webviewShowSuccessAction?.Invoke(str); _webviewShowSuccessAction?.Invoke(str);
} }
}); });
@ -48,10 +51,10 @@ namespace WZ
/// <param name="callback">string 是互动广告的url</param> /// <param name="callback">string 是互动广告的url</param>
public void SetHdH5ImpressionCallback() public void SetHdH5ImpressionCallback()
{ {
EFSdk.get().SetHdH5ImpressionCallback((url) => EFSdk.get().SetHdH5ImpressionCallback((pid) =>
{ {
//判断链接不为空 //判断链接不为空
if (string.IsNullOrEmpty(url)) if (string.IsNullOrEmpty(pid))
{ {
return; return;
} }
@ -61,6 +64,8 @@ namespace WZ
count++; count++;
PlayerPrefsUtils.SavePlayerPrefsInt(KEY_OKSPIN_SHOW_COUNT, count); PlayerPrefsUtils.SavePlayerPrefsInt(KEY_OKSPIN_SHOW_COUNT, count);
string url = GetUrl(pid);
//互动广告只有okSpin //互动广告只有okSpin
float revenue = FireBaseRemoteConfigManager.Instance.GetRemoteConfigFloat("rev_okspin", 0); float revenue = FireBaseRemoteConfigManager.Instance.GetRemoteConfigFloat("rev_okspin", 0);
@ -82,5 +87,28 @@ namespace WZ
{ {
_webviewShowSuccessAction = action; _webviewShowSuccessAction = action;
} }
public void AddUrl(int id, string url)
{
if (!urls.Contains(url))
{
urls.Add(url);
}
}
private string GetUrl(string pid)
{
foreach (var url in urls)
{
if (url.Contains(pid))
{
return url;
}
}
return pid;
}
} }
} }