update 1.1.25

This commit is contained in:
2024-03-12 02:17:14 +08:00
parent 93501423d7
commit d0a6ab116e
346 changed files with 1902 additions and 4759 deletions

View File

@@ -1,48 +0,0 @@
using System;
using UnityEditor;
using UnityEngine;
using AnyThink.Scripts.IntegrationManager.Editor;
[InitializeOnLoad]
public class ATAssetPostprocessor : AssetPostprocessor
{
private static readonly string TAG = "ATAssetPostprocessor";
static ATAssetPostprocessor()
{
log("ATAssetPostprocessor is now initialized!");
}
void OnPostprocessAsset(string path)
{
log("OnPostprocessAsset() >>> path: " + path + " assetPath: " + assetPath);
}
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
foreach (string str in importedAssets)
{
log("imported Asset: " + str);
}
foreach (string str in deletedAssets)
{
log("Deleted Asset: " + str);
}
for (int i = 0; i < movedAssets.Length; i++)
{
log("Moved Asset: " + movedAssets[i] + " from: " + movedFromAssetPaths[i]);
}
}
void OnPreprocessAsset()
{
log("OnPreprocessAsset() >>> called assetPath: " + assetPath);
}
private static void log(string msg)
{
#if AnyThinkSDKEditor
ATLog.log(TAG, msg);
#endif
}
}

View File

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

View File

