Skip to content

Commit

Permalink
feat:update upm
Browse files Browse the repository at this point in the history
  • Loading branch information
lc1006 committed Dec 23, 2024
0 parents commit 8c27b4e
Show file tree
Hide file tree
Showing 323 changed files with 18,845 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Editor/BuildTargetUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using UnityEditor;

namespace TapSDK.Core.Editor {
public static class BuildTargetUtils {
public static bool IsSupportMobile(BuildTarget platform) {
return platform == BuildTarget.iOS || platform == BuildTarget.Android;
}

public static bool IsSupportStandalone(BuildTarget platform) {
return platform == BuildTarget.StandaloneOSX ||
platform == BuildTarget.StandaloneWindows || platform == BuildTarget.StandaloneWindows64;
}
}
}
11 changes: 11 additions & 0 deletions Editor/BuildTargetUtils.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions Editor/LinkXMLGenerator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System.Collections.Generic;
using System.IO;
using System.Xml;
using UnityEngine;
using UnityEditor;

namespace TapSDK.Core.Editor {
public class LinkedAssembly {
public string Fullname { get; set; }
public string[] Types { get; set; }
}

public class LinkXMLGenerator {
public static void Generate(string path, IEnumerable<LinkedAssembly> assemblies) {
DirectoryInfo parent = Directory.GetParent(path);
if (!parent.Exists) {
Directory.CreateDirectory(parent.FullName);
}

XmlDocument doc = new XmlDocument();

XmlNode rootNode = doc.CreateElement("linker");
doc.AppendChild(rootNode);

foreach (LinkedAssembly assembly in assemblies) {
XmlNode assemblyNode = doc.CreateElement("assembly");

XmlAttribute fullnameAttr = doc.CreateAttribute("fullname");
fullnameAttr.Value = assembly.Fullname;
assemblyNode.Attributes.Append(fullnameAttr);

if (assembly.Types?.Length > 0) {
foreach (string type in assembly.Types) {
XmlNode typeNode = doc.CreateElement("type");
XmlAttribute typeFullnameAttr = doc.CreateAttribute("fullname");
typeFullnameAttr.Value = type;
typeNode.Attributes.Append(typeFullnameAttr);

XmlAttribute typePreserveAttr = doc.CreateAttribute("preserve");
typePreserveAttr.Value = "all";
typeNode.Attributes.Append(typePreserveAttr);

assemblyNode.AppendChild(typeNode);
}
} else {
XmlAttribute preserveAttr = doc.CreateAttribute("preserve");
preserveAttr.Value = "all";
assemblyNode.Attributes.Append(preserveAttr);
}

rootNode.AppendChild(assemblyNode);
}

doc.Save(path);
AssetDatabase.Refresh();

Debug.Log($"Generate {path} done.");
Debug.Log(doc.OuterXml);
}

public static void Delete(string path) {
if (File.Exists(path)) {
File.Delete(path);
AssetDatabase.Refresh();
}

Debug.Log($"Delete {path} done.");
}
}
}
11 changes: 11 additions & 0 deletions Editor/LinkXMLGenerator.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8c27b4e

Please sign in to comment.