update
This commit is contained in:
14
Assets/TapSDK/Core/Editor/BuildTargetUtils.cs
Normal file
14
Assets/TapSDK/Core/Editor/BuildTargetUtils.cs
Normal file
@@ -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
Assets/TapSDK/Core/Editor/BuildTargetUtils.cs.meta
Normal file
11
Assets/TapSDK/Core/Editor/BuildTargetUtils.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9416fb163ae0c4cbb8d52caa63978b2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
70
Assets/TapSDK/Core/Editor/LinkXMLGenerator.cs
Normal file
70
Assets/TapSDK/Core/Editor/LinkXMLGenerator.cs
Normal file
@@ -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
Assets/TapSDK/Core/Editor/LinkXMLGenerator.cs.meta
Normal file
11
Assets/TapSDK/Core/Editor/LinkXMLGenerator.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ded83e14866c44fe0912befabd966846
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
954
Assets/TapSDK/Core/Editor/Plist.cs
Normal file
954
Assets/TapSDK/Core/Editor/Plist.cs
Normal file
@@ -0,0 +1,954 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace TapSDK.Core.Editor
|
||||
{
|
||||
public static class Plist
|
||||
{
|
||||
private static List<int> offsetTable = new List<int>();
|
||||
private static List<byte> objectTable = new List<byte>();
|
||||
private static int refCount;
|
||||
private static int objRefSize;
|
||||
private static int offsetByteSize;
|
||||
private static long offsetTableOffset;
|
||||
|
||||
#region Public Functions
|
||||
|
||||
public static object readPlist(string path)
|
||||
{
|
||||
using (FileStream f = new FileStream(path, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
return readPlist(f, plistType.Auto);
|
||||
}
|
||||
}
|
||||
|
||||
public static object readPlistSource(string source)
|
||||
{
|
||||
return readPlist(System.Text.Encoding.UTF8.GetBytes(source));
|
||||
}
|
||||
|
||||
public static object readPlist(byte[] data)
|
||||
{
|
||||
return readPlist(new MemoryStream(data), plistType.Auto);
|
||||
}
|
||||
|
||||
public static plistType getPlistType(Stream stream)
|
||||
{
|
||||
byte[] magicHeader = new byte[8];
|
||||
stream.Read(magicHeader, 0, 8);
|
||||
|
||||
if (BitConverter.ToInt64(magicHeader, 0) == 3472403351741427810)
|
||||
{
|
||||
return plistType.Binary;
|
||||
}
|
||||
else
|
||||
{
|
||||
return plistType.Xml;
|
||||
}
|
||||
}
|
||||
|
||||
public static object readPlist(Stream stream, plistType type)
|
||||
{
|
||||
if (type == plistType.Auto)
|
||||
{
|
||||
type = getPlistType(stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
if (type == plistType.Binary)
|
||||
{
|
||||
using (BinaryReader reader = new BinaryReader(stream))
|
||||
{
|
||||
byte[] data = reader.ReadBytes((int) reader.BaseStream.Length);
|
||||
return readBinary(data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlDocument xml = new XmlDocument();
|
||||
xml.XmlResolver = null;
|
||||
xml.Load(stream);
|
||||
return readXml(xml);
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeXml(object value, string path)
|
||||
{
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(writeXml(value));
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeXml(object value, Stream stream)
|
||||
{
|
||||
using (StreamWriter writer = new StreamWriter(stream))
|
||||
{
|
||||
writer.Write(writeXml(value));
|
||||
}
|
||||
}
|
||||
|
||||
public static string writeXml(object value)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
XmlWriterSettings xmlWriterSettings = new XmlWriterSettings();
|
||||
xmlWriterSettings.Encoding = new System.Text.UTF8Encoding(false);
|
||||
xmlWriterSettings.ConformanceLevel = ConformanceLevel.Document;
|
||||
xmlWriterSettings.Indent = true;
|
||||
|
||||
using (XmlWriter xmlWriter = XmlWriter.Create(ms, xmlWriterSettings))
|
||||
{
|
||||
xmlWriter.WriteStartDocument();
|
||||
//xmlWriter.WriteComment("DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" " + "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"");
|
||||
xmlWriter.WriteDocType("plist", "-//Apple Computer//DTD PLIST 1.0//EN",
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
|
||||
xmlWriter.WriteStartElement("plist");
|
||||
xmlWriter.WriteAttributeString("version", "1.0");
|
||||
compose(value, xmlWriter);
|
||||
xmlWriter.WriteEndElement();
|
||||
xmlWriter.WriteEndDocument();
|
||||
xmlWriter.Flush();
|
||||
xmlWriter.Close();
|
||||
return System.Text.Encoding.UTF8.GetString(ms.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeBinary(object value, string path)
|
||||
{
|
||||
using (BinaryWriter writer = new BinaryWriter(new FileStream(path, FileMode.Create)))
|
||||
{
|
||||
writer.Write(writeBinary(value));
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeBinary(object value, Stream stream)
|
||||
{
|
||||
using (BinaryWriter writer = new BinaryWriter(stream))
|
||||
{
|
||||
writer.Write(writeBinary(value));
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] writeBinary(object value)
|
||||
{
|
||||
offsetTable.Clear();
|
||||
objectTable.Clear();
|
||||
refCount = 0;
|
||||
objRefSize = 0;
|
||||
offsetByteSize = 0;
|
||||
offsetTableOffset = 0;
|
||||
|
||||
//Do not count the root node, subtract by 1
|
||||
int totalRefs = countObject(value) - 1;
|
||||
|
||||
refCount = totalRefs;
|
||||
|
||||
objRefSize = RegulateNullBytes(BitConverter.GetBytes(refCount)).Length;
|
||||
|
||||
composeBinary(value);
|
||||
|
||||
writeBinaryString("bplist00", false);
|
||||
|
||||
offsetTableOffset = (long) objectTable.Count;
|
||||
|
||||
offsetTable.Add(objectTable.Count - 8);
|
||||
|
||||
offsetByteSize = RegulateNullBytes(BitConverter.GetBytes(offsetTable[offsetTable.Count - 1])).Length;
|
||||
|
||||
List<byte> offsetBytes = new List<byte>();
|
||||
|
||||
offsetTable.Reverse();
|
||||
|
||||
for (int i = 0; i < offsetTable.Count; i++)
|
||||
{
|
||||
offsetTable[i] = objectTable.Count - offsetTable[i];
|
||||
byte[] buffer = RegulateNullBytes(BitConverter.GetBytes(offsetTable[i]), offsetByteSize);
|
||||
Array.Reverse(buffer);
|
||||
offsetBytes.AddRange(buffer);
|
||||
}
|
||||
|
||||
objectTable.AddRange(offsetBytes);
|
||||
|
||||
objectTable.AddRange(new byte[6]);
|
||||
objectTable.Add(Convert.ToByte(offsetByteSize));
|
||||
objectTable.Add(Convert.ToByte(objRefSize));
|
||||
|
||||
var a = BitConverter.GetBytes((long) totalRefs + 1);
|
||||
Array.Reverse(a);
|
||||
objectTable.AddRange(a);
|
||||
|
||||
objectTable.AddRange(BitConverter.GetBytes((long) 0));
|
||||
a = BitConverter.GetBytes(offsetTableOffset);
|
||||
Array.Reverse(a);
|
||||
objectTable.AddRange(a);
|
||||
|
||||
return objectTable.ToArray();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Functions
|
||||
|
||||
private static object readXml(XmlDocument xml)
|
||||
{
|
||||
XmlNode rootNode = xml.DocumentElement.ChildNodes[0];
|
||||
return parse(rootNode);
|
||||
}
|
||||
|
||||
private static object readBinary(byte[] data)
|
||||
{
|
||||
offsetTable.Clear();
|
||||
List<byte> offsetTableBytes = new List<byte>();
|
||||
objectTable.Clear();
|
||||
refCount = 0;
|
||||
objRefSize = 0;
|
||||
offsetByteSize = 0;
|
||||
offsetTableOffset = 0;
|
||||
|
||||
List<byte> bList = new List<byte>(data);
|
||||
|
||||
List<byte> trailer = bList.GetRange(bList.Count - 32, 32);
|
||||
|
||||
parseTrailer(trailer);
|
||||
|
||||
objectTable = bList.GetRange(0, (int) offsetTableOffset);
|
||||
|
||||
offsetTableBytes = bList.GetRange((int) offsetTableOffset, bList.Count - (int) offsetTableOffset - 32);
|
||||
|
||||
parseOffsetTable(offsetTableBytes);
|
||||
|
||||
return parseBinary(0);
|
||||
}
|
||||
|
||||
private static Dictionary<string, object> parseDictionary(XmlNode node)
|
||||
{
|
||||
XmlNodeList children = node.ChildNodes;
|
||||
if (children.Count % 2 != 0)
|
||||
{
|
||||
throw new DataMisalignedException("Dictionary elements must have an even number of child nodes");
|
||||
}
|
||||
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
for (int i = 0; i < children.Count; i += 2)
|
||||
{
|
||||
XmlNode keynode = children[i];
|
||||
XmlNode valnode = children[i + 1];
|
||||
|
||||
if (keynode.Name != "key")
|
||||
{
|
||||
throw new ApplicationException("expected a key node");
|
||||
}
|
||||
|
||||
object result = parse(valnode);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
dict.Add(keynode.InnerText, result);
|
||||
}
|
||||
}
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
private static List<object> parseArray(XmlNode node)
|
||||
{
|
||||
List<object> array = new List<object>();
|
||||
|
||||
foreach (XmlNode child in node.ChildNodes)
|
||||
{
|
||||
object result = parse(child);
|
||||
if (result != null)
|
||||
{
|
||||
array.Add(result);
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
private static void composeArray(List<object> value, XmlWriter writer)
|
||||
{
|
||||
writer.WriteStartElement("array");
|
||||
foreach (object obj in value)
|
||||
{
|
||||
compose(obj, writer);
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
private static object parse(XmlNode node)
|
||||
{
|
||||
switch (node.Name)
|
||||
{
|
||||
case "dict":
|
||||
return parseDictionary(node);
|
||||
case "array":
|
||||
return parseArray(node);
|
||||
case "string":
|
||||
return node.InnerText;
|
||||
case "integer":
|
||||
// int result;
|
||||
//int.TryParse(node.InnerText, System.Globalization.NumberFormatInfo.InvariantInfo, out result);
|
||||
return Convert.ToInt32(node.InnerText, System.Globalization.NumberFormatInfo.InvariantInfo);
|
||||
case "real":
|
||||
return Convert.ToDouble(node.InnerText, System.Globalization.NumberFormatInfo.InvariantInfo);
|
||||
case "false":
|
||||
return false;
|
||||
case "true":
|
||||
return true;
|
||||
case "null":
|
||||
return null;
|
||||
case "date":
|
||||
return XmlConvert.ToDateTime(node.InnerText, XmlDateTimeSerializationMode.Utc);
|
||||
case "data":
|
||||
return Convert.FromBase64String(node.InnerText);
|
||||
}
|
||||
|
||||
throw new ApplicationException(String.Format("Plist Node `{0}' is not supported", node.Name));
|
||||
}
|
||||
|
||||
private static void compose(object value, XmlWriter writer)
|
||||
{
|
||||
if (value == null || value is string)
|
||||
{
|
||||
writer.WriteElementString("string", value as string);
|
||||
}
|
||||
else if (value is int || value is long)
|
||||
{
|
||||
writer.WriteElementString("integer",
|
||||
((int) value).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
|
||||
}
|
||||
else if (value is System.Collections.Generic.Dictionary<string, object> ||
|
||||
value.GetType().ToString().StartsWith("System.Collections.Generic.Dictionary`2[System.String"))
|
||||
{
|
||||
//Convert to Dictionary<string, object>
|
||||
Dictionary<string, object> dic = value as Dictionary<string, object>;
|
||||
if (dic == null)
|
||||
{
|
||||
dic = new Dictionary<string, object>();
|
||||
IDictionary idic = (IDictionary) value;
|
||||
foreach (var key in idic.Keys)
|
||||
{
|
||||
dic.Add(key.ToString(), idic[key]);
|
||||
}
|
||||
}
|
||||
|
||||
writeDictionaryValues(dic, writer);
|
||||
}
|
||||
else if (value is List<object>)
|
||||
{
|
||||
composeArray((List<object>) value, writer);
|
||||
}
|
||||
else if (value is byte[])
|
||||
{
|
||||
writer.WriteElementString("data", Convert.ToBase64String((Byte[]) value));
|
||||
}
|
||||
else if (value is float || value is double)
|
||||
{
|
||||
writer.WriteElementString("real",
|
||||
((double) value).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
|
||||
}
|
||||
else if (value is DateTime)
|
||||
{
|
||||
DateTime time = (DateTime) value;
|
||||
string theString = XmlConvert.ToString(time, XmlDateTimeSerializationMode.Utc);
|
||||
writer.WriteElementString("date", theString); //, "yyyy-MM-ddTHH:mm:ssZ"));
|
||||
}
|
||||
else if (value is bool)
|
||||
{
|
||||
writer.WriteElementString(value.ToString().ToLower(), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(String.Format("Value type '{0}' is unhandled", value.GetType().ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeDictionaryValues(Dictionary<string, object> dictionary, XmlWriter writer)
|
||||
{
|
||||
writer.WriteStartElement("dict");
|
||||
foreach (string key in dictionary.Keys)
|
||||
{
|
||||
object value = dictionary[key];
|
||||
writer.WriteElementString("key", key);
|
||||
compose(value, writer);
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
private static int countObject(object value)
|
||||
{
|
||||
int count = 0;
|
||||
switch (value.GetType().ToString())
|
||||
{
|
||||
case "System.Collections.Generic.Dictionary`2[System.String,System.Object]":
|
||||
Dictionary<string, object> dict = (Dictionary<string, object>) value;
|
||||
foreach (string key in dict.Keys)
|
||||
{
|
||||
count += countObject(dict[key]);
|
||||
}
|
||||
|
||||
count += dict.Keys.Count;
|
||||
count++;
|
||||
break;
|
||||
case "System.Collections.Generic.List`1[System.Object]":
|
||||
List<object> list = (List<object>) value;
|
||||
foreach (object obj in list)
|
||||
{
|
||||
count += countObject(obj);
|
||||
}
|
||||
|
||||
count++;
|
||||
break;
|
||||
default:
|
||||
count++;
|
||||
break;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
private static byte[] writeBinaryDictionary(Dictionary<string, object> dictionary)
|
||||
{
|
||||
List<byte> buffer = new List<byte>();
|
||||
List<byte> header = new List<byte>();
|
||||
List<int> refs = new List<int>();
|
||||
for (int i = dictionary.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var o = new object[dictionary.Count];
|
||||
dictionary.Values.CopyTo(o, 0);
|
||||
composeBinary(o[i]);
|
||||
offsetTable.Add(objectTable.Count);
|
||||
refs.Add(refCount);
|
||||
refCount--;
|
||||
}
|
||||
|
||||
for (int i = dictionary.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var o = new string[dictionary.Count];
|
||||
dictionary.Keys.CopyTo(o, 0);
|
||||
composeBinary(o[i]); //);
|
||||
offsetTable.Add(objectTable.Count);
|
||||
refs.Add(refCount);
|
||||
refCount--;
|
||||
}
|
||||
|
||||
if (dictionary.Count < 15)
|
||||
{
|
||||
header.Add(Convert.ToByte(0xD0 | Convert.ToByte(dictionary.Count)));
|
||||
}
|
||||
else
|
||||
{
|
||||
header.Add(0xD0 | 0xf);
|
||||
header.AddRange(writeBinaryInteger(dictionary.Count, false));
|
||||
}
|
||||
|
||||
|
||||
foreach (int val in refs)
|
||||
{
|
||||
byte[] refBuffer = RegulateNullBytes(BitConverter.GetBytes(val), objRefSize);
|
||||
Array.Reverse(refBuffer);
|
||||
buffer.InsertRange(0, refBuffer);
|
||||
}
|
||||
|
||||
buffer.InsertRange(0, header);
|
||||
|
||||
|
||||
objectTable.InsertRange(0, buffer);
|
||||
|
||||
return buffer.ToArray();
|
||||
}
|
||||
|
||||
private static byte[] composeBinaryArray(List<object> objects)
|
||||
{
|
||||
List<byte> buffer = new List<byte>();
|
||||
List<byte> header = new List<byte>();
|
||||
List<int> refs = new List<int>();
|
||||
|
||||
for (int i = objects.Count - 1; i >= 0; i--)
|
||||
{
|
||||
composeBinary(objects[i]);
|
||||
offsetTable.Add(objectTable.Count);
|
||||
refs.Add(refCount);
|
||||
refCount--;
|
||||
}
|
||||
|
||||
if (objects.Count < 15)
|
||||
{
|
||||
header.Add(Convert.ToByte(0xA0 | Convert.ToByte(objects.Count)));
|
||||
}
|
||||
else
|
||||
{
|
||||
header.Add(0xA0 | 0xf);
|
||||
header.AddRange(writeBinaryInteger(objects.Count, false));
|
||||
}
|
||||
|
||||
foreach (int val in refs)
|
||||
{
|
||||
byte[] refBuffer = RegulateNullBytes(BitConverter.GetBytes(val), objRefSize);
|
||||
Array.Reverse(refBuffer);
|
||||
buffer.InsertRange(0, refBuffer);
|
||||
}
|
||||
|
||||
buffer.InsertRange(0, header);
|
||||
|
||||
objectTable.InsertRange(0, buffer);
|
||||
|
||||
return buffer.ToArray();
|
||||
}
|
||||
|
||||
private static byte[] composeBinary(object obj)
|
||||
{
|
||||
byte[] value;
|
||||
switch (obj.GetType().ToString())
|
||||
{
|
||||
case "System.Collections.Generic.Dictionary`2[System.String,System.Object]":
|
||||
value = writeBinaryDictionary((Dictionary<string, object>) obj);
|
||||
return value;
|
||||
|
||||
case "System.Collections.Generic.List`1[System.Object]":
|
||||
value = composeBinaryArray((List<object>) obj);
|
||||
return value;
|
||||
|
||||
case "System.Byte[]":
|
||||
value = writeBinaryByteArray((byte[]) obj);
|
||||
return value;
|
||||
|
||||
case "System.Double":
|
||||
value = writeBinaryDouble((double) obj);
|
||||
return value;
|
||||
|
||||
case "System.Int32":
|
||||
value = writeBinaryInteger((int) obj, true);
|
||||
return value;
|
||||
|
||||
case "System.String":
|
||||
value = writeBinaryString((string) obj, true);
|
||||
return value;
|
||||
|
||||
case "System.DateTime":
|
||||
value = writeBinaryDate((DateTime) obj);
|
||||
return value;
|
||||
|
||||
case "System.Boolean":
|
||||
value = writeBinaryBool((bool) obj);
|
||||
return value;
|
||||
|
||||
default:
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] writeBinaryDate(DateTime obj)
|
||||
{
|
||||
List<byte> buffer =
|
||||
new List<byte>(RegulateNullBytes(BitConverter.GetBytes(PlistDateConverter.ConvertToAppleTimeStamp(obj)),
|
||||
8));
|
||||
buffer.Reverse();
|
||||
buffer.Insert(0, 0x33);
|
||||
objectTable.InsertRange(0, buffer);
|
||||
return buffer.ToArray();
|
||||
}
|
||||
|
||||
public static byte[] writeBinaryBool(bool obj)
|
||||
{
|
||||
List<byte> buffer = new List<byte>(new byte[1] {(bool) obj ? (byte) 9 : (byte) 8});
|
||||
objectTable.InsertRange(0, buffer);
|
||||
return buffer.ToArray();
|
||||
}
|
||||
|
||||
private static byte[] writeBinaryInteger(int value, bool write)
|
||||
{
|
||||
List<byte> buffer = new List<byte>(BitConverter.GetBytes((long) value));
|
||||
buffer = new List<byte>(RegulateNullBytes(buffer.ToArray()));
|
||||
while (buffer.Count != Math.Pow(2, Math.Log(buffer.Count) / Math.Log(2)))
|
||||
buffer.Add(0);
|
||||
int header = 0x10 | (int) (Math.Log(buffer.Count) / Math.Log(2));
|
||||
|
||||
buffer.Reverse();
|
||||
|
||||
buffer.Insert(0, Convert.ToByte(header));
|
||||
|
||||
if (write)
|
||||
objectTable.InsertRange(0, buffer);
|
||||
|
||||
return buffer.ToArray();
|
||||
}
|
||||
|
||||
private static byte[] writeBinaryDouble(double value)
|
||||
{
|
||||
List<byte> buffer = new List<byte>(RegulateNullBytes(BitConverter.GetBytes(value), 4));
|
||||
while (buffer.Count != Math.Pow(2, Math.Log(buffer.Count) / Math.Log(2)))
|
||||
buffer.Add(0);
|
||||
int header = 0x20 | (int) (Math.Log(buffer.Count) / Math.Log(2));
|
||||
|
||||
buffer.Reverse();
|
||||
|
||||
buffer.Insert(0, Convert.ToByte(header));
|
||||
|
||||
objectTable.InsertRange(0, buffer);
|
||||
|
||||
return buffer.ToArray();
|
||||
}
|
||||
|
||||
private static byte[] writeBinaryByteArray(byte[] value)
|
||||
{
|
||||
List<byte> buffer = new List<byte>(value);
|
||||
List<byte> header = new List<byte>();
|
||||
if (value.Length < 15)
|
||||
{
|
||||
header.Add(Convert.ToByte(0x40 | Convert.ToByte(value.Length)));
|
||||
}
|
||||
else
|
||||
{
|
||||
header.Add(0x40 | 0xf);
|
||||
header.AddRange(writeBinaryInteger(buffer.Count, false));
|
||||
}
|
||||
|
||||
buffer.InsertRange(0, header);
|
||||
|
||||
objectTable.InsertRange(0, buffer);
|
||||
|
||||
return buffer.ToArray();
|
||||
}
|
||||
|
||||
private static byte[] writeBinaryString(string value, bool head)
|
||||
{
|
||||
List<byte> buffer = new List<byte>();
|
||||
List<byte> header = new List<byte>();
|
||||
foreach (char chr in value.ToCharArray())
|
||||
buffer.Add(Convert.ToByte(chr));
|
||||
|
||||
if (head)
|
||||
{
|
||||
if (value.Length < 15)
|
||||
{
|
||||
header.Add(Convert.ToByte(0x50 | Convert.ToByte(value.Length)));
|
||||
}
|
||||
else
|
||||
{
|
||||
header.Add(0x50 | 0xf);
|
||||
header.AddRange(writeBinaryInteger(buffer.Count, false));
|
||||
}
|
||||
}
|
||||
|
||||
buffer.InsertRange(0, header);
|
||||
|
||||
objectTable.InsertRange(0, buffer);
|
||||
|
||||
return buffer.ToArray();
|
||||
}
|
||||
|
||||
private static byte[] RegulateNullBytes(byte[] value)
|
||||
{
|
||||
return RegulateNullBytes(value, 1);
|
||||
}
|
||||
|
||||
private static byte[] RegulateNullBytes(byte[] value, int minBytes)
|
||||
{
|
||||
Array.Reverse(value);
|
||||
List<byte> bytes = new List<byte>(value);
|
||||
for (int i = 0; i < bytes.Count; i++)
|
||||
{
|
||||
if (bytes[i] == 0 && bytes.Count > minBytes)
|
||||
{
|
||||
bytes.Remove(bytes[i]);
|
||||
i--;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (bytes.Count < minBytes)
|
||||
{
|
||||
int dist = minBytes - bytes.Count;
|
||||
for (int i = 0; i < dist; i++)
|
||||
bytes.Insert(0, 0);
|
||||
}
|
||||
|
||||
value = bytes.ToArray();
|
||||
Array.Reverse(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
private static void parseTrailer(List<byte> trailer)
|
||||
{
|
||||
offsetByteSize = BitConverter.ToInt32(RegulateNullBytes(trailer.GetRange(6, 1).ToArray(), 4), 0);
|
||||
objRefSize = BitConverter.ToInt32(RegulateNullBytes(trailer.GetRange(7, 1).ToArray(), 4), 0);
|
||||
byte[] refCountBytes = trailer.GetRange(12, 4).ToArray();
|
||||
Array.Reverse(refCountBytes);
|
||||
refCount = BitConverter.ToInt32(refCountBytes, 0);
|
||||
byte[] offsetTableOffsetBytes = trailer.GetRange(24, 8).ToArray();
|
||||
Array.Reverse(offsetTableOffsetBytes);
|
||||
offsetTableOffset = BitConverter.ToInt64(offsetTableOffsetBytes, 0);
|
||||
}
|
||||
|
||||
private static void parseOffsetTable(List<byte> offsetTableBytes)
|
||||
{
|
||||
for (int i = 0; i < offsetTableBytes.Count; i += offsetByteSize)
|
||||
{
|
||||
byte[] buffer = offsetTableBytes.GetRange(i, offsetByteSize).ToArray();
|
||||
Array.Reverse(buffer);
|
||||
offsetTable.Add(BitConverter.ToInt32(RegulateNullBytes(buffer, 4), 0));
|
||||
}
|
||||
}
|
||||
|
||||
private static object parseBinaryDictionary(int objRef)
|
||||
{
|
||||
Dictionary<string, object> buffer = new Dictionary<string, object>();
|
||||
List<int> refs = new List<int>();
|
||||
int refCount = 0;
|
||||
|
||||
int refStartPosition;
|
||||
refCount = getCount(offsetTable[objRef], out refStartPosition);
|
||||
|
||||
|
||||
if (refCount < 15)
|
||||
refStartPosition = offsetTable[objRef] + 1;
|
||||
else
|
||||
refStartPosition = offsetTable[objRef] + 2 +
|
||||
RegulateNullBytes(BitConverter.GetBytes(refCount), 1).Length;
|
||||
|
||||
for (int i = refStartPosition; i < refStartPosition + refCount * 2 * objRefSize; i += objRefSize)
|
||||
{
|
||||
byte[] refBuffer = objectTable.GetRange(i, objRefSize).ToArray();
|
||||
Array.Reverse(refBuffer);
|
||||
refs.Add(BitConverter.ToInt32(RegulateNullBytes(refBuffer, 4), 0));
|
||||
}
|
||||
|
||||
for (int i = 0; i < refCount; i++)
|
||||
{
|
||||
buffer.Add((string) parseBinary(refs[i]), parseBinary(refs[i + refCount]));
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private static object parseBinaryArray(int objRef)
|
||||
{
|
||||
List<object> buffer = new List<object>();
|
||||
List<int> refs = new List<int>();
|
||||
int refCount = 0;
|
||||
|
||||
int refStartPosition;
|
||||
refCount = getCount(offsetTable[objRef], out refStartPosition);
|
||||
|
||||
|
||||
if (refCount < 15)
|
||||
refStartPosition = offsetTable[objRef] + 1;
|
||||
else
|
||||
//The following integer has a header aswell so we increase the refStartPosition by two to account for that.
|
||||
refStartPosition = offsetTable[objRef] + 2 +
|
||||
RegulateNullBytes(BitConverter.GetBytes(refCount), 1).Length;
|
||||
|
||||
for (int i = refStartPosition; i < refStartPosition + refCount * objRefSize; i += objRefSize)
|
||||
{
|
||||
byte[] refBuffer = objectTable.GetRange(i, objRefSize).ToArray();
|
||||
Array.Reverse(refBuffer);
|
||||
refs.Add(BitConverter.ToInt32(RegulateNullBytes(refBuffer, 4), 0));
|
||||
}
|
||||
|
||||
for (int i = 0; i < refCount; i++)
|
||||
{
|
||||
buffer.Add(parseBinary(refs[i]));
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private static int getCount(int bytePosition, out int newBytePosition)
|
||||
{
|
||||
byte headerByte = objectTable[bytePosition];
|
||||
byte headerByteTrail = Convert.ToByte(headerByte & 0xf);
|
||||
int count;
|
||||
if (headerByteTrail < 15)
|
||||
{
|
||||
count = headerByteTrail;
|
||||
newBytePosition = bytePosition + 1;
|
||||
}
|
||||
else
|
||||
count = (int) parseBinaryInt(bytePosition + 1, out newBytePosition);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
private static object parseBinary(int objRef)
|
||||
{
|
||||
byte header = objectTable[offsetTable[objRef]];
|
||||
switch (header & 0xF0)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
//If the byte is
|
||||
//0 return null
|
||||
//9 return true
|
||||
//8 return false
|
||||
return (objectTable[offsetTable[objRef]] == 0)
|
||||
? (object) null
|
||||
: ((objectTable[offsetTable[objRef]] == 9) ? true : false);
|
||||
}
|
||||
case 0x10:
|
||||
{
|
||||
return parseBinaryInt(offsetTable[objRef]);
|
||||
}
|
||||
case 0x20:
|
||||
{
|
||||
return parseBinaryReal(offsetTable[objRef]);
|
||||
}
|
||||
case 0x30:
|
||||
{
|
||||
return parseBinaryDate(offsetTable[objRef]);
|
||||
}
|
||||
case 0x40:
|
||||
{
|
||||
return parseBinaryByteArray(offsetTable[objRef]);
|
||||
}
|
||||
case 0x50: //String ASCII
|
||||
{
|
||||
return parseBinaryAsciiString(offsetTable[objRef]);
|
||||
}
|
||||
case 0x60: //String Unicode
|
||||
{
|
||||
return parseBinaryUnicodeString(offsetTable[objRef]);
|
||||
}
|
||||
case 0xD0:
|
||||
{
|
||||
return parseBinaryDictionary(objRef);
|
||||
}
|
||||
case 0xA0:
|
||||
{
|
||||
return parseBinaryArray(objRef);
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception("This type is not supported");
|
||||
}
|
||||
|
||||
public static object parseBinaryDate(int headerPosition)
|
||||
{
|
||||
byte[] buffer = objectTable.GetRange(headerPosition + 1, 8).ToArray();
|
||||
Array.Reverse(buffer);
|
||||
double appleTime = BitConverter.ToDouble(buffer, 0);
|
||||
DateTime result = PlistDateConverter.ConvertFromAppleTimeStamp(appleTime);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static object parseBinaryInt(int headerPosition)
|
||||
{
|
||||
int output;
|
||||
return parseBinaryInt(headerPosition, out output);
|
||||
}
|
||||
|
||||
private static object parseBinaryInt(int headerPosition, out int newHeaderPosition)
|
||||
{
|
||||
byte header = objectTable[headerPosition];
|
||||
int byteCount = (int) Math.Pow(2, header & 0xf);
|
||||
byte[] buffer = objectTable.GetRange(headerPosition + 1, byteCount).ToArray();
|
||||
Array.Reverse(buffer);
|
||||
//Add one to account for the header byte
|
||||
newHeaderPosition = headerPosition + byteCount + 1;
|
||||
return BitConverter.ToInt32(RegulateNullBytes(buffer, 4), 0);
|
||||
}
|
||||
|
||||
private static object parseBinaryReal(int headerPosition)
|
||||
{
|
||||
byte header = objectTable[headerPosition];
|
||||
int byteCount = (int) Math.Pow(2, header & 0xf);
|
||||
byte[] buffer = objectTable.GetRange(headerPosition + 1, byteCount).ToArray();
|
||||
Array.Reverse(buffer);
|
||||
|
||||
return BitConverter.ToDouble(RegulateNullBytes(buffer, 8), 0);
|
||||
}
|
||||
|
||||
private static object parseBinaryAsciiString(int headerPosition)
|
||||
{
|
||||
int charStartPosition;
|
||||
int charCount = getCount(headerPosition, out charStartPosition);
|
||||
|
||||
var buffer = objectTable.GetRange(charStartPosition, charCount);
|
||||
return buffer.Count > 0 ? Encoding.ASCII.GetString(buffer.ToArray()) : string.Empty;
|
||||
}
|
||||
|
||||
private static object parseBinaryUnicodeString(int headerPosition)
|
||||
{
|
||||
int charStartPosition;
|
||||
int charCount = getCount(headerPosition, out charStartPosition);
|
||||
charCount = charCount * 2;
|
||||
|
||||
byte[] buffer = new byte[charCount];
|
||||
byte one, two;
|
||||
|
||||
for (int i = 0; i < charCount; i += 2)
|
||||
{
|
||||
one = objectTable.GetRange(charStartPosition + i, 1)[0];
|
||||
two = objectTable.GetRange(charStartPosition + i + 1, 1)[0];
|
||||
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
buffer[i] = two;
|
||||
buffer[i + 1] = one;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[i] = one;
|
||||
buffer[i + 1] = two;
|
||||
}
|
||||
}
|
||||
|
||||
return Encoding.Unicode.GetString(buffer);
|
||||
}
|
||||
|
||||
private static object parseBinaryByteArray(int headerPosition)
|
||||
{
|
||||
int byteStartPosition;
|
||||
int byteCount = getCount(headerPosition, out byteStartPosition);
|
||||
return objectTable.GetRange(byteStartPosition, byteCount).ToArray();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum plistType
|
||||
{
|
||||
Auto,
|
||||
Binary,
|
||||
Xml
|
||||
}
|
||||
|
||||
public static class PlistDateConverter
|
||||
{
|
||||
public static long timeDifference = 978307200;
|
||||
|
||||
public static long GetAppleTime(long unixTime)
|
||||
{
|
||||
return unixTime - timeDifference;
|
||||
}
|
||||
|
||||
public static long GetUnixTime(long appleTime)
|
||||
{
|
||||
return appleTime + timeDifference;
|
||||
}
|
||||
|
||||
public static DateTime ConvertFromAppleTimeStamp(double timestamp)
|
||||
{
|
||||
DateTime origin = new DateTime(2001, 1, 1, 0, 0, 0, 0);
|
||||
return origin.AddSeconds(timestamp);
|
||||
}
|
||||
|
||||
public static double ConvertToAppleTimeStamp(DateTime date)
|
||||
{
|
||||
DateTime begin = new DateTime(2001, 1, 1, 0, 0, 0, 0);
|
||||
TimeSpan diff = date - begin;
|
||||
return Math.Floor(diff.TotalSeconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/TapSDK/Core/Editor/Plist.cs.meta
Normal file
3
Assets/TapSDK/Core/Editor/Plist.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96acb9ea8a9264ea6a175b32e605bfab
|
||||
timeCreated: 1617120740
|
||||
119
Assets/TapSDK/Core/Editor/SDKLinkProcessBuild.cs
Normal file
119
Assets/TapSDK/Core/Editor/SDKLinkProcessBuild.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build;
|
||||
using UnityEditor.Build.Reporting;
|
||||
|
||||
namespace TapSDK.Core.Editor {
|
||||
/// <summary>
|
||||
/// 模块 SDK 生成 link.xml 构建过程
|
||||
/// </summary>
|
||||
public abstract class SDKLinkProcessBuild : IPreprocessBuildWithReport, IPostprocessBuildWithReport {
|
||||
/// <summary>
|
||||
/// 执行顺序
|
||||
/// </summary>
|
||||
public abstract int callbackOrder { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成 link.xml 路径
|
||||
/// </summary>
|
||||
public abstract string LinkPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 防止被裁剪的 Assembly
|
||||
/// </summary>
|
||||
public abstract LinkedAssembly[] LinkedAssemblies { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行平台委托
|
||||
/// </summary>
|
||||
public abstract Func<BuildReport, bool> IsTargetPlatform { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 构建时忽略目录,目前主要是 PC 内置浏览器 Vuplex
|
||||
/// </summary>
|
||||
public virtual string[] BuildingIgnorePaths => null;
|
||||
|
||||
/// <summary>
|
||||
/// 构建前处理
|
||||
/// </summary>
|
||||
/// <param name="report"></param>
|
||||
public void OnPreprocessBuild(BuildReport report) {
|
||||
if (!IsTargetPlatform.Invoke(report)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Application.logMessageReceived += OnBuildError;
|
||||
IgnorePaths();
|
||||
|
||||
string linkPath = Path.Combine(Application.dataPath, LinkPath);
|
||||
LinkXMLGenerator.Generate(linkPath, LinkedAssemblies);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构建后处理
|
||||
/// </summary>
|
||||
/// <param name="report"></param>
|
||||
public void OnPostprocessBuild(BuildReport report) {
|
||||
if (!IsTargetPlatform.Invoke(report)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Application.logMessageReceived -= OnBuildError;
|
||||
RecoverIgnoredPaths();
|
||||
|
||||
string linkPath = Path.Combine(Application.dataPath, LinkPath);
|
||||
LinkXMLGenerator.Delete(linkPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 错误日志回调
|
||||
/// </summary>
|
||||
/// <param name="condition"></param>
|
||||
/// <param name="stacktrace"></param>
|
||||
/// <param name="logType"></param>
|
||||
private void OnBuildError(string condition, string stacktrace, LogType logType) {
|
||||
// TRICK: 通过捕获错误日志来监听打包错误事件
|
||||
if (logType == LogType.Error) {
|
||||
Application.logMessageReceived -= OnBuildError;
|
||||
RecoverIgnoredPaths();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 忽略目录
|
||||
/// </summary>
|
||||
private void IgnorePaths() {
|
||||
if (BuildingIgnorePaths == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (string ignorePath in BuildingIgnorePaths) {
|
||||
if (!Directory.Exists(Path.Combine(Application.dataPath, ignorePath))) {
|
||||
continue;
|
||||
}
|
||||
string ignoreName = Path.GetFileName(ignorePath);
|
||||
AssetDatabase.RenameAsset(Path.Combine("Assets", ignorePath), $"{ignoreName}~");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 恢复目录
|
||||
/// </summary>
|
||||
private void RecoverIgnoredPaths() {
|
||||
if (BuildingIgnorePaths == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (string ignorePath in BuildingIgnorePaths) {
|
||||
if (!Directory.Exists(Path.Combine(Application.dataPath, $"{ignorePath}~"))) {
|
||||
continue;
|
||||
}
|
||||
Directory.Move(Path.Combine(Application.dataPath, $"{ignorePath}~"),
|
||||
Path.Combine(Application.dataPath, $"{ignorePath}"));
|
||||
AssetDatabase.ImportAsset(Path.Combine("Assets", ignorePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/TapSDK/Core/Editor/SDKLinkProcessBuild.cs.meta
Normal file
11
Assets/TapSDK/Core/Editor/SDKLinkProcessBuild.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c724204483e1a47f8a4fe400a1353a56
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
168
Assets/TapSDK/Core/Editor/TapFileHelper.cs
Normal file
168
Assets/TapSDK/Core/Editor/TapFileHelper.cs
Normal file
@@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TapSDK.Core.Editor
|
||||
{
|
||||
public class TapFileHelper : System.IDisposable
|
||||
{
|
||||
private string filePath;
|
||||
|
||||
public TapFileHelper(string fPath)
|
||||
{
|
||||
filePath = fPath;
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
{
|
||||
Debug.LogError(filePath + "路径下文件不存在");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteBelow(string below, string text)
|
||||
{
|
||||
StreamReader streamReader = new StreamReader(filePath);
|
||||
string all = streamReader.ReadToEnd();
|
||||
streamReader.Close();
|
||||
int beginIndex = all.IndexOf(below, StringComparison.Ordinal);
|
||||
if (beginIndex == -1)
|
||||
{
|
||||
Debug.LogError(filePath + "中没有找到字符串" + below);
|
||||
return;
|
||||
}
|
||||
|
||||
int endIndex = all.LastIndexOf("\n", beginIndex + below.Length, StringComparison.Ordinal);
|
||||
all = all.Substring(0, endIndex) + "\n" + text + "\n" + all.Substring(endIndex);
|
||||
StreamWriter streamWriter = new StreamWriter(filePath);
|
||||
streamWriter.Write(all);
|
||||
streamWriter.Close();
|
||||
}
|
||||
|
||||
public void Replace(string below, string newText)
|
||||
{
|
||||
StreamReader streamReader = new StreamReader(filePath);
|
||||
string all = streamReader.ReadToEnd();
|
||||
streamReader.Close();
|
||||
int beginIndex = all.IndexOf(below, StringComparison.Ordinal);
|
||||
if (beginIndex == -1)
|
||||
{
|
||||
Debug.LogError(filePath + "中没有找到字符串" + below);
|
||||
return;
|
||||
}
|
||||
|
||||
all = all.Replace(below, newText);
|
||||
StreamWriter streamWriter = new StreamWriter(filePath);
|
||||
streamWriter.Write(all);
|
||||
streamWriter.Close();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public static void CopyAndReplaceDirectory(string srcPath, string dstPath)
|
||||
{
|
||||
if (Directory.Exists(dstPath))
|
||||
Directory.Delete(dstPath, true);
|
||||
if (File.Exists(dstPath))
|
||||
File.Delete(dstPath);
|
||||
|
||||
Directory.CreateDirectory(dstPath);
|
||||
|
||||
foreach (var file in Directory.GetFiles(srcPath))
|
||||
File.Copy(file, Path.Combine(dstPath, Path.GetFileName(file)));
|
||||
|
||||
foreach (var dir in Directory.GetDirectories(srcPath))
|
||||
CopyAndReplaceDirectory(dir, Path.Combine(dstPath, Path.GetFileName(dir)));
|
||||
}
|
||||
|
||||
|
||||
public static void DeleteFileBySuffix(string dir, string[] suffix)
|
||||
{
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var file in Directory.GetFiles(dir))
|
||||
{
|
||||
foreach (var suffixName in suffix)
|
||||
{
|
||||
if (file.Contains(suffixName))
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string FilterFileByPrefix(string srcPath, string filterName)
|
||||
{
|
||||
if (!Directory.Exists(srcPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (var dir in Directory.GetDirectories(srcPath))
|
||||
{
|
||||
string fileName = Path.GetFileName(dir);
|
||||
if (fileName.StartsWith(filterName))
|
||||
{
|
||||
return Path.Combine(srcPath, Path.GetFileName(dir));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string FilterFileBySuffix(string srcPath, string suffix)
|
||||
{
|
||||
if (!Directory.Exists(srcPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (var dir in Directory.GetDirectories(srcPath))
|
||||
{
|
||||
string fileName = Path.GetFileName(dir);
|
||||
if (fileName.StartsWith(suffix))
|
||||
{
|
||||
return Path.Combine(srcPath, Path.GetFileName(dir));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FileInfo RecursionFilterFile(string dir, string fileName)
|
||||
{
|
||||
List<FileInfo> fileInfoList = new List<FileInfo>();
|
||||
Director(dir, fileInfoList);
|
||||
foreach (FileInfo item in fileInfoList)
|
||||
{
|
||||
if (fileName.Equals(item.Name))
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Director(string dir, List<FileInfo> list)
|
||||
{
|
||||
DirectoryInfo d = new DirectoryInfo(dir);
|
||||
FileInfo[] files = d.GetFiles();
|
||||
DirectoryInfo[] directs = d.GetDirectories();
|
||||
foreach (FileInfo f in files)
|
||||
{
|
||||
list.Add(f);
|
||||
}
|
||||
|
||||
foreach (DirectoryInfo dd in directs)
|
||||
{
|
||||
Director(dd.FullName, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/TapSDK/Core/Editor/TapFileHelper.cs.meta
Normal file
3
Assets/TapSDK/Core/Editor/TapFileHelper.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba6aa94e0d93a4706a7d274735817de5
|
||||
timeCreated: 1617120740
|
||||
15
Assets/TapSDK/Core/Editor/TapSDK.Core.Editor.asmdef
Normal file
15
Assets/TapSDK/Core/Editor/TapSDK.Core.Editor.asmdef
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "TapSDK.Core.Editor",
|
||||
"references": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/TapSDK/Core/Editor/TapSDK.Core.Editor.asmdef.meta
Normal file
7
Assets/TapSDK/Core/Editor/TapSDK.Core.Editor.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56f3da7a178484843974054bafe77e73
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
505
Assets/TapSDK/Core/Editor/TapSDKCoreCompile.cs
Normal file
505
Assets/TapSDK/Core/Editor/TapSDKCoreCompile.cs
Normal file
@@ -0,0 +1,505 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEditor.PackageManager;
|
||||
using UnityEngine;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
||||
|
||||
#if UNITY_IOS
|
||||
using System;
|
||||
using Google;
|
||||
using UnityEditor.iOS.Xcode;
|
||||
|
||||
#endif
|
||||
|
||||
namespace TapSDK.Core.Editor
|
||||
{
|
||||
public static class TapSDKCoreCompile
|
||||
{
|
||||
#if UNITY_IOS
|
||||
public static string GetProjPath(string path)
|
||||
{
|
||||
UnityEngine.Debug.Log($"SDX , GetProjPath path:{path}");
|
||||
return PBXProject.GetPBXProjectPath(path);
|
||||
}
|
||||
|
||||
public static PBXProject ParseProjPath(string path)
|
||||
{
|
||||
UnityEngine.Debug.Log($"SDX , ParseProjPath path:{path}");
|
||||
var proj = new PBXProject();
|
||||
proj.ReadFromString(File.ReadAllText(path));
|
||||
return proj;
|
||||
}
|
||||
|
||||
public static string GetUnityFrameworkTarget(PBXProject proj)
|
||||
{
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
UnityEngine.Debug.Log("SDX , GetUnityFrameworkTarget UNITY_2019_3_OR_NEWER");
|
||||
string target = proj.GetUnityFrameworkTargetGuid();
|
||||
return target;
|
||||
#endif
|
||||
UnityEngine.Debug.Log("SDX , GetUnityFrameworkTarget");
|
||||
var unityPhoneTarget = proj.TargetGuidByName("Unity-iPhone");
|
||||
return unityPhoneTarget;
|
||||
}
|
||||
|
||||
public static string GetUnityTarget(PBXProject proj)
|
||||
{
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
UnityEngine.Debug.Log("SDX , GetUnityTarget UNITY_2019_3_OR_NEWER");
|
||||
string target = proj.GetUnityMainTargetGuid();
|
||||
return target;
|
||||
#endif
|
||||
UnityEngine.Debug.Log("SDX , GetUnityTarget");
|
||||
var unityPhoneTarget = proj.TargetGuidByName("Unity-iPhone");
|
||||
return unityPhoneTarget;
|
||||
}
|
||||
|
||||
|
||||
public static bool CheckTarget(string target)
|
||||
{
|
||||
return string.IsNullOrEmpty(target);
|
||||
}
|
||||
|
||||
public static string GetUnityPackagePath(string parentFolder, string unityPackageName)
|
||||
{
|
||||
var request = Client.List(true);
|
||||
while (request.IsCompleted == false)
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
}
|
||||
var pkgs = request.Result;
|
||||
if (pkgs == null)
|
||||
return "";
|
||||
foreach (var pkg in pkgs)
|
||||
{
|
||||
if (pkg.name == unityPackageName)
|
||||
{
|
||||
if (pkg.source == PackageSource.Local)
|
||||
return pkg.resolvedPath;
|
||||
else if (pkg.source == PackageSource.Embedded)
|
||||
return pkg.resolvedPath;
|
||||
else
|
||||
{
|
||||
return pkg.resolvedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static bool HandlerIOSSetting(string path, string appDataPath, string resourceName,
|
||||
string modulePackageName,
|
||||
string moduleName, string[] bundleNames, string target, string projPath, PBXProject proj)
|
||||
{
|
||||
|
||||
var resourcePath = Path.Combine(path, resourceName);
|
||||
|
||||
var parentFolder = Directory.GetParent(appDataPath).FullName;
|
||||
|
||||
UnityEngine.Debug.Log($"ProjectFolder path:{parentFolder}" + " resourcePath: " + resourcePath + " parentFolder: " + parentFolder);
|
||||
|
||||
if (Directory.Exists(resourcePath))
|
||||
{
|
||||
Directory.Delete(resourcePath, true);
|
||||
}
|
||||
|
||||
var podSpecPath = Path.Combine(path + "/Pods", "TapTapSDK");
|
||||
//使用 cocospod 远程依赖
|
||||
if (Directory.Exists(podSpecPath))
|
||||
{
|
||||
var fwRoot = Path.Combine(path + "/Pods", "TapTapSDK/iOS/Frameworks");
|
||||
resourcePath = fwRoot;
|
||||
// 兼容新发版结构:bundle 已按版本子目录存放(podspec 形如 'iOS/Frameworks/<version>/Xxx.bundle')。
|
||||
// 优先识别 fwRoot 下"包含全部目标 bundle"的子目录;找不到则 fallback 到平层(老 podspec)。
|
||||
if (Directory.Exists(fwRoot))
|
||||
{
|
||||
var versioned = Directory.GetDirectories(fwRoot)
|
||||
.FirstOrDefault(d => bundleNames.All(b => Directory.Exists(Path.Combine(d, b))));
|
||||
if (versioned != null)
|
||||
{
|
||||
resourcePath = versioned;
|
||||
}
|
||||
}
|
||||
UnityEngine.Debug.Log($"Find {moduleName} use pods resourcePath:{resourcePath}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(resourcePath);
|
||||
var remotePackagePath = GetUnityPackagePath(parentFolder, modulePackageName);
|
||||
|
||||
var assetLocalPackagePath = TapFileHelper.FilterFileByPrefix(parentFolder + "/Assets/TapSDK/", moduleName);
|
||||
|
||||
var localPackagePath = TapFileHelper.FilterFileByPrefix(parentFolder, moduleName);
|
||||
|
||||
UnityEngine.Debug.Log($"Find {moduleName} path: remote = {remotePackagePath} asset = {assetLocalPackagePath} local = {localPackagePath}");
|
||||
var tdsResourcePath = "";
|
||||
|
||||
if (!string.IsNullOrEmpty(remotePackagePath))
|
||||
{
|
||||
tdsResourcePath = remotePackagePath;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(assetLocalPackagePath))
|
||||
{
|
||||
tdsResourcePath = assetLocalPackagePath;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(localPackagePath))
|
||||
{
|
||||
tdsResourcePath = localPackagePath;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(tdsResourcePath))
|
||||
{
|
||||
throw new Exception(string.Format("Can't find tdsResourcePath with module of : {0}", modulePackageName));
|
||||
}
|
||||
|
||||
tdsResourcePath = $"{tdsResourcePath}/Plugins/iOS/Resource";
|
||||
|
||||
UnityEngine.Debug.Log($"Find {moduleName} path:{tdsResourcePath}");
|
||||
|
||||
if (!Directory.Exists(tdsResourcePath))
|
||||
{
|
||||
throw new Exception(string.Format("Can't Find {0}", tdsResourcePath));
|
||||
}
|
||||
|
||||
TapFileHelper.CopyAndReplaceDirectory(tdsResourcePath, resourcePath);
|
||||
}
|
||||
foreach (var name in bundleNames)
|
||||
{
|
||||
var relativePath = GetRelativePath(Path.Combine(resourcePath, name), path);
|
||||
if (!proj.ContainsFileByRealPath(relativePath))
|
||||
{
|
||||
var fileGuid = proj.AddFile(relativePath, relativePath, PBXSourceTree.Source);
|
||||
proj.AddFileToBuild(target, fileGuid);
|
||||
}
|
||||
}
|
||||
|
||||
File.WriteAllText(projPath, proj.WriteToString());
|
||||
return true;
|
||||
}
|
||||
|
||||
private static string GetRelativePath(string absolutePath, string rootPath)
|
||||
{
|
||||
if (Directory.Exists(rootPath) && !rootPath.EndsWith(Path.AltDirectorySeparatorChar.ToString()))
|
||||
{
|
||||
rootPath += Path.AltDirectorySeparatorChar;
|
||||
}
|
||||
Uri aboslutePathUri = new Uri(absolutePath);
|
||||
Uri rootPathUri = new Uri(rootPath);
|
||||
var relateivePath = rootPathUri.MakeRelativeUri(aboslutePathUri).ToString();
|
||||
UnityEngine.Debug.LogFormat($"[TapSDKCoreCompile] GetRelativePath absolutePath:{absolutePath} rootPath:{rootPath} relateivePath:{relateivePath} ");
|
||||
return relateivePath;
|
||||
}
|
||||
|
||||
public static bool HandlerPlist(string pathToBuildProject, string infoPlistPath, bool macos = false)
|
||||
{
|
||||
// #if UNITY_2020_1_OR_NEWER
|
||||
// var macosXCodePlistPath =
|
||||
// $"{pathToBuildProject}/{PlayerSettings.productName}/Info.plist";
|
||||
// #elif UNITY_2019_1_OR_NEWER
|
||||
// var macosXCodePlistPath =
|
||||
// $"{Path.GetDirectoryName(pathToBuildProject)}/{PlayerSettings.productName}/Info.plist";
|
||||
// #endif
|
||||
|
||||
string plistPath;
|
||||
|
||||
if (pathToBuildProject.EndsWith(".app"))
|
||||
{
|
||||
plistPath = $"{pathToBuildProject}/Contents/Info.plist";
|
||||
}
|
||||
else
|
||||
{
|
||||
var macosXCodePlistPath =
|
||||
$"{Path.GetDirectoryName(pathToBuildProject)}/{PlayerSettings.productName}/Info.plist";
|
||||
if (!File.Exists(macosXCodePlistPath))
|
||||
{
|
||||
macosXCodePlistPath = $"{pathToBuildProject}/{PlayerSettings.productName}/Info.plist";
|
||||
}
|
||||
|
||||
plistPath = !macos
|
||||
? pathToBuildProject + "/Info.plist"
|
||||
: macosXCodePlistPath;
|
||||
}
|
||||
|
||||
UnityEngine.Debug.Log($"plist path:{plistPath}");
|
||||
|
||||
var plist = new PlistDocument();
|
||||
plist.ReadFromString(File.ReadAllText(plistPath));
|
||||
var rootDic = plist.root;
|
||||
|
||||
var items = new List<string>
|
||||
{
|
||||
"tapsdk",
|
||||
"tapiosdk",
|
||||
"taptap"
|
||||
};
|
||||
|
||||
if (!(rootDic["LSApplicationQueriesSchemes"] is PlistElementArray plistElementList))
|
||||
{
|
||||
plistElementList = rootDic.CreateArray("LSApplicationQueriesSchemes");
|
||||
}
|
||||
|
||||
string listData = "";
|
||||
foreach (var item in plistElementList.values)
|
||||
{
|
||||
if (item is PlistElementString)
|
||||
{
|
||||
listData += item.AsString() + ";";
|
||||
}
|
||||
}
|
||||
foreach (var t in items)
|
||||
{
|
||||
if (!listData.Contains(t + ";"))
|
||||
{
|
||||
plistElementList.AddString(t);
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(infoPlistPath)) return false;
|
||||
var dic = (Dictionary<string, object>)Plist.readPlist(infoPlistPath);
|
||||
var taptapId = "";
|
||||
|
||||
foreach (var item in dic)
|
||||
{
|
||||
if (item.Key.Equals("taptap"))
|
||||
{
|
||||
var taptapDic = (Dictionary<string, object>)item.Value;
|
||||
foreach (var taptapItem in taptapDic.Where(taptapItem => taptapItem.Key.Equals("client_id")))
|
||||
{
|
||||
taptapId = (string)taptapItem.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rootDic.SetString(item.Key, item.Value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
//添加url
|
||||
var dict = plist.root.AsDict();
|
||||
if (!(dict["CFBundleURLTypes"] is PlistElementArray array))
|
||||
{
|
||||
array = dict.CreateArray("CFBundleURLTypes");
|
||||
}
|
||||
|
||||
if (!macos)
|
||||
{
|
||||
var dict2 = array.AddDict();
|
||||
dict2.SetString("CFBundleURLName", "TapTap");
|
||||
var array2 = dict2.CreateArray("CFBundleURLSchemes");
|
||||
array2.AddString($"tt{taptapId}");
|
||||
}
|
||||
else
|
||||
{
|
||||
var dict2 = array.AddDict();
|
||||
dict2.SetString("CFBundleURLName", "TapWeb");
|
||||
var array2 = dict2.CreateArray("CFBundleURLSchemes");
|
||||
array2.AddString($"open-taptap-{taptapId}");
|
||||
}
|
||||
|
||||
UnityEngine.Debug.Log("TapSDK change plist Success");
|
||||
File.WriteAllText(plistPath, plist.WriteToString());
|
||||
return true;
|
||||
}
|
||||
|
||||
public static string GetValueFromPlist(string infoPlistPath, string key)
|
||||
{
|
||||
if (infoPlistPath == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var dic = (Dictionary<string, object>)Plist.readPlist(infoPlistPath);
|
||||
return (from item in dic where item.Key.Equals(key) select (string)item.Value).FirstOrDefault();
|
||||
}
|
||||
|
||||
public static void ExecutePodCommand(string command, string workingDirectory)
|
||||
{
|
||||
string podPath = FindPodPath();
|
||||
if (string.IsNullOrEmpty(podPath))
|
||||
{
|
||||
UnityEngine.Debug.LogError("[CocoaPods] search pod install path failed");
|
||||
return;
|
||||
}
|
||||
UnityEngine.Debug.Log("[CocoaPods] search pod install path :" + podPath);
|
||||
command = command.Replace("pod", podPath);
|
||||
command = "export LANG=en_US.UTF-8 && " + command;
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "/bin/bash",
|
||||
Arguments = $"-c \"{command}\"",
|
||||
WorkingDirectory = workingDirectory,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
}
|
||||
};
|
||||
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
string error = process.StandardError.ReadToEnd();
|
||||
|
||||
if (!string.IsNullOrEmpty(output))
|
||||
UnityEngine.Debug.Log($"[CocoaPods] Output: {output}");
|
||||
|
||||
if (!string.IsNullOrEmpty(error))
|
||||
UnityEngine.Debug.LogError($"[CocoaPods] Error: {error}");
|
||||
|
||||
if (process.ExitCode == 0)
|
||||
UnityEngine.Debug.Log($"[CocoaPods] Success: {command}");
|
||||
else
|
||||
UnityEngine.Debug.LogError($"[CocoaPods] Failed: {command} (Exit code: {process.ExitCode})");
|
||||
}
|
||||
|
||||
private static string FindPodPath()
|
||||
{
|
||||
string whichResult = RunBashCommand("-l -c \"which pod\"");
|
||||
whichResult = whichResult.Replace("\n", "");
|
||||
if (!string.IsNullOrEmpty(whichResult) && File.Exists(whichResult))
|
||||
{
|
||||
UnityEngine.Debug.Log($"[PodFinder] Found pod at which result: {whichResult}");
|
||||
return whichResult;
|
||||
}
|
||||
|
||||
string[] CommonPaths = new string[]
|
||||
{
|
||||
"/usr/local/bin",
|
||||
"/usr/bin",
|
||||
"/opt/homebrew/bin"
|
||||
};
|
||||
// 1. 先在常见路径查找 pod
|
||||
foreach (var path in CommonPaths)
|
||||
{
|
||||
string podPath = Path.Combine(path, "pod");
|
||||
if (File.Exists(podPath))
|
||||
{
|
||||
UnityEngine.Debug.Log($"[PodFinder] Found pod at common path: {podPath}");
|
||||
return podPath;
|
||||
}
|
||||
}
|
||||
// 2. 如果没找到,执行 gem environment 查找
|
||||
string gemEnvOutput = RunBashCommand("-l -c \"gem environment\"");
|
||||
|
||||
if (string.IsNullOrEmpty(gemEnvOutput))
|
||||
{
|
||||
UnityEngine.Debug.LogWarning("[PodFinder] gem environment output is empty.");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 3. 解析 EXECUTABLE DIRECTORY
|
||||
string execDir = ParseGemEnvironment(gemEnvOutput, @"EXECUTABLE DIRECTORY:\s*(.+)");
|
||||
if (!string.IsNullOrEmpty(execDir))
|
||||
{
|
||||
string podPath = Path.Combine(execDir.Trim(), "pod");
|
||||
if (File.Exists(podPath))
|
||||
{
|
||||
UnityEngine.Debug.Log($"[PodFinder] Found pod via EXECUTABLE DIRECTORY: {podPath}");
|
||||
return podPath;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 解析 GEM PATHS,尝试从每个路径下的 bin 文件夹查找 pod
|
||||
var gemPaths = ParseGemEnvironmentMultiple(gemEnvOutput, @"GEM PATHS:\s*((?:- .+\n)+)");
|
||||
if (gemPaths != null)
|
||||
{
|
||||
foreach (var gemPath in gemPaths)
|
||||
{
|
||||
// 一般 pod 会在 bin 文件夹或同级目录中
|
||||
string podPath1 = Path.Combine(gemPath.Trim(), "bin", "pod");
|
||||
string podPath2 = Path.Combine(gemPath.Trim(), "pod"); // 备选路径
|
||||
|
||||
if (File.Exists(podPath1))
|
||||
{
|
||||
UnityEngine.Debug.Log($"[PodFinder] Found pod via GEM PATHS (bin): {podPath1}");
|
||||
return podPath1;
|
||||
}
|
||||
|
||||
if (File.Exists(podPath2))
|
||||
{
|
||||
UnityEngine.Debug.Log($"[PodFinder] Found pod via GEM PATHS: {podPath2}");
|
||||
return podPath2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UnityEngine.Debug.LogWarning("[PodFinder] pod executable not found.");
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string RunBashCommand(string arguments)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var process = new Process())
|
||||
{
|
||||
process.StartInfo.FileName = "/bin/bash";
|
||||
process.StartInfo.Arguments = arguments;
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
process.StartInfo.RedirectStandardError = true;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
process.StartInfo.CreateNoWindow = true;
|
||||
|
||||
process.Start();
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
string err = process.StandardError.ReadToEnd();
|
||||
process.WaitForExit();
|
||||
|
||||
if (!string.IsNullOrEmpty(err))
|
||||
{
|
||||
UnityEngine.Debug.LogWarning($"[PodFinder] bash error: {err}");
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UnityEngine.Debug.LogError($"[PodFinder] Exception running bash command: {e}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static string ParseGemEnvironment(string input, string pattern)
|
||||
{
|
||||
var match = Regex.Match(input, pattern);
|
||||
if (match.Success && match.Groups.Count > 1)
|
||||
{
|
||||
return match.Groups[1].Value.Trim();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string[] ParseGemEnvironmentMultiple(string input, string pattern)
|
||||
{
|
||||
var match = Regex.Match(input, pattern, RegexOptions.Multiline);
|
||||
if (!match.Success || match.Groups.Count < 2) return null;
|
||||
|
||||
string block = match.Groups[1].Value;
|
||||
|
||||
// 每行格式是类似 "- /path/to/gem"
|
||||
var lines = block.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var paths = new System.Collections.Generic.List<string>();
|
||||
foreach (var line in lines)
|
||||
{
|
||||
string trimmed = line.Trim();
|
||||
if (trimmed.StartsWith("- "))
|
||||
{
|
||||
paths.Add(trimmed.Substring(2).Trim());
|
||||
}
|
||||
}
|
||||
|
||||
return paths.ToArray();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
3
Assets/TapSDK/Core/Editor/TapSDKCoreCompile.cs.meta
Normal file
3
Assets/TapSDK/Core/Editor/TapSDKCoreCompile.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec6f5ced361da4c9ba6c09d4e2dba5fd
|
||||
timeCreated: 1617120740
|
||||
75
Assets/TapSDK/Core/Editor/TapSDKCoreIOSProcessor.cs
Normal file
75
Assets/TapSDK/Core/Editor/TapSDKCoreIOSProcessor.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
# if UNITY_IOS
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEditor.iOS.Xcode;
|
||||
#endif
|
||||
using UnityEngine;
|
||||
|
||||
namespace TapSDK.Core.Editor
|
||||
{
|
||||
# if UNITY_IOS
|
||||
public static class TapCommonIOSProcessor
|
||||
{
|
||||
// 添加标签,unity导出工程后自动执行该函数
|
||||
[PostProcessBuild(99)]
|
||||
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
|
||||
{
|
||||
if (buildTarget != BuildTarget.iOS) return;
|
||||
|
||||
// 获得工程路径
|
||||
var projPath = TapSDKCoreCompile.GetProjPath(path);
|
||||
var proj = TapSDKCoreCompile.ParseProjPath(projPath);
|
||||
var target = TapSDKCoreCompile.GetUnityTarget(proj);
|
||||
var unityFrameworkTarget = TapSDKCoreCompile.GetUnityFrameworkTarget(proj);
|
||||
|
||||
if (TapSDKCoreCompile.CheckTarget(target))
|
||||
{
|
||||
Debug.LogError("Unity-iPhone is NUll");
|
||||
return;
|
||||
}
|
||||
|
||||
// proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC");
|
||||
// proj.AddBuildProperty(unityFrameworkTarget, "OTHER_LDFLAGS", "-ObjC");
|
||||
|
||||
proj.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
|
||||
proj.SetBuildProperty(target, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
|
||||
proj.SetBuildProperty(target, "SWIFT_VERSION", "5.0");
|
||||
proj.SetBuildProperty(target, "CLANG_ENABLE_MODULES", "YES");
|
||||
|
||||
proj.SetBuildProperty(unityFrameworkTarget, "ENABLE_BITCODE", "NO");
|
||||
proj.SetBuildProperty(unityFrameworkTarget, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
|
||||
proj.SetBuildProperty(unityFrameworkTarget, "BUILD_LIBRARY_FOR_DISTRIBUTION", "YES");
|
||||
|
||||
proj.SetBuildProperty(unityFrameworkTarget, "SWIFT_VERSION", "5.0");
|
||||
proj.SetBuildProperty(unityFrameworkTarget, "CLANG_ENABLE_MODULES", "YES");
|
||||
|
||||
proj.AddFrameworkToProject(unityFrameworkTarget, "MobileCoreServices.framework", false);
|
||||
proj.AddFrameworkToProject(unityFrameworkTarget, "WebKit.framework", false);
|
||||
proj.AddFrameworkToProject(unityFrameworkTarget, "Security.framework", false);
|
||||
proj.AddFrameworkToProject(unityFrameworkTarget, "SystemConfiguration.framework", false);
|
||||
proj.AddFrameworkToProject(unityFrameworkTarget, "CoreTelephony.framework", false);
|
||||
|
||||
proj.AddFileToBuild(unityFrameworkTarget,
|
||||
proj.AddFile("usr/lib/libc++.tbd", "libc++.tbd", PBXSourceTree.Sdk));
|
||||
|
||||
proj.AddFileToBuild(unityFrameworkTarget,
|
||||
proj.AddFile("usr/lib/libsqlite3.tbd", "libsqlite3.tbd", PBXSourceTree.Sdk));
|
||||
|
||||
proj.WriteToFile(projPath);
|
||||
string podfilePath = Path.Combine(path, "Podfile");
|
||||
if (!File.Exists(podfilePath))
|
||||
{
|
||||
Debug.LogWarning("Podfile not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
string podfileContent = File.ReadAllText(podfilePath);
|
||||
podfileContent += "\ninstall! 'cocoapods', :warn_for_unused_master_specs_repo => false";
|
||||
|
||||
File.WriteAllText(podfilePath, podfileContent);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
3
Assets/TapSDK/Core/Editor/TapSDKCoreIOSProcessor.cs.meta
Normal file
3
Assets/TapSDK/Core/Editor/TapSDKCoreIOSProcessor.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b61d97b2d6da94511a1e92afb1519d42
|
||||
timeCreated: 1617120740
|
||||
9
Assets/TapSDK/Core/Editor/UI.meta
Normal file
9
Assets/TapSDK/Core/Editor/UI.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6301720de19974c94b52839ed842dc3f
|
||||
folderAsset: yes
|
||||
timeCreated: 1533042733
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
267
Assets/TapSDK/Core/Editor/UI/ScrollViewEditor.cs
Normal file
267
Assets/TapSDK/Core/Editor/UI/ScrollViewEditor.cs
Normal file
@@ -0,0 +1,267 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// <copyright file="ScrollViewEditor.cs" company="AillieoTech">
|
||||
// Copyright (c) AillieoTech. All rights reserved.
|
||||
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
namespace TapSDK.UI.AillieoTech
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[CustomEditor(typeof(ScrollView))]
|
||||
public class ScrollViewEditor : ScrollRectEditor
|
||||
{
|
||||
private const string bgPath = "UI/Skin/Background.psd";
|
||||
private const string spritePath = "UI/Skin/UISprite.psd";
|
||||
private const string maskPath = "UI/Skin/UIMask.psd";
|
||||
private static Color panelColor = new Color(1f, 1f, 1f, 0.392f);
|
||||
private static Color defaultSelectableColor = new Color(1f, 1f, 1f, 1f);
|
||||
private static Vector2 thinElementSize = new Vector2(160f, 20f);
|
||||
private static Action<GameObject, MenuCommand> PlaceUIElementRoot;
|
||||
|
||||
private SerializedProperty itemTemplate;
|
||||
private SerializedProperty poolSize;
|
||||
private SerializedProperty defaultItemSize;
|
||||
private SerializedProperty layoutType;
|
||||
|
||||
private GUIStyle cachedCaption;
|
||||
|
||||
private GUIStyle caption
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.cachedCaption == null)
|
||||
{
|
||||
this.cachedCaption = new GUIStyle { richText = true, alignment = TextAnchor.MiddleCenter };
|
||||
}
|
||||
|
||||
return this.cachedCaption;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
this.serializedObject.Update();
|
||||
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
EditorGUILayout.LabelField("<b>Additional configs</b>", this.caption);
|
||||
EditorGUILayout.Space();
|
||||
this.DrawConfigInfo();
|
||||
this.serializedObject.ApplyModifiedProperties();
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
EditorGUILayout.LabelField("<b>For original ScrollRect</b>", this.caption);
|
||||
EditorGUILayout.Space();
|
||||
base.OnInspectorGUI();
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
protected static void InternalAddScrollView<T>(MenuCommand menuCommand)
|
||||
where T : ScrollView
|
||||
{
|
||||
GetPrivateMethodByReflection();
|
||||
|
||||
GameObject root = CreateUIElementRoot(typeof(T).Name, new Vector2(200, 200));
|
||||
PlaceUIElementRoot?.Invoke(root, menuCommand);
|
||||
|
||||
GameObject viewport = CreateUIObject("Viewport", root);
|
||||
GameObject content = CreateUIObject("Content", viewport);
|
||||
|
||||
var parent = menuCommand.context as GameObject;
|
||||
if (parent != null)
|
||||
{
|
||||
root.transform.SetParent(parent.transform, false);
|
||||
}
|
||||
|
||||
Selection.activeGameObject = root;
|
||||
|
||||
GameObject hScrollbar = CreateScrollbar();
|
||||
hScrollbar.name = "Scrollbar Horizontal";
|
||||
hScrollbar.transform.SetParent(root.transform, false);
|
||||
RectTransform hScrollbarRT = hScrollbar.GetComponent<RectTransform>();
|
||||
hScrollbarRT.anchorMin = Vector2.zero;
|
||||
hScrollbarRT.anchorMax = Vector2.right;
|
||||
hScrollbarRT.pivot = Vector2.zero;
|
||||
hScrollbarRT.sizeDelta = new Vector2(0, hScrollbarRT.sizeDelta.y);
|
||||
|
||||
GameObject vScrollbar = CreateScrollbar();
|
||||
vScrollbar.name = "Scrollbar Vertical";
|
||||
vScrollbar.transform.SetParent(root.transform, false);
|
||||
vScrollbar.GetComponent<Scrollbar>().SetDirection(Scrollbar.Direction.BottomToTop, true);
|
||||
RectTransform vScrollbarRT = vScrollbar.GetComponent<RectTransform>();
|
||||
vScrollbarRT.anchorMin = Vector2.right;
|
||||
vScrollbarRT.anchorMax = Vector2.one;
|
||||
vScrollbarRT.pivot = Vector2.one;
|
||||
vScrollbarRT.sizeDelta = new Vector2(vScrollbarRT.sizeDelta.x, 0);
|
||||
|
||||
RectTransform viewportRect = viewport.GetComponent<RectTransform>();
|
||||
viewportRect.anchorMin = Vector2.zero;
|
||||
viewportRect.anchorMax = Vector2.one;
|
||||
viewportRect.sizeDelta = Vector2.zero;
|
||||
viewportRect.pivot = Vector2.up;
|
||||
|
||||
RectTransform contentRect = content.GetComponent<RectTransform>();
|
||||
contentRect.anchorMin = Vector2.up;
|
||||
contentRect.anchorMax = Vector2.one;
|
||||
contentRect.sizeDelta = new Vector2(0, 300);
|
||||
contentRect.pivot = Vector2.up;
|
||||
|
||||
ScrollView scrollRect = root.AddComponent<T>();
|
||||
scrollRect.content = contentRect;
|
||||
scrollRect.viewport = viewportRect;
|
||||
scrollRect.horizontalScrollbar = hScrollbar.GetComponent<Scrollbar>();
|
||||
scrollRect.verticalScrollbar = vScrollbar.GetComponent<Scrollbar>();
|
||||
scrollRect.horizontalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
|
||||
scrollRect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
|
||||
scrollRect.horizontalScrollbarSpacing = -3;
|
||||
scrollRect.verticalScrollbarSpacing = -3;
|
||||
|
||||
Image rootImage = root.AddComponent<Image>();
|
||||
rootImage.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>(bgPath);
|
||||
rootImage.type = Image.Type.Sliced;
|
||||
rootImage.color = panelColor;
|
||||
|
||||
Mask viewportMask = viewport.AddComponent<Mask>();
|
||||
viewportMask.showMaskGraphic = false;
|
||||
|
||||
Image viewportImage = viewport.AddComponent<Image>();
|
||||
viewportImage.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>(maskPath);
|
||||
viewportImage.type = Image.Type.Sliced;
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
|
||||
this.itemTemplate = this.serializedObject.FindProperty("itemTemplate");
|
||||
this.poolSize = this.serializedObject.FindProperty("poolSize");
|
||||
this.defaultItemSize = this.serializedObject.FindProperty("defaultItemSize");
|
||||
this.layoutType = this.serializedObject.FindProperty("layoutType");
|
||||
}
|
||||
|
||||
protected virtual void DrawConfigInfo()
|
||||
{
|
||||
EditorGUILayout.PropertyField(this.itemTemplate);
|
||||
EditorGUILayout.PropertyField(this.poolSize);
|
||||
EditorGUILayout.PropertyField(this.defaultItemSize);
|
||||
this.layoutType.intValue = (int)(ScrollView.ItemLayoutType)EditorGUILayout.EnumPopup("layoutType", (ScrollView.ItemLayoutType)this.layoutType.intValue);
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/DynamicScrollView", false, 90)]
|
||||
private static void AddScrollView(MenuCommand menuCommand)
|
||||
{
|
||||
InternalAddScrollView<ScrollView>(menuCommand);
|
||||
}
|
||||
|
||||
private static GameObject CreateScrollbar()
|
||||
{
|
||||
// Create GOs Hierarchy
|
||||
GameObject scrollbarRoot = CreateUIElementRoot("Scrollbar", thinElementSize);
|
||||
GameObject sliderArea = CreateUIObject("Sliding Area", scrollbarRoot);
|
||||
GameObject handle = CreateUIObject("Handle", sliderArea);
|
||||
|
||||
Image bgImage = scrollbarRoot.AddComponent<Image>();
|
||||
bgImage.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>(bgPath);
|
||||
bgImage.type = Image.Type.Sliced;
|
||||
bgImage.color = defaultSelectableColor;
|
||||
|
||||
Image handleImage = handle.AddComponent<Image>();
|
||||
handleImage.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>(spritePath);
|
||||
handleImage.type = Image.Type.Sliced;
|
||||
handleImage.color = defaultSelectableColor;
|
||||
|
||||
RectTransform sliderAreaRect = sliderArea.GetComponent<RectTransform>();
|
||||
sliderAreaRect.sizeDelta = new Vector2(-20, -20);
|
||||
sliderAreaRect.anchorMin = Vector2.zero;
|
||||
sliderAreaRect.anchorMax = Vector2.one;
|
||||
|
||||
RectTransform handleRect = handle.GetComponent<RectTransform>();
|
||||
handleRect.sizeDelta = new Vector2(20, 20);
|
||||
|
||||
Scrollbar scrollbar = scrollbarRoot.AddComponent<Scrollbar>();
|
||||
scrollbar.handleRect = handleRect;
|
||||
scrollbar.targetGraphic = handleImage;
|
||||
SetDefaultColorTransitionValues(scrollbar);
|
||||
|
||||
return scrollbarRoot;
|
||||
}
|
||||
|
||||
private static GameObject CreateUIElementRoot(string name, Vector2 size)
|
||||
{
|
||||
var child = new GameObject(name);
|
||||
RectTransform rectTransform = child.AddComponent<RectTransform>();
|
||||
rectTransform.sizeDelta = size;
|
||||
return child;
|
||||
}
|
||||
|
||||
private static GameObject CreateUIObject(string name, GameObject parent)
|
||||
{
|
||||
var go = new GameObject(name);
|
||||
go.AddComponent<RectTransform>();
|
||||
SetParentAndAlign(go, parent);
|
||||
return go;
|
||||
}
|
||||
|
||||
private static void SetParentAndAlign(GameObject child, GameObject parent)
|
||||
{
|
||||
if (parent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
child.transform.SetParent(parent.transform, false);
|
||||
SetLayerRecursively(child, parent.layer);
|
||||
}
|
||||
|
||||
private static void SetLayerRecursively(GameObject go, int layer)
|
||||
{
|
||||
go.layer = layer;
|
||||
Transform t = go.transform;
|
||||
for (var i = 0; i < t.childCount; i++)
|
||||
{
|
||||
SetLayerRecursively(t.GetChild(i).gameObject, layer);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetDefaultColorTransitionValues(Selectable slider)
|
||||
{
|
||||
ColorBlock colors = slider.colors;
|
||||
colors.highlightedColor = new Color(0.882f, 0.882f, 0.882f);
|
||||
colors.pressedColor = new Color(0.698f, 0.698f, 0.698f);
|
||||
colors.disabledColor = new Color(0.521f, 0.521f, 0.521f);
|
||||
}
|
||||
|
||||
private static void GetPrivateMethodByReflection()
|
||||
{
|
||||
if (PlaceUIElementRoot == null)
|
||||
{
|
||||
Assembly uiEditorAssembly = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.FirstOrDefault(asm => asm.GetName().Name == "UnityEditor.UI");
|
||||
if (uiEditorAssembly != null)
|
||||
{
|
||||
Type menuOptionType = uiEditorAssembly.GetType("UnityEditor.UI.MenuOptions");
|
||||
if (menuOptionType != null)
|
||||
{
|
||||
MethodInfo miPlaceUIElementRoot = menuOptionType.GetMethod(
|
||||
"PlaceUIElementRoot",
|
||||
BindingFlags.NonPublic | BindingFlags.Static);
|
||||
if (miPlaceUIElementRoot != null)
|
||||
{
|
||||
PlaceUIElementRoot = Delegate.CreateDelegate(
|
||||
typeof(Action<GameObject, MenuCommand>),
|
||||
miPlaceUIElementRoot)
|
||||
as Action<GameObject, MenuCommand>;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/TapSDK/Core/Editor/UI/ScrollViewEditor.cs.meta
Normal file
12
Assets/TapSDK/Core/Editor/UI/ScrollViewEditor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c20879c71b49a4b32b4170efe40af02c
|
||||
timeCreated: 1533042733
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Assets/TapSDK/Core/Editor/UI/ScrollViewExEditor.cs
Normal file
34
Assets/TapSDK/Core/Editor/UI/ScrollViewExEditor.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// <copyright file="ScrollViewExEditor.cs" company="AillieoTech">
|
||||
// Copyright (c) AillieoTech. All rights reserved.
|
||||
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
namespace TapSDK.UI.AillieoTech
|
||||
{
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(ScrollViewEx))]
|
||||
public class ScrollViewExEditor : ScrollViewEditor
|
||||
{
|
||||
private SerializedProperty pageSize;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
this.pageSize = this.serializedObject.FindProperty("pageSize");
|
||||
}
|
||||
|
||||
protected override void DrawConfigInfo()
|
||||
{
|
||||
base.DrawConfigInfo();
|
||||
EditorGUILayout.PropertyField(this.pageSize);
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/DynamicScrollViewEx", false, 90)]
|
||||
private static void AddScrollViewEx(MenuCommand menuCommand)
|
||||
{
|
||||
InternalAddScrollView<ScrollViewEx>(menuCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/TapSDK/Core/Editor/UI/ScrollViewExEditor.cs.meta
Normal file
12
Assets/TapSDK/Core/Editor/UI/ScrollViewExEditor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d7c4e920d9c4441a83c3d500596fb75
|
||||
timeCreated: 1533042733
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Assets/TapSDK/Core/Editor/UI/TapSDK.UI.Editor.asmdef
Normal file
17
Assets/TapSDK/Core/Editor/UI/TapSDK.UI.Editor.asmdef
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "TapSDK.UI.Editor",
|
||||
"references": [
|
||||
"GUID:7d5ef2062f3704e1ab74aac0e4d5a1a7"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9925423e828d479c9063ea882f31e06
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user