@@ -20,7 +20,6 @@ namespace AnyThink.Scripts.Editor
private static string PropertyDexingArtifactTransform = "android.enableDexingArtifactTransform";
private static string DisableProperty = "=false";
private static string KeyMetaDataAppLovinVerboseLoggingOn = "applovin.sdk.verbose_logging";
private static string KeyMetaDataGoogleApplicationId = "com.google.android.gms.ads.APPLICATION_ID";
private static string KeyMetaDataGoogleAdManagerApp = "com.google.android.gms.ads.AD_MANAGER_APP";
@@ -73,7 +72,7 @@ namespace AnyThink.Scripts.Editor
//如果是国内则根据选择来决定是否用AndroidX
if (isChina)
{
if (!ATPluginSetting.Instance.EnableAndroidX) {
if (!ATConfig.enableAndroidX()) {
EnableProperty = "=false";
} else {
EnableProperty = "=true";
@@ -145,14 +144,15 @@ namespace AnyThink.Scripts.Editor
private static void addGoogleApplicationIdIfNeeded(XElement elementApplication, IEnumerable<XElement> metaDataElements)
{
var googleApplicationIdMetaData = GetElementByName(metaDataElements, KeyMetaDataGoogleApplicationId);
if (!ATConfig.isAndroidNetworkInstalled("Admob", ATConfig.NONCHINA_COUNTRY))
if (!ATConfig.isNetworkInstalledByName("Admob", ATConfig.OS_ANDROID))
{
ATLog.log("addGoogleApplicationIdIfNeeded() >>> Admob not install.");
if (googleApplicationIdMetaData != null) googleApplicationIdMetaData.Remove();
return;
}
var appId = ATPluginSetting.Instance.AdMobAndroidAppId;
var appId = ATConfig.getAdmobAppIdByOs(ATConfig.OS_ANDROID);
// Log error if the App ID is not set.
if (string.IsNullOrEmpty(appId) || !appId.StartsWith("ca-app-pub-"))
{

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a62affbda13454692bd833665283012b
guid: be367c330856340a4a9626db43b8917b
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -48,7 +48,7 @@ namespace AnyThink.Scripts.Editor
dynamicLibraryPathsToEmbed.Add(Path.Combine("Pods/", "BigoADS/BigoADS/BigoADS.xcframework"));
dynamicLibraryPathsToEmbed.Add(Path.Combine("Pods/", "BigoADS/BigoADS/OMSDK_Bigosg.xcframework"));
dynamicLibraryPathsToEmbed.Add(Path.Combine("Pods/", "HyBid/PubnativeLite/PubnativeLite/OMSDK-1.3.29/OMSDK_Pubnativenet.xcframework"));
dynamicLibraryPathsToEmbed.Add(Path.Combine("Pods/", "Fyber_Marketplace_SDK/IASDKCore/IASDKCore.xcframework"));
return dynamicLibraryPathsToEmbed;
@@ -164,13 +164,13 @@ namespace AnyThink.Scripts.Editor
private static void AddGoogleApplicationIdIfNeeded(PlistDocument plist)
{
if (!ATConfig.isIOSNetworkInstalled("Admob", ATConfig.NONCHINA_COUNTRY))
if (!ATConfig.isNetworkInstalledByName("Admob", ATConfig.OS_IOS))
{
ATLog.log("addGoogleApplicationIdIfNeeded() >>> Admob not install.");
return;
}
var appId = ATPluginSetting.Instance.AdMobIosAppId;
//获取admob app id
var appId = ATConfig.getAdmobAppIdByOs(ATConfig.OS_IOS);
if (string.IsNullOrEmpty(appId) || !appId.StartsWith("ca-app-pub-"))
{

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: db5ce930061584ac383e17723a51940c
guid: 2e2b9e45df1464e4ca34d6674718bb2a
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -8,6 +8,10 @@ using System.Xml.Linq;
using UnityEditor;
using UnityEditor.Android;
using System.Text.RegularExpressions;
using System.Diagnostics;
using UnityEngine;
using System.Text;
namespace AnyThink.Scripts.Editor
{
@@ -35,7 +39,9 @@ namespace AnyThink.Scripts.Editor
// replaceAppBuildPluginVersion(path);
#endif
// replaceAppBuildPluginVersion(path);
// handleNetworksConfit(path);
handleNetworksConfit(path);
// handleNetworkResMerge(path);
// callGradleTask(path);
}
//修改项目的根目录下的build.gradle文件的插件版本号
private static void replaceBuildPluginVersion(string buildGradlePath)
@@ -242,10 +248,10 @@ namespace AnyThink.Scripts.Editor
{
lines.Insert(androidStartIndex + 1, " packagingOptions {\n merge 'META-INF/com.android.tools/proguard/coroutines.pro'\n exclude 'META-INF/*.kotlin_module'\n }");
}
if (!isConfigAll)
{
lines.Insert(androidStartIndex -1, "configurations.all {\n resolutionStrategy {\n force 'androidx.core:core:1.6.0'\n force 'androidx.recyclerview:recyclerview:1.1.0' \n }\n}");
}
// if (!isConfigAll)
// {
// lines.Insert(androidStartIndex -1, "configurations.all {\n resolutionStrategy {\n force 'androidx.core:core:1.6.0'\n force 'androidx.recyclerview:recyclerview:1.1.0' \n }\n}");
// }
}
// configurations.all {
// resolutionStrategy {
@@ -265,6 +271,84 @@ namespace AnyThink.Scripts.Editor
}
}
}
private static void handleNetworkResMerge(string path) {
ATLog.log("handleNetworkResMerge() >>> path: " + path);
#if UNITY_2019_3_OR_NEWER
var buildGradlePath = Path.Combine(path, "../launcher/build.gradle");
#else
var buildGradlePath = Path.Combine(path, "launcher/build.gradle");
#endif
List<string> lines = new List<string>();
bool isAdded = false;
using (StreamReader reader = new StreamReader(buildGradlePath))
{
string line;
while ((line = reader.ReadLine()) != null)
{
if (line.Contains("task handleNetworkResMerge")) {
isAdded = true;
}
lines.Add(line);
}
}
if (isAdded) {
return;
}
using (StreamReader reader = new StreamReader("Assets/AnyThinkPlugin/Script/Editor/network_res_handle.gradle"))
{
string line;
while ((line = reader.ReadLine()) != null)
{
lines.Add(line);
}
}
using (StreamWriter writer = new StreamWriter(buildGradlePath))
{
foreach (string line in lines)
{
writer.WriteLine(line);
}
}
}
private static void callGradleTask(string path) {
// 设置你想要启动的Gradle任务
string gradleTask = "handleNetworkResMerge"; // 例如: assembleDebug or assembleRelease
// 开始一个新的进程来执行Gradle任务
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = Application.platform == RuntimePlatform.WindowsEditor ? "cmd" : "bash";
psi.Arguments = Application.platform == RuntimePlatform.WindowsEditor ?
$"/c gradlew {gradleTask}" : // Windows cmd命令
$"-c './gradlew {gradleTask}'"; // UNIX bash命令
psi.UseShellExecute = false;
psi.StandardOutputEncoding = Encoding.UTF8;
psi.StandardErrorEncoding = Encoding.UTF8;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.CreateNoWindow = true;
psi.WorkingDirectory = "/Users/quinx/Desktop/workspace_topon/sdk_source/a_unity_demo/TestAnyThinkUnityPlugin/Library/Bee/Android/Prj/Mono2x/Gradle"; // 这里应该是你的Android项目路径
ATLog.log("callGradleTask() >>> path: " + path);
using (var process = Process.Start(psi))
{
// 读取输出信息
while (!process.StandardOutput.EndOfStream)
{
var line = process.StandardOutput.ReadLine();
UnityEngine.Debug.Log(line);
}
// 读取错误信息
while (!process.StandardError.EndOfStream)
{
var line = process.StandardError.ReadLine();
UnityEngine.Debug.LogError(line);
}
}
}
}
}
#endif

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d626fd92437ac43b0ab872491daa1322
guid: 311da97c47b0c4a21a96c7f310f9d8ad
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 24e73b2b839c146639f94882952d2e53
guid: fe7f15635ecfd4b0a9b59690ece5d0c6
AssemblyDefinitionImporter:
externalObjects: {}
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 05050f3d6dbb54149aea8c057ee0f776
guid: 9d4c4072cdc0f40c0b81bc2dc3d2dac2
TextScriptImporter:
externalObjects: {}
userData: