kwai广告竞价逻辑调整
This commit is contained in:
parent
c2e165b357
commit
905c58b001
|
|
@ -59,7 +59,7 @@ namespace WZ
|
||||||
};
|
};
|
||||||
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dic);
|
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dic);
|
||||||
ShuShuEvent.Instance.Track(eventName, dic);
|
ShuShuEvent.Instance.Track(eventName, dic);
|
||||||
LoggerUtils.Debug("[actionevent] TrackKwiWaterfallFill" + JsonMapper.ToJson(dic));
|
LoggerUtils.Debug("[actionevent] TrackKwaiWaterfallFill" + JsonMapper.ToJson(dic));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,11 @@ namespace WZ
|
||||||
|
|
||||||
// 开始请求楼层广告
|
// 开始请求楼层广告
|
||||||
RequestNextFloorBatch();
|
RequestNextFloorBatch();
|
||||||
|
|
||||||
|
AdsActionEvents.TrackKwaiWaterfallRequest(AdsType.Interstitial,
|
||||||
|
_currentRequestId,
|
||||||
|
_waterfallRequestCount,
|
||||||
|
_ivParallelRequests);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RequestNextFloorBatch()
|
private void RequestNextFloorBatch()
|
||||||
|
|
@ -88,10 +93,23 @@ namespace WZ
|
||||||
|
|
||||||
if (_currentRequestBatch.Count == 0)
|
if (_currentRequestBatch.Count == 0)
|
||||||
{
|
{
|
||||||
// 所有楼层都请求完毕,没有填充
|
// 检查是否还有正在处理的请求
|
||||||
LoggerUtils.Debug("[kwai] floor inter All floors requested, no fill");
|
bool hasPendingRequests = false;
|
||||||
_isRequestingFloors = false;
|
foreach (var kvp in _ivFloorAdControllers)
|
||||||
return;
|
{
|
||||||
|
if (kvp.Value != null && !kvp.Value.IsReady())
|
||||||
|
{
|
||||||
|
hasPendingRequests = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasPendingRequests)
|
||||||
|
{
|
||||||
|
// 所有楼层都请求完毕,并且没有正在处理的请求,确实没有填充
|
||||||
|
LoggerUtils.Debug("[kwai] floor reward All floors requested, no fill");
|
||||||
|
_isRequestingFloors = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LoggerUtils.Debug($"[kwai] floor inter Requesting floor batch: {string.Join(", ", _currentRequestBatch.Select(f => $"{f.id}({f.price})"))}");
|
LoggerUtils.Debug($"[kwai] floor inter Requesting floor batch: {string.Join(", ", _currentRequestBatch.Select(f => $"{f.id}({f.price})"))}");
|
||||||
|
|
@ -101,10 +119,7 @@ namespace WZ
|
||||||
{
|
{
|
||||||
RequestFloorAd(floor);
|
RequestFloorAd(floor);
|
||||||
}
|
}
|
||||||
AdsActionEvents.TrackKwaiWaterfallRequest(AdsType.Interstitial,
|
|
||||||
_currentRequestId,
|
|
||||||
_waterfallRequestCount,
|
|
||||||
_ivParallelRequests);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RequestFloorAd(FloorConfig floor)
|
private void RequestFloorAd(FloorConfig floor)
|
||||||
|
|
@ -175,24 +190,15 @@ namespace WZ
|
||||||
// 处理楼层广告加载失败
|
// 处理楼层广告加载失败
|
||||||
public void OnFloorAdFailed(FloorConfig floor, string error)
|
public void OnFloorAdFailed(FloorConfig floor, string error)
|
||||||
{
|
{
|
||||||
|
LoggerUtils.Debug($"[kwai] floor inter ad failed: {floor.id} with error: {error} _isRequestingFloors:{!_isRequestingFloors} _successfulFloor: {_successfulFloor != null}" );
|
||||||
if (!_isRequestingFloors || _successfulFloor != null) return;
|
if (!_isRequestingFloors || _successfulFloor != null) return;
|
||||||
|
|
||||||
LoggerUtils.Debug($"[kwai] floor inter Floor ad failed: {floor.id} with error: {error}");
|
// 移除失败floor
|
||||||
|
if(_currentRequestBatch.Contains(floor))_currentRequestBatch.Remove(floor);
|
||||||
|
|
||||||
// 检查当前批次是否全部失败
|
// 检查当前批次是否全部失败
|
||||||
bool allFailedInBatch = true;
|
bool allFailedInBatch = true;
|
||||||
foreach (var f in _currentRequestBatch)
|
if (_currentRequestBatch.Count > 0) allFailedInBatch = false;
|
||||||
{
|
|
||||||
if (f.id == floor.id) continue;
|
|
||||||
|
|
||||||
if (_ivFloorAdControllers.ContainsKey(f.id) &&
|
|
||||||
_ivFloorAdControllers[f.id] != null &&
|
|
||||||
_ivFloorAdControllers[f.id].IsReady())
|
|
||||||
{
|
|
||||||
allFailedInBatch = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果当前批次全部失败,请求下一批
|
// 如果当前批次全部失败,请求下一批
|
||||||
if (allFailedInBatch)
|
if (allFailedInBatch)
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,10 @@ namespace WZ
|
||||||
// 开始请求楼层广告
|
// 开始请求楼层广告
|
||||||
RequestNextFloorBatch();
|
RequestNextFloorBatch();
|
||||||
|
|
||||||
AdsActionEvents.TrackKwaiWaterfallRequest(AdsType.Rewarded, _currentRequestId, _waterfallRequestCount, _rvParallelRequests);
|
AdsActionEvents.TrackKwaiWaterfallRequest(AdsType.Rewarded,
|
||||||
|
_currentRequestId,
|
||||||
|
_waterfallRequestCount,
|
||||||
|
_rvParallelRequests);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RequestNextFloorBatch()
|
private void RequestNextFloorBatch()
|
||||||
|
|
@ -88,10 +91,23 @@ namespace WZ
|
||||||
|
|
||||||
if (_currentRequestBatch.Count == 0)
|
if (_currentRequestBatch.Count == 0)
|
||||||
{
|
{
|
||||||
// 所有楼层都请求完毕,没有填充
|
// 检查是否还有正在处理的请求
|
||||||
LoggerUtils.Debug("[kwai] floor reward All floors requested, no fill");
|
bool hasPendingRequests = false;
|
||||||
_isRequestingFloors = false;
|
foreach (var kvp in _rvFloorAdControllers)
|
||||||
return;
|
{
|
||||||
|
if (kvp.Value != null && !kvp.Value.IsReady())
|
||||||
|
{
|
||||||
|
hasPendingRequests = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasPendingRequests)
|
||||||
|
{
|
||||||
|
// 所有楼层都请求完毕,并且没有正在处理的请求,确实没有填充
|
||||||
|
LoggerUtils.Debug("[kwai] floor reward All floors requested, no fill");
|
||||||
|
_isRequestingFloors = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LoggerUtils.Debug($"[kwai] floor reward Requesting floor batch: {string.Join(", ", _currentRequestBatch.Select(f => $"{f.id}({f.price})"))}");
|
LoggerUtils.Debug($"[kwai] floor reward Requesting floor batch: {string.Join(", ", _currentRequestBatch.Select(f => $"{f.id}({f.price})"))}");
|
||||||
|
|
@ -170,24 +186,15 @@ namespace WZ
|
||||||
// 处理楼层广告加载失败
|
// 处理楼层广告加载失败
|
||||||
public void OnFloorAdFailed(FloorConfig floor, string error)
|
public void OnFloorAdFailed(FloorConfig floor, string error)
|
||||||
{
|
{
|
||||||
|
LoggerUtils.Debug($"[kwai] floor reward ad failed: {floor.id} with error: {error} _isRequestingFloors:{!_isRequestingFloors} _successfulFloor: {_successfulFloor != null}" );
|
||||||
if (!_isRequestingFloors || _successfulFloor != null) return;
|
if (!_isRequestingFloors || _successfulFloor != null) return;
|
||||||
|
|
||||||
LoggerUtils.Debug($"[kwai] floor reward ad failed: {floor.id} with error: {error}");
|
// 移除失败floor
|
||||||
|
if(_currentRequestBatch.Contains(floor))_currentRequestBatch.Remove(floor);
|
||||||
|
|
||||||
// 检查当前批次是否全部失败
|
// 检查当前批次是否全部失败
|
||||||
bool allFailedInBatch = true;
|
bool allFailedInBatch = true;
|
||||||
foreach (var f in _currentRequestBatch)
|
if (_currentRequestBatch.Count > 0) allFailedInBatch = false;
|
||||||
{
|
|
||||||
if (f.id == floor.id) continue;
|
|
||||||
|
|
||||||
if (_rvFloorAdControllers.ContainsKey(f.id) &&
|
|
||||||
_rvFloorAdControllers[f.id] != null &&
|
|
||||||
_rvFloorAdControllers[f.id].IsReady())
|
|
||||||
{
|
|
||||||
allFailedInBatch = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果当前批次全部失败,请求下一批
|
// 如果当前批次全部失败,请求下一批
|
||||||
if (allFailedInBatch)
|
if (allFailedInBatch)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using KwaiAds.Scripts.Api.Interstitial;
|
using KwaiAds.Scripts.Api.Interstitial;
|
||||||
using KwaiAds.Scripts.Api.Reward;
|
using KwaiAds.Scripts.Api.Reward;
|
||||||
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static WZ.KwaiAdsConfigParser;
|
using static WZ.KwaiAdsConfigParser;
|
||||||
|
|
||||||
|
|
@ -26,12 +27,12 @@ namespace WZ
|
||||||
AdsType.Interstitial,
|
AdsType.Interstitial,
|
||||||
Time.realtimeSinceStartup - KwaiFloorIvManager.Instance._ivStartLoadTime,
|
Time.realtimeSinceStartup - KwaiFloorIvManager.Instance._ivStartLoadTime,
|
||||||
msg);
|
msg);
|
||||||
LoggerUtils.Debug("[kwai] floor inter ad load failed: "+trackId+" with error: "+msg);
|
LoggerUtils.Debug("[kwai] floor inter ad load failed: "+_floor.id+" unit_id"+_floor.unite_id+" with error: "+msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnAdLoadStart(string trackId)
|
public void OnAdLoadStart(string trackId)
|
||||||
{
|
{
|
||||||
LoggerUtils.Debug("[kwai] floor inter OnAdLoadStart: "+trackId);
|
LoggerUtils.Debug("[kwai] floor inter OnAdLoadStart: "+_floor.id+" "+_floor.unite_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnAdLoadSuccess(string trackId, string price)
|
public void OnAdLoadSuccess(string trackId, string price)
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ namespace WZ
|
||||||
{
|
{
|
||||||
_manager = manager;
|
_manager = manager;
|
||||||
_floor = floor;
|
_floor = floor;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void OnAdLoadFailed(string trackId, int code, string msg)
|
public void OnAdLoadFailed(string trackId, int code, string msg)
|
||||||
{
|
{
|
||||||
|
|
@ -25,12 +26,11 @@ namespace WZ
|
||||||
AdsType.Rewarded,
|
AdsType.Rewarded,
|
||||||
Time.realtimeSinceStartup - KwaiFloorRvManager.Instance._rvStartLoadTime,
|
Time.realtimeSinceStartup - KwaiFloorRvManager.Instance._rvStartLoadTime,
|
||||||
msg);
|
msg);
|
||||||
LoggerUtils.Debug("[kwai] floor reward ad load failed: "+trackId+" with error: "+msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnAdLoadStart(string trackId)
|
public void OnAdLoadStart(string trackId)
|
||||||
{
|
{
|
||||||
LoggerUtils.Debug("[kwai] floor reward ad load start: "+trackId);
|
LoggerUtils.Debug("[kwai] floor reward ad load start: "+_floor.id+" "+_floor.unite_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnAdLoadSuccess(string trackId, string price)
|
public void OnAdLoadSuccess(string trackId, string price)
|
||||||
|
|
@ -42,7 +42,7 @@ namespace WZ
|
||||||
AdsType.Rewarded,
|
AdsType.Rewarded,
|
||||||
Time.realtimeSinceStartup - KwaiFloorRvManager.Instance._rvStartLoadTime);
|
Time.realtimeSinceStartup - KwaiFloorRvManager.Instance._rvStartLoadTime);
|
||||||
_manager.OnFloorAdLoaded(_floor, _manager._rvFloorAdControllers[_floor.id], KwaiAdsManager.Instance._rewardAdRevenue);
|
_manager.OnFloorAdLoaded(_floor, _manager._rvFloorAdControllers[_floor.id], KwaiAdsManager.Instance._rewardAdRevenue);
|
||||||
LoggerUtils.Debug("[kwai] floor reward ad load success: "+trackId+" with price: "+price);
|
LoggerUtils.Debug("[kwai] floor reward ad load success: "+_floor.id+" "+_floor.unite_id+" with price: "+price);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue