This commit is contained in:
2023-11-07 18:54:01 +08:00
parent 5a24a3292c
commit 120d3315fc
3 changed files with 82 additions and 43 deletions

View File

@@ -22,7 +22,7 @@ MonoBehaviour:
PluginFileName: AnyThinkCore.unitypackage
PluginFilePaths: []
LatestVersions:
Unity: 2.0.1
Unity: 2.0.2
Android: 6.2.72
Ios: 6.2.68
CurrentVersions:

View File

@@ -1,5 +1,7 @@
#if UNITY_ANDROID
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using UnityEngine;
using UnityEditor;
@@ -59,14 +61,36 @@ namespace Topon_Adapter.Editor
}
var queries = CreateQueries ();
var xManifestElements = elementManifest.Descendants ();
var xApplicationElements = elementApplication.Descendants ();
var useQueries = xManifestElements.Where (element => element.Name.LocalName.Equals ("package"));
XElement tencentElement = GetElementByName (useQueries, "com.tencent.mm");
if (tencentElement == null)
{
elementManifest.Add (queries);
}
var wxElements = xApplicationElements.Where (element => element.Name.LocalName.Equals ("activity"));
XElement wxElement = GetElementByName (wxElements, ".wxapi.WXEntryActivity");
if (wxElement != null)
{
wxElement.Remove ();
}
elementApplication.Add (CreateActivityXML ());
var elementlauncherManifest = launcherManifest.Element ("manifest");
var elementlauncherApplication = elementlauncherManifest.Element ("application");
var csjElements = elementlauncherApplication.Descendants ().Where (element => element.Name.LocalName.Equals ("provider"));
XElement csjElement = GetElementByName (csjElements, "com.bytedance.sdk.openadsdk.TTFileProvider");
if (csjElement == null)
{
//增加穿山甲配置
elementlauncherApplication.Add (CreateCSJGromore ());
}
// Save the updated manifest file.
manifest.Save (manifestPath);
@@ -78,7 +102,6 @@ namespace Topon_Adapter.Editor
/// </summary>
public static XElement CreateActivityXML ()
{
var metaData = new XElement ("activity");
metaData.Add (new XAttribute (AndroidNamespace + "name", ".wxapi.WXEntryActivity"));
metaData.Add (new XAttribute (AndroidNamespace + "label", "@string/app_name"));
@@ -98,6 +121,22 @@ namespace Topon_Adapter.Editor
return metaData;
}
private static XElement GetElementByName (IEnumerable<XElement> elements, string name)
{
foreach (var element in elements)
{
var attributes = element.Attributes ();
if (attributes.Any (attribute => attribute.Name.Namespace.Equals (AndroidNamespace)
&& attribute.Name.LocalName.Equals ("name")
&& attribute.Value.Equals (name)))
{
return element;
}
}
return null;
}
public static XElement CreateCSJGromore ()
{

View File

@@ -2,7 +2,7 @@
"name": "com.commercialization.topon",
"displayName": "Commercialization.topon",
"description": "基于topon的广告sdk封装依赖基础商业化模块",
"version": "1.0.16",
"version": "1.0.17",
"unity": "2021.1",
"license": "MIT",
"repository": {