SHA256
Fix Random Seed Parsing and Assignment to RenderSettings in RenderButton
This commit is contained in:
1 parent
f4062912a0
commit
6ca0e5f6e1
2 files changed
+23
-4
No files matched your search
@@ -10,6 +10,7 @@ using ADOFAIRenderer.Util.FFmpeg;
|
|||||||
using MelonLoader;
|
using MelonLoader;
|
||||||
using MelonLoader.Utils;
|
using MelonLoader.Utils;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Random = UnityEngine.Random;
|
||||||
using ThreadPriority = System.Threading.ThreadPriority;
|
using ThreadPriority = System.Threading.ThreadPriority;
|
||||||
|
|
||||||
namespace ADOFAIRenderer.Core
|
namespace ADOFAIRenderer.Core
|
||||||
@@ -63,8 +64,9 @@ namespace ADOFAIRenderer.Core
|
|||||||
public string Codec;
|
public string Codec;
|
||||||
public double EndWaitTime;
|
public double EndWaitTime;
|
||||||
public bool ShowHitText;
|
public bool ShowHitText;
|
||||||
|
public int? RandomSeed;
|
||||||
|
|
||||||
public RenderSettings(double targetFPS, double videoFPS, int renderWidth, int renderHeight, int bitrate, string codec, double endWaitTime, bool showHitText)
|
public RenderSettings(double targetFPS, double videoFPS, int renderWidth, int renderHeight, int bitrate, string codec, double endWaitTime, bool showHitText, int? randomSeed)
|
||||||
{
|
{
|
||||||
TargetFPS = targetFPS;
|
TargetFPS = targetFPS;
|
||||||
VideoFPS = videoFPS;
|
VideoFPS = videoFPS;
|
||||||
@@ -76,6 +78,8 @@ namespace ADOFAIRenderer.Core
|
|||||||
Codec = codec;
|
Codec = codec;
|
||||||
EndWaitTime = endWaitTime;
|
EndWaitTime = endWaitTime;
|
||||||
ShowHitText = showHitText;
|
ShowHitText = showHitText;
|
||||||
|
|
||||||
|
RandomSeed = randomSeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,6 +352,7 @@ namespace ADOFAIRenderer.Core
|
|||||||
GCS.nextSpeedRun = 1;
|
GCS.nextSpeedRun = 1;
|
||||||
GCS.customLevelIndex = 0;
|
GCS.customLevelIndex = 0;
|
||||||
|
|
||||||
|
if (Configuration.RandomSeed.HasValue) Random.InitState(Configuration.RandomSeed.Value);
|
||||||
ADOBase.loader.LoadSceneWithTransition(WipeDirection.StartsFromRight, "scnGame");
|
ADOBase.loader.LoadSceneWithTransition(WipeDirection.StartsFromRight, "scnGame");
|
||||||
skipPressToStart = true;
|
skipPressToStart = true;
|
||||||
_renderSetup = true;
|
_renderSetup = true;
|
||||||
|
|||||||
+17
-3
@@ -17,6 +17,7 @@ namespace ADOFAIRenderer.UI
|
|||||||
[SerializeField] private TMP_InputField renderHeightInput = null!;
|
[SerializeField] private TMP_InputField renderHeightInput = null!;
|
||||||
[SerializeField] private TMP_InputField bitrateInput = null!;
|
[SerializeField] private TMP_InputField bitrateInput = null!;
|
||||||
[SerializeField] private TMP_InputField waitAfterEndInput = null!;
|
[SerializeField] private TMP_InputField waitAfterEndInput = null!;
|
||||||
|
[SerializeField] private TMP_InputField randomSeedInput = null!;
|
||||||
|
|
||||||
[Header("Dropdown")]
|
[Header("Dropdown")]
|
||||||
[SerializeField] private TMP_Dropdown codecDropdown = null!;
|
[SerializeField] private TMP_Dropdown codecDropdown = null!;
|
||||||
@@ -78,11 +79,23 @@ namespace ADOFAIRenderer.UI
|
|||||||
Melon<RenderMod>.Logger.Error("올바르지 않은 Bitrate 값입니다. 0보다 큰 정수여야 합니다.");
|
Melon<RenderMod>.Logger.Error("올바르지 않은 Bitrate 값입니다. 0보다 큰 정수여야 합니다.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!double.TryParse(waitAfterEndInput.text, out var waitAfterEnd) || waitAfterEnd <= 0)
|
if (!double.TryParse(waitAfterEndInput.text, out var waitAfterEnd) || waitAfterEnd < 0)
|
||||||
{
|
{
|
||||||
Melon<RenderMod>.Logger.Error("올바르지 않은 Wait After End 값입니다. 0보다 큰 숫자여야 합니다.");
|
Melon<RenderMod>.Logger.Error("올바르지 않은 Wait After End 값입니다. 0 이상의 숫자여야 합니다.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int? parsedRandomSeed = null;
|
||||||
|
var randomSeedText = randomSeedInput.text.Truncate(int.MaxValue);
|
||||||
|
if (!randomSeedText.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
if (!int.TryParse(randomSeedText, out var seedVal))
|
||||||
|
{
|
||||||
|
Melon<RenderMod>.Logger.Error("올바르지 않은 Random Seed 값입니다. 비어 있거나 정수여야 합니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parsedRandomSeed = seedVal;
|
||||||
|
}
|
||||||
|
|
||||||
if (RenderManager.Instance)
|
if (RenderManager.Instance)
|
||||||
{
|
{
|
||||||
@@ -105,7 +118,8 @@ namespace ADOFAIRenderer.UI
|
|||||||
Bitrate = bitrate,
|
Bitrate = bitrate,
|
||||||
Codec = selectedCodecName,
|
Codec = selectedCodecName,
|
||||||
EndWaitTime = waitAfterEnd,
|
EndWaitTime = waitAfterEnd,
|
||||||
ShowHitText = showHitText
|
ShowHitText = showHitText,
|
||||||
|
RandomSeed = parsedRandomSeed
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user