SHA256
forked from ADOFAIEditorForum/ADOFAIRenderer
Add RenderSession.WithOutputPath
This commit is contained in:
1 parent
d8712c971e
commit
2a5ceb4889
4 files changed
+26
-13
No files matched your search
+16
-5
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using ADOFAIRenderer.Core;
|
||||
using ADOFAIRenderer.Data;
|
||||
using ADOFAIRenderer.Util;
|
||||
|
||||
namespace ADOFAIRenderer.API;
|
||||
|
||||
@@ -29,13 +30,14 @@ public class RenderSession
|
||||
|
||||
private bool _timePatch = true;
|
||||
private bool _screenPatch = true;
|
||||
|
||||
private static Func<bool> _endCondition = () => scrController.instance.state == States.Won;
|
||||
private Func<bool> _endCondition = () => scrController.instance.state == States.Won;
|
||||
|
||||
private string? _outputPath = null;
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether automatic rendering is enabled.
|
||||
/// Sets whether auto mode is enabled.
|
||||
/// </summary>
|
||||
/// <param name="enabled"><c>true</c> to enable automatic rendering; otherwise, <c>false</c>. Default is <c>true</c>.</param>
|
||||
/// <param name="enabled"><c>true</c> to enable auto mode; otherwise, <c>false</c>. Default is <c>true</c>.</param>
|
||||
/// <returns>The current <see cref="RenderSession"/> instance for method chaining.</returns>
|
||||
public RenderSession WithAuto(bool enabled = true)
|
||||
{
|
||||
@@ -73,6 +75,12 @@ public class RenderSession
|
||||
return this;
|
||||
}
|
||||
|
||||
public RenderSession WithOutputPath(string? outputPath)
|
||||
{
|
||||
_outputPath = outputPath;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the configured flags and initiates the render session.
|
||||
/// </summary>
|
||||
@@ -89,7 +97,10 @@ public class RenderSession
|
||||
RenderManager.Instance.Configuration = renderConfig;
|
||||
|
||||
RenderManager.Instance.StartLoadingOverride();
|
||||
RenderManager.Instance.SetupCaptureDirectory();
|
||||
|
||||
if (_outputPath is null) RenderManager.Instance.SetupCaptureDirectory();
|
||||
else FileUtil.CreateDirectory(_outputPath);
|
||||
|
||||
RenderManager.Instance.SetupGameScene();
|
||||
}
|
||||
}
|
||||
@@ -392,10 +392,7 @@ namespace ADOFAIRenderer.Core
|
||||
public void SetupCaptureDirectory()
|
||||
{
|
||||
var renderDir = Path.Combine(MelonEnvironment.GameRootDirectory, "Render");
|
||||
if (!Directory.Exists(renderDir))
|
||||
{
|
||||
Directory.CreateDirectory(renderDir);
|
||||
}
|
||||
FileUtil.CreateDirectory(renderDir);
|
||||
}
|
||||
|
||||
public void SetupGameScene()
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ namespace ADOFAIRenderer
|
||||
if (EventSystem.current == null) return;
|
||||
var currentModule = EventSystem.current.currentInputModule;
|
||||
|
||||
if (currentModule != null) return;
|
||||
if (currentModule) return;
|
||||
Melon<RenderMod>.Logger.Msg("Unity 6 인풋 모듈 이식.");
|
||||
|
||||
var newModule = EventSystem.current.gameObject.AddComponent<StandaloneInputModule>();
|
||||
|
||||
+8
-3
@@ -1,6 +1,11 @@
|
||||
namespace ADOFAIRenderer.Util;
|
||||
using System.IO;
|
||||
|
||||
public class FileUtil
|
||||
namespace ADOFAIRenderer.Util;
|
||||
|
||||
internal static class FileUtil
|
||||
{
|
||||
|
||||
public static void CreateDirectory(string path)
|
||||
{
|
||||
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user