diff options
author | chai <215380520@qq.com> | 2023-05-12 19:00:29 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-05-12 19:00:29 +0800 |
commit | 6c91f1ed6810a57da08a24dd1359f288c443dd75 (patch) | |
tree | 485096584922b7300e987af1fe9c21f262898a5f /WorldlineKeepers/Assets/Scripts/Tests/TestCSV.cs | |
parent | 266370578135dca270729e8a70252e776ed22898 (diff) |
*misc
Diffstat (limited to 'WorldlineKeepers/Assets/Scripts/Tests/TestCSV.cs')
-rw-r--r-- | WorldlineKeepers/Assets/Scripts/Tests/TestCSV.cs | 86 |
1 files changed, 48 insertions, 38 deletions
diff --git a/WorldlineKeepers/Assets/Scripts/Tests/TestCSV.cs b/WorldlineKeepers/Assets/Scripts/Tests/TestCSV.cs index 068d235..b24a8c7 100644 --- a/WorldlineKeepers/Assets/Scripts/Tests/TestCSV.cs +++ b/WorldlineKeepers/Assets/Scripts/Tests/TestCSV.cs @@ -4,54 +4,64 @@ using System.Collections.Generic; using System.Resources; using System.Text; using UnityEngine; +using WK.Data; +using WK; using yutokun; -public class TestCSV : MonoBehaviour +namespace WK { - #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) + + public class TestCSV : MonoBehaviour + { + #region 序列化 + + #endregion + + #region 公共字段 + + #endregion + + #region 私有字段 + + #endregion + + private void OnEnable() { - styled.Append("| "); + // 私有字段赋值 + + // 公共字段赋值 - if (row[0][0] == '#') - continue; + // 初始化 - foreach (var cell in row) + TextAsset text = 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(cell); - styled.Append(" | "); + styled.Append("| "); + + if (row[0][0] == '#') + continue; + + foreach (var cell in row) + { + styled.Append(cell); + styled.Append(" | "); + } + + styled.AppendLine(); } - styled.AppendLine(); - } + Debug.Log(styled.ToString()); // Unity + Console.WriteLine(styled.ToString()); // C# - Debug.Log(styled.ToString()); // Unity - Console.WriteLine(styled.ToString()); // C# + List<CharacterStatsMetadata> stats = CSVReader.Read<CharacterStatsMetadata>(text.text); + Debug.Log(stats.Count); + + } } -} +}
\ No newline at end of file |