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