diff --git a/Assets/Unity-Tools/ExcelResolver/Editor/Core/Data/ClassCodeData.cs b/Assets/Unity-Tools/ExcelResolver/Editor/Core/Data/ClassCodeData.cs index 84e5345..c8726bc 100644 --- a/Assets/Unity-Tools/ExcelResolver/Editor/Core/Data/ClassCodeData.cs +++ b/Assets/Unity-Tools/ExcelResolver/Editor/Core/Data/ClassCodeData.cs @@ -12,7 +12,7 @@ namespace Tools.ExcelResolver.Editor public ClassCodeData(string className) { - this.className = $"{char.ToUpper(className[0])}{className.Substring(1)}"; + this.className = $"{className.Trim()}"; } public void Dispose() diff --git a/Assets/Unity-Tools/ExcelResolver/Editor/ExcelResolverEditorWindow.ReadExcel.cs b/Assets/Unity-Tools/ExcelResolver/Editor/ExcelResolverEditorWindow.ReadExcel.cs index 5e8e686..c84f667 100644 --- a/Assets/Unity-Tools/ExcelResolver/Editor/ExcelResolverEditorWindow.ReadExcel.cs +++ b/Assets/Unity-Tools/ExcelResolver/Editor/ExcelResolverEditorWindow.ReadExcel.cs @@ -4,10 +4,12 @@ using System.IO; using System.Linq; using System.Security.Cryptography; using OfficeOpenXml; +using Tools.Editor; using UnityEditor; using UnityEditor.Compilation; using UnityEngine; using UnityEngine.Assertions; +using FileUtil = UnityEditor.FileUtil; namespace Tools.ExcelResolver.Editor { @@ -19,8 +21,17 @@ namespace Tools.ExcelResolver.Editor // 获取Excel文件 excelResolverConfig.MakeSureDirectory(); - var excelFiles = new DirectoryInfo(excelResolverConfig.ExcelPathRoot).GetFiles("*.xlsx") - .Where(f => !f.Name.StartsWith("~$") && !f.Name.StartsWith("_")); + var removeFiles = new DirectoryInfo(excelResolverConfig.SOPathRoot).GetDirectories(); + var excelFiles = new DirectoryInfo(excelResolverConfig.ExcelPathRoot).GetFiles("*.xlsx").Where(f => !f.Name.StartsWith("~$") && !f.Name.StartsWith("_")); + + removeFiles = removeFiles.Where(f => excelFiles.All(ef => ef.Name[..^5] != f.Name)).ToArray(); + foreach (var removeFile in removeFiles) + { + DirectoryUtil.DeleteDirectory(removeFile.FullName); + Debug.Log($"删除文件夹:'{removeFile.Name}'"); + FileUtil.DeleteFileOrDirectory($"{excelResolverConfig.CodePathRoot}/{removeFile.Name}.cs"); + FileUtil.DeleteFileOrDirectory($"{excelResolverConfig.CodePathRoot}/{removeFile.Name}Util.cs"); + } if (excelFiles.Count() == 0) { Debug.LogError("未检测到Excel文件,请检查路径"); diff --git a/Assets/Unity-Tools/ExcelResolver/Editor/ExcelResolverEditorWindow.WriteUtilSO.cs b/Assets/Unity-Tools/ExcelResolver/Editor/ExcelResolverEditorWindow.WriteUtilSO.cs index 057c6ff..8e0a53b 100644 --- a/Assets/Unity-Tools/ExcelResolver/Editor/ExcelResolverEditorWindow.WriteUtilSO.cs +++ b/Assets/Unity-Tools/ExcelResolver/Editor/ExcelResolverEditorWindow.WriteUtilSO.cs @@ -174,6 +174,7 @@ namespace Tools.ExcelResolver.Editor } else { + Debug.LogError($"没有资产可以写入 {classCodeData.className}Util."); instance.GetType().GetField("Data").SetValue(instance, null); } diff --git a/Assets/_Project/ExcelResolver/Excel/_com.xlsx b/Assets/_Project/ExcelResolver/Excel/com.xlsx similarity index 100% rename from Assets/_Project/ExcelResolver/Excel/_com.xlsx rename to Assets/_Project/ExcelResolver/Excel/com.xlsx diff --git a/Assets/_Project/ExcelResolver/Excel/_com.xlsx.meta b/Assets/_Project/ExcelResolver/Excel/com.xlsx.meta similarity index 100% rename from Assets/_Project/ExcelResolver/Excel/_com.xlsx.meta rename to Assets/_Project/ExcelResolver/Excel/com.xlsx.meta diff --git a/Assets/_Project/ExcelResolver/Excel/_monster3.xlsx b/Assets/_Project/ExcelResolver/Excel/monster3.xlsx similarity index 100% rename from Assets/_Project/ExcelResolver/Excel/_monster3.xlsx rename to Assets/_Project/ExcelResolver/Excel/monster3.xlsx diff --git a/Assets/_Project/ExcelResolver/Excel/_monster3.xlsx.meta b/Assets/_Project/ExcelResolver/Excel/monster3.xlsx.meta similarity index 100% rename from Assets/_Project/ExcelResolver/Excel/_monster3.xlsx.meta rename to Assets/_Project/ExcelResolver/Excel/monster3.xlsx.meta diff --git a/Assets/_Project/ScriptableObject/Excel/Monster2/Monster2_1_1_1.asset b/Assets/_Project/ScriptableObject/Excel/Monster2/Monster2_1_1_1.asset index ea239af..ea2567c 100644 --- a/Assets/_Project/ScriptableObject/Excel/Monster2/Monster2_1_1_1.asset +++ b/Assets/_Project/ScriptableObject/Excel/Monster2/Monster2_1_1_1.asset @@ -10,7 +10,7 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: a576b35de94d3344d8fbd0763d6dd001, type: 3} - m_Name: Monster2_1_1_1 + m_Name: monster2_1_1_1 m_EditorClassIdentifier: serializationData: SerializedFormat: 2 diff --git a/Assets/_Project/ScriptableObject/Excel/Monster2/_Monster2Util.asset b/Assets/_Project/ScriptableObject/Excel/Monster2/_Monster2Util.asset index b6d2be6..6aa2880 100644 --- a/Assets/_Project/ScriptableObject/Excel/Monster2/_Monster2Util.asset +++ b/Assets/_Project/ScriptableObject/Excel/Monster2/_Monster2Util.asset @@ -10,7 +10,7 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 7198c6febd43b3e4e9bc3d03adee7ca6, type: 3} - m_Name: _Monster2Util + m_Name: _monster2Util m_EditorClassIdentifier: serializationData: SerializedFormat: 2 @@ -25,7 +25,7 @@ MonoBehaviour: - Name: Data Entry: 7 Data: 0|System.Collections.Generic.Dictionary`2[[System.ValueTuple`3[[System.Int32, - mscorlib],[System.Int32, mscorlib],[System.Int32, mscorlib]], mscorlib],[Tools.ExcelResolver.Monster2, + mscorlib],[System.Int32, mscorlib],[System.Int32, mscorlib]], mscorlib],[Tools.ExcelResolver.monster2, Assembly-CSharp]], mscorlib - Name: comparer Entry: 7 diff --git a/Assets/_Project/ScriptableObject/Excel/com.meta b/Assets/_Project/ScriptableObject/Excel/com.meta new file mode 100644 index 0000000..1826f9d --- /dev/null +++ b/Assets/_Project/ScriptableObject/Excel/com.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5d697dbce85032d4dba2a90d7bb50290 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Project/ScriptableObject/Excel/com/_comUtil.asset b/Assets/_Project/ScriptableObject/Excel/com/_comUtil.asset new file mode 100644 index 0000000..4a52389 --- /dev/null +++ b/Assets/_Project/ScriptableObject/Excel/com/_comUtil.asset @@ -0,0 +1,26 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 65d0d896e6a9aba4c86524d1ead223f2, type: 3} + m_Name: _comUtil + m_EditorClassIdentifier: + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: [] + cangku_chushi: 3 + des_xishu: 2 + ta_chushi_unlock: 01000000cc00000091010000cb000000 diff --git a/Assets/_Project/ScriptableObject/Excel/com/_comUtil.asset.meta b/Assets/_Project/ScriptableObject/Excel/com/_comUtil.asset.meta new file mode 100644 index 0000000..8a6c35f --- /dev/null +++ b/Assets/_Project/ScriptableObject/Excel/com/_comUtil.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7ee0eb7708acae845ae0445697042da4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Project/ScriptableObject/Excel/monster3.meta b/Assets/_Project/ScriptableObject/Excel/monster3.meta new file mode 100644 index 0000000..6be9a0b --- /dev/null +++ b/Assets/_Project/ScriptableObject/Excel/monster3.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f681dec3cba786f4ba476100c5a6f29e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Project/ScriptableObject/Excel/monster3/_monster3Util.asset b/Assets/_Project/ScriptableObject/Excel/monster3/_monster3Util.asset new file mode 100644 index 0000000..b576193 --- /dev/null +++ b/Assets/_Project/ScriptableObject/Excel/monster3/_monster3Util.asset @@ -0,0 +1,24 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 352ae4160560b684498c8ef06a908f94, type: 3} + m_Name: _monster3Util + m_EditorClassIdentifier: + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: [] + Data: [] diff --git a/Assets/_Project/ScriptableObject/Excel/monster3/_monster3Util.asset.meta b/Assets/_Project/ScriptableObject/Excel/monster3/_monster3Util.asset.meta new file mode 100644 index 0000000..9264955 --- /dev/null +++ b/Assets/_Project/ScriptableObject/Excel/monster3/_monster3Util.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3648edb4f0c677a4485b6b4c2deef683 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Project/Scripts/Generator/Excel/Monster2.cs b/Assets/_Project/Scripts/Generator/Excel/Monster2.cs index 4db84d8..52ff47a 100644 --- a/Assets/_Project/Scripts/Generator/Excel/Monster2.cs +++ b/Assets/_Project/Scripts/Generator/Excel/Monster2.cs @@ -17,7 +17,7 @@ namespace Tools.ExcelResolver using Sirenix.OdinInspector; - public class Monster2 : SerializedScriptableObject, IExcelSOData + public class monster2 : SerializedScriptableObject, IExcelSOData { /// diff --git a/Assets/_Project/Scripts/Generator/Excel/Monster2Util.cs b/Assets/_Project/Scripts/Generator/Excel/Monster2Util.cs index fab1303..6d12712 100644 --- a/Assets/_Project/Scripts/Generator/Excel/Monster2Util.cs +++ b/Assets/_Project/Scripts/Generator/Excel/Monster2Util.cs @@ -17,9 +17,9 @@ namespace Tools.ExcelResolver using Sirenix.OdinInspector; - public class Monster2Util : SerializedScriptableObject, IExcelSOUtil + public class monster2Util : SerializedScriptableObject, IExcelSOUtil { - public Dictionary<(System.Int32, System.Int32, System.Int32), Monster2> Data; + public Dictionary<(System.Int32, System.Int32, System.Int32), monster2> Data; } } diff --git a/Assets/_Project/Scripts/Generator/Excel/comUtil.cs b/Assets/_Project/Scripts/Generator/Excel/comUtil.cs new file mode 100644 index 0000000..0183be7 --- /dev/null +++ b/Assets/_Project/Scripts/Generator/Excel/comUtil.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tools.ExcelResolver +{ + using System; + using System.Collections; + using System.Collections.Generic; + using UnityEngine; + using Sirenix.OdinInspector; + + + public class comUtil : SerializedScriptableObject, IExcelSOUtil + { + + /// + /// 初始仓库空位数 + /// + public int cangku_chushi; + + /// + /// 防御系数 + /// + public int des_xishu; + + /// + /// 初始解锁的塔 + /// + public List ta_chushi_unlock; + } +} diff --git a/Assets/_Project/Scripts/Generator/Excel/comUtil.cs.meta b/Assets/_Project/Scripts/Generator/Excel/comUtil.cs.meta new file mode 100644 index 0000000..0090571 --- /dev/null +++ b/Assets/_Project/Scripts/Generator/Excel/comUtil.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 65d0d896e6a9aba4c86524d1ead223f2 \ No newline at end of file diff --git a/Assets/_Project/Scripts/Generator/Excel/monster3.cs b/Assets/_Project/Scripts/Generator/Excel/monster3.cs new file mode 100644 index 0000000..8b0bf5b --- /dev/null +++ b/Assets/_Project/Scripts/Generator/Excel/monster3.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tools.ExcelResolver +{ + using System; + using System.Collections; + using System.Collections.Generic; + using UnityEngine; + using Sirenix.OdinInspector; + + + public class monster3 : SerializedScriptableObject, IExcelSOData + { + + /// + /// 英雄 + /// + public int id; + + /// + /// 等级 + /// + public int level; + + /// + /// 星级 + /// + public int star; + + /// + /// 名称 + /// + public string name; + + /// + /// icon + /// + public string icon; + + /// + /// 有宠物 + /// + public bool has; + + /// + /// 血量 + /// + public int hp; + + /// + /// 攻击力 + /// + public int atk; + + /// + /// 移速 + /// + public float speed; + + /// + /// 位置 + /// + public Vector3 pos; + + /// + /// 位置 + /// + public Vector2 ches; + + /// + /// 攻击优先级 + /// + public List attack_target; + + /// + /// 你好 + /// + public Dictionary nihao; + + /// + /// + /// + public Dictionary attribute; + + /// + /// + /// + public CustomizeColor color; + } +} diff --git a/Assets/_Project/Scripts/Generator/Excel/monster3.cs.meta b/Assets/_Project/Scripts/Generator/Excel/monster3.cs.meta new file mode 100644 index 0000000..61a1cf0 --- /dev/null +++ b/Assets/_Project/Scripts/Generator/Excel/monster3.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 916e0a5dbd451394bb4ac42b142bbb9d \ No newline at end of file diff --git a/Assets/_Project/Scripts/Generator/Excel/monster3Util.cs b/Assets/_Project/Scripts/Generator/Excel/monster3Util.cs new file mode 100644 index 0000000..4fffffd --- /dev/null +++ b/Assets/_Project/Scripts/Generator/Excel/monster3Util.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tools.ExcelResolver +{ + using System; + using System.Collections; + using System.Collections.Generic; + using UnityEngine; + using Sirenix.OdinInspector; + + + public class monster3Util : SerializedScriptableObject, IExcelSOUtil + { + + public List Data; + } +} diff --git a/Assets/_Project/Scripts/Generator/Excel/monster3Util.cs.meta b/Assets/_Project/Scripts/Generator/Excel/monster3Util.cs.meta new file mode 100644 index 0000000..9bee5c4 --- /dev/null +++ b/Assets/_Project/Scripts/Generator/Excel/monster3Util.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 352ae4160560b684498c8ef06a908f94 \ No newline at end of file