using System.Collections; using System.Collections.Generic; using System.Globalization; using UnityEngine; namespace WZ { public static class DataUtils { [System.Serializable] private class Wrapper { public T[] items; } public static T[] FromJsonArray(string json) { string wrappedJson = $"{{\"items\":{json}}}"; Wrapper wrapper = JsonUtility.FromJson>(wrappedJson); return wrapper.items; } public static double StringToDouble(string str) { double result = 0; if (double.TryParse(str, NumberStyles.Any, CultureInfo.InvariantCulture, out result)) { Debug.Log("转换成功: " + result); } else { Debug.Log("转换失败:字符串格式不正确"); } return result; } } }