You've already forked Commercialization.topon
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 212fec1d1d | |||
| dfa6ce96af | |||
| d653b06c8d |
@@ -156,7 +156,7 @@ namespace AnyThinkAds.Android
|
||||
}catch(System.Exception e){
|
||||
System.Console.WriteLine("Exception caught: {0}", e);
|
||||
Debug.Log ("ATInterstitialAdClient : error."+e.Message);
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,6 +403,7 @@ namespace AnyThinkAds.Android
|
||||
{
|
||||
System.Console.WriteLine("Exception caught: {0}", e);
|
||||
Debug.Log("Unity: ATInterstitialAdClient:showAutoAd() : error." + e.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace AnyThinkAds.Android
|
||||
}catch(System.Exception e){
|
||||
System.Console.WriteLine("Exception caught: {0}", e);
|
||||
Debug.Log ("ATRewardedVideoAdClient : error."+e.Message);
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,6 +390,7 @@ namespace AnyThinkAds.Android
|
||||
{
|
||||
System.Console.WriteLine("Exception caught: {0}", e);
|
||||
Debug.Log("Unity: ATRewardedVideoAdClient:showAutoAd() : error." + e.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<repositories>
|
||||
<repository>https://jfrog.takuad.com/artifactory/china_sdk</repository>
|
||||
</repositories>
|
||||
<androidPackage spec="com.anythink.sdk:core-taku:6.5.52"/>
|
||||
<androidPackage spec="com.anythink.sdk:core-taku:6.5.73.1"/>
|
||||
<androidPackage spec="com.android.support:appcompat-v7:28.0.0"/>
|
||||
</androidPackages>
|
||||
</dependencies>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<dependencies>
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-sdm:6.5.54.1.0"/>
|
||||
<androidPackage spec="com.smartdigimkttech.sdk:sdm-sdk-cn:6.5.54"/>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-sdm:6.5.66.1.0"/>
|
||||
<androidPackage spec="com.smartdigimkttech.sdk:sdm-sdk-cn:6.5.66"/>
|
||||
</androidPackages>
|
||||
</dependencies>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<dependencies>
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-baidu:9.432.1.0"/>
|
||||
<androidPackage spec="mobi.baidu.sdk:mobads:9.432"/>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-baidu:9.450.1.0"/>
|
||||
<androidPackage spec="mobi.baidu.sdk:mobads:9.450"/>
|
||||
</androidPackages>
|
||||
</dependencies>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"name":"baidu","version":"9.432","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/Android/China/mediation/baidu"}
|
||||
{"name":"baidu","version":"9.450","country":1,"path":"Assets/AnyThinkPlugin/Script/IntegrationManager/Editor/../../..//AnyThinkAds\\Plugins/Android/China/mediation/baidu"}
|
||||
@@ -1 +1 @@
|
||||
{"name":"csj","version":"7.5.1.0","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/Android/China/mediation/csj"}
|
||||
{"name":"csj","version":"7.6.1.1","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/Android/China/mediation/csj"}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<dependencies>
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-gdt:4.671.1541.1.0"/>
|
||||
<androidPackage spec="com.qq.e.union:union:4.671.1541"/>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-gdt:4.680.1550.1.0"/>
|
||||
<androidPackage spec="com.qq.e.union:union:4.680.1550"/>
|
||||
</androidPackages>
|
||||
</dependencies>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"name":"gdt","version":"4.671.1541","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/Android/China/mediation/gdt"}
|
||||
{"name":"gdt","version":"4.680.1550","country":1,"path":"Assets/AnyThinkPlugin/Script/IntegrationManager/Editor/../../..//AnyThinkAds\\Plugins/Android/China/mediation/gdt"}
|
||||
@@ -3,7 +3,7 @@
|
||||
<repositories>
|
||||
<repository>https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_support</repository>
|
||||
</repositories>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-mintegral-china:16.3.67.1.0"/>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-mintegral-china:16.3.67.1.1"/>
|
||||
<androidPackage spec="com.mbridge.msdk.support:reward:16.3.67"/>
|
||||
<androidPackage spec="com.mbridge.msdk.support:newinterstitial:16.3.67"/>
|
||||
<androidPackage spec="com.mbridge.msdk.support:mbnative:16.3.67"/>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"name":"gtm","version":"16.3.67","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/Android/China/mediation/gtm"}
|
||||
{"name":"gtm","version":"16.3.67","country":1,"path":"Assets/AnyThinkPlugin/Script/IntegrationManager/Editor/../../..//AnyThinkAds\\Plugins/Android/China/mediation/gtm"}
|
||||
@@ -1,6 +1,6 @@
|
||||
<dependencies>
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-kuaishou:4.12.20.1.1.0"/>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-kuaishou:4.12.20.1.1.2"/>
|
||||
<androidPackage spec="com.anythink.sdk:sdk-ads-kuaishou:4.12.20.1"/>
|
||||
<androidPackage spec="com.android.support:design:28.0.0"/>
|
||||
</androidPackages>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"name":"kuaishou","version":"4.12.20.1","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/Android/China/mediation/kuaishou"}
|
||||
{"name":"kuaishou","version":"4.12.20.1","country":1,"path":"Assets/AnyThinkPlugin/Script/IntegrationManager/Editor/../../..//AnyThinkAds\\Plugins/Android/China/mediation/kuaishou"}
|
||||
@@ -1,7 +1,7 @@
|
||||
<dependencies>
|
||||
<androidPackages>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-tap:4.1.2.7.1.1"/>
|
||||
<androidPackage spec="com.anythink.sdk:sdk-ads-tap:4.1.2.7"/>
|
||||
<androidPackage spec="com.anythink.sdk:adapter-taku-tap:4.2.1.1.1.1"/>
|
||||
<androidPackage spec="com.anythink.sdk:sdk-ads-tap:4.2.1.1"/>
|
||||
<androidPackage spec="com.squareup.okhttp3:okhttp:3.12.1"/>
|
||||
<androidPackage spec="com.github.bumptech.glide:glide:4.9.0"/>
|
||||
<androidPackage spec="com.android.support:appcompat-v7:28.0.0"/>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"name":"tap","version":"4.1.2.7","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/Android/China/mediation/tap"}
|
||||
{"name":"tap","version":"4.2.1.1","country":1,"path":"Assets/AnyThinkPlugin/Script/IntegrationManager/Editor/../../..//AnyThinkAds\\Plugins/Android/China/mediation/tap"}
|
||||
@@ -1 +1 @@
|
||||
{"curCountry":1,"china":{"android_version":"6.5.52","ios_version":"","androidXSetting":1,"country":1,"android_admob_app_id":"","ios_admob_app_id":""},"nonchina":{"android_version":"","ios_version":"","androidXSetting":0,"country":2,"android_admob_app_id":"","ios_admob_app_id":""}}
|
||||
{"curCountry":1,"china":{"android_version":"6.5.73","ios_version":"","androidXSetting":1,"country":1,"android_admob_app_id":"","ios_admob_app_id":""},"nonchina":{"android_version":"","ios_version":"","androidXSetting":0,"country":2,"android_admob_app_id":"","ios_admob_app_id":""}}
|
||||
25
CHANGELOG.md
25
CHANGELOG.md
@@ -1,3 +1,28 @@
|
||||
# [1.4.11]
|
||||
|
||||
### 修复
|
||||
|
||||
* Android 构建后处理合并 `tools:replace` 声明,避免覆盖宿主项目已有的 `android:appComponentFactory` 冲突处理。
|
||||
|
||||
# [1.4.10]
|
||||
|
||||
### 更新
|
||||
|
||||
* 升级 Taku Android 依赖到 `6.5.73` 系列,并同步更新国内广告网络依赖版本。
|
||||
* 更新 CSJ/GroMore 本地整合包到 `7.6.1.1` 系列,保留此前本地 AAR 接入方式。
|
||||
|
||||
# [1.4.9]
|
||||
|
||||
### 新增
|
||||
|
||||
* 示例改为 `Samples~` 可选导入内容,业务项目默认引用主包时不再自动带入 sample 菜单和调试场景。
|
||||
|
||||
### 修复
|
||||
|
||||
* 重构激励视频与插屏展示阶段状态机,补齐 `show/showAutoAd` 同步异常后的失败收口,避免卡死在播放前遮罩。
|
||||
* 按官方语义调整激励视频生命周期:奖励回调只记录奖励结果,关闭回调统一完成会话结算。
|
||||
* 去除广告源级失败对主链的误判,`AdSource` 加载/竞价失败不再错误打断播放器流程。
|
||||
|
||||
# [1.4.8]
|
||||
|
||||
### 修复
|
||||
|
||||
Binary file not shown.
BIN
Plugins/Android/anythink_network_csj_mix_7.6.1.1.1.0.aar
Normal file
BIN
Plugins/Android/anythink_network_csj_mix_7.6.1.1.1.0.aar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -121,7 +121,7 @@ namespace Topon_Adapter.Editor
|
||||
|
||||
elementlauncherApplication.Add (CreateCSJGromore ());
|
||||
SetOrAddAttribute (elementlauncherApplication, AndroidNamespace + "allowBackup", "false");
|
||||
SetOrAddAttribute (elementlauncherApplication, ToolsNamespace + "replace", "android:allowBackup");
|
||||
MergeToolsReplaceAttribute (elementlauncherApplication, "android:allowBackup");
|
||||
|
||||
var elementMainManifest = manifest.Element ("manifest");
|
||||
var elementMainApplication = elementMainManifest.Element ("application");
|
||||
@@ -263,6 +263,30 @@ namespace Topon_Adapter.Editor
|
||||
attribute.SetValue (value);
|
||||
}
|
||||
|
||||
private static void MergeToolsReplaceAttribute (XElement element, params string[] replaceValues)
|
||||
{
|
||||
XName replaceAttributeName = ToolsNamespace + "replace";
|
||||
List<string> mergedValues = new List<string> ();
|
||||
|
||||
var currentValue = element.Attribute (replaceAttributeName)?.Value;
|
||||
if (string.IsNullOrWhiteSpace (currentValue) == false)
|
||||
{
|
||||
mergedValues.AddRange (currentValue.Split (',')
|
||||
.Select (value => value.Trim ())
|
||||
.Where (value => string.IsNullOrWhiteSpace (value) == false));
|
||||
}
|
||||
|
||||
foreach (var replaceValue in replaceValues)
|
||||
{
|
||||
if (mergedValues.Contains (replaceValue) == false)
|
||||
{
|
||||
mergedValues.Add (replaceValue);
|
||||
}
|
||||
}
|
||||
|
||||
element.SetAttributeValue (replaceAttributeName, string.Join (",", mergedValues));
|
||||
}
|
||||
|
||||
public int callbackOrder { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build.Reporting;
|
||||
using UnityEngine;
|
||||
|
||||
public static class IAAAdAndroidBuild
|
||||
{
|
||||
private const string OutputDirectory = "Build/Android";
|
||||
private const string OutputApkPath = OutputDirectory + "/IAAAdDebugSample-starveg.apk";
|
||||
private const string KeystorePath = "Build/Android/keys/starveg-test.keystore";
|
||||
private const string KeystorePassword = "Foldcc123!";
|
||||
private const string KeyAliasName = "starvegtest";
|
||||
private const string PackageName = "com.foldcc.starveg";
|
||||
|
||||
[MenuItem("Topon/Build IAA Android Test APK")]
|
||||
public static void BuildAndroidTestApk()
|
||||
{
|
||||
EnsureBuildFolders();
|
||||
ConfigurePlayerSettings();
|
||||
var resolverState = CaptureResolverState();
|
||||
|
||||
try
|
||||
{
|
||||
ApplyBatchFriendlyResolverSettings();
|
||||
|
||||
var scenes = new[] { "Assets/Samples/IAAAdDebugSample/Scenes/IAAAdDebugSample.unity" };
|
||||
var options = new BuildPlayerOptions
|
||||
{
|
||||
scenes = scenes,
|
||||
target = BuildTarget.Android,
|
||||
locationPathName = OutputApkPath,
|
||||
options = BuildOptions.None
|
||||
};
|
||||
|
||||
var report = BuildPipeline.BuildPlayer(options);
|
||||
if (report.summary.result != BuildResult.Succeeded)
|
||||
{
|
||||
throw new Exception(
|
||||
$"Android APK build failed: {report.summary.result} ({report.summary.totalErrors} errors)");
|
||||
}
|
||||
|
||||
Debug.Log($"[IAA Build] APK generated: {Path.GetFullPath(OutputApkPath)}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
RestoreResolverState(resolverState);
|
||||
}
|
||||
}
|
||||
|
||||
public static void BuildAndroidTestApkInBatchMode()
|
||||
{
|
||||
BuildAndroidTestApk();
|
||||
EditorApplication.Exit(0);
|
||||
}
|
||||
|
||||
private static void ConfigurePlayerSettings()
|
||||
{
|
||||
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, PackageName);
|
||||
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
|
||||
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64;
|
||||
PlayerSettings.Android.useCustomKeystore = true;
|
||||
PlayerSettings.Android.keystoreName = Path.GetFullPath(KeystorePath);
|
||||
PlayerSettings.Android.keystorePass = KeystorePassword;
|
||||
PlayerSettings.Android.keyaliasName = KeyAliasName;
|
||||
PlayerSettings.Android.keyaliasPass = KeystorePassword;
|
||||
PlayerSettings.bundleVersion = string.IsNullOrWhiteSpace(PlayerSettings.bundleVersion)
|
||||
? "1.0.0"
|
||||
: PlayerSettings.bundleVersion;
|
||||
PlayerSettings.Android.bundleVersionCode = Mathf.Max(1, PlayerSettings.Android.bundleVersionCode);
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
private static void EnsureBuildFolders()
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetFullPath(OutputDirectory));
|
||||
Directory.CreateDirectory(Path.GetFullPath(Path.GetDirectoryName(KeystorePath) ?? OutputDirectory));
|
||||
}
|
||||
|
||||
private static ResolverState CaptureResolverState()
|
||||
{
|
||||
var settingsType = GetResolverSettingsType();
|
||||
return new ResolverState
|
||||
{
|
||||
EnableAutoResolution = GetResolverBool(settingsType, "EnableAutoResolution"),
|
||||
AutoResolveOnBuild = GetResolverBool(settingsType, "AutoResolveOnBuild"),
|
||||
PromptBeforeAutoResolution = GetResolverBool(settingsType, "PromptBeforeAutoResolution")
|
||||
};
|
||||
}
|
||||
|
||||
private static void ApplyBatchFriendlyResolverSettings()
|
||||
{
|
||||
var settingsType = GetResolverSettingsType();
|
||||
SetResolverBool(settingsType, "EnableAutoResolution", false);
|
||||
SetResolverBool(settingsType, "AutoResolveOnBuild", false);
|
||||
SetResolverBool(settingsType, "PromptBeforeAutoResolution", false);
|
||||
}
|
||||
|
||||
private static void RestoreResolverState(ResolverState state)
|
||||
{
|
||||
var settingsType = GetResolverSettingsType();
|
||||
SetResolverBool(settingsType, "EnableAutoResolution", state.EnableAutoResolution);
|
||||
SetResolverBool(settingsType, "AutoResolveOnBuild", state.AutoResolveOnBuild);
|
||||
SetResolverBool(settingsType, "PromptBeforeAutoResolution", state.PromptBeforeAutoResolution);
|
||||
}
|
||||
|
||||
private static Type GetResolverSettingsType()
|
||||
{
|
||||
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
var type = assembly.GetType("GooglePlayServices.SettingsDialog");
|
||||
if (type != null)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool GetResolverBool(Type settingsType, string propertyName)
|
||||
{
|
||||
if (settingsType == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var property = settingsType.GetProperty(
|
||||
propertyName,
|
||||
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
|
||||
if (property == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool)property.GetValue(null, null);
|
||||
}
|
||||
|
||||
private static void SetResolverBool(Type settingsType, string propertyName, bool value)
|
||||
{
|
||||
if (settingsType == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var property = settingsType.GetProperty(
|
||||
propertyName,
|
||||
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
|
||||
if (property == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
property.SetValue(null, value, null);
|
||||
}
|
||||
|
||||
private struct ResolverState
|
||||
{
|
||||
public bool EnableAutoResolution;
|
||||
public bool AutoResolveOnBuild;
|
||||
public bool PromptBeforeAutoResolution;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97e92d5544ec4fc9adf7571f9f4ea241
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,159 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Runtime.ADAggregator;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
||||
public static class IAAAdDebugSampleCreator
|
||||
{
|
||||
private const string SampleRoot = "Assets/Samples/IAAAdDebugSample";
|
||||
private const string SampleSceneDirectory = SampleRoot + "/Scenes";
|
||||
private const string SampleConfigDirectory = SampleRoot + "/Configs";
|
||||
private const string SampleScenePath = SampleSceneDirectory + "/IAAAdDebugSample.unity";
|
||||
private const string SampleConfigPath = SampleConfigDirectory + "/IAAAdDebugSampleConfig.asset";
|
||||
|
||||
[MenuItem("Topon/Create IAA IMGUI Debug Sample")]
|
||||
public static void CreateOrUpdateSample()
|
||||
{
|
||||
EnsureDirectory(SampleRoot);
|
||||
EnsureDirectory(SampleSceneDirectory);
|
||||
EnsureDirectory(SampleConfigDirectory);
|
||||
|
||||
var config = LoadOrCreateConfig();
|
||||
CreateOrUpdateScene(config);
|
||||
AppendSceneToBuildSettings(SampleScenePath);
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
EditorUtility.DisplayDialog(
|
||||
"IAA Sample Created",
|
||||
$"Scene: {SampleScenePath}\nConfig: {SampleConfigPath}",
|
||||
"OK");
|
||||
}
|
||||
|
||||
public static void CreateOrUpdateSampleInBatchMode()
|
||||
{
|
||||
CreateOrUpdateSample();
|
||||
EditorApplication.Exit(0);
|
||||
}
|
||||
|
||||
private static ADConfig LoadOrCreateConfig()
|
||||
{
|
||||
var config = AssetDatabase.LoadAssetAtPath<ADConfig>(SampleConfigPath);
|
||||
if (config == null)
|
||||
{
|
||||
config = ScriptableObject.CreateInstance<ADConfig>();
|
||||
AssetDatabase.CreateAsset(config, SampleConfigPath);
|
||||
}
|
||||
|
||||
config.ConfigName = "IAA Ad Debug Sample";
|
||||
config.Id = string.IsNullOrWhiteSpace(config.Id) ? "fill_taku_app_id" : config.Id;
|
||||
config.Key = string.IsNullOrWhiteSpace(config.Key) ? "fill_taku_app_key" : config.Key;
|
||||
config.Key2 = string.IsNullOrWhiteSpace(config.Key2) ? string.Empty : config.Key2;
|
||||
config.BaseAwardAdKeyValue = config.BaseAwardAdKeyValue ?? new AdKeyValue();
|
||||
config.BaseAwardAdKeyValue.key = "rewarded";
|
||||
config.BaseAwardAdKeyValue.value = string.IsNullOrWhiteSpace(config.BaseAwardAdKeyValue.value)
|
||||
? "fill_rewarded_placement"
|
||||
: config.BaseAwardAdKeyValue.value;
|
||||
|
||||
config.BaseInteractionAdKeyValue = config.BaseInteractionAdKeyValue ?? new AdKeyValue();
|
||||
config.BaseInteractionAdKeyValue.key = "interstitial";
|
||||
config.BaseInteractionAdKeyValue.value = string.IsNullOrWhiteSpace(config.BaseInteractionAdKeyValue.value)
|
||||
? "fill_interstitial_placement"
|
||||
: config.BaseInteractionAdKeyValue.value;
|
||||
|
||||
config.BaseSplashAdKeyValue = config.BaseSplashAdKeyValue ?? new AdKeyValue();
|
||||
config.BaseSplashAdKeyValue.key = "splash";
|
||||
config.BaseSplashAdKeyValue.value = string.IsNullOrWhiteSpace(config.BaseSplashAdKeyValue.value)
|
||||
? "optional_splash_placement"
|
||||
: config.BaseSplashAdKeyValue.value;
|
||||
|
||||
config.CommonKeyValues ??= new List<AdKeyValue>();
|
||||
SetOrAddCommonKey(config, "topon.rewarded_auto_load", "true");
|
||||
SetOrAddCommonKey(config, "topon.rewarded_prewarm_on_init", "true");
|
||||
SetOrAddCommonKey(config, "topon.rewarded_max_load_attempts", "3");
|
||||
SetOrAddCommonKey(config, "topon.rewarded_load_retry_delay_ms", "1000");
|
||||
SetOrAddCommonKey(config, "topon.interstitial_auto_load", "true");
|
||||
SetOrAddCommonKey(config, "topon.interstitial_prewarm_on_init", "true");
|
||||
SetOrAddCommonKey(config, "topon.interstitial_max_load_attempts", "2");
|
||||
SetOrAddCommonKey(config, "topon.interstitial_load_retry_delay_ms", "500");
|
||||
|
||||
EditorUtility.SetDirty(config);
|
||||
return config;
|
||||
}
|
||||
|
||||
private static void CreateOrUpdateScene(ADConfig config)
|
||||
{
|
||||
var scene = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single);
|
||||
scene.name = "IAAAdDebugSample";
|
||||
|
||||
var root = new GameObject("IAA Ad Debug Sample");
|
||||
var gui = root.AddComponent<IAAAdDebugSampleGui>();
|
||||
gui.adConfig = config;
|
||||
gui.userId = "debug_user_001";
|
||||
gui.rewardedScenario = "reward_debug";
|
||||
gui.interstitialScenario = "interstitial_debug";
|
||||
gui.autoInitialize = true;
|
||||
gui.forcePortrait = true;
|
||||
gui.captureUnityLogs = true;
|
||||
gui.showVerboseState = true;
|
||||
|
||||
EditorSceneManager.SaveScene(scene, SampleScenePath);
|
||||
}
|
||||
|
||||
private static void AppendSceneToBuildSettings(string scenePath)
|
||||
{
|
||||
var scenes = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes);
|
||||
var exists = false;
|
||||
for (var i = 0; i < scenes.Count; i++)
|
||||
{
|
||||
if (scenes[i].path != scenePath)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
scenes[i] = new EditorBuildSettingsScene(scenePath, true);
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
scenes.Add(new EditorBuildSettingsScene(scenePath, true));
|
||||
}
|
||||
|
||||
EditorBuildSettings.scenes = scenes.ToArray();
|
||||
}
|
||||
|
||||
private static void SetOrAddCommonKey(ADConfig config, string key, string value)
|
||||
{
|
||||
foreach (var item in config.CommonKeyValues)
|
||||
{
|
||||
if (item != null && item.key == key)
|
||||
{
|
||||
item.value = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
config.CommonKeyValues.Add(new AdKeyValue
|
||||
{
|
||||
key = key,
|
||||
value = value
|
||||
});
|
||||
}
|
||||
|
||||
private static void EnsureDirectory(string assetPath)
|
||||
{
|
||||
if (AssetDatabase.IsValidFolder(assetPath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(Path.GetFullPath(assetPath));
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c488fb4879e14f5cb366ce084ff2b748
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,78 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public static class IAABatchBuildBootstrap
|
||||
{
|
||||
private const string TaskFilePath = "Temp/iaa-batch-task.txt";
|
||||
private static bool _subscribed;
|
||||
private static bool _taskRunning;
|
||||
|
||||
static IAABatchBuildBootstrap()
|
||||
{
|
||||
if (!Application.isBatchMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_subscribed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_subscribed = true;
|
||||
EditorApplication.update += ExecutePendingTaskWhenReady;
|
||||
}
|
||||
|
||||
private static void ExecutePendingTaskWhenReady()
|
||||
{
|
||||
if (!Application.isBatchMode || _taskRunning)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var fullPath = Path.GetFullPath(TaskFilePath);
|
||||
if (!File.Exists(fullPath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (EditorApplication.isCompiling || EditorApplication.isUpdating)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_taskRunning = true;
|
||||
EditorApplication.update -= ExecutePendingTaskWhenReady;
|
||||
|
||||
var task = File.ReadAllText(fullPath).Trim();
|
||||
File.Delete(fullPath);
|
||||
|
||||
try
|
||||
{
|
||||
switch (task)
|
||||
{
|
||||
case "create-sample":
|
||||
IAAAdDebugSampleCreator.CreateOrUpdateSample();
|
||||
break;
|
||||
case "build-apk":
|
||||
IAAAdAndroidBuild.BuildAndroidTestApk();
|
||||
break;
|
||||
default:
|
||||
Debug.LogWarning($"[IAA Batch] Unknown task: {task}");
|
||||
break;
|
||||
}
|
||||
|
||||
EditorApplication.Exit(0);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogException(exception);
|
||||
EditorApplication.Exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33e31dbdc20d47a78340d49f58d81ef9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -12,6 +12,7 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
private Action<bool> _onVideoComplete;
|
||||
private ADListenerAggregator _aggregator;
|
||||
private bool _autoLoadRegistered;
|
||||
private bool _rewardGranted;
|
||||
|
||||
public override void OnInit()
|
||||
{
|
||||
@@ -28,6 +29,7 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
}
|
||||
|
||||
curState = 0;
|
||||
_rewardGranted = false;
|
||||
_onVideoComplete = onVideoComplete;
|
||||
adListener.onClose = onClose;
|
||||
adListener.onVideoComplete = OnVideoComplete;
|
||||
@@ -117,6 +119,7 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
public void onRewardedVideoAdPlayStart(string placementId, ATCallbackInfo callbackInfo)
|
||||
{
|
||||
Debug.Log($"[Topon] Rewarded play start. placementId={placementId}");
|
||||
NotifyShowStarted();
|
||||
}
|
||||
|
||||
public void onRewardedVideoAdPlayEnd(string placementId, ATCallbackInfo callbackInfo)
|
||||
@@ -134,7 +137,7 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
public void onRewardedVideoAdPlayClosed(string placementId, bool isReward, ATCallbackInfo callbackInfo)
|
||||
{
|
||||
Debug.Log($"[Topon] Rewarded closed. placementId={placementId}, reward={isReward}");
|
||||
adListener.OnRewardVerify(isReward, 1, "");
|
||||
adListener.OnRewardVerify(_rewardGranted || isReward, 1, "");
|
||||
adListener.OnAdClose();
|
||||
}
|
||||
|
||||
@@ -146,8 +149,7 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
public void onReward(string placementId, ATCallbackInfo callbackInfo)
|
||||
{
|
||||
Debug.Log($"[Topon] Rewarded reward callback. placementId={placementId}");
|
||||
adListener.OnRewardVerify(true, 1, "");
|
||||
adListener.OnAdClose();
|
||||
_rewardGranted = true;
|
||||
}
|
||||
|
||||
public void startLoadingADSource(string placementId, ATCallbackInfo callbackInfo)
|
||||
@@ -160,7 +162,6 @@ public class AwardVideoPlayer : ADPlayer, ATRewardedVideoListener
|
||||
|
||||
public void failToLoadADSource(string placementId, ATCallbackInfo callbackInfo, string code, string message)
|
||||
{
|
||||
OnError(code, message);
|
||||
}
|
||||
|
||||
public void startBiddingADSource(string placementId, ATCallbackInfo callbackInfo)
|
||||
|
||||
@@ -114,6 +114,7 @@ public class InteractionPlayer : ADPlayer, ATInterstitialAdListener
|
||||
public void onInterstitialAdShow(string placementId, ATCallbackInfo callbackInfo)
|
||||
{
|
||||
Debug.Log($"[Topon] Interstitial show. placementId={placementId}");
|
||||
NotifyShowStarted();
|
||||
}
|
||||
|
||||
public void onInterstitialAdFailedToShow(string placementId)
|
||||
@@ -160,7 +161,6 @@ public class InteractionPlayer : ADPlayer, ATInterstitialAdListener
|
||||
|
||||
public void failToLoadADSource(string placementId, ATCallbackInfo callbackInfo, string code, string message)
|
||||
{
|
||||
OnError(code, message);
|
||||
}
|
||||
|
||||
public void startBiddingADSource(string placementId, ATCallbackInfo callbackInfo)
|
||||
@@ -173,7 +173,6 @@ public class InteractionPlayer : ADPlayer, ATInterstitialAdListener
|
||||
|
||||
public void failBiddingADSource(string placementId, ATCallbackInfo callbackInfo, string code, string message)
|
||||
{
|
||||
OnError(code, message);
|
||||
}
|
||||
|
||||
public override void OnPlayRequestStarted()
|
||||
|
||||
11
package.json
11
package.json
@@ -2,7 +2,7 @@
|
||||
"name": "com.commercialization.topon",
|
||||
"displayName": "Commercialization.topon",
|
||||
"description": "基于topon的广告sdk封装,依赖基础商业化模块",
|
||||
"version": "1.4.8",
|
||||
"version": "1.4.11",
|
||||
"unity": "2021.1",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -16,8 +16,15 @@
|
||||
},
|
||||
"dependencies":
|
||||
{
|
||||
"com.foldcc.cc-framework.commercialization" : "http://private.lightyears.ltd:18640/foldcc/CC-Framework.Commercialization.git#1.0.13"
|
||||
"com.foldcc.cc-framework.commercialization" : "http://private.lightyears.ltd:18640/foldcc/CC-Framework.Commercialization.git#1.0.14"
|
||||
},
|
||||
"samples": [
|
||||
{
|
||||
"displayName": "IAA Ad Debug Sample",
|
||||
"description": "Optional debug scene and config for validating rewarded and interstitial flows.",
|
||||
"path": "Samples~/IAAAdDebugSample"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"Framework"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user