From 6af79f048005159b5955039782357a9493239747 Mon Sep 17 00:00:00 2001 From: ninemine <1371605831@qq.com> Date: Sun, 12 Oct 2025 00:54:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BA=86=E5=86=85=E5=AD=98?= =?UTF-8?q?=E6=B3=84=E6=BC=8F=E9=97=AE=E9=A2=98(BasicSplineJustFollow.Upda?= =?UTF-8?q?te=E4=B8=AD=E5=88=A4=E6=96=AD=E6=9D=90=E8=B4=A8=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=8F=98=E6=9B=B4=E7=9A=84=E6=96=B9=E5=BC=8F=E6=9C=89?= =?UTF-8?q?=E8=AF=AF)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Framework/ScriptableObject.cs | 22 +++++++++++++++++-- .../DefaultScriptableObjectInstantiate.cs | 2 +- .../Scripts/MoreSpline/BasicSplineRenderer.cs | 8 ------- Assets/Scripts/MoreSpline/SplineAnchor.cs | 2 +- Assets/Scripts/MoreSpline/SplineCore.cs | 4 ++-- .../Updatement/BasicSplineJustFollow.cs | 2 +- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/Assets/Scripts/Framework/ScriptableObject.cs b/Assets/Scripts/Framework/ScriptableObject.cs index 383532a..a8946d8 100644 --- a/Assets/Scripts/Framework/ScriptableObject.cs +++ b/Assets/Scripts/Framework/ScriptableObject.cs @@ -802,7 +802,7 @@ namespace Demo return result; } - public IEnumerator LoadSubScriptAsync([In] string type, [In] string path, [Opt] Action callback) + public IEnumerator DoLoadSubScriptAsync([In] string type, [In] string path, [Opt] Action callback) { // 判断类型是否合法 if (DefaultInstantiate.GetScriptableObjectInstantiate().TryGetValue(type, out var creater) == false) @@ -858,7 +858,25 @@ namespace Demo ")] public IEnumerator LoadSubScript([In] string type, [In] string path) { - yield return LoadSubScriptAsync(type, path, null); + return DoLoadSubScriptAsync(type, path, null); + } + + + /// + /// 异步加载子脚本 + /// + /// 指定类型 + /// 指定脚本,可用决定路径或与当前脚本目录的相对路径 + [ScriptableCall(@" + +异步加载子脚本 + +指定类型 +指定脚本,可用决定路径或与当前脚本目录的相对路径 +")] + public void LoadSubScriptAsync([In] string type, [In] string path) + { + StartCoroutine(DoLoadSubScriptAsync(type, path, null)); } private enum ParseStats diff --git a/Assets/Scripts/Framework/ScriptableObjectInstantiate/DefaultScriptableObjectInstantiate.cs b/Assets/Scripts/Framework/ScriptableObjectInstantiate/DefaultScriptableObjectInstantiate.cs index 0b0a425..39324e3 100644 --- a/Assets/Scripts/Framework/ScriptableObjectInstantiate/DefaultScriptableObjectInstantiate.cs +++ b/Assets/Scripts/Framework/ScriptableObjectInstantiate/DefaultScriptableObjectInstantiate.cs @@ -129,7 +129,7 @@ namespace Demo.Game childFileStream.Close(); } //不刷新世界,直接加载 - so.StartCoroutine(so.LoadSubScriptAsync(type, childFile, targetChildSO => + so.StartCoroutine(so.DoLoadSubScriptAsync(type, childFile, targetChildSO => { // 打开手动编辑 try diff --git a/Assets/Scripts/MoreSpline/BasicSplineRenderer.cs b/Assets/Scripts/MoreSpline/BasicSplineRenderer.cs index f2e3fd1..98a5cc7 100644 --- a/Assets/Scripts/MoreSpline/BasicSplineRenderer.cs +++ b/Assets/Scripts/MoreSpline/BasicSplineRenderer.cs @@ -173,14 +173,6 @@ namespace Demo.Game if (MyMeshGenerator == null) return; base.UpdateTicks(currentTime, deltaTime, tickType); - if (currentTime >= Entries[0].TimePoint && (tickType == TickType.Update)) - { - if (MyLineMaterial != MyMeshRenderer.material) - { - MyMeshRenderer.material = MyLineMaterial; - MyMeshGenerator.Rebuild(); - } - } } public override Vector3 EvaluateClipFromPosition(float time) diff --git a/Assets/Scripts/MoreSpline/SplineAnchor.cs b/Assets/Scripts/MoreSpline/SplineAnchor.cs index 6eb2010..4f454fd 100644 --- a/Assets/Scripts/MoreSpline/SplineAnchor.cs +++ b/Assets/Scripts/MoreSpline/SplineAnchor.cs @@ -19,7 +19,7 @@ namespace Demo.Game protected override void UpdateTicks(float currentTime, float deltaTime, TickType tickType) { base.UpdateTicks(currentTime, deltaTime, tickType); - //Updater?.Invoke(); + Updater?.Invoke(); } /// diff --git a/Assets/Scripts/MoreSpline/SplineCore.cs b/Assets/Scripts/MoreSpline/SplineCore.cs index fd0cd5c..1fa13fc 100644 --- a/Assets/Scripts/MoreSpline/SplineCore.cs +++ b/Assets/Scripts/MoreSpline/SplineCore.cs @@ -42,7 +42,7 @@ namespace Demo.Game { var spline = self.SharedInterfaceScriptObject.FindWithPath(path, false); if (spline == null) - yield return self.SharedInterfaceScriptObject.LoadSubScriptAsync(nameof(SplineCore), path, x => spline = x); + yield return self.SharedInterfaceScriptObject.DoLoadSubScriptAsync(nameof(SplineCore), path, x => spline = x); if (spline is SplineCore sc) { self.MySplineCore = sc; @@ -160,7 +160,7 @@ namespace Demo.Game ")] public IEnumerator LoadNode(string path) { - yield return LoadSubScriptAsync(nameof(SplineNode), path, node => + yield return DoLoadSubScriptAsync(nameof(SplineNode), path, node => { if (node is SplineNode _node) { diff --git a/Assets/Scripts/MoreSpline/Updatement/BasicSplineJustFollow.cs b/Assets/Scripts/MoreSpline/Updatement/BasicSplineJustFollow.cs index 95c4f0c..9cc06e7 100644 --- a/Assets/Scripts/MoreSpline/Updatement/BasicSplineJustFollow.cs +++ b/Assets/Scripts/MoreSpline/Updatement/BasicSplineJustFollow.cs @@ -61,7 +61,7 @@ namespace Demo.Game MySplineCore = FindWithPath(path, false) as SplineCore; if (MySplineCore == null) { - yield return LoadSubScriptAsync(nameof(SplineCore), path, x => + yield return DoLoadSubScriptAsync(nameof(SplineCore), path, x => { MySplineCore = x as SplineCore; });