diff --git a/Assets/05.TableTextConversion/Editor/ConvertedExslDataMessage.cs b/Assets/05.TableTextConversion/Editor/ConvertedExslDataMessage.cs new file mode 100644 index 0000000..786692f --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/ConvertedExslDataMessage.cs @@ -0,0 +1,263 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.IO; +using Excel; +using UnityEditor; +using UnityEngine; +using Sirenix.OdinInspector; +using Sirenix.OdinInspector.Editor; +using System.Linq; +using Stary.Evo.TableTextConversion; + +namespace Stary.Evo.TableTextConversion +{ + public class ConvertedExslDataMessage : OdinEditorWindow + { + private static ConvertedExslDataMessage window; + + // 读取的位置 + private static string DocFolderPath; + + // 生成配置文件的位置 + private static string Assetpath; + + // 转化表的名称 + private static string newDataName; + + [MenuItem("Exsl/信息表转换")] + static void ShowWindows() + { + window = (ConvertedExslDataMessage)EditorWindow.GetWindow(typeof(ConvertedExslDataMessage)); + window.Show(); + } + + + [Title("转化配置的Exsl文件:", titleAlignment: TitleAlignments.Centered)] + [HorizontalGroup("BuildPipeline"), HideLabel] + [ValueDropdown("GetBuildExslNames")] + [OnValueChanged("SetBuildExslNames")] + public string selectedExslNames; + + [Title("转化文件存储的作用域:", titleAlignment: TitleAlignments.Centered)] + [HorizontalGroup("BuildPipeline"), HideLabel] + [ValueDropdown("GetCreatDomainAllName")] + [OnValueChanged("SetCurrentDomainName")] + public string selectedDomainNames; + + #region 信息表转存 + + //[MenuItem("Exsl/信息表转换")] + [Button("转化Exsl表格", ButtonSizes.Large)] + public static void CrtateMessage() + { + #region 读取Excel表格并转成DataSet类型的数据 + + if (DocFolderPath == null) + { + Debug.LogError("UnityEvo:请先选择Exsl文件"); + return; + } + + if (Assetpath == null) + { + Debug.LogError("UnityEvo:请先选择生成配置文件的位置"); + return; + } + + /*if (!Directory.Exists(DocFolderPath)) + { + Debug.LogError("UnityEvo:Exsl文件不存在"); + return; + }*/ + + if (!Directory.Exists(Assetpath)) + { + Debug.LogError("UnityEvo:生成配置文件的位置不存在"); + return; + } + FileStream stream = File.Open(DocFolderPath, FileMode.Open, FileAccess.Read); + IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream); + //获取结果 + DataSet result = excelReader.AsDataSet(); + + int oneRows = result.Tables[0].Rows.Count; //行数 + + Dictionary dict_Question = new Dictionary(); + Dictionary dict_Menu = new Dictionary(); + + #endregion + + #region 通过遍历一遍表格所有行的第一列【序号】不为空 + + int VoiceCount = 0; + for (int i = 0; i < oneRows; i++) + { + string key = FilterTo(result.Tables[0].Rows[i][0].ToString()); + if (!string.IsNullOrEmpty(key)) + { + VoiceCount++; + } + } + + #endregion + + // 条件判断 + /*if (newDataName == null) + { + return; + } + else if(newDataName == "") + { + + }*/ + #region AudioTableData + + #region 遍历表格相应的数据转换成数据 + + List messageInfos = new List(); + for (int i = 1; i < VoiceCount; i++) + { + AudioTableData.MessageInfo messageInfo = new AudioTableData.MessageInfo(); + //获取对话块 + messageInfo.index = i - 1; + //文件名称 + messageInfo.name = FilterTo(result.Tables[0].Rows[i][0].ToString()); + //获取内容 + messageInfo.nameMessage = FilterTo(result.Tables[0].Rows[i][1].ToString()); + //添加数据 + messageInfos.Add(messageInfo); + } + + #endregion + + ScriptObjectSave("AudioTableData", (data) => + { + data.infos = new List(); + data.infos = messageInfos; + }); + + #endregion + } + + /// + /// 过滤:去掉首尾空格和换行符【\n】 + /// + private static string FilterTo(string self) + { + self = self.TrimStart(); + self = self.TrimEnd(); + self = self.Replace("\n", ""); + return self; + } + + /// + /// ScriptObject数据保存类 + /// + /// + /// 写入数据的一个回调 + /// + private static void ScriptObjectSave(string assetName, Action action) where T : ScriptableObject + { + string jsonPath = $"{Assetpath}{assetName}.asset"; + if (File.Exists(jsonPath)) + { + EditorFrameworkUtils.DeleteFile(Assetpath, assetName + ".asset"); + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + } + + jsonPath = jsonPath.Substring(jsonPath.IndexOf("Assets")); + // Debug.Log($"要创建的为{jsonPath}"); + var data = ScriptableObject.CreateInstance(); + //放写入数据操作 + action.Invoke(data); + + AssetDatabase.CreateAsset(data, jsonPath); + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + } + + #endregion + + /// + /// 获取Doc文件夹的路径 + /// + /// + private string GetDocFolderPath() + { + // 获取 Assets 文件夹的路径 + string assetsPath = Application.dataPath; + + // 获取项目的根目录路径 + string projectRootPath = Path.GetDirectoryName(assetsPath); + + // 构造 Doc 文件夹的路径 + string docFolderPath = Path.Combine(projectRootPath, "Doc"); + + return docFolderPath; + } + + /// + /// 获取Doc文件夹下所有的Exsl名 + /// + /// + private List GetBuildExslNames() + { + string docFolderPath = GetDocFolderPath(); + + // 检查 Doc 文件夹是否存在 + if (!Directory.Exists(docFolderPath)) + { + Debug.LogError($"UnityEvo:Doc 文件夹不存在,请检查路径:{docFolderPath}"); + return null; + } + + List result = new List(); + + // 遍历 Doc 文件夹中的所有 .xlsx 文件 + string[] xlsxFiles = Directory.GetFiles(docFolderPath, "*.xlsx"); + + result = xlsxFiles.Select(file => Path.GetFileNameWithoutExtension(file)).ToList(); + + return result; + } + + private void SetBuildExslNames(string newValue) + { + DocFolderPath = Path.Combine(GetDocFolderPath(), newValue + ".xlsx"); + newDataName = newValue; + } + + + /// + /// 获取全部作用域名 + /// + public static List GetCreatDomainAllName() + { + string domainPath = $"{Application.dataPath}/Domain"; + string[] domains; + // 新增目录获取代码 + if (Directory.Exists(domainPath)) + { + var dirInfo = new DirectoryInfo(domainPath); + // 获取直接子目录(不递归) + domains = dirInfo.GetDirectories("*", SearchOption.TopDirectoryOnly) + .Select(d => d.Name) + .ToArray(); + } + else + { + domains = Array.Empty(); + } + + return domains.Select(file => Path.GetFileNameWithoutExtension(file)).ToList(); + } + + private void SetCurrentDomainName(string newValue) + { + Assetpath = Application.dataPath + "/Domain/" + newValue + "/AddressableRes/Config/"; + } + } +} \ No newline at end of file diff --git a/Assets/05.TableTextConversion/Editor/ConvertedExslDataMessage.cs.meta b/Assets/05.TableTextConversion/Editor/ConvertedExslDataMessage.cs.meta new file mode 100644 index 0000000..575f39b --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/ConvertedExslDataMessage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ff5d8ff0135f01143b78a80fca9eb4cb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/EditorFrameworkUtils.cs b/Assets/05.TableTextConversion/Editor/EditorFrameworkUtils.cs new file mode 100644 index 0000000..f9759c5 --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/EditorFrameworkUtils.cs @@ -0,0 +1,482 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using UnityEditor; +using UnityEngine; + +namespace Stary.Evo.TableTextConversion +{ +#if UNITY_EDITOR + /// + /// 文件辅助类 + /// + public static class EditorFrameworkUtils + { + /// + /// 编码方式 + /// + private static readonly Encoding Encoding = Encoding.UTF8; + + /// + /// 递归取得文件夹下文件 + /// + /// + /// + public static void GetFiles(string dir, List list) + { + GetFiles(dir, list, new List()); + } + + /// + /// 递归取得文件夹下文件 + /// + /// + /// + /// + public static void GetFiles(string dir, List list, List fileExtsions) + { + //添加文件 + string[] files = Directory.GetFiles(dir); + if (fileExtsions.Count > 0) + { + foreach (string file in files) + { + string extension = Path.GetExtension(file); + if (extension != null && fileExtsions.Contains(extension)) + { + list.Add(file); + } + } + } + else + { + list.AddRange(files); + } + + //如果是目录,则递归 + DirectoryInfo[] directories = new DirectoryInfo(dir).GetDirectories(); + foreach (DirectoryInfo item in directories) + { + GetFiles(item.FullName, list, fileExtsions); + } + } + + /// + /// 创建文件夹 + /// + public static void CreateFolder() + { + // Directory.CreateDirectory();// + } + + /// + /// 写入文件 + /// + /// 文件名 + /// 文件内容 + public static void WriteFile(string filePath, string content) + { + try + { + var fs = new FileStream(filePath, FileMode.Create); + Encoding encode = Encoding; + //获得字节数组 + byte[] data = encode.GetBytes(content); + //开始写入 + fs.Write(data, 0, data.Length); + //清空缓冲区、关闭流 + fs.Flush(); + fs.Close(); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + + /// + /// 读取文件 + /// + /// + /// + public static string ReadFile(string filePath) + { + return ReadFile(filePath, Encoding); + } + + /// + /// 读取文件 + /// + /// + /// + /// + public static string ReadFile(string filePath, Encoding encoding) + { + using (var sr = new StreamReader(filePath, encoding)) + { + return sr.ReadToEnd(); + } + } + + /// + /// 读取文件 + /// + /// + /// + public static List ReadFileLines(string filePath) + { + var str = new List(); + using (var sr = new StreamReader(filePath, Encoding)) + { + String input; + while ((input = sr.ReadLine()) != null) + { + str.Add(input); + } + } + + return str; + } + + /// + /// 复制文件夹(及文件夹下所有子文件夹和文件) + /// + /// 待复制的文件夹路径 + /// 目标路径 + public static void CopyDirectory(String sourcePath, String destinationPath) + { + var info = new DirectoryInfo(sourcePath); + Directory.CreateDirectory(destinationPath); + foreach (FileSystemInfo fsi in info.GetFileSystemInfos()) + { + String destName = Path.Combine(destinationPath, fsi.Name); + + if (fsi is FileInfo) //如果是文件,复制文件 + File.Copy(fsi.FullName, destName); + else //如果是文件夹,新建文件夹,递归 + { + Directory.CreateDirectory(destName); + CopyDirectory(fsi.FullName, destName); + } + } + } + + /// + /// 删除文件夹(及文件夹下所有子文件夹和文件) + /// + /// + public static void DeleteFolder(string directoryPath) + { + foreach (string d in Directory.GetFileSystemEntries(directoryPath)) + { + if (File.Exists(d)) + { + var fi = new FileInfo(d); + if (fi.Attributes.ToString().IndexOf("ReadOnly", StringComparison.Ordinal) != -1) + fi.Attributes = FileAttributes.Normal; + File.Delete(d); //删除文件 + } + else + DeleteFolder(d); //删除文件夹 + } + + Directory.Delete(directoryPath); //删除空文件夹 + } + + /// + /// 清空文件夹(及文件夹下所有子文件夹和文件) + /// + /// + public static void ClearFolder(string directoryPath) + { + foreach (string d in Directory.GetFileSystemEntries(directoryPath)) + { + if (File.Exists(d)) + { + var fi = new FileInfo(d); + if (fi.Attributes.ToString().IndexOf("ReadOnly", StringComparison.Ordinal) != -1) + fi.Attributes = FileAttributes.Normal; + File.Delete(d); //删除文件 + } + else + DeleteFolder(d); //删除文件夹 + } + } + + /// + /// 取得文件大小,按适当单位转换 + /// + /// + /// + public static string GetFileSize(string filepath) + { + string result = "0KB"; + if (File.Exists(filepath)) + { + var size = new FileInfo(filepath).Length; + int filelength = size.ToString().Length; + if (filelength < 4) + result = size + "byte"; + else if (filelength < 7) + result = Math.Round(Convert.ToDouble(size / 1024d), 2) + "KB"; + else if (filelength < 10) + result = Math.Round(Convert.ToDouble(size / 1024d / 1024), 2) + "MB"; + else if (filelength < 13) + result = Math.Round(Convert.ToDouble(size / 1024d / 1024 / 1024), 2) + "GB"; + else + result = Math.Round(Convert.ToDouble(size / 1024d / 1024 / 1024 / 1024), 2) + "TB"; + return result; + } + + return result; + } + + /// + /// 删除文件. + /// + /// 删除完整文件夹路径. + /// 删除文件的名称. + public static void DeleteFile(string path, string name) + { + File.Delete(path + name); + } + + // /// + // /// 删除文件 + // /// + // /// + // /// + // /// + // public static bool DeleteFiles(string path, string filesName) + // { + // bool isDelete = false; + // try + // { + // if (Directory.Exists(path)) + // { + // if (File.Exists(PathUtil.Build(path, filesName))) + // { + // File.Delete(PathUtil.Build(path, filesName)); + // isDelete = true; + // } + // } + // } + // catch + // { + // return isDelete; + // } + // + // return isDelete; + // } + + /// + /// 删除文件夹下所有子文件夹与文件 + /// + public static void DeleteAllChild(string path, FileAttributes filter) + { + if (!Directory.Exists(path)) + return; + + DirectoryInfo dir = new DirectoryInfo(path); + FileInfo[] files = dir.GetFiles("*"); + for (int i = 0; i < files.Length; ++i) + { + if ((files[i].Attributes & filter) > 0) + continue; + if (File.Exists(files[i].FullName)) + File.Delete(files[i].FullName); + } + + DirectoryInfo[] dirs = dir.GetDirectories("*"); + for (int i = 0; i < dirs.Length; ++i) + { + if ((dirs[i].Attributes & filter) > 0) + continue; + + if (Directory.Exists(dirs[i].FullName)) + Directory.Delete(dirs[i].FullName, true); + } + } + + /// + /// 绝对路径转相对路径 + /// + public static string AbsoluteToRelativePath(string root_path, string absolute_path) + { + absolute_path = absolute_path.Replace('\\', '/'); + int last_idx = absolute_path.LastIndexOf(root_path); + if (last_idx < 0) + return absolute_path; + + int start = last_idx + root_path.Length; + if (absolute_path[start] == '/') + start += 1; + + int length = absolute_path.Length - start; + return absolute_path.Substring(start, length); + } + + /// + /// 获得取除路径扩展名的路径 + /// + public static string GetPathWithoutExtension(this string full_name) + { + int last_idx = full_name.LastIndexOfAny(".".ToCharArray()); + if (last_idx < 0) + return full_name; + + return full_name.Substring(0, last_idx); + } + + /// + /// 将字符串转为大写或小写 + /// + /// + /// + /// + public static string GetUpperOrLower(this string tmp, bool isUpper = true) + { + if (isUpper) + return tmp.ToLower(); + else + return tmp.ToUpper(); + } + /// + /// 判断是否有中文,有转为全拼 + /// + /// + /// + // public static string ChineseToPinYin(string text, bool isfile = true) + // { + // if (HasChinese(text)) + // { + // return ConvertPinYin(text, isfile).GetUpperOrLower().Replace(" ", ""); + // } + // else + // { + // if (isfile) + // text = String.Concat("_", text); + // return text.GetUpperOrLower(); + // } + // } + + /// + /// 判断字符串中是否有中文 + /// + private static bool HasChinese(string s) + { + return Regex.IsMatch(s, "[\u4e00-\u9fbb]"); + } + + /// + /// 汉字转全拼 + /// + // private static string ConvertPinYin(string text, bool isfile = true) + // { + // if (string.IsNullOrEmpty(text)) + // return text; + // + // try + // { + // var sb = new StringBuilder(); + // bool isfirstchinese = false; + // if (HasChinese(text.ToList()[0].ToString())) + // { + // isfirstchinese = true; + // } + // + // for (int i = 0; i < text.ToList().Count; i++) + // { + // if (text.ToList()[i] <= 127) + // sb.Append(text.ToList()[i]); + // else + // sb.Append($"_{NPinyin.Pinyin.GetPinyin(text.ToList()[i])}_"); + // } + // + // var name = sb.ToString().Replace("__", "_"); + // if (!isfile) //裁剪首尾字符“_” + // { + // name = name.Trim('_'); + // } + // else + // { + // name = name.TrimEnd('_'); + // if (!isfirstchinese) + // name = String.Concat("_", name); + // } + // + // return name; + // } + // catch (Exception e) + // { + // Debug.LogError($"拼音转换失败:{text} {e.Message}"); + // } + // + // return text; + // } + + /// + /// 删除指定字符后的字符串 + /// + /// 字符串 + /// 符号例如:“ .” + /// + public static string DeleteLastIndex(string fileName, string lastIndex) + { + int index = fileName.LastIndexOf(lastIndex); + if (index >= 0) + { + fileName = fileName.Substring(0, index); + } + + return fileName; + } + + /// + /// 带颜色的日志输出 + /// + public static void LogColor(string s, string path = null, Color color = default) + { + if (string.IsNullOrEmpty(path)) + Debug.Log($"{s}"); + else + { + string assetPath = s.Replace("\\", "/").Replace(Application.dataPath, "Assets"); + Debug.Log($"{assetPath}", + AssetDatabase.LoadAssetAtPath(assetPath)); + } + } + + /// + /// 过滤:去掉首尾空格和换行符【\n】 + /// + private static string FilterTo(string self) + { + self = self.TrimStart(); + self = self.TrimEnd(); + self = self.Replace("\n", ""); + return self; + } + + /// + /// 获取Assets下带.meta文件的资源的路径 + /// + /// 文件夹、资源 + private static string[] GetPathsOfAssetsObject(string objectName) + { + string[] guids = AssetDatabase.FindAssets(objectName); + string[] paths = new string[guids.Length]; + for (int i = 0; i < guids.Length; i++) + { + string path = AssetDatabase.GUIDToAssetPath(guids[i]); + if (path.Contains("Assets")) + paths[i] = path; + } + + return paths; + } + } +#endif +} \ No newline at end of file diff --git a/Assets/05.TableTextConversion/Editor/EditorFrameworkUtils.cs.meta b/Assets/05.TableTextConversion/Editor/EditorFrameworkUtils.cs.meta new file mode 100644 index 0000000..8a71ad4 --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/EditorFrameworkUtils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 46cba106b812e6244a8d564849dd290a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel.meta b/Assets/05.TableTextConversion/Editor/Excel.meta new file mode 100644 index 0000000..2b93ebe --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4f1217f9aa6674740afe51db32d6d46f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel/EPPlus.dll b/Assets/05.TableTextConversion/Editor/Excel/EPPlus.dll new file mode 100644 index 0000000..39e6295 Binary files /dev/null and b/Assets/05.TableTextConversion/Editor/Excel/EPPlus.dll differ diff --git a/Assets/05.TableTextConversion/Editor/Excel/EPPlus.dll.meta b/Assets/05.TableTextConversion/Editor/Excel/EPPlus.dll.meta new file mode 100644 index 0000000..e1def9c --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel/EPPlus.dll.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 7dfb627e8ab8af84c92cc52d66888c25 +timeCreated: 1453536009 +licenseType: Pro +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel/Excel.dll b/Assets/05.TableTextConversion/Editor/Excel/Excel.dll new file mode 100644 index 0000000..06c249b Binary files /dev/null and b/Assets/05.TableTextConversion/Editor/Excel/Excel.dll differ diff --git a/Assets/05.TableTextConversion/Editor/Excel/Excel.dll.meta b/Assets/05.TableTextConversion/Editor/Excel/Excel.dll.meta new file mode 100644 index 0000000..cf00fa7 --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel/Excel.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: b6f487270cfb1cb44bc5b5c70462786f +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N.meta b/Assets/05.TableTextConversion/Editor/Excel/I18N.meta new file mode 100644 index 0000000..9326d14 --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel/I18N.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: a0ddbcdd27271534b8277ca2bddffca7 +folderAsset: yes +timeCreated: 1531104110 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.CJK.dll b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.CJK.dll new file mode 100644 index 0000000..e39be98 Binary files /dev/null and b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.CJK.dll differ diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.CJK.dll.meta b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.CJK.dll.meta new file mode 100644 index 0000000..b060045 --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.CJK.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 7e3f17ca90ece22438eaaf291cdf55d0 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.MidEast.dll b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.MidEast.dll new file mode 100644 index 0000000..43276d2 Binary files /dev/null and b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.MidEast.dll differ diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.MidEast.dll.meta b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.MidEast.dll.meta new file mode 100644 index 0000000..b6783eb --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.MidEast.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 62dd34932f2b9034985e3802a02e3312 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Other.dll b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Other.dll new file mode 100644 index 0000000..f8a680e Binary files /dev/null and b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Other.dll differ diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Other.dll.meta b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Other.dll.meta new file mode 100644 index 0000000..04bc174 --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Other.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 78c1f6d64a65d7746893d7863c4190da +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Rare.dll b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Rare.dll new file mode 100644 index 0000000..8aa4c1b Binary files /dev/null and b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Rare.dll differ diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Rare.dll.meta b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Rare.dll.meta new file mode 100644 index 0000000..3c43864 --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.Rare.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: e574b19de6650b9468301fdc43ed0e75 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.West.dll b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.West.dll new file mode 100644 index 0000000..6046648 Binary files /dev/null and b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.West.dll differ diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.West.dll.meta b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.West.dll.meta new file mode 100644 index 0000000..c289e71 --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.West.dll.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 6be8b9ff3c2d68b4c93997d421034d15 +timeCreated: 1531103978 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.dll b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.dll new file mode 100644 index 0000000..43977bc Binary files /dev/null and b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.dll differ diff --git a/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.dll.meta b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.dll.meta new file mode 100644 index 0000000..c4aab72 --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel/I18N/I18N.dll.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: fa2a07ff605e5664a830c8247ce1f8d0 +timeCreated: 1531103979 +licenseType: Pro +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/Editor/Excel/ICSharpCode.SharpZipLib.dll b/Assets/05.TableTextConversion/Editor/Excel/ICSharpCode.SharpZipLib.dll new file mode 100644 index 0000000..e829ebf Binary files /dev/null and b/Assets/05.TableTextConversion/Editor/Excel/ICSharpCode.SharpZipLib.dll differ diff --git a/Assets/05.TableTextConversion/Editor/Excel/ICSharpCode.SharpZipLib.dll.meta b/Assets/05.TableTextConversion/Editor/Excel/ICSharpCode.SharpZipLib.dll.meta new file mode 100644 index 0000000..9764745 --- /dev/null +++ b/Assets/05.TableTextConversion/Editor/Excel/ICSharpCode.SharpZipLib.dll.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 92cce7f762d252b40853ec8cfca85b7c +timeCreated: 1453461718 +licenseType: Pro +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/README.md b/Assets/05.TableTextConversion/README.md index 39fa340..daa9555 100644 --- a/Assets/05.TableTextConversion/README.md +++ b/Assets/05.TableTextConversion/README.md @@ -1 +1 @@ -# 代码检查工具 +# 表格转化工具 diff --git a/Assets/05.TableTextConversion/RunTime/Abstract.meta b/Assets/05.TableTextConversion/RunTime/Abstract.meta new file mode 100644 index 0000000..09fe492 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Abstract.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f4958b2707b1874fb59e045842881b7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/RunTime/Abstract/ITableData.cs b/Assets/05.TableTextConversion/RunTime/Abstract/ITableData.cs new file mode 100644 index 0000000..607bc5b --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Abstract/ITableData.cs @@ -0,0 +1,12 @@ +namespace Stary.Evo.TableTextConversion +{ + public interface ITableData + { + public string TableName { get; } + } + public enum TableName + { + AudioTableData, + AudioTextData + } +} \ No newline at end of file diff --git a/Assets/05.TableTextConversion/RunTime/Abstract/ITableData.cs.meta b/Assets/05.TableTextConversion/RunTime/Abstract/ITableData.cs.meta new file mode 100644 index 0000000..e649e12 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Abstract/ITableData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 33bd2c65630947399d1eb3e8c3e454c1 +timeCreated: 1743415380 \ No newline at end of file diff --git a/Assets/05.TableTextConversion/RunTime/Base.meta b/Assets/05.TableTextConversion/RunTime/Base.meta new file mode 100644 index 0000000..4da0968 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Base.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f458924b47972e344ab95e73c17cec83 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/RunTime/Base/AudioTableData.cs b/Assets/05.TableTextConversion/RunTime/Base/AudioTableData.cs new file mode 100644 index 0000000..7c47062 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Base/AudioTableData.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Sirenix.OdinInspector; +using UnityEngine; + +namespace Stary.Evo.TableTextConversion +{ + public class AudioTableData : ScriptableObject, ITableData + { + public string TableName { get; } + public List infos; + + [Serializable] + public class MessageInfo + { + // 序号 + [GUIColor(0, 1, 0)] public int index; + // 名称 + public string name; + // 名称描述 + public string nameMessage; + } + } +} \ No newline at end of file diff --git a/Assets/05.TableTextConversion/RunTime/Base/AudioTableData.cs.meta b/Assets/05.TableTextConversion/RunTime/Base/AudioTableData.cs.meta new file mode 100644 index 0000000..aa05671 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Base/AudioTableData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2123856275778e24ebda59ff88f2d153 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/RunTime/Base/UITableData.cs b/Assets/05.TableTextConversion/RunTime/Base/UITableData.cs new file mode 100644 index 0000000..dc96d01 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Base/UITableData.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Sirenix.OdinInspector; +using UnityEngine; + +namespace Stary.Evo.TableTextConversion +{ + public class UITableData : ScriptableObject, ITableData + { + public string TableName { get; } + public List infos; + + [Serializable] + public class MessageInfo + { + // 序号 + [GUIColor(0, 1, 0)] public int index; + // 名称 + public string name; + // 名称描述 + public string nameMessage; + } + } +} \ No newline at end of file diff --git a/Assets/05.TableTextConversion/RunTime/Base/UITableData.cs.meta b/Assets/05.TableTextConversion/RunTime/Base/UITableData.cs.meta new file mode 100644 index 0000000..a5ce228 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Base/UITableData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d87122eaab924cad9155ee33a31ebcc3 +timeCreated: 1743496104 \ No newline at end of file diff --git a/Assets/05.TableTextConversion/RunTime/Test.cs b/Assets/05.TableTextConversion/RunTime/Test.cs new file mode 100644 index 0000000..203c8d4 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Test.cs @@ -0,0 +1,34 @@ +using System.Collections; +using System.Collections.Generic; +using System.Threading.Tasks; +using UnityEngine; +using Stary.Evo.TableTextConversion; + +public class Test : MonoBehaviour +{ + // Start is called before the first frame update + /*async void Start() + { + Task audioTableData = ReadDumpInformation.Read(); + await audioTableData; + AudioTableData data = audioTableData.Result; + if (data != null) + { + Debug.Log($"UnityEvo:{data.infos[3].name}"); + } + }*/ + void Start() + { + AudioTableData audioTableData = ReadDumpInformation.ReadInEditor(); + if (audioTableData != null) + { + Debug.Log($"UnityEvo:{audioTableData.infos[3].name}"); + } + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/05.TableTextConversion/RunTime/Test.cs.meta b/Assets/05.TableTextConversion/RunTime/Test.cs.meta new file mode 100644 index 0000000..7ac4987 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Test.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5cc8857da4ee2534289add72195af962 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/RunTime/Use.meta b/Assets/05.TableTextConversion/RunTime/Use.meta new file mode 100644 index 0000000..f40c637 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Use.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 102768b9489625641a18c187eac264be +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05.TableTextConversion/RunTime/Use/ReadDumpInformation.cs b/Assets/05.TableTextConversion/RunTime/Use/ReadDumpInformation.cs new file mode 100644 index 0000000..ed9e942 --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Use/ReadDumpInformation.cs @@ -0,0 +1,40 @@ +using System.Threading.Tasks; +using UnityEngine; +using YooAsset; + +namespace Stary.Evo.TableTextConversion +{ + public static class ReadDumpInformation + { + public static async Task Read() where T : ScriptableObject, ITableData + { + var conf = YooAssets.LoadAssetAsync($"Config_{typeof(T).Name}"); + await conf.Task; + if (conf.Status == EOperationStatus.Succeed) + { + return conf.AssetObject as T; + } + else + { + Debug.LogError("UnityEvo:" + "配置文件:" + typeof(T).Name + "加载失败!!!"); + return null; + } + } + +#if UNITY_EDITOR + public static T ReadInEditor() where T : ScriptableObject, ITableData + { + // 同步加载并直接返回结果 + var conf = Resources.Load(typeof(T).Name); + + if (conf != null) + { + return conf; + } + + Debug.LogError($"UnityEvo:配置文件同步加载失败:{typeof(T).Name}"); + return null; + } +#endif + } +} \ No newline at end of file diff --git a/Assets/05.TableTextConversion/RunTime/Use/ReadDumpInformation.cs.meta b/Assets/05.TableTextConversion/RunTime/Use/ReadDumpInformation.cs.meta new file mode 100644 index 0000000..f01478d --- /dev/null +++ b/Assets/05.TableTextConversion/RunTime/Use/ReadDumpInformation.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 64089130470a47d496bd6c8168cd95f6 +timeCreated: 1743415570 \ No newline at end of file diff --git a/Assets/05.TableTextConversion/package.json b/Assets/05.TableTextConversion/package.json index 343cd5f..099b0be 100644 --- a/Assets/05.TableTextConversion/package.json +++ b/Assets/05.TableTextConversion/package.json @@ -1,10 +1,10 @@ { - "name": "com.staryevo.tabletextconversion", - "version": "1.0.0", + "name": "com.staryevo.codechecker", + "version": "1.0.1", "displayName": "05.TableTextConversion", - "description": "配置导出工具", + "description": "表格转化工具", "unity": "2021.3", - "unityRelease": "30f1", + "unityRelease": "23f1", "keywords": [ "unity", "scirpt"