Add OnLastUpdate Callback to API

This commit is contained in:
copecone committed 2026-08-20 10:50:02 +09:00
1 parent 5ffd73052d
commit 111f5cf792
3 files changed
+33 -2

No files matched your search

+19 -1
View File
@@ -48,6 +48,9 @@ internal static class RenderContext
};
public static Action<RenderResult> OnComplete = OnCompleteDefault;
private static readonly Action OnLastUpdateDefault = () => { };
public static Action OnLastUpdate = OnLastUpdateDefault;
public static void Reset()
{
Auto = true;
@@ -58,6 +61,7 @@ internal static class RenderContext
EndCondition = EndConditionDefault;
OnComplete = OnCompleteDefault;
OnLastUpdate = OnLastUpdateDefault;
}
}
@@ -270,7 +274,7 @@ internal class RenderManager : MonoBehaviour
}
}
public void OnPreRenderUpdate()
public void OnPreUpdate()
{
if (!IsRendering) return;
@@ -331,6 +335,8 @@ internal class RenderManager : MonoBehaviour
{
floor.holdRenderer.m_meshRenderer.enabled = false;
}
TriggerOnLastUpdate();
}
// ReSharper disable once Unity.IncorrectMethodSignature
@@ -867,6 +873,18 @@ internal class RenderManager : MonoBehaviour
Melon<RenderMod>.Logger.Error($"OnComplete callback caused error: {err}");
}
}
private static void TriggerOnLastUpdate()
{
try
{
RenderContext.OnLastUpdate.Invoke();
}
catch (Exception err)
{
Melon<RenderMod>.Logger.Error($"OnLastUpdate callback caused error: {err}");
}
}
private static readonly Dictionary<Codec, AVCodecID> AudioCodecMatch = new()
{