using System.Collections.Generic; using Convention; using UnityEngine; namespace Demo.Game { public class DDT : ScriptableObject { public string BindingDataJson => $"{ScriptPath}.json"; public static DDT Make() { return new GameObject().AddComponent(); } public List Datas = new(); [ScriptableCall(@" 添加float数据, 随后可以用对象路径+索引获取变量值, e.g: CameraObject/DDT[3], 获取CameraObject/DDT对象路径下DDT数据中的第四个值 ")] public void Add(string value) { Datas.Add(float.Parse(value)); } /// /// 从特定的json中读取数据 /// [ScriptableCall(@"从特定的json中读取数据")] public void Load() { var file = new ToolFile(BindingDataJson); if (file.Exists() == false) { file.MustExistsPath() .SaveAsJson>(new()); Datas.Clear(); } else { Datas = file.LoadAsJson>(); } } } }