diff options
author | chai <215380520@qq.com> | 2023-05-12 09:24:40 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-05-12 09:24:40 +0800 |
commit | 2a1cd4fda8a4a8e649910d16b4dfa1ce7ae63543 (patch) | |
tree | a471fafed72e80b4ac3ac3002e06c34220dd6058 /marching/Assets/Scripts/Tests | |
parent | b8a694746562b37dc8dc5b8b5aec8612bb0964fc (diff) |
*misc
Diffstat (limited to 'marching/Assets/Scripts/Tests')
-rw-r--r-- | marching/Assets/Scripts/Tests/TestCSV.cs | 57 | ||||
-rw-r--r-- | marching/Assets/Scripts/Tests/TestCSV.cs.meta | 11 |
2 files changed, 68 insertions, 0 deletions
diff --git a/marching/Assets/Scripts/Tests/TestCSV.cs b/marching/Assets/Scripts/Tests/TestCSV.cs new file mode 100644 index 0000000..068d235 --- /dev/null +++ b/marching/Assets/Scripts/Tests/TestCSV.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Resources; +using System.Text; +using UnityEngine; +using yutokun; + +public class TestCSV : MonoBehaviour +{ + #region 序列化 + + #endregion + + #region 公共字段 + + #endregion + + #region 私有字段 + + #endregion + + private void OnEnable() + { + // 私有字段赋值 + + // 公共字段赋值 + + // 初始化 + + TextAsset text = WK.ResourceManager.Instance.LoadAsset<TextAsset>("metadata/default_stats.csv"); + + var sheet = CSVParser.LoadFromString(text.text); + + var styled = new StringBuilder(); + foreach (var row in sheet) + { + styled.Append("| "); + + if (row[0][0] == '#') + continue; + + foreach (var cell in row) + { + styled.Append(cell); + styled.Append(" | "); + } + + styled.AppendLine(); + } + + Debug.Log(styled.ToString()); // Unity + Console.WriteLine(styled.ToString()); // C# + + } + +} diff --git a/marching/Assets/Scripts/Tests/TestCSV.cs.meta b/marching/Assets/Scripts/Tests/TestCSV.cs.meta new file mode 100644 index 0000000..48e6de1 --- /dev/null +++ b/marching/Assets/Scripts/Tests/TestCSV.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5e9d405b1bd5e604db9cc8638d465aaf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |