推进同化RScript
This commit is contained in:
@@ -6,8 +6,6 @@ namespace Demo.Game
|
||||
{
|
||||
public class DDT : ScriptableObject
|
||||
{
|
||||
public string BindingDataJson => $"{ScriptPath}.json";
|
||||
|
||||
public static DDT Make()
|
||||
{
|
||||
return new GameObject().AddComponent<DDT>();
|
||||
@@ -15,12 +13,6 @@ namespace Demo.Game
|
||||
|
||||
public List<float> Datas = new();
|
||||
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void Add(string value)
|
||||
{
|
||||
Datas.Add(Parse(value));
|
||||
}
|
||||
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void Add(float value)
|
||||
{
|
||||
@@ -32,28 +24,5 @@ namespace Demo.Game
|
||||
{
|
||||
Datas.Add((barCount + tickCount / (float)barSplitTimes) * OneBarTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从特定的json中读取数据, 并调用<see cref="Add(string)"/>
|
||||
/// </summary>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void Load()
|
||||
{
|
||||
var file = new ToolFile(BindingDataJson);
|
||||
if (file.Exists() == false)
|
||||
{
|
||||
file.MustExistsPath()
|
||||
.SaveAsJson<List<string>>(new());
|
||||
Datas.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
Datas.Clear();
|
||||
foreach (var item in file.LoadAsJson<List<string>>())
|
||||
{
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user