1.修复Updatement中遗漏的bug2.对生成进行了一定的优化
This commit is contained in:
@@ -221,17 +221,23 @@ namespace Demo.Game
|
|||||||
rootGameObject.SetContent(nameof(IsAutoPlay), IsAutoPlay ? 1 : 0);
|
rootGameObject.SetContent(nameof(IsAutoPlay), IsAutoPlay ? 1 : 0);
|
||||||
rootGameObject.SetContent("SongLength", MainAudio.CurrentClip.length);
|
rootGameObject.SetContent("SongLength", MainAudio.CurrentClip.length);
|
||||||
yield return rootGameObject.ParseFromScriptFile2Expr(rootObject);
|
yield return rootGameObject.ParseFromScriptFile2Expr(rootObject);
|
||||||
static void NDFS(ScriptableObject current)
|
int NDFSCount = 0;
|
||||||
|
IEnumerator NDFS(ScriptableObject current)
|
||||||
{
|
{
|
||||||
foreach (var child in current.Childs)
|
foreach (var child in current.Childs)
|
||||||
{
|
{
|
||||||
NDFS(child);
|
ConventionUtility.StartCoroutine(NDFS(child));
|
||||||
|
NDFSCount++;
|
||||||
|
if(NDFSCount % 100 == 0)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (current.IsScriptApply == false)
|
if (current.IsScriptApply == false)
|
||||||
ConventionUtility.StartCoroutine(current.ApplyScript());
|
ConventionUtility.StartCoroutine(current.ApplyScript());
|
||||||
}
|
}
|
||||||
//yield return
|
//yield return
|
||||||
NDFS(rootGameObject);
|
ConventionUtility.StartCoroutine(NDFS(rootGameObject));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -108,7 +108,16 @@ namespace Demo.Game
|
|||||||
{
|
{
|
||||||
using (Profiler.BeginZone($"{type.Name}.ScriptUpdate"))
|
using (Profiler.BeginZone($"{type.Name}.ScriptUpdate"))
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
item.ScriptUpdate(currentTime, deltaTime, tickType);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
item.ScriptUpdate(currentTime, deltaTime, tickType);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.LogException(ex, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -659,27 +659,35 @@ namespace Demo
|
|||||||
private static Color CacheLastFocusImageOriginColor = new(1, 1, 1, 0.01f);
|
private static Color CacheLastFocusImageOriginColor = new(1, 1, 1, 0.01f);
|
||||||
private static Color FocusImageColor = new(1f, 47f / 51f, 0.0156862754f, 0.1f);
|
private static Color FocusImageColor = new(1f, 47f / 51f, 0.0156862754f, 0.1f);
|
||||||
|
|
||||||
|
[Content, SerializeField] private bool IsEnableTimelineItem = false;
|
||||||
|
|
||||||
|
[Convention.RScript.Variable.Attr.Method]
|
||||||
|
public void EnableTimelineItem()
|
||||||
|
{
|
||||||
|
IsEnableTimelineItem = true;
|
||||||
|
}
|
||||||
|
|
||||||
protected override IEnumerator DoSomethingDuringApplyScript()
|
protected override IEnumerator DoSomethingDuringApplyScript()
|
||||||
{
|
{
|
||||||
yield return base.DoSomethingDuringApplyScript();
|
yield return base.DoSomethingDuringApplyScript();
|
||||||
if (MyTimelineEntry == null)
|
if (IsEnableTimelineItem)
|
||||||
{
|
|
||||||
MyTimelineEntry = TimelineWindow.CreateRootItemEntries(1)[0];
|
|
||||||
MyTimelineItem = MyTimelineEntry.ref_value.GetComponent<Editor.UI.TimelineItem>();
|
|
||||||
}
|
|
||||||
MyTimelineItem.title = ScriptName;
|
|
||||||
MyTimelineItem.RawButton.onClick.RemoveAllListeners();
|
|
||||||
MyTimelineItem.AddListener(() =>
|
|
||||||
{
|
|
||||||
HierarchyWindow.instance.MakeFocusOn(MyHierarchyItem.GetHierarchyItem());
|
|
||||||
if (CacheLastFocusImage != null)
|
|
||||||
CacheLastFocusImage.color = CacheLastFocusImageOriginColor;
|
|
||||||
CacheLastFocusImage = MyHierarchyItem.GetHierarchyItem().ButtonGameObject.GetComponent<UnityEngine.UI.Image>();
|
|
||||||
CacheLastFocusImage.color = FocusImageColor;
|
|
||||||
});
|
|
||||||
SetupTimelineItem(MyTimelineItem);
|
|
||||||
// 暂时的逻辑是总是展示的
|
|
||||||
{
|
{
|
||||||
|
if (MyTimelineEntry == null)
|
||||||
|
{
|
||||||
|
MyTimelineEntry = TimelineWindow.CreateRootItemEntries(1)[0];
|
||||||
|
MyTimelineItem = MyTimelineEntry.ref_value.GetComponent<Editor.UI.TimelineItem>();
|
||||||
|
}
|
||||||
|
MyTimelineItem.title = ScriptName;
|
||||||
|
MyTimelineItem.RawButton.onClick.RemoveAllListeners();
|
||||||
|
MyTimelineItem.AddListener(() =>
|
||||||
|
{
|
||||||
|
HierarchyWindow.instance.MakeFocusOn(MyHierarchyItem.GetHierarchyItem());
|
||||||
|
if (CacheLastFocusImage != null)
|
||||||
|
CacheLastFocusImage.color = CacheLastFocusImageOriginColor;
|
||||||
|
CacheLastFocusImage = MyHierarchyItem.GetHierarchyItem().ButtonGameObject.GetComponent<UnityEngine.UI.Image>();
|
||||||
|
CacheLastFocusImage.color = FocusImageColor;
|
||||||
|
});
|
||||||
|
SetupTimelineItem(MyTimelineItem);
|
||||||
TimelineScriptObjectWhichOnShow.Add(this);
|
TimelineScriptObjectWhichOnShow.Add(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -710,6 +718,7 @@ namespace Demo
|
|||||||
{
|
{
|
||||||
base.UpdateTicks(currentTime, deltaTime, tickType);
|
base.UpdateTicks(currentTime, deltaTime, tickType);
|
||||||
// 存在严重的性能开销, 在解决之前将不会允许其快速自动更新
|
// 存在严重的性能开销, 在解决之前将不会允许其快速自动更新
|
||||||
|
if (IsEnableTimelineItem)
|
||||||
{
|
{
|
||||||
if (UIResizeOnTimelineCount > 0.1 || tickType != TickType.Update)
|
if (UIResizeOnTimelineCount > 0.1 || tickType != TickType.Update)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ namespace Demo
|
|||||||
{ $"{nameof(SplineTrackRenderer)}",SplineTrackRenderer.Make},
|
{ $"{nameof(SplineTrackRenderer)}",SplineTrackRenderer.Make},
|
||||||
{ $"{nameof(SplineTubeRenderer)}",SplineTubeRenderer.Make},
|
{ $"{nameof(SplineTubeRenderer)}",SplineTubeRenderer.Make},
|
||||||
{ $"{nameof(SplineSurfaceRenderer)}",SplineSurfaceRenderer.Make},
|
{ $"{nameof(SplineSurfaceRenderer)}",SplineSurfaceRenderer.Make},
|
||||||
|
{ $"{nameof(SplineRenderer)}",SplineRenderer.Make},
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Dictionary<string, Func<ScriptableObject>> JudgementInstantiate = new()
|
public static Dictionary<string, Func<ScriptableObject>> JudgementInstantiate = new()
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Demo.Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int Content = 0;
|
public int Content = 0;
|
||||||
private List<UpdatementEntry> Entries = new();
|
private readonly List<UpdatementEntry> Entries = new();
|
||||||
public UpdatementCompiledEntries CompiledEntries;
|
public UpdatementCompiledEntries CompiledEntries;
|
||||||
protected abstract void UpdateData(DataType data);
|
protected abstract void UpdateData(DataType data);
|
||||||
protected abstract DataType Lerp(DataType begin, DataType end, float t);
|
protected abstract DataType Lerp(DataType begin, DataType end, float t);
|
||||||
@@ -77,7 +77,6 @@ namespace Demo.Game
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
Entries.Clear();
|
Entries.Clear();
|
||||||
Entries = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateEntry(int start, float percent)
|
private void UpdateEntry(int start, float percent)
|
||||||
@@ -101,7 +100,9 @@ namespace Demo.Game
|
|||||||
|
|
||||||
public override void ResetEnterGameStatus()
|
public override void ResetEnterGameStatus()
|
||||||
{
|
{
|
||||||
base.ResetEnterGameStatus();
|
base.ResetEnterGameStatus();
|
||||||
|
if (CompiledEntries.Count <= 1)
|
||||||
|
return;
|
||||||
UpdateEntry(0, 0);
|
UpdateEntry(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,6 +119,8 @@ namespace Demo.Game
|
|||||||
|
|
||||||
float GetPercentValue()
|
float GetPercentValue()
|
||||||
{
|
{
|
||||||
|
if (Content + 1 == CompiledEntries.Count)
|
||||||
|
return 1;
|
||||||
return (currentTime - CompiledEntries.TimePoints[Content]) / (CompiledEntries.TimePoints[Content + 1] - CompiledEntries.TimePoints[Content]);
|
return (currentTime - CompiledEntries.TimePoints[Content]) / (CompiledEntries.TimePoints[Content + 1] - CompiledEntries.TimePoints[Content]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,14 +140,11 @@ namespace Demo.Game
|
|||||||
default:
|
default:
|
||||||
if (CompiledEntries.TimePoints[0] > currentTime)
|
if (CompiledEntries.TimePoints[0] > currentTime)
|
||||||
return;
|
return;
|
||||||
if (Content + 1 >= CompiledEntries.Count)
|
if (Content + 1 < CompiledEntries.Count && CompiledEntries.TimePoints[Content + 1] < currentTime)
|
||||||
return;
|
|
||||||
if (CompiledEntries.TimePoints[Content + 1] < currentTime)
|
|
||||||
Content++;
|
Content++;
|
||||||
if (Content + 1 >= CompiledEntries.Count)
|
if (Content + 1 > CompiledEntries.Count)
|
||||||
UpdateEntry(Content, 1);
|
return;
|
||||||
else
|
UpdateEntry(Content, GetPercentValue());
|
||||||
UpdateEntry(Content, GetPercentValue());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user