初始化仓库

This commit is contained in:
SepComet
2026-02-07 19:38:49 +08:00
commit 88641dae11
1540 changed files with 371772 additions and 0 deletions
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 051868bff0e1df3498c100dc5a9f027d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,13 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.Text;
namespace StarForce.Editor.DataTableTools
{
public delegate void DataTableCodeGenerator(DataTableProcessor dataTableProcessor, StringBuilder codeContent, object userData);
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 40941eb45ca7d284f8a806370b88fa78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,412 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using UnityEngine;
namespace StarForce.Editor.DataTableTools
{
public sealed class DataTableGenerator
{
private const string DataTablePath = "Assets/GameMain/DataTables";
private const string CSharpCodePath = "Assets/GameMain/Scripts/DataTable";
private const string CSharpCodeTemplateFileName = "Assets/GameMain/Configs/DataTableCodeTemplate.txt";
private static readonly Regex EndWithNumberRegex = new Regex(@"\d+$");
private static readonly Regex NameRegex = new Regex(@"^[A-Z][A-Za-z0-9_]*$");
public static DataTableProcessor CreateDataTableProcessor(string dataTableName)
{
return new DataTableProcessor(Utility.Path.GetRegularPath(Path.Combine(DataTablePath, dataTableName + ".txt")), Encoding.GetEncoding("GB2312"), 1, 2, null, 3, 4, 1);
}
public static bool CheckRawData(DataTableProcessor dataTableProcessor, string dataTableName)
{
for (int i = 0; i < dataTableProcessor.RawColumnCount; i++)
{
string name = dataTableProcessor.GetName(i);
if (string.IsNullOrEmpty(name) || name == "#")
{
continue;
}
if (!NameRegex.IsMatch(name))
{
Debug.LogWarning(Utility.Text.Format("Check raw data failure. DataTableName='{0}' Name='{1}'", dataTableName, name));
return false;
}
}
return true;
}
public static void GenerateDataFile(DataTableProcessor dataTableProcessor, string dataTableName)
{
string binaryDataFileName = Utility.Path.GetRegularPath(Path.Combine(DataTablePath, dataTableName + ".bytes"));
if (!dataTableProcessor.GenerateDataFile(binaryDataFileName) && File.Exists(binaryDataFileName))
{
File.Delete(binaryDataFileName);
}
}
public static void GenerateCodeFile(DataTableProcessor dataTableProcessor, string dataTableName)
{
dataTableProcessor.SetCodeTemplate(CSharpCodeTemplateFileName, Encoding.UTF8);
dataTableProcessor.SetCodeGenerator(DataTableCodeGenerator);
string csharpCodeFileName = Utility.Path.GetRegularPath(Path.Combine(CSharpCodePath, "DR" + dataTableName + ".cs"));
if (!dataTableProcessor.GenerateCodeFile(csharpCodeFileName, Encoding.UTF8, dataTableName) && File.Exists(csharpCodeFileName))
{
File.Delete(csharpCodeFileName);
}
}
private static void DataTableCodeGenerator(DataTableProcessor dataTableProcessor, StringBuilder codeContent, object userData)
{
string dataTableName = (string)userData;
codeContent.Replace("__DATA_TABLE_CREATE_TIME__", DateTime.UtcNow.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss.fff"));
codeContent.Replace("__DATA_TABLE_NAME_SPACE__", "StarForce");
codeContent.Replace("__DATA_TABLE_CLASS_NAME__", "DR" + dataTableName);
codeContent.Replace("__DATA_TABLE_COMMENT__", dataTableProcessor.GetValue(0, 1) + "。");
codeContent.Replace("__DATA_TABLE_ID_COMMENT__", "获取" + dataTableProcessor.GetComment(dataTableProcessor.IdColumn) + "。");
codeContent.Replace("__DATA_TABLE_PROPERTIES__", GenerateDataTableProperties(dataTableProcessor));
codeContent.Replace("__DATA_TABLE_PARSER__", GenerateDataTableParser(dataTableProcessor));
codeContent.Replace("__DATA_TABLE_PROPERTY_ARRAY__", GenerateDataTablePropertyArray(dataTableProcessor));
}
private static string GenerateDataTableProperties(DataTableProcessor dataTableProcessor)
{
StringBuilder stringBuilder = new StringBuilder();
bool firstProperty = true;
for (int i = 0; i < dataTableProcessor.RawColumnCount; i++)
{
if (dataTableProcessor.IsCommentColumn(i))
{
// 注释列
continue;
}
if (dataTableProcessor.IsIdColumn(i))
{
// 编号列
continue;
}
if (firstProperty)
{
firstProperty = false;
}
else
{
stringBuilder.AppendLine().AppendLine();
}
stringBuilder
.AppendLine(" /// <summary>")
.AppendFormat(" /// 获取{0}。", dataTableProcessor.GetComment(i)).AppendLine()
.AppendLine(" /// </summary>")
.AppendFormat(" public {0} {1}", dataTableProcessor.GetLanguageKeyword(i), dataTableProcessor.GetName(i)).AppendLine()
.AppendLine(" {")
.AppendLine(" get;")
.AppendLine(" private set;")
.Append(" }");
}
return stringBuilder.ToString();
}
private static string GenerateDataTableParser(DataTableProcessor dataTableProcessor)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder
.AppendLine(" public override bool ParseDataRow(string dataRowString, object userData)")
.AppendLine(" {")
.AppendLine(" string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);")
.AppendLine(" for (int i = 0; i < columnStrings.Length; i++)")
.AppendLine(" {")
.AppendLine(" columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);")
.AppendLine(" }")
.AppendLine()
.AppendLine(" int index = 0;");
for (int i = 0; i < dataTableProcessor.RawColumnCount; i++)
{
if (dataTableProcessor.IsCommentColumn(i))
{
// 注释列
stringBuilder.AppendLine(" index++;");
continue;
}
if (dataTableProcessor.IsIdColumn(i))
{
// 编号列
stringBuilder.AppendLine(" m_Id = int.Parse(columnStrings[index++]);");
continue;
}
if (dataTableProcessor.IsSystem(i))
{
string languageKeyword = dataTableProcessor.GetLanguageKeyword(i);
if (languageKeyword == "string")
{
stringBuilder.AppendFormat(" {0} = columnStrings[index++];", dataTableProcessor.GetName(i)).AppendLine();
}
else
{
stringBuilder.AppendFormat(" {0} = {1}.Parse(columnStrings[index++]);", dataTableProcessor.GetName(i), languageKeyword).AppendLine();
}
}
else
{
stringBuilder.AppendFormat(" {0} = DataTableExtension.Parse{1}(columnStrings[index++]);", dataTableProcessor.GetName(i), dataTableProcessor.GetType(i).Name).AppendLine();
}
}
stringBuilder.AppendLine()
.AppendLine(" GeneratePropertyArray();")
.AppendLine(" return true;")
.AppendLine(" }")
.AppendLine()
.AppendLine(" public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)")
.AppendLine(" {")
.AppendLine(" using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))")
.AppendLine(" {")
.AppendLine(" using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))")
.AppendLine(" {");
for (int i = 0; i < dataTableProcessor.RawColumnCount; i++)
{
if (dataTableProcessor.IsCommentColumn(i))
{
// 注释列
continue;
}
if (dataTableProcessor.IsIdColumn(i))
{
// 编号列
stringBuilder.AppendLine(" m_Id = binaryReader.Read7BitEncodedInt32();");
continue;
}
string languageKeyword = dataTableProcessor.GetLanguageKeyword(i);
if (languageKeyword == "int" || languageKeyword == "uint" || languageKeyword == "long" || languageKeyword == "ulong")
{
stringBuilder.AppendFormat(" {0} = binaryReader.Read7BitEncoded{1}();", dataTableProcessor.GetName(i), dataTableProcessor.GetType(i).Name).AppendLine();
}
else
{
stringBuilder.AppendFormat(" {0} = binaryReader.Read{1}();", dataTableProcessor.GetName(i), dataTableProcessor.GetType(i).Name).AppendLine();
}
}
stringBuilder
.AppendLine(" }")
.AppendLine(" }")
.AppendLine()
.AppendLine(" GeneratePropertyArray();")
.AppendLine(" return true;")
.Append(" }");
return stringBuilder.ToString();
}
private static string GenerateDataTablePropertyArray(DataTableProcessor dataTableProcessor)
{
List<PropertyCollection> propertyCollections = new List<PropertyCollection>();
for (int i = 0; i < dataTableProcessor.RawColumnCount; i++)
{
if (dataTableProcessor.IsCommentColumn(i))
{
// 注释列
continue;
}
if (dataTableProcessor.IsIdColumn(i))
{
// 编号列
continue;
}
string name = dataTableProcessor.GetName(i);
if (!EndWithNumberRegex.IsMatch(name))
{
continue;
}
string propertyCollectionName = EndWithNumberRegex.Replace(name, string.Empty);
int id = int.Parse(EndWithNumberRegex.Match(name).Value);
PropertyCollection propertyCollection = null;
foreach (PropertyCollection pc in propertyCollections)
{
if (pc.Name == propertyCollectionName)
{
propertyCollection = pc;
break;
}
}
if (propertyCollection == null)
{
propertyCollection = new PropertyCollection(propertyCollectionName, dataTableProcessor.GetLanguageKeyword(i));
propertyCollections.Add(propertyCollection);
}
propertyCollection.AddItem(id, name);
}
StringBuilder stringBuilder = new StringBuilder();
bool firstProperty = true;
foreach (PropertyCollection propertyCollection in propertyCollections)
{
if (firstProperty)
{
firstProperty = false;
}
else
{
stringBuilder.AppendLine().AppendLine();
}
stringBuilder
.AppendFormat(" private KeyValuePair<int, {1}>[] m_{0} = null;", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine()
.AppendLine()
.AppendFormat(" public int {0}Count", propertyCollection.Name).AppendLine()
.AppendLine(" {")
.AppendLine(" get")
.AppendLine(" {")
.AppendFormat(" return m_{0}.Length;", propertyCollection.Name).AppendLine()
.AppendLine(" }")
.AppendLine(" }")
.AppendLine()
.AppendFormat(" public {1} Get{0}(int id)", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine()
.AppendLine(" {")
.AppendFormat(" foreach (KeyValuePair<int, {1}> i in m_{0})", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine()
.AppendLine(" {")
.AppendLine(" if (i.Key == id)")
.AppendLine(" {")
.AppendLine(" return i.Value;")
.AppendLine(" }")
.AppendLine(" }")
.AppendLine()
.AppendFormat(" throw new GameFrameworkException(Utility.Text.Format(\"Get{0} with invalid id '{{0}}'.\", id));", propertyCollection.Name).AppendLine()
.AppendLine(" }")
.AppendLine()
.AppendFormat(" public {1} Get{0}At(int index)", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine()
.AppendLine(" {")
.AppendFormat(" if (index < 0 || index >= m_{0}.Length)", propertyCollection.Name).AppendLine()
.AppendLine(" {")
.AppendFormat(" throw new GameFrameworkException(Utility.Text.Format(\"Get{0}At with invalid index '{{0}}'.\", index));", propertyCollection.Name).AppendLine()
.AppendLine(" }")
.AppendLine()
.AppendFormat(" return m_{0}[index].Value;", propertyCollection.Name).AppendLine()
.Append(" }");
}
if (propertyCollections.Count > 0)
{
stringBuilder.AppendLine().AppendLine();
}
stringBuilder
.AppendLine(" private void GeneratePropertyArray()")
.AppendLine(" {");
firstProperty = true;
foreach (PropertyCollection propertyCollection in propertyCollections)
{
if (firstProperty)
{
firstProperty = false;
}
else
{
stringBuilder.AppendLine().AppendLine();
}
stringBuilder
.AppendFormat(" m_{0} = new KeyValuePair<int, {1}>[]", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine()
.AppendLine(" {");
int itemCount = propertyCollection.ItemCount;
for (int i = 0; i < itemCount; i++)
{
KeyValuePair<int, string> item = propertyCollection.GetItem(i);
stringBuilder.AppendFormat(" new KeyValuePair<int, {0}>({1}, {2}),", propertyCollection.LanguageKeyword, item.Key.ToString(), item.Value).AppendLine();
}
stringBuilder.Append(" };");
}
stringBuilder
.AppendLine()
.Append(" }");
return stringBuilder.ToString();
}
private sealed class PropertyCollection
{
private readonly string m_Name;
private readonly string m_LanguageKeyword;
private readonly List<KeyValuePair<int, string>> m_Items;
public PropertyCollection(string name, string languageKeyword)
{
m_Name = name;
m_LanguageKeyword = languageKeyword;
m_Items = new List<KeyValuePair<int, string>>();
}
public string Name
{
get
{
return m_Name;
}
}
public string LanguageKeyword
{
get
{
return m_LanguageKeyword;
}
}
public int ItemCount
{
get
{
return m_Items.Count;
}
}
public KeyValuePair<int, string> GetItem(int index)
{
if (index < 0 || index >= m_Items.Count)
{
throw new GameFrameworkException(Utility.Text.Format("GetItem with invalid index '{0}'.", index));
}
return m_Items[index];
}
public void AddItem(int id, string propertyName)
{
m_Items.Add(new KeyValuePair<int, string>(id, propertyName));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f91ec109eb6c73a408325960701b4c94
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,36 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework;
using Procedure;
using UnityEditor;
using UnityEngine;
namespace StarForce.Editor.DataTableTools
{
public sealed class DataTableGeneratorMenu
{
[MenuItem("Star Force/Generate DataTables")]
private static void GenerateDataTables()
{
foreach (string dataTableName in ProcedurePreload.DataTableNames)
{
DataTableProcessor dataTableProcessor = DataTableGenerator.CreateDataTableProcessor(dataTableName);
if (!DataTableGenerator.CheckRawData(dataTableProcessor, dataTableName))
{
Debug.LogError(Utility.Text.Format("Check raw data failure. DataTableName='{0}'", dataTableName));
break;
}
DataTableGenerator.GenerateDataFile(dataTableProcessor, dataTableName);
DataTableGenerator.GenerateCodeFile(dataTableProcessor, dataTableName);
}
AssetDatabase.Refresh();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7ddc8f13b2516c643a67d92a319dbf72
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class BooleanProcessor : GenericDataProcessor<bool>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "bool";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"bool",
"boolean",
"system.boolean"
};
}
public override bool Parse(string value)
{
return bool.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 00bc8bc968fa2134095a36a43f326d56
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class ByteProcessor : GenericDataProcessor<byte>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "byte";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"byte",
"system.byte"
};
}
public override byte Parse(string value)
{
return byte.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 11199a40fe5a3ef49a3c3d1ae670ac97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class CharProcessor : GenericDataProcessor<char>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "char";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"char",
"system.char"
};
}
public override char Parse(string value)
{
return char.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 37f1181bc8fb29742b06ec3f42f652b4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,58 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
using UnityEngine;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class Color32Processor : GenericDataProcessor<Color32>
{
public override bool IsSystem
{
get
{
return false;
}
}
public override string LanguageKeyword
{
get
{
return "Color32";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"color32",
"unityengine.color32"
};
}
public override Color32 Parse(string value)
{
string[] splitedValue = value.Split(',');
return new Color32(byte.Parse(splitedValue[0]), byte.Parse(splitedValue[1]), byte.Parse(splitedValue[2]), byte.Parse(splitedValue[3]));
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
Color32 color32 = Parse(value);
binaryWriter.Write(color32.r);
binaryWriter.Write(color32.g);
binaryWriter.Write(color32.b);
binaryWriter.Write(color32.a);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2a9b916d7c8e446439b74c27340be473
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,58 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
using UnityEngine;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class ColorProcessor : GenericDataProcessor<Color>
{
public override bool IsSystem
{
get
{
return false;
}
}
public override string LanguageKeyword
{
get
{
return "Color";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"color",
"unityengine.color"
};
}
public override Color Parse(string value)
{
string[] splitedValue = value.Split(',');
return new Color(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3]));
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
Color color = Parse(value);
binaryWriter.Write(color.r);
binaryWriter.Write(color.g);
binaryWriter.Write(color.b);
binaryWriter.Write(color.a);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f4583af9902c99a4fad14d732796117e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class CommentProcessor : DataProcessor
{
public override System.Type Type
{
get
{
return null;
}
}
public override bool IsId
{
get
{
return false;
}
}
public override bool IsComment
{
get
{
return true;
}
}
public override bool IsSystem
{
get
{
return false;
}
}
public override string LanguageKeyword
{
get
{
return null;
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
string.Empty,
"#",
"comment"
};
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2ece238877c1e9344a50ce47697a93ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,46 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
public abstract class DataProcessor
{
public abstract System.Type Type
{
get;
}
public abstract bool IsId
{
get;
}
public abstract bool IsComment
{
get;
}
public abstract bool IsSystem
{
get;
}
public abstract string LanguageKeyword
{
get;
}
public abstract string[] GetTypeStrings();
public abstract void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ccc7c992b5573ae4fafd0d5706bdad48
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,61 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework;
using System;
using System.Collections.Generic;
using System.Reflection;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private static class DataProcessorUtility
{
private static readonly IDictionary<string, DataProcessor> s_DataProcessors = new SortedDictionary<string, DataProcessor>(StringComparer.Ordinal);
static DataProcessorUtility()
{
System.Type dataProcessorBaseType = typeof(DataProcessor);
Assembly assembly = Assembly.GetExecutingAssembly();
System.Type[] types = assembly.GetTypes();
for (int i = 0; i < types.Length; i++)
{
if (!types[i].IsClass || types[i].IsAbstract)
{
continue;
}
if (dataProcessorBaseType.IsAssignableFrom(types[i]))
{
DataProcessor dataProcessor = (DataProcessor)Activator.CreateInstance(types[i]);
foreach (string typeString in dataProcessor.GetTypeStrings())
{
s_DataProcessors.Add(typeString.ToLowerInvariant(), dataProcessor);
}
}
}
}
public static DataProcessor GetDataProcessor(string type)
{
if (type == null)
{
type = string.Empty;
}
DataProcessor dataProcessor = null;
if (s_DataProcessors.TryGetValue(type.ToLowerInvariant(), out dataProcessor))
{
return dataProcessor;
}
throw new GameFrameworkException(Utility.Text.Format("Not supported data processor type '{0}'.", type));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 83d25f17cbb262649959b7952811f8c8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System;
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class DateTimeProcessor : GenericDataProcessor<DateTime>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "DateTime";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"datetime",
"system.datetime"
};
}
public override DateTime Parse(string value)
{
return DateTime.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value).Ticks);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4223bbe977dd5244a8611c6aad7f693e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class DecimalProcessor : GenericDataProcessor<decimal>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "decimal";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"decimal",
"system.decimal"
};
}
public override decimal Parse(string value)
{
return decimal.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad6d6ba18487f7643830e156d300ee75
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class DoubleProcessor : GenericDataProcessor<double>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "double";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"double",
"system.double"
};
}
public override double Parse(string value)
{
return double.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 44293fe0c3e108248bc98e8674238aed
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,41 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
public abstract class GenericDataProcessor<T> : DataProcessor
{
public override System.Type Type
{
get
{
return typeof(T);
}
}
public override bool IsId
{
get
{
return false;
}
}
public override bool IsComment
{
get
{
return false;
}
}
public abstract T Parse(string value);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 65dd2cb98d350654fb3df2ddfc4fa4b8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,70 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class IdProcessor : DataProcessor
{
public override System.Type Type
{
get
{
return typeof(int);
}
}
public override bool IsId
{
get
{
return true;
}
}
public override bool IsComment
{
get
{
return false;
}
}
public override bool IsSystem
{
get
{
return false;
}
}
public override string LanguageKeyword
{
get
{
return "int";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"id"
};
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write7BitEncodedInt32(int.Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f4171c2dabb4ee9468f7297ab334ddf1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class Int16Processor : GenericDataProcessor<short>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "short";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"short",
"int16",
"system.int16"
};
}
public override short Parse(string value)
{
return short.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c1e3b1767ca81c343a31324956e5f032
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class Int32Processor : GenericDataProcessor<int>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "int";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"int",
"int32",
"system.int32"
};
}
public override int Parse(string value)
{
return int.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write7BitEncodedInt32(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 239560231c239b54f95c183913ec9cbf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class Int64Processor : GenericDataProcessor<long>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "long";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"long",
"int64",
"system.int64"
};
}
public override long Parse(string value)
{
return long.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write7BitEncodedInt64(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d6dadc699adc6744e898979b1e85d6cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,58 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
using UnityEngine;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class QuaternionProcessor : GenericDataProcessor<Quaternion>
{
public override bool IsSystem
{
get
{
return false;
}
}
public override string LanguageKeyword
{
get
{
return "Quaternion";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"quaternion",
"unityengine.quaternion"
};
}
public override Quaternion Parse(string value)
{
string[] splitedValue = value.Split(',');
return new Quaternion(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3]));
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
Quaternion quaternion = Parse(value);
binaryWriter.Write(quaternion.x);
binaryWriter.Write(quaternion.y);
binaryWriter.Write(quaternion.z);
binaryWriter.Write(quaternion.w);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c288505f764c21149b9986dd3ebff1ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,58 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
using UnityEngine;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class RectProcessor : GenericDataProcessor<Rect>
{
public override bool IsSystem
{
get
{
return false;
}
}
public override string LanguageKeyword
{
get
{
return "Rect";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"rect",
"unityengine.rect"
};
}
public override Rect Parse(string value)
{
string[] splitedValue = value.Split(',');
return new Rect(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3]));
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
Rect rect = Parse(value);
binaryWriter.Write(rect.x);
binaryWriter.Write(rect.y);
binaryWriter.Write(rect.width);
binaryWriter.Write(rect.height);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 235589b35d4744a4d8ef100da517e0ce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class SByteProcessor : GenericDataProcessor<sbyte>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "sbyte";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"sbyte",
"system.sbyte"
};
}
public override sbyte Parse(string value)
{
return sbyte.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 49f8d16f80f1ec046bfcae38be8c96a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class SingleProcessor : GenericDataProcessor<float>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "float";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"float",
"single",
"system.single"
};
}
public override float Parse(string value)
{
return float.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4c1502c70e1294543b14df45c7841a73
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class StringProcessor : GenericDataProcessor<string>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "string";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"string",
"system.string"
};
}
public override string Parse(string value)
{
return value;
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d502b9a1939b46246bd8e4c107b77744
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class UInt16Processor : GenericDataProcessor<ushort>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "ushort";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"ushort",
"uint16",
"system.uint16"
};
}
public override ushort Parse(string value)
{
return ushort.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 20f758534f1981b4593f97deb2a5ae25
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class UInt32Processor : GenericDataProcessor<uint>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "uint";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"uint",
"uint32",
"system.uint32"
};
}
public override uint Parse(string value)
{
return uint.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write7BitEncodedUInt32(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fd3c289549d93924ea928ea558436a57
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class UInt64Processor : GenericDataProcessor<ulong>
{
public override bool IsSystem
{
get
{
return true;
}
}
public override string LanguageKeyword
{
get
{
return "ulong";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"ulong",
"uint64",
"system.uint64"
};
}
public override ulong Parse(string value)
{
return ulong.Parse(value);
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
binaryWriter.Write7BitEncodedUInt64(Parse(value));
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 23d841306167268488c7c5a8bb8cf685
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,56 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
using UnityEngine;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class Vector2Processor : GenericDataProcessor<Vector2>
{
public override bool IsSystem
{
get
{
return false;
}
}
public override string LanguageKeyword
{
get
{
return "Vector2";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"vector2",
"unityengine.vector2"
};
}
public override Vector2 Parse(string value)
{
string[] splitedValue = value.Split(',');
return new Vector2(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]));
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
Vector2 vector2 = Parse(value);
binaryWriter.Write(vector2.x);
binaryWriter.Write(vector2.y);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 165df2a7d4a52984282f1c3bc87d5aaa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,57 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
using UnityEngine;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class Vector3Processor : GenericDataProcessor<Vector3>
{
public override bool IsSystem
{
get
{
return false;
}
}
public override string LanguageKeyword
{
get
{
return "Vector3";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"vector3",
"unityengine.vector3"
};
}
public override Vector3 Parse(string value)
{
string[] splitedValue = value.Split(',');
return new Vector3(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]));
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
Vector3 vector3 = Parse(value);
binaryWriter.Write(vector3.x);
binaryWriter.Write(vector3.y);
binaryWriter.Write(vector3.z);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d45ef71d28b25f047ab0f4d4acac8b42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,58 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.IO;
using UnityEngine;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private sealed class Vector4Processor : GenericDataProcessor<Vector4>
{
public override bool IsSystem
{
get
{
return false;
}
}
public override string LanguageKeyword
{
get
{
return "Vector4";
}
}
public override string[] GetTypeStrings()
{
return new string[]
{
"vector4",
"unityengine.vector4"
};
}
public override Vector4 Parse(string value)
{
string[] splitedValue = value.Split(',');
return new Vector4(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3]));
}
public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value)
{
Vector4 vector4 = Parse(value);
binaryWriter.Write(vector4.x);
binaryWriter.Write(vector4.y);
binaryWriter.Write(vector4.z);
binaryWriter.Write(vector4.w);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 40409bde40a898b48af91126d343c4ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,498 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEngine;
namespace StarForce.Editor.DataTableTools
{
public sealed partial class DataTableProcessor
{
private const string CommentLineSeparator = "#";
private static readonly char[] DataSplitSeparators = new char[] { '\t' };
private static readonly char[] DataTrimSeparators = new char[] { '\"' };
private readonly string[] m_NameRow;
private readonly string[] m_TypeRow;
private readonly string[] m_DefaultValueRow;
private readonly string[] m_CommentRow;
private readonly int m_ContentStartRow;
private readonly int m_IdColumn;
private readonly DataProcessor[] m_DataProcessor;
private readonly string[][] m_RawValues;
private readonly string[] m_Strings;
private string m_CodeTemplate;
private DataTableCodeGenerator m_CodeGenerator;
public DataTableProcessor(string dataTableFileName, Encoding encoding, int nameRow, int typeRow, int? defaultValueRow, int? commentRow, int contentStartRow, int idColumn)
{
if (string.IsNullOrEmpty(dataTableFileName))
{
throw new GameFrameworkException("Data table file name is invalid.");
}
if (!dataTableFileName.EndsWith(".txt", StringComparison.Ordinal))
{
throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not a txt.", dataTableFileName));
}
if (!File.Exists(dataTableFileName))
{
throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not exist.", dataTableFileName));
}
string[] lines = File.ReadAllLines(dataTableFileName, encoding);
int rawRowCount = lines.Length;
int rawColumnCount = 0;
List<string[]> rawValues = new List<string[]>();
for (int i = 0; i < lines.Length; i++)
{
string[] rawValue = lines[i].Split(DataSplitSeparators);
for (int j = 0; j < rawValue.Length; j++)
{
rawValue[j] = rawValue[j].Trim(DataTrimSeparators);
}
if (i == 0)
{
rawColumnCount = rawValue.Length;
}
else if (rawValue.Length != rawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}', raw Column is '{2}', but line '{1}' column is '{3}'.", dataTableFileName, i, rawColumnCount, rawValue.Length));
}
rawValues.Add(rawValue);
}
m_RawValues = rawValues.ToArray();
if (nameRow < 0)
{
throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' is invalid.", nameRow));
}
if (typeRow < 0)
{
throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' is invalid.", typeRow));
}
if (contentStartRow < 0)
{
throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' is invalid.", contentStartRow));
}
if (idColumn < 0)
{
throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' is invalid.", idColumn));
}
if (nameRow >= rawRowCount)
{
throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' >= raw row count '{1}' is not allow.", nameRow, rawRowCount));
}
if (typeRow >= rawRowCount)
{
throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' >= raw row count '{1}' is not allow.", typeRow, rawRowCount));
}
if (defaultValueRow.HasValue && defaultValueRow.Value >= rawRowCount)
{
throw new GameFrameworkException(Utility.Text.Format("Default value row '{0}' >= raw row count '{1}' is not allow.", defaultValueRow.Value, rawRowCount));
}
if (commentRow.HasValue && commentRow.Value >= rawRowCount)
{
throw new GameFrameworkException(Utility.Text.Format("Comment row '{0}' >= raw row count '{1}' is not allow.", commentRow.Value, rawRowCount));
}
if (contentStartRow > rawRowCount)
{
throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' > raw row count '{1}' is not allow.", contentStartRow, rawRowCount));
}
if (idColumn >= rawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' >= raw column count '{1}' is not allow.", idColumn, rawColumnCount));
}
m_NameRow = m_RawValues[nameRow];
m_TypeRow = m_RawValues[typeRow];
m_DefaultValueRow = defaultValueRow.HasValue ? m_RawValues[defaultValueRow.Value] : null;
m_CommentRow = commentRow.HasValue ? m_RawValues[commentRow.Value] : null;
m_ContentStartRow = contentStartRow;
m_IdColumn = idColumn;
m_DataProcessor = new DataProcessor[rawColumnCount];
for (int i = 0; i < rawColumnCount; i++)
{
if (i == IdColumn)
{
m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor("id");
}
else
{
m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor(m_TypeRow[i]);
}
}
Dictionary<string, int> strings = new Dictionary<string, int>(StringComparer.Ordinal);
for (int i = contentStartRow; i < rawRowCount; i++)
{
if (IsCommentRow(i))
{
continue;
}
for (int j = 0; j < rawColumnCount; j++)
{
if (m_DataProcessor[j].LanguageKeyword != "string")
{
continue;
}
string str = m_RawValues[i][j];
if (strings.ContainsKey(str))
{
strings[str]++;
}
else
{
strings[str] = 1;
}
}
}
m_Strings = strings.OrderBy(value => value.Key).OrderByDescending(value => value.Value).Select(value => value.Key).ToArray();
m_CodeTemplate = null;
m_CodeGenerator = null;
}
public int RawRowCount
{
get
{
return m_RawValues.Length;
}
}
public int RawColumnCount
{
get
{
return m_RawValues.Length > 0 ? m_RawValues[0].Length : 0;
}
}
public int StringCount
{
get
{
return m_Strings.Length;
}
}
public int ContentStartRow
{
get
{
return m_ContentStartRow;
}
}
public int IdColumn
{
get
{
return m_IdColumn;
}
}
public bool IsIdColumn(int rawColumn)
{
if (rawColumn < 0 || rawColumn >= RawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn));
}
return m_DataProcessor[rawColumn].IsId;
}
public bool IsCommentRow(int rawRow)
{
if (rawRow < 0 || rawRow >= RawRowCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw row '{0}' is out of range.", rawRow));
}
return GetValue(rawRow, 0).StartsWith(CommentLineSeparator, StringComparison.Ordinal);
}
public bool IsCommentColumn(int rawColumn)
{
if (rawColumn < 0 || rawColumn >= RawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn));
}
return string.IsNullOrEmpty(GetName(rawColumn)) || m_DataProcessor[rawColumn].IsComment;
}
public string GetName(int rawColumn)
{
if (rawColumn < 0 || rawColumn >= RawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn));
}
if (IsIdColumn(rawColumn))
{
return "Id";
}
return m_NameRow[rawColumn];
}
public bool IsSystem(int rawColumn)
{
if (rawColumn < 0 || rawColumn >= RawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn));
}
return m_DataProcessor[rawColumn].IsSystem;
}
public System.Type GetType(int rawColumn)
{
if (rawColumn < 0 || rawColumn >= RawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn));
}
return m_DataProcessor[rawColumn].Type;
}
public string GetLanguageKeyword(int rawColumn)
{
if (rawColumn < 0 || rawColumn >= RawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn));
}
return m_DataProcessor[rawColumn].LanguageKeyword;
}
public string GetDefaultValue(int rawColumn)
{
if (rawColumn < 0 || rawColumn >= RawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn));
}
return m_DefaultValueRow != null ? m_DefaultValueRow[rawColumn] : null;
}
public string GetComment(int rawColumn)
{
if (rawColumn < 0 || rawColumn >= RawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn));
}
return m_CommentRow != null ? m_CommentRow[rawColumn] : null;
}
public string GetValue(int rawRow, int rawColumn)
{
if (rawRow < 0 || rawRow >= RawRowCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw row '{0}' is out of range.", rawRow));
}
if (rawColumn < 0 || rawColumn >= RawColumnCount)
{
throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn));
}
return m_RawValues[rawRow][rawColumn];
}
public string GetString(int index)
{
if (index < 0 || index >= StringCount)
{
throw new GameFrameworkException(Utility.Text.Format("String index '{0}' is out of range.", index));
}
return m_Strings[index];
}
public int GetStringIndex(string str)
{
for (int i = 0; i < StringCount; i++)
{
if (m_Strings[i] == str)
{
return i;
}
}
return -1;
}
public bool GenerateDataFile(string outputFileName)
{
if (string.IsNullOrEmpty(outputFileName))
{
throw new GameFrameworkException("Output file name is invalid.");
}
try
{
using (FileStream fileStream = new FileStream(outputFileName, FileMode.Create, FileAccess.Write))
{
using (BinaryWriter binaryWriter = new BinaryWriter(fileStream, Encoding.UTF8))
{
for (int rawRow = ContentStartRow; rawRow < RawRowCount; rawRow++)
{
if (IsCommentRow(rawRow))
{
continue;
}
byte[] bytes = GetRowBytes(outputFileName, rawRow);
binaryWriter.Write7BitEncodedInt32(bytes.Length);
binaryWriter.Write(bytes);
}
}
}
Debug.Log(Utility.Text.Format("Parse data table '{0}' success.", outputFileName));
return true;
}
catch (Exception exception)
{
Debug.LogError(Utility.Text.Format("Parse data table '{0}' failure, exception is '{1}'.", outputFileName, exception));
return false;
}
}
public bool SetCodeTemplate(string codeTemplateFileName, Encoding encoding)
{
try
{
m_CodeTemplate = File.ReadAllText(codeTemplateFileName, encoding);
Debug.Log(Utility.Text.Format("Set code template '{0}' success.", codeTemplateFileName));
return true;
}
catch (Exception exception)
{
Debug.LogError(Utility.Text.Format("Set code template '{0}' failure, exception is '{1}'.", codeTemplateFileName, exception));
return false;
}
}
public void SetCodeGenerator(DataTableCodeGenerator codeGenerator)
{
m_CodeGenerator = codeGenerator;
}
public bool GenerateCodeFile(string outputFileName, Encoding encoding, object userData = null)
{
if (string.IsNullOrEmpty(m_CodeTemplate))
{
throw new GameFrameworkException("You must set code template first.");
}
if (string.IsNullOrEmpty(outputFileName))
{
throw new GameFrameworkException("Output file name is invalid.");
}
try
{
StringBuilder stringBuilder = new StringBuilder(m_CodeTemplate);
if (m_CodeGenerator != null)
{
m_CodeGenerator(this, stringBuilder, userData);
}
using (FileStream fileStream = new FileStream(outputFileName, FileMode.Create, FileAccess.Write))
{
using (StreamWriter stream = new StreamWriter(fileStream, encoding))
{
stream.Write(stringBuilder.ToString());
}
}
Debug.Log(Utility.Text.Format("Generate code file '{0}' success.", outputFileName));
return true;
}
catch (Exception exception)
{
Debug.LogError(Utility.Text.Format("Generate code file '{0}' failure, exception is '{1}'.", outputFileName, exception));
return false;
}
}
private byte[] GetRowBytes(string outputFileName, int rawRow)
{
using (MemoryStream memoryStream = new MemoryStream())
{
using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream, Encoding.UTF8))
{
for (int rawColumn = 0; rawColumn < RawColumnCount; rawColumn++)
{
if (IsCommentColumn(rawColumn))
{
continue;
}
try
{
m_DataProcessor[rawColumn].WriteToStream(this, binaryWriter, GetValue(rawRow, rawColumn));
}
catch
{
if (m_DataProcessor[rawColumn].IsId || string.IsNullOrEmpty(GetDefaultValue(rawColumn)))
{
Debug.LogError(Utility.Text.Format("Parse raw value failure. OutputFileName='{0}' RawRow='{1}' RowColumn='{2}' Name='{3}' Type='{4}' RawValue='{5}'", outputFileName, rawRow, rawColumn, GetName(rawColumn), GetLanguageKeyword(rawColumn), GetValue(rawRow, rawColumn)));
return null;
}
else
{
Debug.LogWarning(Utility.Text.Format("Parse raw value failure, will try default value. OutputFileName='{0}' RawRow='{1}' RowColumn='{2}' Name='{3}' Type='{4}' RawValue='{5}'", outputFileName, rawRow, rawColumn, GetName(rawColumn), GetLanguageKeyword(rawColumn), GetValue(rawRow, rawColumn)));
try
{
m_DataProcessor[rawColumn].WriteToStream(this, binaryWriter, GetDefaultValue(rawColumn));
}
catch
{
Debug.LogError(Utility.Text.Format("Parse default value failure. OutputFileName='{0}' RawRow='{1}' RowColumn='{2}' Name='{3}' Type='{4}' RawValue='{5}'", outputFileName, rawRow, rawColumn, GetName(rawColumn), GetLanguageKeyword(rawColumn), GetComment(rawColumn)));
return null;
}
}
}
}
return memoryStream.ToArray();
}
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 81b27209918096743b988ea62b39d109
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,30 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework;
using System.IO;
using UnityEngine;
using UnityGameFramework.Editor;
using UnityGameFramework.Editor.ResourceTools;
namespace StarForce.Editor
{
public static class GameFrameworkConfigs
{
[BuildSettingsConfigPath]
public static string BuildSettingsConfig = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "GameMain/Configs/BuildSettings.xml"));
[ResourceCollectionConfigPath]
public static string ResourceCollectionConfig = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "GameMain/Configs/ResourceCollection.xml"));
[ResourceEditorConfigPath]
public static string ResourceEditorConfig = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "GameMain/Configs/ResourceEditor.xml"));
[ResourceBuilderConfigPath]
public static string ResourceBuilderConfig = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "GameMain/Configs/ResourceBuilder.xml"));
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 36618c709c84656438dd91e565226606
timeCreated: 1528026150
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using System.IO;
[InitializeOnLoad]
public class SceneSwitchLeft
{
static SceneSwitchLeft()
{
// 注册到全局工具栏绘制事件
SceneView.duringSceneGui += OnSceneGUI;
}
static void OnSceneGUI(SceneView sceneView)
{
// 在 Scene 视图的左上角绘制一个下拉菜单
Handles.BeginGUI();
GUILayout.BeginArea(new Rect(10, 10, 200, 100));
if (EditorGUILayout.DropdownButton(new GUIContent("快速切换场景"), FocusType.Passive, EditorStyles.toolbarDropDown))
{
ShowSceneMenu();
}
GUILayout.EndArea();
Handles.EndGUI();
}
static void ShowSceneMenu()
{
GenericMenu menu = new GenericMenu();
// 查找项目中所有启用(Enabled)的场景
string[] sceneGuids = AssetDatabase.FindAssets("t:Scene");
foreach (string guid in sceneGuids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
string name = Path.GetFileNameWithoutExtension(path);
menu.AddItem(new GUIContent(name), false, () => {
if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
{
EditorSceneManager.OpenScene(path);
}
});
}
menu.ShowAsContext();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e7f70b2d5386e4941ab913255891bb99
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,90 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework;
using System.IO;
using UnityEditor;
using UnityEngine;
using UnityGameFramework.Editor.ResourceTools;
namespace StarForce.Editor
{
public sealed class StarForceBuildEventHandler : IBuildEventHandler
{
public bool ContinueOnFailure
{
get
{
return false;
}
}
public void OnPreprocessAllPlatforms(string productName, string companyName, string gameIdentifier, string gameFrameworkVersion, string unityVersion, string applicableGameVersion, int internalResourceVersion,
Platform platforms, AssetBundleCompressionType assetBundleCompression, string compressionHelperTypeName, bool additionalCompressionSelected, bool forceRebuildAssetBundleSelected, string buildEventHandlerTypeName, string outputDirectory, BuildAssetBundleOptions buildAssetBundleOptions,
string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, string buildReportPath)
{
string streamingAssetsPath = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "StreamingAssets"));
string[] fileNames = Directory.GetFiles(streamingAssetsPath, "*", SearchOption.AllDirectories);
foreach (string fileName in fileNames)
{
if (fileName.Contains(".gitkeep"))
{
continue;
}
File.Delete(fileName);
}
Utility.Path.RemoveEmptyDirectory(streamingAssetsPath);
}
public void OnPostprocessAllPlatforms(string productName, string companyName, string gameIdentifier, string gameFrameworkVersion, string unityVersion, string applicableGameVersion, int internalResourceVersion,
Platform platforms, AssetBundleCompressionType assetBundleCompression, string compressionHelperTypeName, bool additionalCompressionSelected, bool forceRebuildAssetBundleSelected, string buildEventHandlerTypeName, string outputDirectory, BuildAssetBundleOptions buildAssetBundleOptions,
string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, string buildReportPath)
{
}
public void OnPreprocessPlatform(Platform platform, string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath)
{
}
public void OnBuildAssetBundlesComplete(Platform platform, string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, AssetBundleManifest assetBundleManifest)
{
}
public void OnOutputUpdatableVersionListData(Platform platform, string versionListPath, int versionListLength, int versionListHashCode, int versionListCompressedLength, int versionListCompressedHashCode)
{
}
public void OnPostprocessPlatform(Platform platform, string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, bool isSuccess)
{
if (!outputPackageSelected)
{
return;
}
if (platform != Platform.Windows)
{
return;
}
string streamingAssetsPath = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "StreamingAssets"));
string[] fileNames = Directory.GetFiles(outputPackagePath, "*", SearchOption.AllDirectories);
foreach (string fileName in fileNames)
{
string destFileName = Utility.Path.GetRegularPath(Path.Combine(streamingAssetsPath, fileName.Substring(outputPackagePath.Length)));
FileInfo destFileInfo = new FileInfo(destFileName);
if (!destFileInfo.Directory.Exists)
{
destFileInfo.Directory.Create();
}
File.Copy(fileName, destFileName);
}
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 64311189c3f9ae140b59a31db9831950
timeCreated: 1528026151
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: