From dbf4ea119100f571b3710568dfdc2e09dcec2a61 Mon Sep 17 00:00:00 2001
From: chai <215380520@qq.com>
Date: Wed, 31 May 2023 09:21:51 +0800
Subject: *misc
---
WorldlineKeepers/Assets/Editor.meta | 8 ++
.../Assets/Scripts/Battle/BattleBehaviour.cs | 16 +++
.../Assets/Scripts/Battle/BattleBehaviour.cs.meta | 11 ++
.../Assets/Scripts/Battle/StageBehaviour.cs | 15 +++
.../Assets/Scripts/Battle/StageBehaviour.cs.meta | 11 ++
.../Assets/Scripts/Buffs/BuffMetadata.cs | 2 +-
WorldlineKeepers/Assets/Scripts/Common/Common.cs | 2 +-
.../Assets/Scripts/Common/CommonParse.cs | 2 +-
WorldlineKeepers/Assets/Scripts/Data/CSVReader.cs | 137 ---------------------
.../Assets/Scripts/Data/CSVReader.cs.meta | 11 --
.../Assets/Scripts/Data/DataManager.cs | 99 +++++++--------
.../Assets/Scripts/Data/DataManager_Data.cs | 24 ++++
.../Assets/Scripts/Data/DataManager_Data.cs.meta | 11 ++
.../Assets/Scripts/Data/DataManager_Load.cs | 4 +-
WorldlineKeepers/Assets/Scripts/Data/FileKey.cs | 22 ----
.../Assets/Scripts/Data/FileKey.cs.meta | 11 --
WorldlineKeepers/Assets/Scripts/Data/Filelist.cs | 34 -----
.../Assets/Scripts/Data/Filelist.cs.meta | 11 --
WorldlineKeepers/Assets/Scripts/Data/Metadata.meta | 8 ++
.../Assets/Scripts/Data/Metadata/FileKey.cs | 22 ++++
.../Assets/Scripts/Data/Metadata/FileKey.cs.meta | 11 ++
.../Assets/Scripts/Data/Metadata/Filelist.cs | 39 ++++++
.../Assets/Scripts/Data/Metadata/Filelist.cs.meta | 11 ++
.../Assets/Scripts/Data/Metadata/StageMetadata.cs | 17 +++
.../Scripts/Data/Metadata/StageMetadata.cs.meta | 11 ++
WorldlineKeepers/Assets/Scripts/StaticDefine.cs | 3 +-
WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs | 133 ++++++++++++++++++++
.../Assets/Scripts/Tools/CSVReader.cs.meta | 11 ++
.../Assets/ThirdParty/LitJson/JsonMapper.cs | 36 +++---
.../Assets/ThirdParty/LitJson/JsonWriter.cs | 6 +-
WorldlineKeepers/Assets/Tools.meta | 8 ++
WorldlineKeepers/Assets/Tools/LevelEditor.meta | 8 ++
32 files changed, 448 insertions(+), 307 deletions(-)
create mode 100644 WorldlineKeepers/Assets/Editor.meta
create mode 100644 WorldlineKeepers/Assets/Scripts/Battle/BattleBehaviour.cs
create mode 100644 WorldlineKeepers/Assets/Scripts/Battle/BattleBehaviour.cs.meta
create mode 100644 WorldlineKeepers/Assets/Scripts/Battle/StageBehaviour.cs
create mode 100644 WorldlineKeepers/Assets/Scripts/Battle/StageBehaviour.cs.meta
delete mode 100644 WorldlineKeepers/Assets/Scripts/Data/CSVReader.cs
delete mode 100644 WorldlineKeepers/Assets/Scripts/Data/CSVReader.cs.meta
create mode 100644 WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs
create mode 100644 WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs.meta
delete mode 100644 WorldlineKeepers/Assets/Scripts/Data/FileKey.cs
delete mode 100644 WorldlineKeepers/Assets/Scripts/Data/FileKey.cs.meta
delete mode 100644 WorldlineKeepers/Assets/Scripts/Data/Filelist.cs
delete mode 100644 WorldlineKeepers/Assets/Scripts/Data/Filelist.cs.meta
create mode 100644 WorldlineKeepers/Assets/Scripts/Data/Metadata.meta
create mode 100644 WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs
create mode 100644 WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs.meta
create mode 100644 WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs
create mode 100644 WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs.meta
create mode 100644 WorldlineKeepers/Assets/Scripts/Data/Metadata/StageMetadata.cs
create mode 100644 WorldlineKeepers/Assets/Scripts/Data/Metadata/StageMetadata.cs.meta
create mode 100644 WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs
create mode 100644 WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs.meta
create mode 100644 WorldlineKeepers/Assets/Tools.meta
create mode 100644 WorldlineKeepers/Assets/Tools/LevelEditor.meta
diff --git a/WorldlineKeepers/Assets/Editor.meta b/WorldlineKeepers/Assets/Editor.meta
new file mode 100644
index 0000000..ae1b3ae
--- /dev/null
+++ b/WorldlineKeepers/Assets/Editor.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c133e97861bffb94588d6cb22894b5f8
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Battle/BattleBehaviour.cs b/WorldlineKeepers/Assets/Scripts/Battle/BattleBehaviour.cs
new file mode 100644
index 0000000..68b81b4
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Battle/BattleBehaviour.cs
@@ -0,0 +1,16 @@
+using System.Collections;
+using System.Collections.Generic;
+using Unity.VisualScripting;
+using UnityEngine;
+
+namespace WK
+{
+
+ public class BattleBehaviour
+ {
+
+
+
+ }
+
+}
diff --git a/WorldlineKeepers/Assets/Scripts/Battle/BattleBehaviour.cs.meta b/WorldlineKeepers/Assets/Scripts/Battle/BattleBehaviour.cs.meta
new file mode 100644
index 0000000..a0c3a26
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Battle/BattleBehaviour.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 6c8b27831b1022e4881217680c643f15
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Battle/StageBehaviour.cs b/WorldlineKeepers/Assets/Scripts/Battle/StageBehaviour.cs
new file mode 100644
index 0000000..6cffe4d
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Battle/StageBehaviour.cs
@@ -0,0 +1,15 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace WK
+{
+
+ public class StageBehaviour
+ {
+
+
+
+ }
+
+}
diff --git a/WorldlineKeepers/Assets/Scripts/Battle/StageBehaviour.cs.meta b/WorldlineKeepers/Assets/Scripts/Battle/StageBehaviour.cs.meta
new file mode 100644
index 0000000..bb28c07
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Battle/StageBehaviour.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 47c0fe08c8f25a04dac706a9aefdd444
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Buffs/BuffMetadata.cs b/WorldlineKeepers/Assets/Scripts/Buffs/BuffMetadata.cs
index fd82064..b468807 100644
--- a/WorldlineKeepers/Assets/Scripts/Buffs/BuffMetadata.cs
+++ b/WorldlineKeepers/Assets/Scripts/Buffs/BuffMetadata.cs
@@ -4,7 +4,7 @@ using UnityEngine;
namespace WK.Data
{
-
+
public class BuffMetadata
{
diff --git a/WorldlineKeepers/Assets/Scripts/Common/Common.cs b/WorldlineKeepers/Assets/Scripts/Common/Common.cs
index 13a9f58..6fd2315 100644
--- a/WorldlineKeepers/Assets/Scripts/Common/Common.cs
+++ b/WorldlineKeepers/Assets/Scripts/Common/Common.cs
@@ -13,7 +13,7 @@
using UnityEngine;
using System.Collections;
-namespace DNA
+namespace WK
{
[System.Serializable]
public struct IntVector2
diff --git a/WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs b/WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs
index 6d06eff..f2d7640 100644
--- a/WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs
+++ b/WorldlineKeepers/Assets/Scripts/Common/CommonParse.cs
@@ -15,7 +15,7 @@ using System.Collections;
using System;
using LitJson;
-namespace DNA
+namespace WK
{
public class CommonParse
{
diff --git a/WorldlineKeepers/Assets/Scripts/Data/CSVReader.cs b/WorldlineKeepers/Assets/Scripts/Data/CSVReader.cs
deleted file mode 100644
index 207656b..0000000
--- a/WorldlineKeepers/Assets/Scripts/Data/CSVReader.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-using JetBrains.Annotations;
-using LitJson;
-using Newtonsoft.Json.Serialization;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Net.Mime;
-using System.Reflection;
-using UnityEngine;
-using yutokun;
-using static UnityEngine.Rendering.DebugUI;
-
-namespace WK.Data
-{
-
- public class CSVReader
- {
- private static Dictionary m_KeyMapping = new Dictionary();
- private static List> m_Rows = new List>();
-
- ///
- /// 解析csv表格,并返回列表
- ///
- ///
- ///
- ///
- public static List Read(string content) where T : new()
- {
- List result = new List();
- Read(result, content);
- return result;
- }
-
- ///
- /// 解析csv表格,并返回数量
- ///
- ///
- ///
- ///
- public static int Read(List target, string content) where T : new()
- {
- m_KeyMapping.Clear();
- m_Rows.Clear();
-
- m_Rows = CSVParser.LoadFromString(content);
- // 第一行是key
- List keys = m_Rows[0];
- for (int i = 0; i < keys.Count; ++i)
- {
- m_KeyMapping.Add(keys[i], i);
- }
- int count = 0;
- Type type = typeof(T);
- for (int i = 1; i < m_Rows.Count; ++i)
- {
- if (m_Rows[i][0][0] == '#') // 注释
- continue;
- List row = m_Rows[i];
- T obj = new T();
- foreach (var key in m_KeyMapping)
- {
- int index = key.Value;
- var fieldInfo = type.GetField(key.Key);
- if (fieldInfo != null)
- {
- Type fieldType = fieldInfo.FieldType;
- if (fieldType.IsEnum) // 如果是枚举,先转成int
- {
- int value = int.Parse(row[index]);
- fieldInfo.SetValue(obj, value);
- }
- else
- {
- fieldInfo.SetValue(obj, Convert.ChangeType(row[index], fieldInfo.FieldType));
- }
- }
- }
- target.Add(obj);
- count++;
- }
- return count;
- }
-
- ///
- /// 解析csv表格,并按key存储到字典里,返回数量
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public static int ReadDictionary(Dictionary target, string content, string keyName) where TValue : new()
- {
- List data = CSVReader.Read(content);
- if (data == null || data.Count == 0)
- return 0;
- Type type_key = typeof(TKey);
- Type type_value = typeof(TValue);
- FieldInfo field = type_value.GetField(keyName);
- Type type_field = field.FieldType;
- int count = 0;
- for (int i = 0; i < data.Count; ++i)
- {
- TValue d = data[i];
-
- TKey key = default(TKey);
- if (type_key.IsEnum)
- {
- if(type_field == typeof(string))
- {
- key = (TKey)Enum.Parse(type_key, field.GetValue(d).ToString());
- }
- else if(type_field == typeof(int))
- {
- key = (TKey)field.GetValue(d);
- }
- }
- else
- {
- key = (TKey)field.GetValue(d);
- }
- if (key == null)
- {
- LogHelper.LogError("CSVReader.ReadDictionary(): key is null");
- continue;
- }
-
- target.Add(key, d);
- count++;
- }
- return count;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/WorldlineKeepers/Assets/Scripts/Data/CSVReader.cs.meta b/WorldlineKeepers/Assets/Scripts/Data/CSVReader.cs.meta
deleted file mode 100644
index 52670ce..0000000
--- a/WorldlineKeepers/Assets/Scripts/Data/CSVReader.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f6b35022c04390a46beb2b27711a7950
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Data/DataManager.cs b/WorldlineKeepers/Assets/Scripts/Data/DataManager.cs
index 2667736..9ec2734 100644
--- a/WorldlineKeepers/Assets/Scripts/Data/DataManager.cs
+++ b/WorldlineKeepers/Assets/Scripts/Data/DataManager.cs
@@ -7,63 +7,54 @@ using UnityEngine;
namespace WK.Data
{
- ///
- /// 所有配置数据
- ///
public partial class DataManager : Singleton
{
- private Dictionary m_CharacterStatsMetadata = new Dictionary();
- private Dictionary m_BuffMetadata = new Dictionary();
- private Dictionary m_CharacterMetadata = new Dictionary();
-
- private Dictionary m_Filelist = new Dictionary();
-
- public CharacterStatsMetadata GetCharacterStats(string uid)
- {
- CharacterStatsMetadata metadata;
- if(m_CharacterStatsMetadata.TryGetValue(uid, out metadata))
- {
- return metadata;
- }
- return null;
- }
-
- public BuffMetadata GetBuffMetadata(string uid)
- {
- BuffMetadata metadata;
- if(m_BuffMetadata.TryGetValue(uid, out metadata))
- {
- return metadata;
- }
- return null;
- }
-
- public void Load()
- {
- LoadDefaultStats();
- LoadDefaultCharacters();
- }
-
- private void LoadDefaultStats()
- {
- TextAsset text = ResourceManager.Instance.LoadAsset(StaticDefine.StatsFilePath);
- List stats = CSVReader.Read(text.text);
- for(int i = 0; i < stats.Count; ++i)
- {
- m_CharacterStatsMetadata.Add(stats[i].uid, stats[i]);
- }
- }
-
- private void LoadDefaultCharacters()
- {
- TextAsset text = ResourceManager.Instance.LoadAsset(StaticDefine.RoninPath);
- CharacterMetadata metadata = JsonMapper.ToObject(text.text);
- if(metadata != null)
- {
- m_CharacterMetadata.Add(metadata.uid, metadata);
- }
- }
+ //public CharacterStatsMetadata GetCharacterStats(string uid)
+ //{
+ // CharacterStatsMetadata metadata;
+ // if(m_CharacterStatsMetadata.TryGetValue(uid, out metadata))
+ // {
+ // return metadata;
+ // }
+ // return null;
+ //}
+
+ //public BuffMetadata GetBuffMetadata(string uid)
+ //{
+ // BuffMetadata metadata;
+ // if(m_BuffMetadata.TryGetValue(uid, out metadata))
+ // {
+ // return metadata;
+ // }
+ // return null;
+ //}
+
+ //public void Load()
+ //{
+ // LoadDefaultStats();
+ // LoadDefaultCharacters();
+ //}
+
+ //private void LoadDefaultStats()
+ //{
+ // TextAsset text = ResourceManager.Instance.LoadAsset(StaticDefine.StatsFilePath);
+ // List stats = CSVReader.Read(text.text);
+ // for(int i = 0; i < stats.Count; ++i)
+ // {
+ // m_CharacterStatsMetadata.Add(stats[i].uid, stats[i]);
+ // }
+ //}
+
+ //private void LoadDefaultCharacters()
+ //{
+ // TextAsset text = ResourceManager.Instance.LoadAsset(StaticDefine.RoninPath);
+ // CharacterMetadata metadata = JsonMapper.ToObject(text.text);
+ // if(metadata != null)
+ // {
+ // m_CharacterMetadata.Add(metadata.uid, metadata);
+ // }
+ //}
}
diff --git a/WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs
new file mode 100644
index 0000000..d16c785
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs
@@ -0,0 +1,24 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace WK.Data
+{
+
+ ///
+ /// 所有配置数据
+ ///
+ public partial class DataManager : Singleton
+ {
+ // 文件列表
+ private Dictionary m_Filelist = new Dictionary();
+
+ private Dictionary m_CharacterStatsMetadata = new Dictionary();
+ private Dictionary m_BuffMetadata = new Dictionary();
+ private Dictionary m_CharacterMetadata = new Dictionary();
+
+
+
+ }
+
+}
diff --git a/WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs.meta b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs.meta
new file mode 100644
index 0000000..cea1f4f
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Data.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 707bcf2d592188048b205923766b94a5
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs b/WorldlineKeepers/Assets/Scripts/Data/DataManager_Load.cs
index 811f5b4..aab90a9 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(StaticDefine.FileList);
string content = text.text;
- List files = CSVReader.Read(content);
- CSVReader.ReadDictionary(m_Filelist, content, "key");
+ List files = CSVReader.Read(content);
+ CSVReader.ReadDictionary(m_Filelist, content, "key");
Debug.Log(m_Filelist.Count);
}
diff --git a/WorldlineKeepers/Assets/Scripts/Data/FileKey.cs b/WorldlineKeepers/Assets/Scripts/Data/FileKey.cs
deleted file mode 100644
index 1ab15b2..0000000
--- a/WorldlineKeepers/Assets/Scripts/Data/FileKey.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace WK.Data
-{
-
- ///
- /// 文件enum
- ///
- public enum EFileKey
- {
- none = 0,
-
- default_stats,
- default_buffs,
- default_items,
-
- all
- }
-
-}
diff --git a/WorldlineKeepers/Assets/Scripts/Data/FileKey.cs.meta b/WorldlineKeepers/Assets/Scripts/Data/FileKey.cs.meta
deleted file mode 100644
index 1564c3d..0000000
--- a/WorldlineKeepers/Assets/Scripts/Data/FileKey.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 024b24790fd0abd4181e4b690d9fb4ee
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Data/Filelist.cs b/WorldlineKeepers/Assets/Scripts/Data/Filelist.cs
deleted file mode 100644
index dc96df9..0000000
--- a/WorldlineKeepers/Assets/Scripts/Data/Filelist.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace WK.Data
-{
-
- public enum FileType
- {
- CSV = 0,
- Json = 1,
- Txt = 2,
- }
-
- public enum FileRoot
- {
- Bundle = 0,
- Streaming = 1,
- Persistent = 2,
- }
-
- ///
- /// 文件列表
- ///
- public class MetadataFile
- {
-
- public string key;
- public FileType type;
- public FileRoot root;
- public string path;
- }
-
-}
diff --git a/WorldlineKeepers/Assets/Scripts/Data/Filelist.cs.meta b/WorldlineKeepers/Assets/Scripts/Data/Filelist.cs.meta
deleted file mode 100644
index 9bb6057..0000000
--- a/WorldlineKeepers/Assets/Scripts/Data/Filelist.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f427347e73ff3e94d8d6f091ddcd4179
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Data/Metadata.meta b/WorldlineKeepers/Assets/Scripts/Data/Metadata.meta
new file mode 100644
index 0000000..adfaa0d
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Data/Metadata.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c9192579c4677b3438c941d65a0a1a61
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs b/WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs
new file mode 100644
index 0000000..621203e
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs
@@ -0,0 +1,22 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace WK.Data
+{
+
+ ///
+ /// 默认文件enum,编号无所谓,名字不可更改。方便找文件
+ ///
+ public enum EFileKey
+ {
+ none = 0,
+
+ default_stats,
+ default_buffs,
+ default_items,
+
+ all
+ }
+
+}
diff --git a/WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs.meta b/WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs.meta
new file mode 100644
index 0000000..1564c3d
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Data/Metadata/FileKey.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 024b24790fd0abd4181e4b690d9fb4ee
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs b/WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs
new file mode 100644
index 0000000..b91619b
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs
@@ -0,0 +1,39 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace WK.Data
+{
+
+ ///
+ /// 文件类型
+ ///
+ public enum FileType
+ {
+ CSV = 0,
+ Json = 1,
+ Txt = 2,
+ }
+
+ ///
+ /// 文件路径
+ ///
+ public enum FileRoot
+ {
+ Bundle = 0,
+ Streaming = 1,
+ Persistent = 2,
+ }
+
+ ///
+ /// 元文件描述符
+ ///
+ public class MetadataFileDescriptor
+ {
+ public string key;
+ public FileType type;
+ public FileRoot root;
+ public string path;
+ }
+
+}
diff --git a/WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs.meta b/WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs.meta
new file mode 100644
index 0000000..9bb6057
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Data/Metadata/Filelist.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f427347e73ff3e94d8d6f091ddcd4179
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/Data/Metadata/StageMetadata.cs b/WorldlineKeepers/Assets/Scripts/Data/Metadata/StageMetadata.cs
new file mode 100644
index 0000000..ed7b1cb
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Data/Metadata/StageMetadata.cs
@@ -0,0 +1,17 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace WK.Data
+{
+ ///
+ /// 关卡元数据
+ ///
+ public class StageMetadata
+ {
+
+
+
+ }
+
+}
diff --git a/WorldlineKeepers/Assets/Scripts/Data/Metadata/StageMetadata.cs.meta b/WorldlineKeepers/Assets/Scripts/Data/Metadata/StageMetadata.cs.meta
new file mode 100644
index 0000000..7ff42d8
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Data/Metadata/StageMetadata.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7e2e7c43d0f01fe4799d8284e9982627
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Scripts/StaticDefine.cs b/WorldlineKeepers/Assets/Scripts/StaticDefine.cs
index 947882e..b772d86 100644
--- a/WorldlineKeepers/Assets/Scripts/StaticDefine.cs
+++ b/WorldlineKeepers/Assets/Scripts/StaticDefine.cs
@@ -17,10 +17,11 @@ namespace WK
public static string RoninPath = "characters/ronin/ronin.json";
- // 场景
+ // 场景名
public static string Scene_Dojo = "Scenes/3_Dojo";
public static string Scene_Stage = "Scenes/4_Stage";
+ // 文件列表
public static string FileList = "metadata/filelist.csv";
}
diff --git a/WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs b/WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs
new file mode 100644
index 0000000..0ce796e
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs
@@ -0,0 +1,133 @@
+using JetBrains.Annotations;
+using LitJson;
+using Newtonsoft.Json.Serialization;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Net.Mime;
+using System.Reflection;
+using UnityEngine;
+using yutokun;
+using static UnityEngine.Rendering.DebugUI;
+
+public class CSVReader
+{
+ private static Dictionary m_KeyMapping = new Dictionary();
+ private static List> m_Rows = new List>();
+
+ ///
+ /// 解析csv表格,并返回列表
+ ///
+ ///
+ ///
+ ///
+ public static List Read(string content) where T : new()
+ {
+ List result = new List();
+ Read(result, content);
+ return result;
+ }
+
+ ///
+ /// 解析csv表格,并返回数量
+ ///
+ ///
+ ///
+ ///
+ public static int Read(List target, string content) where T : new()
+ {
+ m_KeyMapping.Clear();
+ m_Rows.Clear();
+
+ m_Rows = CSVParser.LoadFromString(content);
+ // 第一行是key
+ List keys = m_Rows[0];
+ for (int i = 0; i < keys.Count; ++i)
+ {
+ m_KeyMapping.Add(keys[i], i);
+ }
+ int count = 0;
+ Type type = typeof(T);
+ for (int i = 1; i < m_Rows.Count; ++i)
+ {
+ if (m_Rows[i][0][0] == '#') // 注释
+ continue;
+ List row = m_Rows[i];
+ T obj = new T();
+ foreach (var key in m_KeyMapping)
+ {
+ int index = key.Value;
+ var fieldInfo = type.GetField(key.Key);
+ if (fieldInfo != null)
+ {
+ Type fieldType = fieldInfo.FieldType;
+ if (fieldType.IsEnum) // 如果是枚举,先转成int
+ {
+ int value = int.Parse(row[index]);
+ fieldInfo.SetValue(obj, value);
+ }
+ else
+ {
+ fieldInfo.SetValue(obj, Convert.ChangeType(row[index], fieldInfo.FieldType));
+ }
+ }
+ }
+ target.Add(obj);
+ count++;
+ }
+ return count;
+ }
+
+ ///
+ /// 解析csv表格,并按key存储到字典里,返回数量
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static int ReadDictionary(Dictionary target, string content, string keyName) where TValue : new()
+ {
+ List data = CSVReader.Read(content);
+ if (data == null || data.Count == 0)
+ return 0;
+ Type type_key = typeof(TKey);
+ Type type_value = typeof(TValue);
+ FieldInfo field = type_value.GetField(keyName);
+ Type type_field = field.FieldType;
+ int count = 0;
+ for (int i = 0; i < data.Count; ++i)
+ {
+ TValue d = data[i];
+
+ TKey key = default(TKey);
+ if (type_key.IsEnum)
+ {
+ if(type_field == typeof(string))
+ {
+ key = (TKey)Enum.Parse(type_key, field.GetValue(d).ToString());
+ }
+ else if(type_field == typeof(int))
+ {
+ key = (TKey)field.GetValue(d);
+ }
+ }
+ else
+ {
+ key = (TKey)field.GetValue(d);
+ }
+ if (key == null)
+ {
+ LogHelper.LogError("CSVReader.ReadDictionary(): key is null");
+ continue;
+ }
+
+ target.Add(key, d);
+ count++;
+ }
+ return count;
+ }
+
+}
+
diff --git a/WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs.meta b/WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs.meta
new file mode 100644
index 0000000..52670ce
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Tools/CSVReader.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f6b35022c04390a46beb2b27711a7950
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonMapper.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonMapper.cs
index 3a09a87..6f79c65 100644
--- a/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonMapper.cs
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonMapper.cs
@@ -414,35 +414,35 @@ namespace LitJson
}
if (inst_type == typeof(UnityEngine.Vector4))
{
- return DNA.CommonParse.ParseVector4(reader.Value.ToString());
+ return WK.CommonParse.ParseVector4(reader.Value.ToString());
}
if (inst_type == typeof(UnityEngine.Vector3))
{
- return DNA.CommonParse.ParseVector3(reader.Value.ToString());
+ return WK.CommonParse.ParseVector3(reader.Value.ToString());
}
if (inst_type == typeof(UnityEngine.Vector2))
{
- return DNA.CommonParse.ParseVector2(reader.Value.ToString());
+ return WK.CommonParse.ParseVector2(reader.Value.ToString());
}
- if (inst_type == typeof(DNA.IntVector4))
+ if (inst_type == typeof(WK.IntVector4))
{
- return DNA.CommonParse.ParseIntVector4(reader.Value.ToString());
+ return WK.CommonParse.ParseIntVector4(reader.Value.ToString());
}
- if (inst_type == typeof(DNA.IntVector3))
+ if (inst_type == typeof(WK.IntVector3))
{
- return DNA.CommonParse.ParseIntVector3(reader.Value.ToString());
+ return WK.CommonParse.ParseIntVector3(reader.Value.ToString());
}
- if (inst_type == typeof(DNA.IntVector2))
+ if (inst_type == typeof(WK.IntVector2))
{
- return DNA.CommonParse.ParseIntVector2(reader.Value.ToString());
+ return WK.CommonParse.ParseIntVector2(reader.Value.ToString());
}
if (inst_type == typeof(UnityEngine.Color))
{
- return DNA.CommonParse.ParseColor(reader.Value.ToString());
+ return WK.CommonParse.ParseColor(reader.Value.ToString());
}
if (inst_type == typeof(UnityEngine.Color32))
{
- return DNA.CommonParse.ParseColor32(reader.Value.ToString());
+ return WK.CommonParse.ParseColor32(reader.Value.ToString());
}
//==========================================
@@ -560,7 +560,7 @@ namespace LitJson
object keyObj = property;
if (t_data.GenericKeyType == typeof(int))
{
- keyObj = DNA.CommonParse.ParseInt(property);
+ keyObj = WK.CommonParse.ParseInt(property);
}
((IDictionary) instance).Add (
@@ -827,21 +827,21 @@ namespace LitJson
writer.Write((UnityEngine.Vector2)obj);
return;
}
- if (obj is DNA.IntVector4)
+ if (obj is WK.IntVector4)
{
- writer.Write((DNA.IntVector4)obj);
+ writer.Write((WK.IntVector4)obj);
return;
}
- if (obj is DNA.IntVector3)
+ if (obj is WK.IntVector3)
{
- writer.Write((DNA.IntVector3)obj);
+ writer.Write((WK.IntVector3)obj);
return;
}
- if (obj is DNA.IntVector2)
+ if (obj is WK.IntVector2)
{
- writer.Write((DNA.IntVector2)obj);
+ writer.Write((WK.IntVector2)obj);
return;
}
diff --git a/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonWriter.cs b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonWriter.cs
index 40324e9..887adad 100644
--- a/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonWriter.cs
+++ b/WorldlineKeepers/Assets/ThirdParty/LitJson/JsonWriter.cs
@@ -340,7 +340,7 @@ namespace LitJson
context.ExpectingValue = false;
}
- //public void Write(DNA.IntVector4 v4)
+ //public void Write(WK.IntVector4 v4)
//{
// DoValidation(Condition.Value);
// PutNewline();
@@ -353,7 +353,7 @@ namespace LitJson
// context.ExpectingValue = false;
//}
- //public void Write(DNA.IntVector3 v3)
+ //public void Write(WK.IntVector3 v3)
//{
// DoValidation(Condition.Value);
// PutNewline();
@@ -366,7 +366,7 @@ namespace LitJson
// context.ExpectingValue = false;
//}
- //public void Write(DNA.IntVector2 v2)
+ //public void Write(WK.IntVector2 v2)
//{
// DoValidation(Condition.Value);
// PutNewline();
diff --git a/WorldlineKeepers/Assets/Tools.meta b/WorldlineKeepers/Assets/Tools.meta
new file mode 100644
index 0000000..8ce3fe9
--- /dev/null
+++ b/WorldlineKeepers/Assets/Tools.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 137d3d7aebb9acd4aa3798ec18198450
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/WorldlineKeepers/Assets/Tools/LevelEditor.meta b/WorldlineKeepers/Assets/Tools/LevelEditor.meta
new file mode 100644
index 0000000..d70b307
--- /dev/null
+++ b/WorldlineKeepers/Assets/Tools/LevelEditor.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: cf820871525e2d64eb429efd80875983
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
--
cgit v1.1-26-g67d0