feat:1、添加项目

This commit is contained in:
2026-06-02 10:26:44 +08:00
commit dfead2c461
7518 changed files with 748693 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a2320132f2f584e4db70a243fb355189
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 42b11239795a857438cebb0b42577408
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+231
View File
@@ -0,0 +1,231 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json;
using ASMhQ45fSDK;
using UnityEngine;
using UnityEngine.UI;
using Random = UnityEngine.Random;
public class ASMhQ45fSDKDemo : MonoBehaviour
{
public void ShowReward()
{
ASMhQ45fSDKUTILITY.Instance.ShowRewardVideo("TAG", b =>
{
Debug.LogError($"reward result = {b}");
},(() =>
{
Debug.LogError($"reward close!!!");
}));
}
public void ShowInter()
{
ASMhQ45fSDKUTILITY.Instance.ShowInter("TAG", () =>
{
Debug.LogError("inter hide");
});
}
public void ShowAdmobInter()
{
ASMhQ45fSDKUTILITY.Instance.ShowAdmobInter("TAG", () =>
{
Debug.LogError("inter hide");
});
}
public void ShowSplash()
{
ASMhQ45fSDKUTILITY.Instance.ShowSplash();
}
public void CheckReward(Image btnImg)
{
var isReady = ASMhQ45fSDKUTILITY.Instance.IsVideoReady();
btnImg.color = isReady ? Color.green : Color.white;
Debug.Log($"Reward : {isReady}");
}
public void CheckInter(Image btnImg)
{
var isReady = ASMhQ45fSDKUTILITY.Instance.IsInterReady();
btnImg.color = isReady ? Color.green : Color.white;
Debug.Log($"Inter : {isReady}");
}
public void CheckSplash(Image btnImg)
{
var isReady = ASMhQ45fSDKUTILITY.Instance.IsSplashReady();
btnImg.color = isReady ? Color.green : Color.white;
Debug.Log($"Splash : {isReady}");
}
public void Track()
{
ASMhQ45fSDKUTILITY.Instance.Track("test", new Dictionary<string, string>()
{
{"evt1", "1"},
{"evt2", "2"},
{"evt3", "3"},
{"evt4", "4"},
{"evt5", "5"},
{"evt6", "6"},
{"evt7", "7"},
{"evt8", "8"},
{"evt9", "9"},
});
}
public void GetCountryCode()
{
var code = ASMhQ45fSDKUTILITY.Instance.GetCountryCode();
Debug.Log($"country : {code}");
}
public void ShowH5()
{
ASMhQ45fSDKUTILITY.Instance.H5.ShowH5((() =>
{
Debug.Log("H5 close");
}), () =>
{
Debug.Log($"H5 show failed!");
});
}
public void ShowH5(RectTransform rectTransform)
{
ASMhQ45fSDKUTILITY.Instance.H5.ShowH5(rectTransform);
}
public void HideH5()
{
ASMhQ45fSDKUTILITY.Instance.H5.HideH5();
}
public void CheckShowH5(Image btnImg)
{
var show = ASMhQ45fSDKUTILITY.Instance.H5.IsShowH5();
btnImg.color = show ? Color.green : Color.red;
Debug.Log($"CheckShowH5 : {show}");
}
private int _level = 1;
public void TrackLevel()
{
ASMhQ45fSDKUTILITY.Instance.TrackLevelUp(_level);
if (Random.Range(0, 100) < 50)
{
_level++;
}
}
private string withDrawSceneId = "";
public void GetWithDrawConfigs()
{
ASMhQ45fSDKUTILITY.Instance.GetWithDrawConfigs(((b, s) =>
{
Debug.Log($"GetWithDrawConfigs result : {b}, data : {s}");
if (b)
{
var cfgs = JsonConvert.DeserializeObject<List<WithDrawConfig>>(s);
int idx = 0;
foreach (WithDrawConfig config in cfgs)
{
Debug.Log($"index = {idx}, {config.ToString()}");
if (idx == 0)
withDrawSceneId = config.SecneId;
idx++;
}
}
}));
}
private int payIndex = 0;
public void CreateWithDrawOrder()
{
string taxNo = "";
string payAccount = "tom@gmail.com";
string accountType = "E";
PaymentTypeCode payCode = PaymentTypeCode.GOPAY;
//GOPAY DANA 收款账号需要为电话号码
if (payIndex == 1 || payIndex == 0)
{
payCode = payIndex == 1 ? PaymentTypeCode.DANA : payCode;
payAccount = "0881234567890";
accountType = "P";
}
if (payIndex == 2)
{
// PIX 需要填写税号
payCode = PaymentTypeCode.PIX;
taxNo = "99999999999";
}
if (payIndex == 3) payCode = PaymentTypeCode.MERCADOPAGO;
ASMhQ45fSDKUTILITY.Instance.CreateWithDrawOrder(withDrawSceneId, payCode, payAccount, accountType, "testName", taxNo, b =>
{
Debug.Log($"CreateWithDrawOrder result : {b}");
});
payIndex++;
payIndex = payIndex > 3 ? 0 : payIndex;
}
public void GetWithDrawOrders()
{
ASMhQ45fSDKUTILITY.Instance.GetWithDrawOrders(((b, s) =>
{
Debug.Log($"GetWithDrawOrders result : {b}, data : {s}");
if (b)
{
var cfgs = JsonConvert.DeserializeObject<List<WithDrawOrder>>(s);
int idx = 0;
foreach (WithDrawOrder config in cfgs)
{
Debug.Log($"index = {idx}, {config.ToString()}");
idx++;
}
}
}));
}
// Start is called before the first frame update
void Start()
{
Init();
Invoke("ShowSplash", 5);
}
// Update is called once per frame
void Update()
{
}
private void Init()
{
ASMhQ45fSDKUTILITY.Instance.RegistIosParam((i =>
{
Debug.Log($"ios ab param : {i}");
}));
void GameConfig(bool result, string config)
{
Debug.Log($"************* game config result : {result}, config : {config}");
}
ASMhQ45fSDKUTILITY.Instance.Init(null, "app_config", GameConfig);
}
public static string GetSdkVersion()
{
return ASMhQ45fSDKUTILITY.SdkVersion;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 959ec24a7131c9d488e5007fa82612be
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 51f8b691978644845a59d4da09bb72e3
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+33
View File
@@ -0,0 +1,33 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7999829969770386720
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 520568642914021788}
m_Layer: 0
m_Name: Demo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &520568642914021788
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7999829969770386720}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5597cf0c8207a4448a9e84a8800d5cad
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 730a988606a036b4b92d1abb57c9d112
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,653 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using ASMhQ45fSDK;
using UnityEditor;
using UnityEngine;
public class ASMhQ45fSDKConfigEditor : EditorWindow
{
private static ASMhQ45fSDKConfigEditor _view;
private int _emptyKwInterIdCount = 1;
private int _emptyKwVideoIdCount = 1;
private int _emptyBigoInterIdCount = 1;
private int _emptyBigoVideoIdCount = 1;
[MenuItem("Tools/设置 &G")]
public static void ShowWin()
{
if (_view != null)
{
CloseView();
return;
}
var win = GetWindow<ASMhQ45fSDKConfigEditor>();
win.minSize = new Vector2(790, 872);
_view = win;
RemoveExtraEmptyStrings(SDKConfig.KwaiInterUnitId, _view._emptyKwInterIdCount);
RemoveExtraEmptyStrings(SDKConfig.KwaiVideoUnitId, _view._emptyKwVideoIdCount);
RemoveExtraEmptyStrings(SDKConfig.BigoInterUnitId, _view._emptyBigoInterIdCount);
RemoveExtraEmptyStrings(SDKConfig.BigoVideoUnitId, _view._emptyBigoVideoIdCount);
win.Show();
#region topon
_view.loadPluginData();
#endregion
}
static void CloseView()
{
_view.Close();
_view = null;
}
private void OnGUI()
{
DrawWindow();
EditorUtility.SetDirty(SDKConfig.Instance);
}
#region Topon
private AnyThink.Scripts.IntegrationManager.Editor.ATEditorCoroutine loadDataCoroutine;
private AnyThink.Scripts.IntegrationManager.Editor.PluginData pluginData;
private bool pluginDataLoadFailed;
private void loadPluginData()
{
if (loadDataCoroutine != null)
{
loadDataCoroutine.Stop();
}
loadDataCoroutine = AnyThink.Scripts.IntegrationManager.Editor.ATEditorCoroutine.startCoroutine(AnyThink.Scripts.IntegrationManager.Editor.ATIntegrationManager.Instance.loadPluginData(data =>
{
if (data == null)
{
pluginDataLoadFailed = true;
}
else
{
ATLog.log("loadNetworksData() >>> pluginData: " + data);
pluginData = data;
pluginDataLoadFailed = false;
}
}));
}
#endregion
private void DrawWindow()
{
TextLabel("基础配置");
EditorGUILayout.BeginVertical("frameBox");
#if UNITY_IOS
SDKConfig.Instance.appsFlyerDevKey = DrawTextField("appsFlyerDevKey", SDKConfig.Instance.appsFlyerDevKey);
SDKConfig.Instance.appsFlyerIosAppleAppId = DrawTextField("appsFlyerIosAppleAppId", SDKConfig.Instance.appsFlyerIosAppleAppId);
#elif UNITY_ANDROID
SDKConfig.Instance.appsFlyerDevKey = DrawTextField("appsFlyerDevKey", SDKConfig.Instance.appsFlyerDevKey);
#endif
SDKConfig.Instance.logReportUrl = DrawTextField("配置域名", SDKConfig.Instance.logReportUrl);
SDKConfig.Instance.appKey = DrawTextField("appKey", SDKConfig.Instance.appKey);
SDKConfig.Instance.appSecret = DrawTextField("appSecret", SDKConfig.Instance.appSecret);
EditorGUILayout.EndVertical();
TextLabel("广告配置");
#region MAX
// EditorGUILayout.BeginVertical("frameBox");
// TextLabel("MAX", Color.cyan);
// SDKConfig.Instance.maxAppKey = DrawTextField("MaxSdkKey", SDKConfig.Instance.maxAppKey);
// SDKConfig.Instance.videoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.videoUnitId);
// SDKConfig.Instance.interUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.interUnitId);
// SDKConfig.Instance.bannerUnitId = DrawTextField("Banner ID", SDKConfig.Instance.bannerUnitId);
// SDKConfig.Instance.splashUnitId = DrawTextField("开屏 ID", SDKConfig.Instance.splashUnitId);
// EditorGUILayout.EndVertical();
// AppLovinSettings.Instance.SdkKey = SDKConfig.Instance.maxAppKey;
#endregion
#region Topon
EditorGUILayout.BeginVertical("frameBox");
TextLabel("Topon", Color.cyan);
SDKConfig.Instance.toponAppId = DrawTextField("AppId", SDKConfig.Instance.toponAppId);
SDKConfig.Instance.toponAppkey = DrawTextField("Appkey", SDKConfig.Instance.toponAppkey);
SDKConfig.Instance.toponVideoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.toponVideoUnitId);
SDKConfig.Instance.toponInterUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.toponInterUnitId);
EditorGUILayout.EndVertical();
//AnyThink.Scripts.IntegrationManager.Editor.ATIntegrationManager.Instance.setAdmobAppidByOs(pluginData, );
var integrationManager = AnyThink.Scripts.IntegrationManager.Editor.ATIntegrationManager.Instance;
bool isAdmobInstalledForAndroid = integrationManager.isAdmobInstalled(AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_ANDROID);
bool isAdmobInstalledForIos = integrationManager.isAdmobInstalled(AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_IOS);
if (isAdmobInstalledForAndroid || isAdmobInstalledForIos)
{
if (isAdmobInstalledForAndroid)
{
var androidAdmobAppId = "ca-app-pub-3940256099942544~3347511713";
integrationManager.setAdmobAppidByOs(pluginData, AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_ANDROID, androidAdmobAppId);
}
if (isAdmobInstalledForIos)
{
var iosAdmobAppId = "ca-app-pub-3940256099942544~1458002511";
integrationManager.setAdmobAppidByOs(pluginData, AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_IOS, iosAdmobAppId);
}
}
#endregion
#if UNITY_ANDROID
EditorGUILayout.BeginVertical("frameBox");
EditorGUILayout.BeginHorizontal("frameBox");
TextLabel("KWai", Color.cyan);
DrawButton("插屏ID +", AddInterId);
//DrawButton("插屏ID -", DelInterId);
DrawButton("激励视频ID +", AddRewardId);
//DrawButton("激励视频ID -", DelRewardId);
EditorGUILayout.EndHorizontal();
SDKConfig.Instance.kwaiAppId = DrawTextField("AppId", SDKConfig.Instance.kwaiAppId);
for (int i = 0; i < SDKConfig.Instance.kwaiInterUnitId.Count; i++)
{
var index = i;
GUILayout.BeginHorizontal();
SDKConfig.Instance.kwaiInterUnitId[i] =
DrawTextField("插屏ID - " + (i + 1), SDKConfig.Instance.kwaiInterUnitId[i]);
DrawButtonX("X", () => DelInterId(index));
GUILayout.EndHorizontal();
}
for (int i = 0; i < SDKConfig.Instance.kwaiVideoUnitId.Count; i++)
{
var index = i;
GUILayout.BeginHorizontal();
SDKConfig.Instance.kwaiVideoUnitId[i] =
DrawTextField("激励视频ID - " + (i + 1), SDKConfig.Instance.kwaiVideoUnitId[i]);
DrawButtonX("X", () => DelRewardId(index));
GUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical("frameBox");
EditorGUILayout.BeginHorizontal("frameBox");
TextLabel("Bigo", Color.cyan);
DrawButton("插屏ID +", AddBigoInterId);
DrawButton("激励视频ID +", AddBigoRewardId);
EditorGUILayout.EndHorizontal();
SDKConfig.Instance.bigoAppId = DrawTextField("AppId", SDKConfig.Instance.bigoAppId);
SDKConfig.Instance.bigoSplashUnitId = DrawTextField("开屏 ID", SDKConfig.Instance.bigoSplashUnitId);
for (int i = 0; i < SDKConfig.Instance.bigoInterUnitId.Count; i++)
{
//SDKConfig.Instance.bigoInterUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.bigoInterUnitId);
var index = i;
GUILayout.BeginHorizontal();
SDKConfig.Instance.bigoInterUnitId[i] =
DrawTextField("插屏ID - " + (i + 1), SDKConfig.Instance.bigoInterUnitId[i]);
DrawButtonX("X", () => DelBigoInterId(index));
GUILayout.EndHorizontal();
}
for (int i = 0; i < SDKConfig.Instance.bigoVideoUnitId.Count; i++)
{
//SDKConfig.Instance.bigoVideoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.bigoVideoUnitId);
var index = i;
GUILayout.BeginHorizontal();
SDKConfig.Instance.bigoVideoUnitId[i] =
DrawTextField("激励视频ID - " + (i + 1), SDKConfig.Instance.bigoVideoUnitId[i]);
DrawButtonX("X", () => DelBigoRewardId(index));
GUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
#endif
EditorGUILayout.BeginVertical("frameBox");
SDKConfig.Instance.isUseAdmobSplash = DrawBoolField("启用开屏优化", SDKConfig.Instance.isUseAdmobSplash, "");
if (SDKConfig.Instance.isUseAdmobSplash)
{
EditorGUILayout.BeginVertical("frameBox");
TextLabel("Admob", Color.cyan);
SDKConfig.Instance.admobAppId = DrawTextField("AppId", SDKConfig.Instance.admobAppId);
SDKConfig.Instance.admobSplashUnitId = DrawTextField("开屏 ID", SDKConfig.Instance.admobSplashUnitId);
//SDKConfig.Instance.admobInterUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.admobInterUnitId);
//SDKConfig.Instance.admobVideoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.admobVideoUnitId);
EditorGUILayout.EndVertical();
}
else
{
SDKConfig.Instance.admobSplashUnitId = string.Empty;
}
EditorGUILayout.EndVertical();
TextLabel("Debug");
EditorGUILayout.BeginVertical("frameBox");
SDKConfig.Instance.isDebug = DrawBoolField("测试模式", SDKConfig.Instance.isDebug, "正式发布时请勿勾选");
SDKConfig.Instance.isPrintLog = DrawBoolField("日志打印", SDKConfig.Instance.isPrintLog, "正式发布时请勿勾选");
EditorGUILayout.EndVertical();
// 水平布局实现按钮靠右
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace(); // 左侧填充弹性空间
if (GUILayout.Button(new GUIContent("从剪贴板获取参数", _tooltipText),
GUILayout.Width(120),
GUILayout.Height(30)
))
{
ParseClipboard();
}
GUILayout.EndHorizontal();
var sdkVersion = ASMhQ45fSDKUTILITY.SdkVersion;
GUI.Label(new Rect(10, position.height - 40, 400, 40), "@version: " + sdkVersion);
EditorPrefs.SetString("sdk_version", sdkVersion);
}
private string DrawTextField(string title, string content)
{
EditorGUILayout.BeginHorizontal();
GUILayout.Label(title, GUILayout.MinWidth(90), GUILayout.ExpandWidth(false));
content = GUILayout.TextField(content);
EditorGUILayout.EndHorizontal();
return content;
}
private bool DrawBoolField(string title, bool content, string warn = "")
{
EditorGUILayout.BeginHorizontal();
GUILayout.Label(title, GUILayout.MinWidth(80), GUILayout.ExpandWidth(false));
content = EditorGUILayout.Toggle(content);
if (content)
{
TextLabelWarn(warn);
}
EditorGUILayout.EndHorizontal();
return content;
}
private void TextLabel(string content, Color color = new Color())
{
if (color.Equals(Color.clear))
{
color = Color.gray;
}
GUIStyle style = new GUIStyle();
style.contentOffset = new Vector2(8, 0);
style.normal.textColor = color;
style.fontSize = 14;
style.padding = new RectOffset(0, 0, 3, 0);
GUILayout.Label(content, style);
}
private void TextLabelWarn(string content)
{
GUIStyle style = new GUIStyle();
style.contentOffset = new Vector2(8, 0);
style.normal.textColor = Color.red;
style.fontSize = 14;
style.padding = new RectOffset(0, 0, 3, 0);
GUILayout.Label(content, style);
}
private void DrawButton(string btnName, Action clickAction)
{
if (GUILayout.Button(btnName, GUILayout.Width(100), GUILayout.Height(30)))
{
clickAction?.Invoke();
}
}
private void DrawButtonX(string btnName, Action clickAction)
{
var originalBackgroundColor = GUI.backgroundColor;
// 设置按钮的背景颜色
GUI.backgroundColor = Color.red;
if (GUILayout.Button(btnName, GUILayout.Width(40), GUILayout.Height(18)))
{
clickAction?.Invoke();
}
GUI.backgroundColor = originalBackgroundColor;
}
private void AddInterId()
{
_emptyKwInterIdCount++;
SDKConfig.KwaiInterUnitId.Add("");
}
private void DelInterId(int index)
{
_emptyKwInterIdCount--;
SDKConfig.KwaiInterUnitId.RemoveAt(index);
}
private void AddRewardId()
{
_emptyKwVideoIdCount++;
SDKConfig.KwaiVideoUnitId.Add("");
}
private void DelRewardId(int index)
{
_emptyKwVideoIdCount--;
SDKConfig.KwaiVideoUnitId.RemoveAt(index);
}
private void AddBigoInterId()
{
_emptyBigoInterIdCount++;
SDKConfig.BigoInterUnitId.Add("");
}
private void DelBigoInterId(int index)
{
_emptyBigoInterIdCount--;
SDKConfig.BigoInterUnitId.RemoveAt(index);
}
private void AddBigoRewardId()
{
_emptyBigoVideoIdCount++;
SDKConfig.BigoVideoUnitId.Add("");
}
private void DelBigoRewardId(int index)
{
_emptyBigoVideoIdCount--;
SDKConfig.BigoVideoUnitId.RemoveAt(index);
}
static void RemoveExtraEmptyStrings(List<string> list, int count)
{
int emptyCount = count;
if (list == null) return;
// 先统计空字符串的数量
for (int i = list.Count - 1; i >= 0; i--)
{
if (string.IsNullOrEmpty(list[i]))
{
emptyCount++;
if (emptyCount > 1)
{
// 若空字符串数量超过 1,移除该元素
list.RemoveAt(i);
}
}
}
}
// ---------------------------- 参数解析 ------------------------------
private string clipboardText = "";
private Dictionary<string, string> parsedParameters = new Dictionary<string, string>();
private readonly string _tooltipText = "需提前在参数列表界面 Ctrl + A 全选,然后再 Ctrl + C 复制";
// 正则表达式模式字典,用于匹配不同类型的广告参数
private static readonly Dictionary<string, string> parameterPatterns = new Dictionary<string, string>
{
// App基本信息
{ "App名称", @"App name\s*([^\n]+)" },
{ "AF Dev key", @"AF Dev key(?:[\s-]*iOS)?\s*([^\n]+)"},
{ "APP KEY", @"a\s*p\s*p\s*k\s*e\s*y\s*([^\n]+)"},
{ "APP Secret", @"a\s*p\s*p\s*s\s*e\s*c\s*r\s*e\s*t\s*([^\n]+)" },
{ "包名", @"(?:正式包名|测试包名|包名)\*?\s+([^\n]+)"},
{ "广告源", @"广告源\s*([^\n]+)" },
{ "开发者邮箱", @"开发者邮箱\s*([^\n]+)" },
{ "谷歌商店链接", @"谷歌商店链接\s*([^\n]+)" },
{ "官网链接", @"官网链接\s*([^\n]+)" },
{ "隐私协议", @"隐私协议\s*([^\n]+)" },
{ "业务上报域名", @"(?:业务上报域名|业务域名)\s*([^\n]+)" },
{ "appkey", @"appkey\s*([^\n]+)" },
{ "appsecret", @"appsecret\s*([^\n]+)" },
{"AF Apple Appid", @"(?i)app\s*id(?:\s+id)*\s*[=:]*\s*([^\n]*)"},
// MAX (兼容多种格式)
{ "MAX 激励视频", @"MAX参数(?:-[^\s]+)?[\s\S]*?(?:激励视频|激励1|激励2|客户端激励|bidding激励广告位ID|激励)\s*[""\r\n]*([^""\s\r\n]+)"},
{ "MAX 插屏", @"MAX参数(?:-[^\s]+)?[\s\S]*?(?:插屏|插屏1|插屏2|客户端插屏|bidding插屏广告位ID)\s*[""\r\n]*([^""\s\r\n]+)" },
{ "MAX SDK Key", @"MAX参数[\s\S]*?SDK key\*?\s*([^\n]+)" },
{ "MAX ad review key", @"MAX参数[\s\S]*?ad review key\*?\s*([^\n]+)" },
// BIGO (兼容多种格式)
{ "BIGO 应用ID", @"BIGO参数[\s\S]*?(?:应用ID|appid)\s*([^\n]+)" },
{ "BIGO 激励", @"BIGO参数[\s\S]*?(?:激励|激励1|激励2|客户端激励|bidding激励广告位ID)\s*([^\n]+)" },
{ "BIGO 插屏", @"BIGO参数[\s\S]*?(?:插屏|插屏1|插屏2|客户端插屏|bidding插屏广告位ID)\s*([^\n]+)" },
// Kwai (兼容多种格式)
{ "Kwai 应用ID", @"kwai参数[\s\S]*?(?:应用ID|appid)\s*([^\n]+)" },
{ "Kwai 激励", @"kwai参数[\s\S]*?(?:激励|激励1|激励2|客户端激励|bidding激励广告位ID)\s*([^\n]+)" },
{ "Kwai 插屏", @"kwai参数[\s\S]*?(?:插屏|插屏1|插屏2|客户端插屏|bidding插屏广告位ID)\s*([^\n]+)" },
// Admob (兼容多种格式)
{ "Admob 应用ID", @"admob参数[\s\S]*?(?:应用ID|App ID)\s*([^\n]+)" },
{ "Admob 激励", @"admob参数[\s\S]*?(?:激励1|激励)\s*([^\n]+)" },
{ "Admob 插屏", @"admob参数[\s\S]*?(?:插屏1|插屏)\s*([^\n]+)" },
{ "Admob txt", @"admob参数[\s\S]*?txt\s*([^\n]+)" },
// Facebook (兼容多种格式)
{ "FB appid", @"fb参数[\s\S]*?appid\s*([^\n]+)" },
{ "FB property_id", @"fb参数[\s\S]*?property_id\s*([^\n]+)" },
{ "FB 激励", @"fb参数[\s\S]*?激励\s*([^\n]+)" },
{ "FB 插屏", @"fb参数[\s\S]*?插屏\s*([^\n]+)" },
{ "FB txt", @"fb参数[\s\S]*?txt\s*([^\n]+)" },
// Topon (兼容多种格式)
// Topon (兼容多种格式)
{ "Topon ID", @"(?i)topon[\s\S]*?ID[\t\s]+([^\r\n]+)" },
{ "Topon KEY", @"(?i)topon[\s\S]*?(?:App Key|KEY)[\t\s]+([^\r\n]+)" },
{ "Topon 激励", @"(?i)topon[\s\S]*?激励[\t\s]+([^\r\n]+)" },
{ "Topon 插屏", @"(?i)topon[\s\S]*?插屏[\t\s]+([^\r\n]+)" }
};
private void ParseClipboard()
{
if (string.IsNullOrEmpty(clipboardText.Trim()))
{
clipboardText = EditorGUIUtility.systemCopyBuffer;
}
parsedParameters.Clear();
foreach (var pattern in parameterPatterns)
{
Match match = Regex.Match(clipboardText, pattern.Value, RegexOptions.IgnoreCase);
if (match.Success)
{
// 处理可能有多个捕获组的情况(如BIGO和Kwai的两种格式)
for (int i = 1; i < match.Groups.Count; i++)
{
if (!string.IsNullOrEmpty(match.Groups[i].Value))
{
parsedParameters[pattern.Key] = match.Groups[i].Value.Trim();
break;
}
}
}
}
UpdateConfig();
EditorUtility.DisplayDialog("解析完成",
$"成功解析 {parsedParameters.Count} 个参数", "确定");
}
private void UpdateConfig()
{
SDKConfig.Instance.bigoVideoUnitId ??= new List<string>();
SDKConfig.Instance.bigoVideoUnitId.Clear();
SDKConfig.Instance.bigoInterUnitId ??= new List<string>();
SDKConfig.Instance.bigoInterUnitId.Clear();
SDKConfig.Instance.kwaiVideoUnitId ??= new List<string>();
SDKConfig.Instance.kwaiVideoUnitId.Clear();
SDKConfig.Instance.kwaiInterUnitId ??= new List<string>();
SDKConfig.Instance.kwaiInterUnitId.Clear();
foreach (KeyValuePair<string, string> pair in parsedParameters)
{
//Debug.Log($"KEY : {pair.Key}, VALUE : {pair.Value}");
if (pair.Key.Contains("包名"))
{
#if UNITY_IOS
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, pair.Value);
#elif UNITY_ANDROID
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, pair.Value);
#endif
Debug.Log($"包名设置 : {pair.Value}");
}
if (pair.Key.Contains("AF Dev key"))
{
Debug.Log($"AF Dev key: {pair.Value}");
SDKConfig.Instance.appsFlyerDevKey = pair.Value;
}
#if UNITY_IOS
if (pair.Key.Contains("AF Apple Appid"))
{
Debug.Log($"AF Apple Appid: {pair.Value}");
SDKConfig.Instance.appsFlyerIosAppleAppId = pair.Value;
}
#endif
if (pair.Key.Contains("APP KEY"))
{
Debug.Log($"BI APP KEY: {pair.Value}");
SDKConfig.Instance.appKey = pair.Value;
}
if (pair.Key.Contains("APP Secret"))
{
Debug.Log($"BI APP Secret: {pair.Value}");
SDKConfig.Instance.appSecret = pair.Value;
}
if (pair.Key.Contains("域名"))
{
Debug.Log($"业务域名: {pair.Value}");
SDKConfig.Instance.logReportUrl = pair.Value;
}
if (pair.Key.Contains("Topon ID"))
{
Debug.Log($"Topon APP ID: {pair.Value}");
SDKConfig.Instance.toponAppId = pair.Value;
}
if (pair.Key.Contains("Topon KEY"))
{
Debug.Log($"Topon APP KEY: {pair.Value}");
SDKConfig.Instance.toponAppkey = pair.Value;
}
if (pair.Key.Contains("Topon 激励"))
{
Debug.Log($"Topon 激励: {pair.Value}");
SDKConfig.Instance.toponVideoUnitId = pair.Value;
}
if (pair.Key.Contains("Topon 插屏"))
{
Debug.Log($"Topon 插屏: {pair.Value}");
SDKConfig.Instance.toponInterUnitId = pair.Value;
}
if (pair.Key.Contains("MAX SDK Key"))
{
Debug.Log($"MAX SDK Key: {pair.Value}");
SDKConfig.Instance.maxAppKey = pair.Value;
}
if (pair.Key.Contains("MAX 激励视频"))
{
Debug.Log($"MAX 激励视频: {pair.Value}");
SDKConfig.Instance.videoUnitId = pair.Value;
}
if (pair.Key.Contains("MAX 插屏"))
{
Debug.Log($"MAX 插屏: {pair.Value}");
SDKConfig.Instance.interUnitId = pair.Value;
}
if (pair.Key.Contains("BIGO 应用ID"))
{
Debug.Log($"BIGO 应用ID: {pair.Value}");
SDKConfig.Instance.bigoAppId = pair.Value;
}
if (pair.Key.Contains("BIGO 激励"))
{
Debug.Log($"BIGO 激励: {pair.Value}");
//SDKConfig.Instance.bigoVideoUnitId = pair.Value;
SDKConfig.Instance.bigoVideoUnitId ??= new List<string>();
SDKConfig.Instance.bigoVideoUnitId.Add(pair.Value);
}
if (pair.Key.Contains("BIGO 插屏"))
{
Debug.Log($"BIGO 插屏: {pair.Value}");
//SDKConfig.Instance.bigoInterUnitId = pair.Value;
SDKConfig.Instance.bigoInterUnitId ??= new List<string>();
SDKConfig.Instance.bigoInterUnitId.Add(pair.Value);
}
if (pair.Key.Contains("Admob 应用ID"))
{
Debug.Log($"Admob 应用ID: {pair.Value}");
//SDKConfig.Instance.admobAppId = pair.Value;
}
if (pair.Key.Contains("Admob 激励"))
{
Debug.Log($"Admob 激励: {pair.Value}");
}
if (pair.Key.Contains("Admob 插屏"))
{
Debug.Log($"Admob 插屏: {pair.Value}");
}
if (pair.Key.Contains("Kwai 应用ID"))
{
Debug.Log($"Kwai 应用ID: {pair.Value}");
SDKConfig.Instance.kwaiAppId = pair.Value;
}
if (pair.Key.Contains("Kwai 激励"))
{
Debug.Log($"Kwai 激励: {pair.Value}");
SDKConfig.Instance.kwaiVideoUnitId ??= new List<string>();
SDKConfig.Instance.kwaiVideoUnitId.Add(pair.Value);
}
if (pair.Key.Contains("Kwai 插屏"))
{
Debug.Log($"Kwai 插屏: {pair.Value}");
SDKConfig.Instance.kwaiInterUnitId ??= new List<string>();
SDKConfig.Instance.kwaiInterUnitId.Add(pair.Value);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f717ff4d02845a84e881bb8a38f0bc6d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4df08fba7905adf48876bcfff4f5704f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: d98edee58b36f0048b7a696b5da283d0
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,17 @@
package com.tool.countrycode;
import android.app.Activity;
import java.util.Locale;
public class AcquireCountryCode {
// 获取国家码
public static String getCountryCode()
{
Locale locale = Locale.getDefault();
return locale.getCountry();
}
public static String getCountryCode3() {
Locale currentLocale = Locale.getDefault();
return currentLocale.getISO3Country();
}
}
@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 439c7d376883ccb4da22414c75510b24
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 6e3da5c7fe21c1347a563e64e8f305d4
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d95a0f1f59b85b14d95ac7fa16356627
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 7bc122d7ecc60a94581cd8d1fa8a00d1
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 62cd95d3cdb46984ab747afbce81d5a0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,12 @@
#import <Foundation/Foundation.h>
extern "C" {
__attribute__((visibility("default")))
const char* _GetDeviceCountryCode() {
@autoreleasepool {
NSLocale *currentLocale = [NSLocale currentLocale];
NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
return strdup([countryCode UTF8String]); // 使用strdup确保内存安全
}
}
}
@@ -0,0 +1,37 @@
fileFormatVersion: 2
guid: 63f1a672ae2b65f478662e01b0b67d7b
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 96d3bb1be45827f47a83034c9908c005
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ea7ef46cf2ade545b68fd32b9c4b8b6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,14 @@
{
"name": "SDKConfig",
"rootNamespace": "",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8b6da46957b38914aa097a61bd86a16d
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,234 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace ASMhQ45fSDK
{
[System.Serializable]
public class SDKConfig : ScriptableObject
{
public string appsFlyerDevKey;
public string appsFlyerIosAppleAppId;
public string appKey;
public string appSecret;
public string logReportUrl;
public string maxAppKey;
public string splashUnitId;
public string bannerUnitId;
public string interUnitId;
public string videoUnitId;
public string kwaiAppId;
public List<string> kwaiVideoUnitId = new();
public List<string> kwaiInterUnitId = new();
public string bigoAppId;
public List<string> bigoVideoUnitId = new();
public List<string> bigoInterUnitId = new();
public string bigoSplashUnitId;
public string toponAppId;
public string toponAppkey;
public string toponVideoUnitId;
public string toponInterUnitId;
public string admobAppId;
public string admobVideoUnitId;
public string admobInterUnitId;
public string admobSplashUnitId;
public bool isDebug = false;
public bool isPrintLog = false;
public bool isUseAdmobSplash = false;
private static SDKConfig _instance;
public static SDKConfig Instance
{
get
{
if (_instance != null) return _instance;
_instance = AssetUtils.GetScriptableObject<SDKConfig>(typeof(SDKConfig).Name, "Assets/Resources", false, false);
return _instance;
}
set
{
_instance = value;
}
}
public static string AppsFlyerDevKey
{
get { return Instance.appsFlyerDevKey; }
}
public static string AppsFlyerIosAppleAppId
{
get { return Instance.appsFlyerIosAppleAppId; }
}
public static string AppKey
{
get { return Instance.appKey; }
}
public static string AppSecret
{
get { return Instance.appSecret; }
}
public static string LogReportUrl
{
get
{
if (!Instance.logReportUrl.StartsWith("http"))
{
return "https://" + Instance.logReportUrl.Replace(" ", ""); ;
}
return Instance.logReportUrl.Replace(" ", ""); ;
}
}
public static string MaxAppKey
{
get { return Instance.maxAppKey; }
}
public static string SplashUnitID
{
get { return Instance.splashUnitId; }
}
public static string BannerUnitId
{
get { return Instance.bannerUnitId; }
}
public static string InterUnitId
{
get { return Instance.interUnitId; }
}
public static string VideoUnitId
{
get { return Instance.videoUnitId; }
}
public static string KwaiAppId
{
get => Instance.kwaiAppId;
set => Instance.kwaiAppId = value;
}
public static List<string> KwaiVideoUnitId
{
get => Instance.kwaiVideoUnitId;
set => Instance.kwaiVideoUnitId = value;
}
public static List<string> KwaiInterUnitId
{
get => Instance.kwaiInterUnitId;
set => Instance.kwaiInterUnitId = value;
}
public static string BigoAppId
{
get => Instance.bigoAppId;
set => Instance.bigoAppId = value;
}
public static List<string> BigoVideoUnitId
{
get => Instance.bigoVideoUnitId;
set => Instance.bigoVideoUnitId = value;
}
public static List<string> BigoInterUnitId
{
get => Instance.bigoInterUnitId;
set => Instance.bigoInterUnitId = value;
}
public static string BigoSplashUnitId
{
get => Instance.bigoSplashUnitId;
set => Instance.bigoSplashUnitId = value;
}
public static string ToponAppId
{
get { return Instance.toponAppId; }
}
public static string ToponAppkey
{
get { return Instance.toponAppkey; }
}
public static string ToponVideoUnitId
{
get { return Instance.toponVideoUnitId; }
}
public static string ToponInterUnitId
{
get { return Instance.toponInterUnitId; }
}
public static string AdmobAppId
{
get => Instance.admobAppId;
set => Instance.admobAppId = value;
}
public static string AdmobVideoUnitId
{
get => Instance.admobVideoUnitId;
set => Instance.admobVideoUnitId = value;
}
public static string AdmobSplashUnitId
{
get => Instance.admobSplashUnitId;
set => Instance.admobSplashUnitId = value;
}
public static string AdmobInterUnitId
{
get => Instance.admobInterUnitId;
set => Instance.admobInterUnitId = value;
}
public static bool IsDebug => Instance.isDebug;
public static bool IsPrintLog => Instance.isPrintLog;
public static bool IsUseAdmobSplash => Instance.isUseAdmobSplash;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6e4857e9d117e764490d38ceb6820095
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d0d9293c0ca40cd41ba02042aeb78b89
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,152 @@
using System;
using System.IO;
using UnityEngine;
#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEditor;
#endif
namespace ASMhQ45fSDK
{
public static class AssetUtils
{
/// <summary>
/// Returns a reference to a scriptable object of type T with the given fileName at the relative resourcesPath.
/// <para/> If the asset is not found, one will get created automatically (in the Editor only)
/// </summary>
/// <param name="fileName"></param>
/// <param name="resourcesPath"></param>
/// <param name="saveAssetDatabase"></param>
/// <param name="refreshAssetDatabase"></param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static T GetScriptableObject<T>(string fileName,
string resourcesPath,
bool saveAssetDatabase,
bool refreshAssetDatabase)
where T : ScriptableObject
{
if (string.IsNullOrEmpty(resourcesPath)) return null;
if (string.IsNullOrEmpty(fileName)) return null;
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!resourcesPath[resourcesPath.Length - 1].Equals(@"\")) resourcesPath += @"\";
// resourcesPath = resourcesPath.Replace(@"\", "/");
resourcesPath = CleanPath(resourcesPath);
var obj = (T)Resources.Load(fileName, typeof(T));
if (obj == null)
{
string simpleResourcesPath = resourcesPath.Replace(resourcesPath.Substring(0, resourcesPath.LastIndexOf("Resources", StringComparison.Ordinal)), "");
simpleResourcesPath = simpleResourcesPath.Replace("Resources", "").Remove(0, 1);
obj = (T)Resources.Load(Path.Combine(simpleResourcesPath, fileName), typeof(T));
}
#if UNITY_EDITOR
if (obj != null) return obj;
if (!Directory.Exists("Assets/Resources"))
{
Directory.CreateDirectory("Assets/Resources");
}
obj = CreateAsset<T>(resourcesPath, fileName, ".asset", saveAssetDatabase, refreshAssetDatabase);
#endif
return obj;
}
public static T GetResource<T>(string resourcesPath, string fileName) where T : ScriptableObject
{
if (string.IsNullOrEmpty(resourcesPath)) return null;
if (string.IsNullOrEmpty(fileName)) return null;
resourcesPath = CleanPath(resourcesPath);
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!resourcesPath[resourcesPath.Length - 1].Equals(@"\")) resourcesPath += @"\";
// resourcesPath = resourcesPath.Replace(@"\", "/");
return (T)Resources.Load(resourcesPath + fileName, typeof(T));
}
public static string CleanPath(string path)
{
// ReSharper disable once SuspiciousTypeConversion.Global
if (!path[path.Length - 1].Equals(@"\")) path += @"\";
path = path.Replace(@"\\", @"\");
path = path.Replace(@"\", "/");
return path;
}
#if UNITY_EDITOR
public static T CreateAsset<T>(string relativePath,
string fileName,
string extension = ".asset",
bool saveAssetDatabase = true,
bool refreshAssetDatabase = true)
where T : ScriptableObject
{
if (string.IsNullOrEmpty(relativePath)) return null;
if (string.IsNullOrEmpty(fileName)) return null;
relativePath = CleanPath(relativePath);
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!relativePath[relativePath.Length - 1].Equals(@"\")) relativePath += @"\";
// relativePath = relativePath.Replace(@"\\", @"\");
var asset = ScriptableObject.CreateInstance<T>();
AssetDatabase.CreateAsset(asset, relativePath + fileName + extension);
EditorUtility.SetDirty(asset);
if (saveAssetDatabase) AssetDatabase.SaveAssets();
if (refreshAssetDatabase) AssetDatabase.Refresh();
return asset;
}
public static List<T> GetAssets<T>() where T : ScriptableObject
{
var list = new List<T>();
string[] guids = AssetDatabase.FindAssets("t:" + typeof(T).Name);
foreach (string guid in guids)
{
var asset = AssetDatabase.LoadAssetAtPath<T>(AssetDatabase.GUIDToAssetPath(guid));
if (asset == null) continue;
list.Add(asset);
}
return list;
}
public static void MoveAssetToTrash(string relativePath, string fileName, bool saveAssetDatabase = true,
bool refreshAssetDatabase = true, bool printDebugMessage = true)
{
if (string.IsNullOrEmpty(relativePath)) return;
if (string.IsNullOrEmpty(fileName)) return;
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!relativePath[relativePath.Length - 1].Equals(@"\")) relativePath += @"\";
relativePath = CleanPath(relativePath);
if (!AssetDatabase.MoveAssetToTrash(relativePath + fileName + ".asset")) return;
if (printDebugMessage) Debug.Log("The " + fileName + ".asset file has been moved to trash.");
if (saveAssetDatabase) AssetDatabase.SaveAssets();
if (refreshAssetDatabase) AssetDatabase.Refresh();
}
public static Texture GetTexture(string filePath, string fileName, string fileExtension = ".png")
{
if (string.IsNullOrEmpty(filePath)) return null;
if (string.IsNullOrEmpty(fileName)) return null;
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!filePath[filePath.Length - 1].Equals(@"\")) filePath += @"\";
filePath = CleanPath(filePath);
return AssetDatabase.LoadAssetAtPath<Texture>(filePath + fileName + fileExtension);
}
public static Texture2D GetTexture2D(string filePath, string fileName, string fileExtension = ".png")
{
if (string.IsNullOrEmpty(filePath)) return null;
if (string.IsNullOrEmpty(fileName)) return null;
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!filePath[filePath.Length - 1].Equals(@"\")) filePath += @"\";
filePath = CleanPath(filePath);
return AssetDatabase.LoadAssetAtPath<Texture2D>(filePath + fileName + fileExtension);
}
#endif
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a6cff4f16b2f10d499cfd019dc05cf9f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d0a2dd547ed87a64a8c6e3d3a12a3d91
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6ce04f7adf3833347beabc1f05c117cd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fddd3da8ac49d2343a36639cc952313a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 89f3c63786553694baf52526f080ddac
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>20G417</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>AppsFlyerBundle</string>
<key>CFBundleIdentifier</key>
<string>com.appsflyer.support.two.AppsFlyerBundle</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AppsFlyerBundle</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>13A1030d</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>12.0</string>
<key>DTSDKBuild</key>
<string>21A344</string>
<key>DTSDKName</key>
<string>macosx12.0</string>
<key>DTXcode</key>
<string>1310</string>
<key>DTXcodeBuild</key>
<string>13A1030d</string>
<key>LSMinimumSystemVersion</key>
<string>11.6</string>
<key>NSHumanReadableCopyright</key>
<string></string>
</dict>
</plist>
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 429c3c4b79918684894c368157dad34a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bd0ef81b1482347b38905fab4f30e583
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,3 @@
{
"name": "BigoAds"
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a16a603f2fee3094a83a14116e2d8129
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 467aa0b9eadf04b22b5b3713a1b07bea
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1dd438e36fdc745aaa018eac5d3b182c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using BigoAds.Scripts.Api.Constant;
using System.Collections.Generic;
namespace BigoAds.Scripts.Api
{
public class BigoAdConfig
{
public const string EXTRA_KEY_HOST_RULES = "host_rules";
/// <summary>
/// the unique identifier of the App
/// </summary>
internal string AppId { get; }
/// <summary>
/// Custom set the debugLog to print debug Log.
/// debugLog NO: close debug log, YES: open debug log.
/// </summary>
internal bool DebugLog { get; }
/// <summary>
/// Channels for publishing media applications
/// </summary>
internal string Channel { get; }
internal int Age { get; }
internal int Gender { get; }
internal long ActivatedTime { get; }
internal Dictionary<string, string> ExtraDictionary { get; }
private BigoAdConfig(BigoAdConfig.Builder builder)
{
AppId = builder.AppId;
DebugLog = builder.DebugLog;
Channel = builder.Channel;
Age = builder.Age;
Gender = (int)builder.Gender;
ActivatedTime = builder.ActivatedTime;
ExtraDictionary = builder.ExtraDictionary;
}
public class Builder
{
internal string AppId;
internal bool DebugLog;
internal string Channel;
internal int Age;
internal BGAdGender Gender;
internal long ActivatedTime;
internal Dictionary<string, string> ExtraDictionary = new Dictionary<string, string>();
public Builder SetAppId(string appid)
{
this.AppId = appid;
return this;
}
public Builder SetDebugLog(bool debugLog)
{
this.DebugLog = debugLog;
return this;
}
public Builder SetChannel(string channel)
{
this.Channel = channel;
return this;
}
public Builder SetAge(int age)
{
this.Age = age;
return this;
}
public Builder SetGender(BGAdGender gender)
{
this.Gender = gender;
return this;
}
public Builder SetActivatedTime(long activatedTime)
{
this.ActivatedTime = activatedTime;
return this;
}
///Only works on Android
public Builder SetExtra(string key, string extra)
{
if (key != null && extra != null)
{
this.ExtraDictionary.Add(key, extra);
}
return this;
}
public BigoAdConfig Build()
{
return new BigoAdConfig(this);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b18497a84c58a49f385b63be54aff0cb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,106 @@
using BigoAds.Scripts.Common;
using BigoAds.Scripts.Api.Constant;
namespace BigoAds.Scripts.Api
{
public static class BigoAdSdk
{
private static IClientFactory _clientFactory;
private static ISDK _sdk;
internal static ISDK SDK
{
get
{
if (_sdk == null)
{
_sdk = GetClientFactory().BuildSDKClient();
}
return _sdk;
}
}
internal static IClientFactory GetClientFactory()
{
if (_clientFactory != null)
{
return _clientFactory;
}
_clientFactory =
#if UNITY_ANDROID
new BigoAds.Scripts.Platforms.Android.AndroidClientFactory();
#elif UNITY_IOS
new BigoAds.Scripts.Platforms.iOS.IOSClientFactory();
#else
null;
throw new PlatformNotSupportedException();
#endif
return _clientFactory;
}
public delegate void InitResultDelegate();
public static event InitResultDelegate OnInitFinish;
/// Starts the Bigo SDK
/// @warning Call this method as early as possible to reduce ad request fail.
/// @param config SDK configuration
/// @param callback Callback for starting the Bigo SDK
/// ////
public static void Initialize(BigoAdConfig config)
{
if (IsInitSuccess())
{
OnInitFinish?.Invoke();
return;
}
SDK.Init(config, (() => { OnInitFinish?.Invoke(); }));
}
////
/// The SDK initialization state
////
public static bool IsInitSuccess()
{
return SDK.IsInitSuccess();
}
///////
/// Bigo SDK version
/// ////
public static string GetSDKVersion()
{
return SDK.GetSDKVersion();
}
///////
/// Bigo SDK version name
/// ////
public static string GetSDKVersionName()
{
return SDK.GetSDKVersionName();
}
///////
/// Bigo SDK set user consent
/// ////
public static void SetUserConsent(ConsentOptions option, bool consent)
{
SDK.SetUserConsent(option, consent);
}
///////
/// Only works on Android
/// Bigo SDK set user consent
/// ////
public static void AddExtraHost(string country, string host)
{
SDK.AddExtraHost(country, host);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e5ad9c8c265954d4e8f4f03312b5fa42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,30 @@
using BigoAds.Scripts.Api.Constant;
using BigoAds.Scripts.Common;
using UnityEngine;
namespace BigoAds.Scripts.Api
{
public class BigoBannerAd : BigoBaseAd<BigoBannerRequest>
{
private readonly IBannerAd _bannerAdClient;
/// <summary>
/// create a banner ad
/// </summary>
/// <param name="slotId"></param>
public BigoBannerAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildBannerAdClient())
{
_bannerAdClient = (IBannerAd) ADClient;
}
/// <summary>
/// set position for banner
/// </summary>
/// <param name="position"></param>
public void SetPosition(BigoPosition position)
{
_bannerAdClient?.SetPosition(position);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5136d466cbb6c461f92fbd90b6fa157d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,22 @@
using System;
using BigoAds.Scripts.Api.Constant;
using UnityEngine;
namespace BigoAds.Scripts.Api
{
[Serializable]
public class BigoBannerRequest : BigoRequest
{
[SerializeField()]
private BigoBannerSize size;
public BigoBannerSize Size => size;
public BigoPosition Position { get; }
public BigoBannerRequest(BigoBannerSize size, BigoPosition position = BigoPosition.Bottom)
{
this.size = size;
this.Position = position;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 159c6164853954739adbca1ae7592df7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
using BigoAds.Scripts.Common;
namespace BigoAds.Scripts.Api
{
public class BigoInterstitialAd : BigoBaseAd<BigoInterstitialRequest>
{
public BigoInterstitialAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildInterstitialAdClient())
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1323eae1e03094d8281b23f5527a53db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using System;
namespace BigoAds.Scripts.Api
{
[Serializable]
public class BigoInterstitialRequest : BigoRequest
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1947fd630823b4858af6c3a471497f70
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
using BigoAds.Scripts.Api.Constant;
using BigoAds.Scripts.Common;
using UnityEngine;
namespace BigoAds.Scripts.Api
{
public class BigoNativeAd : BigoBaseAd<BigoNativeRequest>
{
private readonly INativeAd _NativeAdClient;
public BigoNativeAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildNativeAdClient())
{
_NativeAdClient = (INativeAd) ADClient;
}
/// <summary>
/// set position for native
/// </summary>
/// <param name="position"></param>
public void SetPosition(BigoPosition position)
{
_NativeAdClient?.SetPosition(position);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1742d1ee2ff5e4d508ae81524cb94ade
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using System;
namespace BigoAds.Scripts.Api
{
[Serializable]
public class BigoNativeRequest : BigoRequest
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 033c30386f5714bddb5dd41d7524979e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
using BigoAds.Scripts.Common;
namespace BigoAds.Scripts.Api
{
public class BigoPopupAd : BigoBaseAd<BigoPopupRequest>
{
public BigoPopupAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildPopupAdClient())
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2be0a8fe9e5aa4bea8970a47e617a076
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using System;
namespace BigoAds.Scripts.Api
{
[Serializable]
public class BigoPopupRequest : BigoRequest
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 580aad20fbde543bab37a5e878c682cb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,47 @@
using System;
using UnityEngine;
using BigoAds.Scripts.Api.Constant;
namespace BigoAds.Scripts.Api
{
[Serializable]
public class BigoRequest
{
[SerializeField] private string extraInfo;
[SerializeField] private int age;
[SerializeField] private BGAdGender gender;
[SerializeField] private long activatedTime;
public string ExtraInfoJson
{
get => extraInfo;
set => extraInfo = value;
}
/// Only works on Android
public int Age
{
get => age;
set => age = value;
}
/// Only works on Android
public BGAdGender Gender
{
get => gender;
set => gender = value;
}
/// Only works on Android
public long ActivatedTime
{
get => activatedTime;
set => activatedTime = value;
}
public string ToJson()
{
return JsonUtility.ToJson(this);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2707ffe474e6443d6a5260876d5b1370
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,29 @@
using System;
using BigoAds.Scripts.Common;
namespace BigoAds.Scripts.Api
{
public class BigoRewardedAd : BigoBaseAd<BigoRewardedRequest>
{
public event Action OnUserEarnedReward;
public BigoRewardedAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildRewardedAdClient())
{
var rewardedAdClient = (IRewardedAd) ADClient;
rewardedAdClient.OnUserEarnedReward += InvokeOnUserEarnedReward;
}
private void InvokeOnUserEarnedReward()
{
if (CallbackOnMainThread)
{
BigoDispatcher.PostTask((() => { OnUserEarnedReward?.Invoke(); }));
}
else
{
OnUserEarnedReward?.Invoke();
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2f745c8797b25430685a5a08b34f0d9f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using System;
namespace BigoAds.Scripts.Api
{
[Serializable]
public class BigoRewardedRequest : BigoRequest
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 38f4a763a1fc9429ca87c62eed4b4645
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
using BigoAds.Scripts.Common;
namespace BigoAds.Scripts.Api
{
public class BigoSplashAd : BigoBaseAd<BigoSplashRequest>
{
public BigoSplashAd(string slotId) : base(slotId, BigoAdSdk.GetClientFactory().BuildSplashAdClient())
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 61b62ca232d2e42788e61f33d7784209
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using System;
namespace BigoAds.Scripts.Api
{
[Serializable]
public class BigoSplashRequest : BigoRequest
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: afdf808922a744419b5db1fdd4ca18b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0762cd7e46c3c43e5a32b1558643eb74
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using System;
namespace BigoAds.Scripts.Api.Constant
{
[Serializable]
public enum BGAdGender
{
Female = 1,
Male = 2
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2784802c5b5b34470a0500118ccb7f55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,13 @@
using System;
namespace BigoAds.Scripts.Api.Constant
{
[Serializable]
public enum BGAdLossReason
{
InternalError = 1,
Timeout = 2,
LowerThanFloorPrice = 100,
LowerThanHighestPrice = 101
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 303b2e25e09c44797a167b642310a319
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
using System;
using UnityEngine;
namespace BigoAds.Scripts.Api.Constant
{
[Serializable]
public struct BigoBannerSize
{
public static readonly BigoBannerSize BANNER_W_320_H_50 = new BigoBannerSize(320,50);
public static readonly BigoBannerSize BANNER_W_300_H_250 = new BigoBannerSize(300,250);
[SerializeField] private int width;
[SerializeField] private int height;
public int Width => width;
public int Height => height;
public BigoBannerSize(int width, int height)
{
this.width = width;
this.height = height;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4a4411a50cfc94717b30325ceed3d52f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,12 @@
using System;
namespace BigoAds.Scripts.Api.Constant
{
[Serializable]
public enum BigoPosition
{
Top = 0,
Middle = 1,
Bottom = 2
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6511065ffc7f44235bacb3ee16a87f5a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,13 @@
using System;
namespace BigoAds.Scripts.Api.Constant
{
[Serializable]
public enum ConsentOptions
{
GDPR,
CCPA,
LGPD,
COPPA
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7867ac15c426649a6aa633a772d54879
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8b4db2c2875384f11b89eb7dec28b823
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -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:

Some files were not shown because too many files have changed in this diff Show More