Add RenderSession.OnComplete

This commit is contained in:
copecone committed 2026-08-19 15:08:55 +09:00
1 parent 6840395041
commit 4e67cb9b09
4 files changed
+816 -728

No files matched your search

+21 -3
View File
@@ -33,10 +33,13 @@ public class RenderSession
private bool _timePatch = true;
private bool _screenPatch = true;
private Func<bool> _endCondition = () => scrController.instance.state == States.Won;
private string? _outputPath;
private bool _notification = true;
private Func<bool>? _endCondition;
private Action<RenderResult>? _onComplete;
/// <summary>
/// Sets whether auto mode is enabled.
/// </summary>
@@ -89,6 +92,18 @@ public class RenderSession
return this;
}
public RenderSession WithNotification(bool enabled)
{
_notification = enabled;
return this;
}
public RenderSession OnComplete(Action<RenderResult> callback)
{
_onComplete += callback;
return this;
}
/// <summary>
/// Applies the configured flags and initiates the render session.
/// </summary>
@@ -99,8 +114,11 @@ public class RenderSession
RenderContext.Auto = _auto;
RenderContext.TimePatch = _timePatch;
RenderContext.ScreenPatch = _screenPatch;
RenderContext.EndCondition = _endCondition;
RenderContext.OutputPath = _outputPath;
RenderContext.Notification = _notification;
if (_endCondition is not null) RenderContext.EndCondition = _endCondition;
if (_onComplete is not null) RenderContext.OnComplete = _onComplete;
RenderManager.Instance.levelPath = levelPath;
RenderManager.Instance.Configuration = renderConfig;