SHA256
forked from ADOFAIEditorForum/ADOFAIRenderer
Change RenderConfig.DelayAfterLevelEnd to DelayAfterEnd
This commit is contained in:
4 files changed
+148
-97
No files matched your search
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using ADOFAIRenderer.Core;
|
||||
|
||||
namespace ADOFAIRenderer.API;
|
||||
|
||||
/// <summary>
|
||||
/// Fluent builder for configuring and starting a render session.
|
||||
/// </summary>
|
||||
public class RenderSessionBuilder
|
||||
{
|
||||
private bool _auto = true;
|
||||
|
||||
public enum PatchType { Time, Screen }
|
||||
private bool _timePatch = true;
|
||||
private bool _screenPatch = true;
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether automatic rendering is enabled.
|
||||
/// </summary>
|
||||
/// <param name="enabled"><c>true</c> to enable automatic rendering; otherwise, <c>false</c>. Default is <c>true</c>.</param>
|
||||
/// <returns>The current <see cref="RenderSessionBuilder"/> instance for method chaining.</returns>
|
||||
public RenderSessionBuilder WithAuto(bool enabled = true)
|
||||
{
|
||||
_auto = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RenderSessionBuilder WithPatch(PatchType patchType, bool enabled = true)
|
||||
{
|
||||
switch (patchType)
|
||||
{
|
||||
case PatchType.Time: _timePatch = enabled; break;
|
||||
case PatchType.Screen: _screenPatch = enabled; break;
|
||||
default: throw new ArgumentOutOfRangeException(nameof(patchType), patchType, null);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the configured flags and initiates the render session.
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
RenderFlags.Auto = _auto;
|
||||
RenderFlags.TimePatch = _timePatch;
|
||||
RenderFlags.ScreenPatch = _screenPatch;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user