推进中, 解析存在错误

This commit is contained in:
2025-11-25 17:04:19 +08:00
parent 1dc2109a18
commit a0347dcfe6
7 changed files with 89 additions and 46 deletions

View File

@@ -194,19 +194,26 @@ namespace Demo.Game
var rootObject = new ToolFile(Path.Combine(content.RootSourceDir, rootFileName));
rootObject.MustExistsPath();
var rootGameObject = new GameObject(rootObject.GetName(true)).AddComponent<RootObject>();
MainObject = rootGameObject;
rootGameObject.transform.SetParent(transform);
rootGameObject.ScriptName = rootObject.GetName(true);
rootGameObject.audioSystem = MainAudio;
rootGameObject.EnableScript(content.RootSourceDir, this);
try
rootGameObject.SetContent(nameof(SongOffset), SongOffset);
rootGameObject.SetContent(nameof(IsAutoPlay), IsAutoPlay ? 1 : 0);
rootGameObject.SetContent("SongLength", MainAudio.CurrentClip.length);
yield return rootGameObject.ParseScript2Expr(rootObject.LoadAsText());
yield return rootGameObject.ApplyScript();
IEnumerator DFS(ScriptableObject parent)
{
yield return rootGameObject.ParseScript2Expr(rootObject.LoadAsText());
yield return rootGameObject.ApplyScript();
}
finally
{
MainObject = rootGameObject;
foreach (var child in parent.Childs)
{
if (child.IsScriptApply == false)
yield return child.ApplyScript();
yield return DFS(child);
}
}
yield return DFS(rootGameObject);
}
}
finally