diff options
18 files changed, 160 insertions, 35 deletions
diff --git a/WorldlineKeepers/Assets/Bundle/metadata/filelist.csv b/WorldlineKeepers/Assets/Bundle/metadata/filelist.csv index c7acbf6..d41b78e 100644 --- a/WorldlineKeepers/Assets/Bundle/metadata/filelist.csv +++ b/WorldlineKeepers/Assets/Bundle/metadata/filelist.csv @@ -1,6 +1,29 @@ key,type,root,path +,,, "#type: 0-csv, 1-json, 2-txt",,, "#root: 0-bundle, 1-streaming, 2-persistent",,, +,,, +#CSV ,,, default_stats,0,0,metadata/default_stats.csv default_buffs,0,0,metadata/default_buffs.csv default_items,0,0,metadata/default_items.csv +,,, +#Prefabs,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +,,, +#Sprites,,, diff --git a/WorldlineKeepers/Assets/Bundle/stages.meta b/WorldlineKeepers/Assets/Bundle/stages.meta new file mode 100644 index 0000000..231bbd8 --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/stages.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 02bf86416713ad248828f51590f74f53 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Bundle/stages/readme.txt b/WorldlineKeepers/Assets/Bundle/stages/readme.txt new file mode 100644 index 0000000..e1640bb --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/stages/readme.txt @@ -0,0 +1 @@ +关卡
\ No newline at end of file diff --git a/WorldlineKeepers/Assets/Bundle/stages/readme.txt.meta b/WorldlineKeepers/Assets/Bundle/stages/readme.txt.meta new file mode 100644 index 0000000..b4b7f91 --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/stages/readme.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2286d872f3c027448810c815b0ba7939 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Bundle/stages/stage0.meta b/WorldlineKeepers/Assets/Bundle/stages/stage0.meta new file mode 100644 index 0000000..75ee6f6 --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/stages/stage0.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 778eff8a64bca644a950efa6067c3700 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Bundle/stages/stage0/stage.json b/WorldlineKeepers/Assets/Bundle/stages/stage0/stage.json new file mode 100644 index 0000000..4eb7c3f --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/stages/stage0/stage.json @@ -0,0 +1,3 @@ +{ + +}
\ No newline at end of file diff --git a/WorldlineKeepers/Assets/Bundle/stages/stage0/stage.json.meta b/WorldlineKeepers/Assets/Bundle/stages/stage0/stage.json.meta new file mode 100644 index 0000000..dc7985d --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/stages/stage0/stage.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2ef234317b0a618409cb5f7409133248 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Bundle/stages/stage1.meta b/WorldlineKeepers/Assets/Bundle/stages/stage1.meta new file mode 100644 index 0000000..e10d369 --- /dev/null +++ b/WorldlineKeepers/Assets/Bundle/stages/stage1.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d5b982ab99af64740a4fdf5de6433c49 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Editor/GenerateFileKey.cs b/WorldlineKeepers/Assets/Editor/GenerateFileKey.cs new file mode 100644 index 0000000..bec1374 --- /dev/null +++ b/WorldlineKeepers/Assets/Editor/GenerateFileKey.cs @@ -0,0 +1,51 @@ +using System.IO; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using WK.Data; + +namespace WK +{ + + public class GenerateFileKey + { + private static string targetFile = "Assets/Scripts/Data/Metadata/FileKey.cs"; + + [MenuItem("Tools/生成FileKey.cs")] + public static void EditorGenerateFileKey() + { + TextAsset text = ResourceManager.Instance.LoadAsset<TextAsset>(StaticDefine.FileList); + string content = text.text; + List<FileDescriptor> files = CSVReader.Read<FileDescriptor>(content); + Dictionary<string/*EFileKey*/, FileDescriptor> filelist = new Dictionary<string, FileDescriptor>(); + CSVReader.ReadDictionary<string, FileDescriptor>(filelist, content, "key"); + if(filelist.Count > 0) + { + if (File.Exists(targetFile)) + { + File.Delete(targetFile); + } + FileStream fs = File.Create(targetFile); + using (StreamWriter writer = new StreamWriter(fs)) + { + writer.WriteLine("// 自动生成"); + writer.WriteLine("namespace WK.Data"); + writer.WriteLine("{"); + writer.WriteLine("\tpublic enum EFileKey"); + writer.WriteLine("\t{"); + writer.WriteLine("\t\tnone = 0,\n"); + foreach(var kv in filelist) + { + writer.WriteLine("\t\t" + kv.Key + ","); + } + writer.WriteLine("\n\t\tall"); + writer.WriteLine("\t}"); + writer.WriteLine("}"); + } + } + } + + } + +} diff --git a/WorldlineKeepers/Assets/Editor/GenerateFileKey.cs.meta b/WorldlineKeepers/Assets/Editor/GenerateFileKey.cs.meta new file mode 100644 index 0000000..180fc9d --- /dev/null +++ b/WorldlineKeepers/Assets/Editor/GenerateFileKey.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6ed96edb19890924a93d28a72ab8a7c3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Battle/Metadata/StageMetadata.cs b/WorldlineKeepers/Assets/Scripts/Battle/Metadata/StageMetadata.cs index b530390..1fc5c2a 100644 --- a/WorldlineKeepers/Assets/Scripts/Battle/Metadata/StageMetadata.cs +++ b/WorldlineKeepers/Assets/Scripts/Battle/Metadata/StageMetadata.cs @@ -11,7 +11,7 @@ namespace WK.Data /// </summary> public abstract class StageEntityMetadatas { - public string entityId; + public string entityId; // óеĶ } public class StageDesc @@ -36,3 +36,4 @@ namespace WK.Data } } + diff --git a/WorldlineKeepers/Assets/Scripts/Battle/SceneManager.cs b/WorldlineKeepers/Assets/Scripts/Battle/SceneManager.cs index ac800ee..15fc861 100644 --- a/WorldlineKeepers/Assets/Scripts/Battle/SceneManager.cs +++ b/WorldlineKeepers/Assets/Scripts/Battle/SceneManager.cs @@ -10,18 +10,13 @@ namespace WK /// </summary> public class GameSceneManager : Singleton<GameSceneManager> { - private AsyncOperation m_AsyncOpt = null; - public AsyncOperation AsyncOpt - { - get - { - return m_AsyncOpt; - } - } + private AsyncOperation m_SceneOpt = null; + public AsyncOperation sceneOpt => m_SceneOpt; - public void LoadScene(string sceneName, UnityEngine.SceneManagement.LoadSceneMode loadMode = UnityEngine.SceneManagement.LoadSceneMode.Single) + public AsyncOperation LoadScene(string sceneName, UnityEngine.SceneManagement.LoadSceneMode loadMode = UnityEngine.SceneManagement.LoadSceneMode.Single) { - m_AsyncOpt = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneName, loadMode); + m_SceneOpt = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneName, loadMode); + return m_SceneOpt; } diff --git a/WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs index d16c785..6e12d6e 100644 --- a/WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs +++ b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs @@ -11,7 +11,7 @@ namespace WK.Data public partial class DataManager : Singleton<DataManager> { // ļб - private Dictionary<string/*EFileKey*/, MetadataFileDescriptor> m_Filelist = new Dictionary<string, MetadataFileDescriptor>(); + private Dictionary<string/*EFileKey*/, FileDescriptor> m_Filelist = new Dictionary<string, FileDescriptor>(); private Dictionary<string/*uid*/, CharacterStatsMetadata> m_CharacterStatsMetadata = new Dictionary<string, CharacterStatsMetadata>(); private Dictionary<string/*uid*/, BuffMetadata> m_BuffMetadata = new Dictionary<string, BuffMetadata>(); diff --git a/WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs index aab90a9..b7fb0b9 100644 --- a/WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs +++ b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs @@ -33,8 +33,8 @@ namespace WK.Data { TextAsset text = ResourceManager.Instance.LoadAsset<TextAsset>(StaticDefine.FileList); string content = text.text; - List<MetadataFileDescriptor> files = CSVReader.Read<MetadataFileDescriptor>(content); - CSVReader.ReadDictionary<string, MetadataFileDescriptor>(m_Filelist, content, "key"); + List<FileDescriptor> files = CSVReader.Read<FileDescriptor>(content); + CSVReader.ReadDictionary<string, FileDescriptor>(m_Filelist, content, "key"); Debug.Log(m_Filelist.Count); } diff --git a/WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs b/WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs index 621203e..2fdff3f 100644 --- a/WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs +++ b/WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs @@ -1,22 +1,14 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - +// 自动生成 namespace WK.Data { + public enum EFileKey + { + none = 0, - /// <summary> - /// Ĭļenumνֲɸġļ - /// </summary> - public enum EFileKey - { - none = 0, - - default_stats, - default_buffs, - default_items, - - all - } + default_stats, + default_buffs, + default_items, + all + } } diff --git a/WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs b/WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs index b91619b..c4ae257 100644 --- a/WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs +++ b/WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs @@ -26,9 +26,9 @@ namespace WK.Data } /// <summary> - /// Ԫļ + /// ļ /// </summary> - public class MetadataFileDescriptor + public class FileDescriptor { public string key; public FileType type; diff --git a/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Dojo.cs b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Dojo.cs index c492c5d..2c8094b 100644 --- a/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Dojo.cs +++ b/WorldlineKeepers/Assets/Scripts/Stages/GameStage_Dojo.cs @@ -16,7 +16,7 @@ namespace WK public override IEnumerator<float> OnStart() { GameSceneManager.Instance.LoadScene(StaticDefine.Scene_Dojo); - while(!GameSceneManager.Instance.AsyncOpt.isDone) + while(!GameSceneManager.Instance.sceneOpt.isDone) { yield return 0f; } diff --git a/WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs b/WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs index 0ce796e..aa0c925 100644 --- a/WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs +++ b/WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs @@ -4,6 +4,7 @@ using Newtonsoft.Json.Serialization; using System; using System.Collections; using System.Collections.Generic; +using System.Linq; using System.Net.Mime; using System.Reflection; using UnityEngine; @@ -50,8 +51,17 @@ public class CSVReader Type type = typeof(T); for (int i = 1; i < m_Rows.Count; ++i) { - if (m_Rows[i][0][0] == '#') // ע + if (m_Rows[i] == null || m_Rows[i].Count == 0) // continue; + + bool isBlank = true; + m_Rows[i].ForEach(s => { if (!string.IsNullOrEmpty(s)) isBlank = false; }); + if (isBlank) + continue; + + if (m_Rows[i][0].Length > 0 && m_Rows[i][0][0] == '#') // ע + continue; + List<string> row = m_Rows[i]; T obj = new T(); foreach (var key in m_KeyMapping) |