fix:1、删除上一个sdk,更换新的。2、删除了max广告

This commit is contained in:
2026-05-27 09:28:34 +08:00
parent 978797b678
commit 69c818e992
1039 changed files with 99687 additions and 94871 deletions
@@ -0,0 +1,218 @@
using System;
using BigoAds.Scripts.Api;
using BigoAds.Scripts.Api.Constant;
namespace BigoAds.Scripts.Common
{
public class BigoBaseAd<T> where T : BigoRequest
{
/// <summary>
/// event for load ad success
/// </summary>
public event Action OnLoad;
/// <summary>
/// load ad failed with error code and error message
/// </summary>
public event Action<int, string> OnLoadFailed;
/// <summary>
/// event for ad impression
/// </summary>
public event Action OnAdShowed;
/// <summary>
/// event for ad be clicked
/// </summary>
public event Action OnAdClicked;
/// <summary>
/// event for ad be closed
/// </summary>
public event Action OnAdDismissed;
/// <summary>
/// event for ad error
/// </summary>
public event Action<int, string> OnAdError;
private readonly string _slotId;
private bool _isAdLoaded;
protected readonly IBigoAd<T> ADClient;
public bool CallbackOnMainThread { get; set; } = true;
private BigoAdBid _bid;
protected BigoBaseAd(string id, IBigoAd<T> adClient)
{
_slotId = id;
ADClient = adClient;
InitEvent(ADClient);
}
private void InitEvent(IBigoAd<T> adClient)
{
adClient.OnLoad += InvokeOnLoad;
adClient.OnLoadFailed += InvokeOnLoadFailed;
adClient.OnAdShowed += InvokeOnAdShowed;
adClient.OnAdClicked += InvokeOnAdClicked;
adClient.OnAdDismissed += InvokeOnAdDismissed;
adClient.OnAdError += InvokeOnAdError;
}
public void Load(T request)
{
if (_isAdLoaded)
{
InvokeOnLoad();
}
if (string.IsNullOrEmpty(_slotId))
{
InvokeOnLoadFailed(-1, "slotId must be not null");
return;
}
if (!BigoAdSdk.IsInitSuccess())
{
InvokeOnLoadFailed(-1, "sdk has not init");
return;
}
ADClient?.Load(_slotId, request);
}
public virtual void Show()
{
_isAdLoaded = false;
ADClient?.Show();
}
public void DestroyAd()
{
ADClient?.Destroy();
}
public bool IsLoaded()
{
return _isAdLoaded;
}
public bool IsExpired()
{
return ADClient == null ? false : ADClient.IsExpired();
}
public string GetExtraInfo(String key)
{
return ADClient == null ? "" : ADClient.GetExtraInfo(key);
}
private void InvokeOnLoad()
{
OnLoad?.Invoke();
_isAdLoaded = true;
}
protected void InvokeOnLoadFailed(int errorCode, string errorMessage)
{
if (CallbackOnMainThread)
{
BigoDispatcher.PostTask((() => { OnLoadFailed?.Invoke(errorCode, errorMessage); }));
}
else
{
OnLoadFailed?.Invoke(errorCode, errorMessage);
}
}
private void InvokeOnAdShowed()
{
if (CallbackOnMainThread)
{
BigoDispatcher.PostTask((() => { OnAdShowed?.Invoke(); }));
}
else
{
OnAdShowed?.Invoke();
}
}
private void InvokeOnAdClicked()
{
if (CallbackOnMainThread)
{
BigoDispatcher.PostTask((() => { OnAdClicked?.Invoke(); }));
}
else
{
OnAdClicked?.Invoke();
}
}
private void InvokeOnAdDismissed()
{
if (CallbackOnMainThread)
{
BigoDispatcher.PostTask((() => { OnAdDismissed?.Invoke(); }));
}
else
{
OnAdDismissed?.Invoke();
}
}
private void InvokeOnAdError(int errorCode, string errorMessage)
{
if (CallbackOnMainThread)
{
BigoDispatcher.PostTask((() => { OnAdError?.Invoke(errorCode, errorMessage); }));
}
else
{
OnAdError?.Invoke(errorCode, errorMessage);
}
}
public BigoAdBid GetBid()
{
if (ADClient == null) return null;
if (!ADClient.IsClientBidding()) return null;
if (_bid == null)
{
_bid = new BigoAdBid(ADClient);
}
return _bid;
}
public class BigoAdBid : IClientBidding
{
protected readonly IBigoAd<T> _ADClient;
public BigoAdBid(IBigoAd<T> ADClient)
{
_ADClient = ADClient;
}
/// get price
public double getPrice()
{
return _ADClient == null ? 0 : _ADClient.getPrice();
}
///notify win
public void notifyWin(double secPrice, string secBidder)
{
_ADClient?.notifyWin(secPrice, secBidder);
}
///notify loss
public void notifyLoss(double firstPrice, string firstBidder, BGAdLossReason lossReason)
{
_ADClient?.notifyLoss(firstPrice, firstBidder, lossReason);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8554386bfcec3403cb6fab89c7a35f31
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,86 @@
namespace BigoAds.Scripts.Common
{
using System;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// The unity thread dispatcher.
/// </summary>
[DisallowMultipleComponent]
internal sealed class BigoDispatcher : MonoBehaviour
{
private static bool _instanceCreated;
// The thread safe task queue.
private static readonly List<Action> PostTasks = new List<Action>();
// The executing buffer.
private static readonly List<Action> Executing = new List<Action>();
static BigoDispatcher()
{
CreateInstance();
}
/// <summary>
/// Work thread post a task to the main thread.
/// </summary>
public static void PostTask(Action task)
{
lock (PostTasks)
{
PostTasks.Add(task);
}
}
/// <summary>
/// Start to run this dispatcher.
/// </summary>
[RuntimeInitializeOnLoadMethod]
private static void CreateInstance()
{
if (_instanceCreated || !Application.isPlaying) return;
var go = new GameObject(
"BigoDispatcher", typeof(BigoDispatcher));
DontDestroyOnLoad(go);
_instanceCreated = true;
}
private void OnDestroy()
{
lock (PostTasks)
{
PostTasks.Clear();
}
Executing.Clear();
}
private void Update()
{
lock (PostTasks)
{
if (PostTasks.Count > 0)
{
Executing.AddRange(PostTasks);
PostTasks.Clear();
}
}
foreach (var task in Executing)
{
try
{
task();
}
catch (Exception e)
{
Debug.LogError(e.Message, this);
}
}
Executing.Clear();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2d1af23e5ee93476382ea747bb4b6985
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using BigoAds.Scripts.Api;
using BigoAds.Scripts.Api.Constant;
namespace BigoAds.Scripts.Common
{
public interface IBannerAd : IBigoAd<BigoBannerRequest>
{
void SetPosition(BigoPosition position);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9632da3a0b8674b539385af7fec47c33
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,22 @@
using System;
using BigoAds.Scripts.Api;
namespace BigoAds.Scripts.Common
{
public interface IBigoAd<in T> : IClientBidding where T : BigoRequest
{
event Action OnLoad;
event Action<int, string> OnLoadFailed;
event Action OnAdShowed;
event Action OnAdClicked;
event Action OnAdDismissed;
event Action<int, string> OnAdError;
void Load(string slotId, T request);
bool IsLoaded();
bool IsExpired();
void Show();
void Destroy();
bool IsClientBidding();
string GetExtraInfo(String key);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ac3c835ae5b8f421192fb72d32c9c6c1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
using BigoAds.Scripts.Api.Constant;
namespace BigoAds.Scripts.Common
{
public interface IClientBidding
{
/// get price
double getPrice();
///notify win
void notifyWin(double secPrice, string secBidder);
///notify loss
void notifyLoss(double firstPrice, string firstBidder, BGAdLossReason lossReason);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be474d5a8f44740eeac370fd98153d15
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,13 @@
namespace BigoAds.Scripts.Common
{
public interface IClientFactory
{
ISDK BuildSDKClient();
IBannerAd BuildBannerAdClient();
INativeAd BuildNativeAdClient();
IInterstitialAd BuildInterstitialAdClient();
IPopupAd BuildPopupAdClient();
ISplashAd BuildSplashAdClient();
IRewardedAd BuildRewardedAdClient();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b2cb5f6ac1b7f463db75ac0bfa7d7fbe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
using BigoAds.Scripts.Api;
namespace BigoAds.Scripts.Common
{
public interface IInterstitialAd : IBigoAd<BigoInterstitialRequest>
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2d31ee1df8a074b81a5575e9a7735b2a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using BigoAds.Scripts.Api;
using BigoAds.Scripts.Api.Constant;
namespace BigoAds.Scripts.Common
{
public interface INativeAd : IBigoAd<BigoNativeRequest>
{
void SetPosition(BigoPosition position);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eef5c6b4f590c4ceaac635a2992576ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
using BigoAds.Scripts.Api;
namespace BigoAds.Scripts.Common
{
public interface IPopupAd : IBigoAd<BigoPopupRequest>
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9e767b9004c4f4ca19baa6f54c409c5d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using System;
using BigoAds.Scripts.Api;
namespace BigoAds.Scripts.Common
{
public interface IRewardedAd : IBigoAd<BigoRewardedRequest>
{
event Action OnUserEarnedReward;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0b3baa8d362724d19997664f34f4320d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,40 @@
using BigoAds.Scripts.Api;
using BigoAds.Scripts.Api.Constant;
namespace BigoAds.Scripts.Common
{
public interface ISDK
{
///
/// Starts the Bigo SDK
///
void Init(BigoAdConfig config, BigoAdSdk.InitResultDelegate initResultDelegate);
////
/// The SDK initialization state
////
bool IsInitSuccess();
///////
/// Bigo SDK version
/// ////
string GetSDKVersion();
///////
/// Bigo SDK version name
/// ////
string GetSDKVersionName();
///////
/// Bigo SDK set user consent
/// ////
void SetUserConsent(ConsentOptions option, bool consent);
///////
/// Only works on Android
/// Bigo SDK set user consent
/// ////
void AddExtraHost(string country, string host);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 00ad18b48fa1047ee98bd415dd127f65
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
using BigoAds.Scripts.Api;
namespace BigoAds.Scripts.Common
{
public interface ISplashAd:IBigoAd<BigoSplashRequest>
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e1105e67678354e71850311744a989c3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: