5 Commits

61 changed files with 111 additions and 697 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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"}

View File

@@ -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"}

View File

@@ -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>

View File

@@ -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"}

View File

@@ -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"/>

View File

@@ -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"}

View File

@@ -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>

View File

@@ -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"}

View File

@@ -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"/>

View File

@@ -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"}

View File

@@ -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":""}}

View File

@@ -1,3 +1,41 @@
# [1.4.13]
### 修复
* 移除包内嵌的 EDM4U 1.2.177,避免消费项目启动导入阶段重复初始化 Google Version Handler 并写入 `ProjectSettings/GvhProjectSettings.xml`
* 保留 `Dependencies.xml` 依赖声明,由宿主项目统一安装和管理 EDM4U 版本。
# [1.4.12]
### 修复
* Android 构建后处理在 launcher `application` 已存在 `android:appComponentFactory` 时,同步合并 `tools:replace="android:appComponentFactory"`,避免 TapTap AndroidX manifest merger 冲突。
# [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]
### 修复

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 90c597385ff9346a89d38256315fb735
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 773d3f2446f5440bb892ec25e114d547
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 9ee3e98fba8c1468bbdf8cfa0803a7d8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,36 +0,0 @@
fileFormatVersion: 2
guid: 5552c54c11d94016bcfe740f27df44a6
labels:
- gvh
- gvh_version-1.2.177
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.177/Google.IOSResolver.dll
- gvhp_targets-editor
timeCreated: 1480838400
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,36 +0,0 @@
fileFormatVersion: 2
guid: 1f4f113972f04c3695341dfb3ba48d3b
labels:
- gvh
- gvh_version-1.2.177
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.177/Google.JarResolver.dll
- gvhp_targets-editor
timeCreated: 1480838400
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,36 +0,0 @@
fileFormatVersion: 2
guid: 413ed4abd14645c38ebbd8c5ff26e9de
labels:
- gvh
- gvh_version-1.2.177
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.177/Google.PackageManagerResolver.dll
- gvhp_targets-editor
timeCreated: 1480838400
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,36 +0,0 @@
fileFormatVersion: 2
guid: 38d0b40a7b2d44c6a6a2362599bfc41e
labels:
- gvh
- gvh_version-1.2.177
- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.177/Google.VersionHandlerImpl.dll
- gvhp_targets-editor
timeCreated: 1480838400
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,36 +0,0 @@
fileFormatVersion: 2
guid: 86460262ea60447dbb6a62d21167790f
labels:
- gvh
- gvh_version-1.2.177
- gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.dll
- gvhp_targets-editor
timeCreated: 1480838400
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,13 +0,0 @@
Assets/ExternalDependencyManager/Editor/1.2.177/Google.IOSResolver.dll
Assets/ExternalDependencyManager/Editor/1.2.177/Google.IOSResolver.dll.mdb
Assets/ExternalDependencyManager/Editor/1.2.177/Google.JarResolver.dll
Assets/ExternalDependencyManager/Editor/1.2.177/Google.JarResolver.dll.mdb
Assets/ExternalDependencyManager/Editor/1.2.177/Google.PackageManagerResolver.dll
Assets/ExternalDependencyManager/Editor/1.2.177/Google.PackageManagerResolver.dll.mdb
Assets/ExternalDependencyManager/Editor/1.2.177/Google.VersionHandlerImpl.dll
Assets/ExternalDependencyManager/Editor/1.2.177/Google.VersionHandlerImpl.dll.mdb
Assets/ExternalDependencyManager/Editor/CHANGELOG.md
Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll
Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb
Assets/ExternalDependencyManager/Editor/LICENSE
Assets/ExternalDependencyManager/Editor/README.md

View File

@@ -1,15 +0,0 @@
fileFormatVersion: 2
guid: 2764c5ea3b354f3cb7ca80028fd08da2
labels:
- gvh
- gvh_manifest
- gvh_version-1.2.177
- gvhp_exportpath-ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.177_manifest.txt
- gvhp_manifestname-0External Dependency Manager
- gvhp_manifestname-play-services-resolver
timeCreated: 1474401009
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -121,7 +121,7 @@ namespace Topon_Adapter.Editor
elementlauncherApplication.Add (CreateCSJGromore ());
SetOrAddAttribute (elementlauncherApplication, AndroidNamespace + "allowBackup", "false");
SetOrAddAttribute (elementlauncherApplication, ToolsNamespace + "replace", "android:allowBackup");
MergeToolsReplaceAttribute (elementlauncherApplication, GetLauncherApplicationReplaceValues (elementlauncherApplication));
var elementMainManifest = manifest.Element ("manifest");
var elementMainApplication = elementMainManifest.Element ("application");
@@ -263,6 +263,41 @@ namespace Topon_Adapter.Editor
attribute.SetValue (value);
}
private static string[] GetLauncherApplicationReplaceValues (XElement element)
{
List<string> replaceValues = new List<string> { "android:allowBackup" };
if (element.Attribute (AndroidNamespace + "appComponentFactory") != null)
{
replaceValues.Add ("android:appComponentFactory");
}
return replaceValues.ToArray ();
}
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; }
}
}

View File

@@ -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

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 97e92d5544ec4fc9adf7571f9f4ea241
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c488fb4879e14f5cb366ce084ff2b748
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 33e31dbdc20d47a78340d49f58d81ef9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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)

View File

@@ -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()

View File

@@ -2,7 +2,7 @@
"name": "com.commercialization.topon",
"displayName": "Commercialization.topon",
"description": "基于topon的广告sdk封装依赖基础商业化模块",
"version": "1.4.8",
"version": "1.4.13",
"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"
]