From 6c91f1ed6810a57da08a24dd1359f288c443dd75 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Fri, 12 May 2023 19:00:29 +0800 Subject: *misc --- WorldlineKeepers/Assets/Scripts/Tests/TestCSV.cs | 86 +++++++++++++----------- 1 file changed, 48 insertions(+), 38 deletions(-) (limited to 'WorldlineKeepers/Assets/Scripts/Tests/TestCSV.cs') 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("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("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 stats = CSVReader.Read(text.text); + Debug.Log(stats.Count); + + } } -} +} \ No newline at end of file -- cgit v1.1-26-g67d0