Refactor Every namespace Keyword Usage

This commit is contained in:
copecone committed 2026-08-19 15:40:00 +09:00
1 parent 4e67cb9b09
commit 27be2141f7
44 files changed
+359 -285

No files matched your search

+64
View File
@@ -110,4 +110,68 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="FFmpeg.AutoGen" Version="8.1.0" /> <PackageReference Include="FFmpeg.AutoGen" Version="8.1.0" />
</ItemGroup> </ItemGroup>
<!-- Build 후 XML 문서에서 ADOFAIRenderer.API 네임스페이스만 남기고 나머지 제거 -->
<UsingTask TaskName="FilterXmlDoc" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<XmlFilePath ParameterType="System.String" Required="true" />
<TargetNamespace ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Collections.Generic" />
<Using Namespace="System.Xml.Linq" />
<Code Type="Fragment" Language="cs">
<![CDATA[
if (!File.Exists(XmlFilePath)) return true;
try
{
var doc = XDocument.Load(XmlFilePath);
var members = doc.Root?.Element("members");
if (members != null)
{
var prefix = TargetNamespace + ".";
var toRemove = new List<XElement>();
foreach (var member in members.Elements("member"))
{
var nameAttr = member.Attribute("name")?.Value;
if (string.IsNullOrEmpty(nameAttr)) continue;
// XML 주석 형식: T:네임스페이스.타입, M:메서드, P:프로퍼티, F:필드/열거형, E:이벤트 등
int colonIndex = nameAttr.IndexOf(':');
string fullName = colonIndex >= 0 ? nameAttr.Substring(colonIndex + 1) : nameAttr;
if (!fullName.StartsWith(prefix, StringComparison.Ordinal) && !fullName.Equals(TargetNamespace, StringComparison.Ordinal))
{
toRemove.Add(member);
}
}
foreach (var elem in toRemove)
{
elem.Remove();
}
doc.Save(XmlFilePath);
Log.LogMessage(Microsoft.Build.Framework.MessageImportance.High, $"[FilterXmlDoc] Kept '{TargetNamespace}' namespace docs. Removed {toRemove.Count} other members.");
}
}
catch (Exception ex)
{
Log.LogWarning($"[FilterXmlDoc] XML filtering failed: {ex.Message}");
}
]]>
</Code>
</Task>
</UsingTask>
<Target Name="FilterDocumentationFile" AfterTargets="Build" Condition="'$(GenerateDocumentationFile)' == 'true'">
<PropertyGroup>
<_XmlDocPath Condition="'$(_XmlDocPath)' == '' and Exists('$(TargetDir)$(TargetName).xml')">$(TargetDir)$(TargetName).xml</_XmlDocPath>
<_XmlDocPath Condition="'$(_XmlDocPath)' == '' and Exists('$(DocumentationFile)')">$(DocumentationFile)</_XmlDocPath>
</PropertyGroup>
<FilterXmlDoc Condition="'$(_XmlDocPath)' != ''" XmlFilePath="$(_XmlDocPath)" TargetNamespace="ADOFAIRenderer.API" />
</Target>
</Project> </Project>
+35 -4
View File
@@ -5,9 +5,10 @@ using System.IO;
namespace ADOFAIRenderer.API; namespace ADOFAIRenderer.API;
/// <summary> /// <summary>
/// Represents the result and metadata of a completed or cancelled render session. /// Represents the result and metadata of a completed or canceled render session.
/// </summary> /// </summary>
[SuppressMessage("ReSharper", "UnusedType.Global")] [SuppressMessage("ReSharper", "UnusedType.Global")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public class RenderResult public class RenderResult
{ {
/// <summary> /// <summary>
@@ -41,10 +42,20 @@ public class RenderResult
public long FileSizeBytes { get; } public long FileSizeBytes { get; }
/// <summary> /// <summary>
/// Error message or reason if rendering failed or was cancelled; <c>null</c> on success. /// Error message or reason if rendering failed or was canceled; <c>null</c> on success.
/// </summary> /// </summary>
public string? ErrorMessage { get; } public string? ErrorMessage { get; }
/// <summary>
/// Initializes a new instance of the <see cref="RenderResult"/> class.
/// </summary>
/// <param name="success">Whether the render session completed successfully.</param>
/// <param name="outputPath">The absolute output path of the rendered video file.</param>
/// <param name="totalFrames">Total number of video frames sent to the encoder.</param>
/// <param name="videoDuration">Calculated video duration in seconds.</param>
/// <param name="renderDuration">Total wall-clock time spent rendering.</param>
/// <param name="fileSizeBytes">File size of the output video in bytes.</param>
/// <param name="errorMessage">Error message or reason if failed or canceled; otherwise, <c>null</c>.</param>
public RenderResult( public RenderResult(
bool success, bool success,
string outputPath, string outputPath,
@@ -63,7 +74,15 @@ public class RenderResult
ErrorMessage = errorMessage; ErrorMessage = errorMessage;
} }
public static RenderResult CreateSuccess(string outputPath, long totalFrames, double fps, TimeSpan renderDuration) /// <summary>
/// Creates a successful <see cref="RenderResult"/> instance from the specified render metrics.
/// </summary>
/// <param name="outputPath">The path to the rendered video file.</param>
/// <param name="totalFrames">Total number of video frames sent to the encoder.</param>
/// <param name="fps">The effective frames per second used to compute video duration.</param>
/// <param name="renderDuration">Total wall-clock time spent rendering.</param>
/// <returns>A new <see cref="RenderResult"/> representing a successful render session.</returns>
internal static RenderResult CreateSuccess(string outputPath, long totalFrames, double fps, TimeSpan renderDuration)
{ {
var fileSizeBytes = 0L; var fileSizeBytes = 0L;
if (!string.IsNullOrEmpty(outputPath) && File.Exists(outputPath)) if (!string.IsNullOrEmpty(outputPath) && File.Exists(outputPath))
@@ -76,12 +95,24 @@ public class RenderResult
return new RenderResult(true, outputPath, totalFrames, videoDuration, renderDuration, fileSizeBytes); return new RenderResult(true, outputPath, totalFrames, videoDuration, renderDuration, fileSizeBytes);
} }
public static RenderResult CreateFailure(string? errorMessage, long totalFrames, double fps, TimeSpan renderDuration) /// <summary>
/// Creates a failed or cancelled <see cref="RenderResult"/> instance.
/// </summary>
/// <param name="errorMessage">Error message or reason for failure/cancellation.</param>
/// <param name="totalFrames">Total number of video frames sent to the encoder prior to termination.</param>
/// <param name="fps">The effective frames per second used to compute video duration.</param>
/// <param name="renderDuration">Total wall-clock time spent rendering prior to termination.</param>
/// <returns>A new <see cref="RenderResult"/> representing a failed or canceled render session.</returns>
internal static RenderResult CreateFailure(string? errorMessage, long totalFrames, double fps, TimeSpan renderDuration)
{ {
var videoDuration = fps > 0 ? totalFrames / fps : 0.0; var videoDuration = fps > 0 ? totalFrames / fps : 0.0;
return new RenderResult(false, string.Empty, totalFrames, videoDuration, renderDuration, 0, errorMessage ?? "Rendering failed or was cancelled."); return new RenderResult(false, string.Empty, totalFrames, videoDuration, renderDuration, 0, errorMessage ?? "Rendering failed or was cancelled.");
} }
/// <summary>
/// Returns a string summarizing the render result metrics or failure reason.
/// </summary>
/// <returns>A string representation of the <see cref="RenderResult"/>.</returns>
public override string ToString() public override string ToString()
{ {
return Success return Success
+11
View File
@@ -92,12 +92,22 @@ public class RenderSession
return this; return this;
} }
/// <summary>
/// Sets whether desktop notifications should be displayed when rendering completes.
/// </summary>
/// <param name="enabled"><c>true</c> to enable desktop notifications; otherwise, <c>false</c>.</param>
/// <returns>The current <see cref="RenderSession"/> instance for method chaining.</returns>
public RenderSession WithNotification(bool enabled) public RenderSession WithNotification(bool enabled)
{ {
_notification = enabled; _notification = enabled;
return this; return this;
} }
/// <summary>
/// Adds a callback action to be invoked when the render session completes or fails.
/// </summary>
/// <param name="callback">The callback action that receives the resulting <see cref="RenderResult"/>.</param>
/// <returns>The current <see cref="RenderSession"/> instance for method chaining.</returns>
public RenderSession OnComplete(Action<RenderResult> callback) public RenderSession OnComplete(Action<RenderResult> callback)
{ {
_onComplete += callback; _onComplete += callback;
@@ -109,6 +119,7 @@ public class RenderSession
/// </summary> /// </summary>
/// <param name="renderConfig">The configuration settings for the render session.</param> /// <param name="renderConfig">The configuration settings for the render session.</param>
/// <param name="levelPath">The file path of the level to render.</param> /// <param name="levelPath">The file path of the level to render.</param>
/// <exception cref="InvalidOperationException">Thrown when the output directory cannot be determined from the output path.</exception>
public void Start(RenderConfig renderConfig, string levelPath) public void Start(RenderConfig renderConfig, string levelPath)
{ {
RenderContext.Auto = _auto; RenderContext.Auto = _auto;
+4 -5
View File
@@ -1,11 +1,11 @@
using ADOFAIRenderer.UI; using ADOFAIRenderer.UI;
using UnityEngine; using UnityEngine;
namespace ADOFAIRenderer.Core namespace ADOFAIRenderer.Core;
[DefaultExecutionOrder(int.MinValue)]
internal class FirstUpdateHook : MonoBehaviour
{ {
[DefaultExecutionOrder(int.MinValue)]
internal class FirstUpdateHook : MonoBehaviour
{
private bool _checkedFFmpeg; private bool _checkedFFmpeg;
private bool _checkedNvidiaDriver; private bool _checkedNvidiaDriver;
@@ -62,5 +62,4 @@ namespace ADOFAIRenderer.Core
}) })
); );
} }
}
} }
+4 -5
View File
@@ -3,11 +3,11 @@ using System.Reflection;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
namespace ADOFAIRenderer.Core namespace ADOFAIRenderer.Core;
[DefaultExecutionOrder(int.MaxValue)]
internal class PostRenderHook : MonoBehaviour
{ {
[DefaultExecutionOrder(int.MaxValue)]
internal class PostRenderHook : MonoBehaviour
{
private FieldInfo? _camQuadMeshField; private FieldInfo? _camQuadMeshField;
private void Awake() private void Awake()
@@ -31,5 +31,4 @@ namespace ADOFAIRenderer.Core
if (RenderManager.Instance) if (RenderManager.Instance)
RenderManager.Instance.OnPostFrame(val.sharedMaterial.mainTexture as RenderTexture); RenderManager.Instance.OnPostFrame(val.sharedMaterial.mainTexture as RenderTexture);
} }
}
} }
+24 -23
View File
@@ -1,11 +1,11 @@
namespace ADOFAIRenderer.Data namespace ADOFAIRenderer.Data;
/// <summary>
/// Base class for double input validation limits.
/// Multiple limits can be composed on a single input field — all are checked in order.
/// </summary>
internal abstract class DoubleLimit
{ {
/// <summary>
/// Base class for double input validation limits.
/// Multiple limits can be composed on a single input field — all are checked in order.
/// </summary>
internal abstract class DoubleLimit
{
/// <summary> /// <summary>
/// Validates the given double value against this limit. /// Validates the given double value against this limit.
/// </summary> /// </summary>
@@ -16,13 +16,13 @@ namespace ADOFAIRenderer.Data
/// </param> /// </param>
/// <returns>true if the value satisfies this limit; false otherwise.</returns> /// <returns>true if the value satisfies this limit; false otherwise.</returns>
public abstract bool Validate(double value, out string errorMessage); public abstract bool Validate(double value, out string errorMessage);
} }
/// <summary> /// <summary>
/// Requires the double value to be strictly positive (> 0). /// Requires the double value to be strictly positive (> 0).
/// </summary> /// </summary>
internal class PositiveOnlyDoubleLimit : DoubleLimit internal class PositiveOnlyDoubleLimit : DoubleLimit
{ {
public override bool Validate(double value, out string errorMessage) public override bool Validate(double value, out string errorMessage)
{ {
if (value > 0) if (value > 0)
@@ -34,16 +34,18 @@ namespace ADOFAIRenderer.Data
errorMessage = "값은 0보다 큰 양수여야 합니다."; errorMessage = "값은 0보다 큰 양수여야 합니다.";
return false; return false;
} }
} }
/// <summary> /// <summary>
/// Requires the double value to be within an inclusive [Min, Max] range. /// Requires the double value to be within an inclusive [Min, Max] range.
/// Either bound can be null to represent an unbounded side. /// Either bound can be null to represent an unbounded side.
/// </summary> /// </summary>
internal class RangeDoubleLimit : DoubleLimit internal class RangeDoubleLimit : DoubleLimit
{ {
// ReSharper disable MemberCanBePrivate.Global
public double? Min { get; } public double? Min { get; }
public double? Max { get; } public double? Max { get; }
// ReSharper restore MemberCanBePrivate.Global
/// <param name="min">Inclusive lower bound, or null for no lower bound.</param> /// <param name="min">Inclusive lower bound, or null for no lower bound.</param>
/// <param name="max">Inclusive upper bound, or null for no upper bound.</param> /// <param name="max">Inclusive upper bound, or null for no upper bound.</param>
@@ -55,7 +57,7 @@ namespace ADOFAIRenderer.Data
public override bool Validate(double value, out string errorMessage) public override bool Validate(double value, out string errorMessage)
{ {
if (Min.HasValue && value < Min.Value) if (value < Min)
{ {
errorMessage = Max.HasValue errorMessage = Max.HasValue
? $"값은 {Min.Value}에서 {Max.Value} 사이의 숫자여야 합니다." ? $"값은 {Min.Value}에서 {Max.Value} 사이의 숫자여야 합니다."
@@ -63,7 +65,7 @@ namespace ADOFAIRenderer.Data
return false; return false;
} }
if (Max.HasValue && value > Max.Value) if (value > Max)
{ {
errorMessage = Min.HasValue errorMessage = Min.HasValue
? $"값은 {Min.Value}에서 {Max.Value} 사이의 숫자여야 합니다." ? $"값은 {Min.Value}에서 {Max.Value} 사이의 숫자여야 합니다."
@@ -74,5 +76,4 @@ namespace ADOFAIRenderer.Data
errorMessage = null!; errorMessage = null!;
return true; return true;
} }
}
} }
+3 -4
View File
@@ -3,10 +3,10 @@ using System.Linq;
using MelonLoader; using MelonLoader;
using UnityEngine.UIElements; using UnityEngine.UIElements;
namespace ADOFAIRenderer.Data.Input namespace ADOFAIRenderer.Data.Input;
internal class DoubleInputValidator
{ {
internal class DoubleInputValidator
{
private struct FieldEntry private struct FieldEntry
{ {
public List<DoubleLimit> Limits; public List<DoubleLimit> Limits;
@@ -73,5 +73,4 @@ namespace ADOFAIRenderer.Data.Input
}); });
} }
} }
}
} }
+10 -9
View File
@@ -1,18 +1,20 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq; using System.Linq;
using MelonLoader; using MelonLoader;
using UnityEngine.UIElements; using UnityEngine.UIElements;
namespace ADOFAIRenderer.Data.Input namespace ADOFAIRenderer.Data.Input;
/// <summary>
/// Binds a UI Toolkit <see cref="DropdownField"/> to an enum type.
/// Populates choices from enum names and provides typed access to the selected value.
/// </summary>
/// <typeparam name="T">The enum type to bind.</typeparam>
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
internal class EnumDropdownBinder<T> where T : struct, Enum
{ {
/// <summary>
/// Binds a UI Toolkit <see cref="DropdownField"/> to an enum type.
/// Populates choices from enum names and provides typed access to the selected value.
/// </summary>
/// <typeparam name="T">The enum type to bind.</typeparam>
internal class EnumDropdownBinder<T> where T : struct, Enum
{
private readonly DropdownField? _dropdown; private readonly DropdownField? _dropdown;
private readonly List<T> _values; private readonly List<T> _values;
private Action<T>? _onValueChanged; private Action<T>? _onValueChanged;
@@ -82,5 +84,4 @@ namespace ADOFAIRenderer.Data.Input
_dropdown.index = idx; _dropdown.index = idx;
} }
} }
}
} }
+3 -4
View File
@@ -3,10 +3,10 @@ using System.Linq;
using MelonLoader; using MelonLoader;
using UnityEngine.UIElements; using UnityEngine.UIElements;
namespace ADOFAIRenderer.Data.Input namespace ADOFAIRenderer.Data.Input;
internal class IntegerInputValidator
{ {
internal class IntegerInputValidator
{
private struct FieldEntry private struct FieldEntry
{ {
public List<IntegerLimit> Limits; public List<IntegerLimit> Limits;
@@ -73,5 +73,4 @@ namespace ADOFAIRenderer.Data.Input
}); });
} }
} }
}
} }
+24 -23
View File
@@ -1,11 +1,11 @@
namespace ADOFAIRenderer.Data namespace ADOFAIRenderer.Data;
/// <summary>
/// Base class for integer input validation limits.
/// Multiple limits can be composed on a single input field — all are checked in order.
/// </summary>
internal abstract class IntegerLimit
{ {
/// <summary>
/// Base class for integer input validation limits.
/// Multiple limits can be composed on a single input field — all are checked in order.
/// </summary>
internal abstract class IntegerLimit
{
/// <summary> /// <summary>
/// Validates the given integer value against this limit. /// Validates the given integer value against this limit.
/// </summary> /// </summary>
@@ -16,13 +16,13 @@ namespace ADOFAIRenderer.Data
/// </param> /// </param>
/// <returns>true if the value satisfies this limit; false otherwise.</returns> /// <returns>true if the value satisfies this limit; false otherwise.</returns>
public abstract bool Validate(int value, out string errorMessage); public abstract bool Validate(int value, out string errorMessage);
} }
/// <summary> /// <summary>
/// Requires the integer value to be strictly positive (> 0). /// Requires the integer value to be strictly positive (> 0).
/// </summary> /// </summary>
internal class PositiveOnlyIntegerLimit : IntegerLimit internal class PositiveOnlyIntegerLimit : IntegerLimit
{ {
public override bool Validate(int value, out string errorMessage) public override bool Validate(int value, out string errorMessage)
{ {
if (value > 0) if (value > 0)
@@ -34,16 +34,18 @@ namespace ADOFAIRenderer.Data
errorMessage = "값은 0보다 큰 양의 정수여야 합니다."; errorMessage = "값은 0보다 큰 양의 정수여야 합니다.";
return false; return false;
} }
} }
/// <summary> /// <summary>
/// Requires the integer value to be within an inclusive [Min, Max] range. /// Requires the integer value to be within an inclusive [Min, Max] range.
/// Either bound can be null to represent an unbounded side. /// Either bound can be null to represent an unbounded side.
/// </summary> /// </summary>
internal class RangeIntegerLimit : IntegerLimit internal class RangeIntegerLimit : IntegerLimit
{ {
// ReSharper disable MemberCanBePrivate.Global
public int? Min { get; } public int? Min { get; }
public int? Max { get; } public int? Max { get; }
// ReSharper restore MemberCanBePrivate.Global
/// <param name="min">Inclusive lower bound, or null for no lower bound.</param> /// <param name="min">Inclusive lower bound, or null for no lower bound.</param>
/// <param name="max">Inclusive upper bound, or null for no upper bound.</param> /// <param name="max">Inclusive upper bound, or null for no upper bound.</param>
@@ -55,7 +57,7 @@ namespace ADOFAIRenderer.Data
public override bool Validate(int value, out string errorMessage) public override bool Validate(int value, out string errorMessage)
{ {
if (Min.HasValue && value < Min.Value) if (value < Min)
{ {
errorMessage = Max.HasValue errorMessage = Max.HasValue
? $"값은 {Min.Value}에서 {Max.Value} 사이의 정수여야 합니다." ? $"값은 {Min.Value}에서 {Max.Value} 사이의 정수여야 합니다."
@@ -63,7 +65,7 @@ namespace ADOFAIRenderer.Data
return false; return false;
} }
if (Max.HasValue && value > Max.Value) if (value > Max)
{ {
errorMessage = Min.HasValue errorMessage = Min.HasValue
? $"값은 {Min.Value}에서 {Max.Value} 사이의 정수여야 합니다." ? $"값은 {Min.Value}에서 {Max.Value} 사이의 정수여야 합니다."
@@ -74,5 +76,4 @@ namespace ADOFAIRenderer.Data
errorMessage = null!; errorMessage = null!;
return true; return true;
} }
}
} }
+6 -7
View File
@@ -7,16 +7,16 @@ using MelonLoader.Utils;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace ADOFAIRenderer.Data namespace ADOFAIRenderer.Data;
internal class RenderPreset
{ {
internal class RenderPreset
{
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public RenderConfig Config { get; set; } = null!; public RenderConfig Config { get; set; } = null!;
} }
internal static class PresetManager internal static class PresetManager
{ {
private static string GetPresetsDirectory() private static string GetPresetsDirectory()
{ {
return Path.Combine(MelonEnvironment.GameRootDirectory, "UserData", "ADOFAIRenderer", "Presets"); return Path.Combine(MelonEnvironment.GameRootDirectory, "UserData", "ADOFAIRenderer", "Presets");
@@ -186,5 +186,4 @@ namespace ADOFAIRenderer.Data
File.Delete(filePath); File.Delete(filePath);
} }
} }
}
} }
+14 -15
View File
@@ -1,11 +1,11 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using ADOFAIRenderer.Util.FFmpeg; using ADOFAIRenderer.Util.FFmpeg;
namespace ADOFAIRenderer.Data namespace ADOFAIRenderer.Data;
[SuppressMessage("ReSharper", "RedundantDefaultMemberInitializer")]
public class RenderConfig
{ {
[SuppressMessage("ReSharper", "RedundantDefaultMemberInitializer")]
public class RenderConfig
{
public double RenderFPS { get; set; } public double RenderFPS { get; set; }
public double VideoFPS { get; set; } public double VideoFPS { get; set; }
@@ -18,19 +18,19 @@ namespace ADOFAIRenderer.Data
public double DelayAfterEnd { get; set; } public double DelayAfterEnd { get; set; }
public bool ShowJudgementText { get; set; } = false; public bool ShowJudgementText { get; set; } = false;
} }
[SuppressMessage("ReSharper", "RedundantDefaultMemberInitializer")] [SuppressMessage("ReSharper", "RedundantDefaultMemberInitializer")]
public class AdvancedConfig public class AdvancedConfig
{ {
public int? RandomSeed { get; set; } = null; public int? RandomSeed { get; set; } = null;
public bool ProcessAudio { get; set; } = true; public bool ProcessAudio { get; set; } = true;
public bool NonTile { get; set; } = false; public bool NonTile { get; set; } = false;
public string FileExtension { get; set; } = "mkv"; public string FileExtension { get; set; } = "mkv";
} }
public class VideoEncodingConfig public class VideoEncodingConfig
{ {
public Codec Codec { get; set; } = Codec.H264; public Codec Codec { get; set; } = Codec.H264;
public RateControlMode RateControlMode { get; set; } = RateControlMode.CBR; public RateControlMode RateControlMode { get; set; } = RateControlMode.CBR;
@@ -40,10 +40,10 @@ namespace ADOFAIRenderer.Data
public int QP { get; set; } = 18; public int QP { get; set; } = 18;
public double KeyframeInterval { get; set; } = 2.0; public double KeyframeInterval { get; set; } = 2.0;
public bool ForceSoftwareEncoder { get; set; } public bool ForceSoftwareEncoder { get; set; }
} }
public class AudioEncodingConfig public class AudioEncodingConfig
{ {
private int _audioSampleRate = 44100; private int _audioSampleRate = 44100;
private int _audioChannels = 2; private int _audioChannels = 2;
private int _audioBitrate = 256000; private int _audioBitrate = 256000;
@@ -67,5 +67,4 @@ namespace ADOFAIRenderer.Data
get => _audioBitrate <= 0 ? 256000 : _audioBitrate; get => _audioBitrate <= 0 ? 256000 : _audioBitrate;
set => _audioBitrate = value <= 0 ? 256000 : value; set => _audioBitrate = value <= 0 ? 256000 : value;
} }
}
} }
+5 -6
View File
@@ -1,12 +1,12 @@
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Engine namespace ADOFAIRenderer.Patch.Engine;
[HarmonyPatch(typeof(AsyncInputUtils), "UpdateOffsetTime")]
// ReSharper disable once InconsistentNaming
public static class AsyncInputPatches
{ {
[HarmonyPatch(typeof(AsyncInputUtils), "UpdateOffsetTime")]
// ReSharper disable once InconsistentNaming
public static class AsyncInputPatches
{
[HarmonyPrefix] [HarmonyPrefix]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
public static bool Prefix() public static bool Prefix()
@@ -17,5 +17,4 @@ namespace ADOFAIRenderer.Patch.Engine
AsyncInputManager.offsetTickUpdated = true; AsyncInputManager.offsetTickUpdated = true;
return false; // Skip the original damped offset calculation return false; // Skip the original damped offset calculation
} }
}
} }
+20 -21
View File
@@ -4,11 +4,11 @@ using HarmonyLib;
using UnityEngine; using UnityEngine;
using UnityEngine.Audio; using UnityEngine.Audio;
namespace ADOFAIRenderer.Patch.Engine namespace ADOFAIRenderer.Patch.Engine;
[HarmonyPatch(typeof(AudioManager), "_Play")]
public static class AudioManagerPlayPatch
{ {
[HarmonyPatch(typeof(AudioManager), "_Play")]
public static class AudioManagerPlayPatch
{
[HarmonyPrefix] [HarmonyPrefix]
public static bool Prefix(string snd, double time, AudioMixerGroup group, float volume, int priority) public static bool Prefix(string snd, double time, AudioMixerGroup group, float volume, int priority)
{ {
@@ -33,11 +33,11 @@ namespace ADOFAIRenderer.Patch.Engine
RenderManager.Instance.AudioMixer?.RegisterSoundEvent(__result, snd, relativeStartTime, -1.0, volume, 1.0f); RenderManager.Instance.AudioMixer?.RegisterSoundEvent(__result, snd, relativeStartTime, -1.0, volume, 1.0f);
} }
} }
} }
[HarmonyPatch(typeof(scrConductor), "PlayWithEndTime")] [HarmonyPatch(typeof(scrConductor), "PlayWithEndTime")]
public static class PlayWithEndTimePatch public static class PlayWithEndTimePatch
{ {
[HarmonyPrefix] [HarmonyPrefix]
public static bool Prefix(string snd, double time, double endTime, float volume, int priority) public static bool Prefix(string snd, double time, double endTime, float volume, int priority)
{ {
@@ -59,11 +59,11 @@ namespace ADOFAIRenderer.Patch.Engine
} }
return true; // Let the original method execute return true; // Let the original method execute
} }
} }
[HarmonyPatch(typeof(AudioSource), "pitch", MethodType.Setter)] [HarmonyPatch(typeof(AudioSource), "pitch", MethodType.Setter)]
public static class AudioSourcePitchPatch public static class AudioSourcePitchPatch
{ {
[HarmonyPostfix] [HarmonyPostfix]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
public static void Postfix(AudioSource __instance, float value) public static void Postfix(AudioSource __instance, float value)
@@ -77,11 +77,11 @@ namespace ADOFAIRenderer.Patch.Engine
} }
} }
} }
} }
[HarmonyPatch(typeof(AudioSource), "SetScheduledEndTime", typeof(double))] [HarmonyPatch(typeof(AudioSource), "SetScheduledEndTime", typeof(double))]
public static class AudioSourceSetScheduledEndTimePatch public static class AudioSourceSetScheduledEndTimePatch
{ {
[HarmonyPostfix] [HarmonyPostfix]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
public static void Postfix(AudioSource __instance, double time) public static void Postfix(AudioSource __instance, double time)
@@ -95,11 +95,11 @@ namespace ADOFAIRenderer.Patch.Engine
} }
} }
} }
} }
[HarmonyPatch(typeof(AudioSource), "Stop", new Type[0])] [HarmonyPatch(typeof(AudioSource), "Stop", new Type[0])]
public static class AudioSourceStopPatch public static class AudioSourceStopPatch
{ {
[HarmonyPostfix] [HarmonyPostfix]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
public static void Postfix(AudioSource __instance) public static void Postfix(AudioSource __instance)
@@ -109,5 +109,4 @@ namespace ADOFAIRenderer.Patch.Engine
RenderManager.Instance.AudioMixer?.RemoveSourceMapping(__instance); RenderManager.Instance.AudioMixer?.RemoveSourceMapping(__instance);
} }
} }
}
} }
+3 -6
View File
@@ -1,15 +1,13 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using ADOFAIRenderer.Util;
using ADOFAIRenderer.Util.Audio; using ADOFAIRenderer.Util.Audio;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
namespace ADOFAIRenderer.Patch.Engine namespace ADOFAIRenderer.Patch.Engine;
public static class RenderEnvironmentPatches
{ {
public static class RenderEnvironmentPatches
{
private const bool RenderPatch = true;
private static double TimeSpent => RenderManager.Instance.frameCount / RenderManager.Instance.Configuration.RenderFPS; private static double TimeSpent => RenderManager.Instance.frameCount / RenderManager.Instance.Configuration.RenderFPS;
[HarmonyPatch(typeof(Time), "time", MethodType.Getter)] [HarmonyPatch(typeof(Time), "time", MethodType.Getter)]
@@ -164,5 +162,4 @@ namespace ADOFAIRenderer.Patch.Engine
stream = false; stream = false;
} }
} }
}
} }
+5 -6
View File
@@ -2,12 +2,12 @@ using System.Diagnostics.CodeAnalysis;
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(EndscreenLanterns))]
// ReSharper disable once InconsistentNaming
public static class EndscreenLanternsPatch
{ {
[HarmonyPatch(typeof(EndscreenLanterns))]
// ReSharper disable once InconsistentNaming
public static class EndscreenLanternsPatch
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch("Show")] [HarmonyPatch("Show")]
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
@@ -70,5 +70,4 @@ namespace ADOFAIRenderer.Patch.Game
} }
chainSequenceField.SetValue(null); chainSequenceField.SetValue(null);
} }
}
} }
+4 -5
View File
@@ -1,11 +1,11 @@
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(Persistence))]
public static class PersistencePatch
{ {
[HarmonyPatch(typeof(Persistence))]
public static class PersistencePatch
{
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch("skipIntroBehavior", MethodType.Getter)] [HarmonyPatch("skipIntroBehavior", MethodType.Getter)]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
@@ -18,5 +18,4 @@ namespace ADOFAIRenderer.Patch.Game
__result = SkipIntroBehavior.Off; __result = SkipIntroBehavior.Off;
} }
} }
}
} }
+5 -6
View File
@@ -4,12 +4,12 @@ using MelonLoader;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scnEditor))]
// ReSharper disable once InconsistentNaming
public static class scnEditorPatch
{ {
[HarmonyPatch(typeof(scnEditor))]
// ReSharper disable once InconsistentNaming
public static class scnEditorPatch
{
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch("Start")] [HarmonyPatch("Start")]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
@@ -47,5 +47,4 @@ namespace ADOFAIRenderer.Patch.Game
iconImage.sprite = sprite; iconImage.sprite = sprite;
iconImage.rectTransform.sizeDelta = new Vector2(24, 24); iconImage.rectTransform.sizeDelta = new Vector2(24, 24);
} }
}
} }
+6 -7
View File
@@ -4,12 +4,12 @@ using ADOFAIRenderer.Util;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scnGame))]
// ReSharper disable once InconsistentNaming
public static class scnGamePatch
{ {
[HarmonyPatch(typeof(scnGame))]
// ReSharper disable once InconsistentNaming
public static class scnGamePatch
{
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch("Play")] [HarmonyPatch("Play")]
public static void ProcessFloors() public static void ProcessFloors()
@@ -97,7 +97,7 @@ namespace ADOFAIRenderer.Patch.Game
__instance.videoBG.gameObject.SetActive(true); __instance.videoBG.gameObject.SetActive(true);
// We can only play external video files via FFmpegNativeDecoder. // We can only play external video files via FFmpegNativeDecoder.
// Internal/Bundle level background videos are built-in VideoClips, so we fallback to native Unity VideoPlayer. // Internal/Bundle level background videos are built-in VideoClips, so we fall back to native Unity VideoPlayer.
if (ADOBase.isInternalLevel || ADOBase.isBundleLevel) if (ADOBase.isInternalLevel || ADOBase.isBundleLevel)
{ {
__instance.videoBG.enabled = true; __instance.videoBG.enabled = true;
@@ -138,5 +138,4 @@ namespace ADOFAIRenderer.Patch.Game
return false; // Skip original UpdateVideo return false; // Skip original UpdateVideo
} }
}
} }
+5 -6
View File
@@ -1,12 +1,12 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrCamera))]
// ReSharper disable once InconsistentNaming
public class scrCameraPatch
{ {
[HarmonyPatch(typeof(scrCamera))]
// ReSharper disable once InconsistentNaming
public class scrCameraPatch
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch("SetCustomFrameRate")] [HarmonyPatch("SetCustomFrameRate")]
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
@@ -19,5 +19,4 @@ namespace ADOFAIRenderer.Patch.Game
__instance.frameRate = frame; __instance.frameRate = frame;
return false; return false;
} }
}
} }
+5 -6
View File
@@ -1,12 +1,12 @@
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrController))]
// ReSharper disable once InconsistentNaming
public static class scrControllerPatch
{ {
[HarmonyPatch(typeof(scrController))]
// ReSharper disable once InconsistentNaming
public static class scrControllerPatch
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch("TogglePauseGame")] [HarmonyPatch("TogglePauseGame")]
public static bool PreventPause() public static bool PreventPause()
@@ -41,5 +41,4 @@ namespace ADOFAIRenderer.Patch.Game
{ {
return !RenderManager.IsActive; return !RenderManager.IsActive;
} }
}
} }
+5 -6
View File
@@ -1,11 +1,11 @@
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrDecoration))]
// ReSharper disable once InconsistentNaming
public static class scrDecorationPatch
{ {
[HarmonyPatch(typeof(scrDecoration))]
// ReSharper disable once InconsistentNaming
public static class scrDecorationPatch
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch("SetRotation")] [HarmonyPatch("SetRotation")]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
@@ -37,5 +37,4 @@ namespace ADOFAIRenderer.Patch.Game
{ {
return __instance != null && __instance && __instance.pivotTrans != null; return __instance != null && __instance && __instance.pivotTrans != null;
} }
}
} }
+5 -6
View File
@@ -1,12 +1,12 @@
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrFloor))]
// ReSharper disable once InconsistentNaming
public class scrFloorPatch
{ {
[HarmonyPatch(typeof(scrFloor))]
// ReSharper disable once InconsistentNaming
public class scrFloorPatch
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch("SpawnPortalParticles")] [HarmonyPatch("SpawnPortalParticles")]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
@@ -18,5 +18,4 @@ namespace ADOFAIRenderer.Patch.Game
RenderManager.Instance.Configuration.AdvancedConfig.NonTile; RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
return !nonTile; return !nonTile;
} }
}
} }
+5 -6
View File
@@ -1,15 +1,14 @@
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrHitTextManager), "ShowHitText")]
// ReSharper disable once InconsistentNaming
public class scrHitTextManagerPatch
{ {
[HarmonyPatch(typeof(scrHitTextManager), "ShowHitText")]
// ReSharper disable once InconsistentNaming
public class scrHitTextManagerPatch
{
public static bool Prefix() public static bool Prefix()
{ {
return !RenderManager.IsActive || RenderManager.Instance is { Configuration: { ShowJudgementText: true } }; return !RenderManager.IsActive || RenderManager.Instance is { Configuration: { ShowJudgementText: true } };
} }
}
} }
+5 -6
View File
@@ -1,17 +1,16 @@
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrMistakesManager))]
// ReSharper disable once InconsistentNaming
public static class scrMistakesManagerPatch
{ {
[HarmonyPatch(typeof(scrMistakesManager))]
// ReSharper disable once InconsistentNaming
public static class scrMistakesManagerPatch
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch("SaveCustom")] [HarmonyPatch("SaveCustom")]
public static bool PreventSaveCustom() public static bool PreventSaveCustom()
{ {
return !RenderManager.IsActive; return !RenderManager.IsActive;
} }
}
} }
+5 -6
View File
@@ -1,12 +1,12 @@
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrPlayerManager))]
// ReSharper disable once InconsistentNaming
public static class scrPlayerManagerPatch
{ {
[HarmonyPatch(typeof(scrPlayerManager))]
// ReSharper disable once InconsistentNaming
public static class scrPlayerManagerPatch
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch("AnyValidInputWasTriggered")] [HarmonyPatch("AnyValidInputWasTriggered")]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
@@ -17,5 +17,4 @@ namespace ADOFAIRenderer.Patch.Game
__result = RenderManager.Instance && RenderManager.Instance.frameCount == 0 && RenderManager.Instance.countdown == 0; __result = RenderManager.Instance && RenderManager.Instance.frameCount == 0 && RenderManager.Instance.countdown == 0;
return false; return false;
} }
}
} }
+5 -6
View File
@@ -2,12 +2,12 @@ using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrPortalParticles))]
// ReSharper disable once InconsistentNaming
public static class scrPortalParticlesPatch
{ {
[HarmonyPatch(typeof(scrPortalParticles))]
// ReSharper disable once InconsistentNaming
public static class scrPortalParticlesPatch
{
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch("Start")] [HarmonyPatch("Start")]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
@@ -25,5 +25,4 @@ namespace ADOFAIRenderer.Patch.Game
main.useUnscaledTime = false; main.useUnscaledTime = false;
} }
} }
}
} }
+5 -6
View File
@@ -1,12 +1,12 @@
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrPressToStart))]
// ReSharper disable once InconsistentNaming
public class scrPressToStartPatch
{ {
[HarmonyPatch(typeof(scrPressToStart))]
// ReSharper disable once InconsistentNaming
public class scrPressToStartPatch
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch("ShowText")] [HarmonyPatch("ShowText")]
private static bool PreventShowText() private static bool PreventShowText()
@@ -16,5 +16,4 @@ namespace ADOFAIRenderer.Patch.Game
RenderManager.Instance.skipPressToStart = false; RenderManager.Instance.skipPressToStart = false;
return false; return false;
} }
}
} }
+5 -6
View File
@@ -4,12 +4,12 @@ using HarmonyLib;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrShowIfDebug))]
// ReSharper disable once InconsistentNaming
public static class scrShowIfDebugPatch
{ {
[HarmonyPatch(typeof(scrShowIfDebug))]
// ReSharper disable once InconsistentNaming
public static class scrShowIfDebugPatch
{
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch("Update")] [HarmonyPatch("Update")]
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
@@ -33,5 +33,4 @@ namespace ADOFAIRenderer.Patch.Game
___txt.color = ___defaultColor; ___txt.color = ___defaultColor;
} }
}
} }
+5 -6
View File
@@ -1,12 +1,12 @@
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using HarmonyLib; using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game namespace ADOFAIRenderer.Patch.Game;
[HarmonyPatch(typeof(scrUIController))]
// ReSharper disable once InconsistentNaming
public class scrUIControllerPatch
{ {
[HarmonyPatch(typeof(scrUIController))]
// ReSharper disable once InconsistentNaming
public class scrUIControllerPatch
{
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch("ShowEndscreenLanterns")] [HarmonyPatch("ShowEndscreenLanterns")]
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
@@ -17,5 +17,4 @@ namespace ADOFAIRenderer.Patch.Game
__instance.HideEndscreenLanterns(); __instance.HideEndscreenLanterns();
} }
} }
}
} }
+1 -1
View File
@@ -7,7 +7,7 @@ using MelonLoader.Utils;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.1.1-INDEV", "ADOFAI Editor Forum")] [assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.1.2-INDEV", "ADOFAI Editor Forum")]
[assembly: MelonGame("7th Beat Games", "A Dance of Fire and Ice")] [assembly: MelonGame("7th Beat Games", "A Dance of Fire and Ice")]
namespace ADOFAIRenderer namespace ADOFAIRenderer
+9 -8
View File
@@ -7,13 +7,15 @@ using UnityEngine.UIElements;
using Button = UnityEngine.UI.Button; using Button = UnityEngine.UI.Button;
using Image = UnityEngine.UI.Image; using Image = UnityEngine.UI.Image;
namespace ADOFAIRenderer.UI namespace ADOFAIRenderer.UI;
internal class DialogButton
{ {
internal class DialogButton // ReSharper disable FieldCanBeMadeReadOnly.Global
{
public string Text; public string Text;
public Action OnClick; public Action OnClick;
public Color? BackgroundColor; public Color? BackgroundColor;
// ReSharper restore FieldCanBeMadeReadOnly.Global
public DialogButton(string text, Action onClick, Color? backgroundColor = null) public DialogButton(string text, Action onClick, Color? backgroundColor = null)
{ {
@@ -21,10 +23,10 @@ namespace ADOFAIRenderer.UI
OnClick = onClick; OnClick = onClick;
BackgroundColor = backgroundColor; BackgroundColor = backgroundColor;
} }
} }
internal class CommonWarningDialogUI : MonoBehaviour internal class CommonWarningDialogUI : MonoBehaviour
{ {
public static CommonWarningDialogUI? Instance { get; private set; } public static CommonWarningDialogUI? Instance { get; private set; }
private readonly List<VisualElement> _disabledElements = new(); private readonly List<VisualElement> _disabledElements = new();
@@ -112,7 +114,7 @@ namespace ADOFAIRenderer.UI
foreach (var doc in FindObjectsByType<UIDocument>(FindObjectsSortMode.None)) foreach (var doc in FindObjectsByType<UIDocument>(FindObjectsSortMode.None))
{ {
if (doc && doc.rootVisualElement != null && doc.rootVisualElement.enabledSelf) if (doc && doc.rootVisualElement is { enabledSelf: true })
{ {
doc.rootVisualElement.SetEnabled(false); doc.rootVisualElement.SetEnabled(false);
_disabledElements.Add(doc.rootVisualElement); _disabledElements.Add(doc.rootVisualElement);
@@ -319,5 +321,4 @@ namespace ADOFAIRenderer.UI
float b = Mathf.Clamp01(color.b * factor); float b = Mathf.Clamp01(color.b * factor);
return new Color(r, g, b, color.a); return new Color(r, g, b, color.a);
} }
}
} }
+3 -4
View File
@@ -6,10 +6,10 @@ using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
namespace ADOFAIRenderer.UI namespace ADOFAIRenderer.UI;
internal class DebugMonitorUI : MonoBehaviour
{ {
internal class DebugMonitorUI : MonoBehaviour
{
// --- Progress Bar UI Configuration Constants --- // --- Progress Bar UI Configuration Constants ---
private const float BarWidth = 800f; private const float BarWidth = 800f;
private const float BarHeight = 28f; private const float BarHeight = 28f;
@@ -230,5 +230,4 @@ namespace ADOFAIRenderer.UI
if (_fillRect) _fillRect.sizeDelta = new Vector2(BarWidth * progress, 0); if (_fillRect) _fillRect.sizeDelta = new Vector2(BarWidth * progress, 0);
if (_progressText) _progressText.text = $"{progress * 100f:F1}% ({currentFloor}/{totalFloors})"; if (_progressText) _progressText.text = $"{progress * 100f:F1}% ({currentFloor}/{totalFloors})";
} }
}
} }
+3 -4
View File
@@ -4,10 +4,10 @@ using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
namespace ADOFAIRenderer.UI namespace ADOFAIRenderer.UI;
internal class EscapeHandlerUI : MonoBehaviour
{ {
internal class EscapeHandlerUI : MonoBehaviour
{
private GameObject _containerObj = null!; private GameObject _containerObj = null!;
private TextMeshProUGUI _textComponent = null!; private TextMeshProUGUI _textComponent = null!;
private Stopwatch? _escapeStopwatch; private Stopwatch? _escapeStopwatch;
@@ -127,5 +127,4 @@ namespace ADOFAIRenderer.UI
_escapeStopwatch.Stop(); _escapeStopwatch.Stop();
_escapeStopwatch = null; _escapeStopwatch = null;
} }
}
} }
+3 -4
View File
@@ -10,10 +10,10 @@ using UnityEngine.UI;
using MelonLoader; using MelonLoader;
using MelonLoader.Utils; using MelonLoader.Utils;
namespace ADOFAIRenderer.UI namespace ADOFAIRenderer.UI;
internal class FFmpegDownloadUI : MonoBehaviour
{ {
internal class FFmpegDownloadUI : MonoBehaviour
{
private GameObject _buttonContainerObj = null!; private GameObject _buttonContainerObj = null!;
private GameObject _progressBarObj = null!; private GameObject _progressBarObj = null!;
private GameObject _progressBarFillObj = null!; private GameObject _progressBarFillObj = null!;
@@ -689,5 +689,4 @@ namespace ADOFAIRenderer.UI
Instance = null; Instance = null;
} }
} }
}
} }
+3 -4
View File
@@ -7,10 +7,10 @@ using MelonLoader;
using UnityEngine; using UnityEngine;
using UnityEngine.UIElements; using UnityEngine.UIElements;
namespace ADOFAIRenderer.UI namespace ADOFAIRenderer.UI;
internal class RenderConfigUIManager : MonoBehaviour
{ {
internal class RenderConfigUIManager : MonoBehaviour
{
[SerializeField] [SerializeField]
private UIDocument uiDocument = null!; private UIDocument uiDocument = null!;
@@ -1147,5 +1147,4 @@ namespace ADOFAIRenderer.UI
}; };
return label; return label;
} }
}
} }
+3 -4
View File
@@ -1,9 +1,9 @@
using System; using System;
namespace ADOFAIRenderer.Util.Audio namespace ADOFAIRenderer.Util.Audio;
internal static class AudioResampler
{ {
internal static class AudioResampler
{
public static float[] Resample(float[] inputSamples, int inputChannels, int inputFrequency, int targetChannels, int targetFrequency) public static float[] Resample(float[] inputSamples, int inputChannels, int inputFrequency, int targetChannels, int targetFrequency)
{ {
// ── Safety Validation ── // ── Safety Validation ──
@@ -97,5 +97,4 @@ namespace ADOFAIRenderer.Util.Audio
return outputSamples; return outputSamples;
} }
}
} }
+5 -4
View File
@@ -3,14 +3,16 @@ using System.Collections.Generic;
using ADOFAIRenderer.Core; using ADOFAIRenderer.Core;
using UnityEngine; using UnityEngine;
namespace ADOFAIRenderer.Util.Audio namespace ADOFAIRenderer.Util.Audio;
internal static class AudioSpectrumGenerator
{ {
internal static class AudioSpectrumGenerator // ReSharper disable MemberCanBePrivate.Global
{
public static float[]? AudioClipData { get; private set; } public static float[]? AudioClipData { get; private set; }
public static int Channels { get; private set; } public static int Channels { get; private set; }
public static int Frequency { get; private set; } public static int Frequency { get; private set; }
public static int TotalSamples { get; private set; } public static int TotalSamples { get; private set; }
// ReSharper restore MemberCanBePrivate.Global
private static long _cachedFrame = -1; private static long _cachedFrame = -1;
private static readonly Dictionary<int, float[]> CachedSpectrums = new(); private static readonly Dictionary<int, float[]> CachedSpectrums = new();
@@ -236,5 +238,4 @@ namespace ADOFAIRenderer.Util.Audio
spectrum[i] = (float)Math.Sqrt(re[i] * re[i] + im[i] * im[i]) * factor; spectrum[i] = (float)Math.Sqrt(re[i] * re[i] + im[i] * im[i]) * factor;
} }
} }
}
} }
+3 -4
View File
@@ -1,9 +1,9 @@
using System; using System;
namespace ADOFAIRenderer.Util.Audio namespace ADOFAIRenderer.Util.Audio;
internal class AudioSyncCalculator
{ {
internal class AudioSyncCalculator
{
private readonly long _sampleRate; private readonly long _sampleRate;
private readonly (long Numerator, long Denominator) _fpsRational; private readonly (long Numerator, long Denominator) _fpsRational;
@@ -37,5 +37,4 @@ namespace ADOFAIRenderer.Util.Audio
_currentSample += samplesNeeded; _currentSample += samplesNeeded;
return (int)samplesNeeded; return (int)samplesNeeded;
} }
}
} }
+3 -4
View File
@@ -1,9 +1,9 @@
using System; using System;
namespace ADOFAIRenderer.Util.Audio.Filter namespace ADOFAIRenderer.Util.Audio.Filter;
internal class Gain : IAudioFilter
{ {
internal class Gain : IAudioFilter
{
public float Level = 0f; public float Level = 0f;
public void Initialize(int sampleRate, int channels) { } public void Initialize(int sampleRate, int channels) { }
@@ -20,5 +20,4 @@ namespace ADOFAIRenderer.Util.Audio.Filter
public void Reset() { } public void Reset() { }
public double Latency => 0.0; public double Latency => 0.0;
}
} }
+3 -4
View File
@@ -1,10 +1,10 @@
using System; using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
namespace ADOFAIRenderer.Util.Audio.Filter namespace ADOFAIRenderer.Util.Audio.Filter;
internal class HardClip : IAudioFilter
{ {
internal class HardClip : IAudioFilter
{
// ReSharper disable once MemberCanBePrivate.Global // ReSharper disable once MemberCanBePrivate.Global
// ReSharper disable once FieldCanBeMadeReadOnly.Global // ReSharper disable once FieldCanBeMadeReadOnly.Global
// ReSharper disable once ConvertToConstant.Global // ReSharper disable once ConvertToConstant.Global
@@ -29,5 +29,4 @@ namespace ADOFAIRenderer.Util.Audio.Filter
public void Reset() { } public void Reset() { }
public double Latency => 0.0; public double Latency => 0.0;
}
} }
+3 -4
View File
@@ -1,9 +1,9 @@
using System; using System;
namespace ADOFAIRenderer.Util.Audio.Filter namespace ADOFAIRenderer.Util.Audio.Filter;
internal interface IAudioFilter
{ {
internal interface IAudioFilter
{
void Initialize(int sampleRate, int channels); void Initialize(int sampleRate, int channels);
float ProcessSample(float sample, int channel); float ProcessSample(float sample, int channel);
@@ -12,5 +12,4 @@ namespace ADOFAIRenderer.Util.Audio.Filter
void Reset(); void Reset();
double Latency { get; } double Latency { get; }
}
} }
+6 -7
View File
@@ -1,11 +1,11 @@
using System; using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
namespace ADOFAIRenderer.Util.Audio.Filter namespace ADOFAIRenderer.Util.Audio.Filter;
// ReSharper disable once InconsistentNaming
internal class RMSCompressor : IAudioFilter
{ {
// ReSharper disable once InconsistentNaming
internal class RMSCompressor : IAudioFilter
{
private float _thresholdDb = -20f; private float _thresholdDb = -20f;
private float _ratio = 4f; private float _ratio = 4f;
private float _attackTime = 0.010f; // in seconds private float _attackTime = 0.010f; // in seconds
@@ -219,11 +219,10 @@ namespace ADOFAIRenderer.Util.Audio.Filter
Array.Clear(_rmsState, 0, _rmsState.Length); Array.Clear(_rmsState, 0, _rmsState.Length);
Array.Clear(_gainState, 0, _gainState.Length); Array.Clear(_gainState, 0, _gainState.Length);
for (int i = 0; i < _delayBuffers.Length; i++) foreach (var delayBuffer in _delayBuffers)
{ {
Array.Clear(_delayBuffers[i], 0, _delayBuffers[i].Length); Array.Clear(delayBuffer, 0, delayBuffer.Length);
} }
Array.Clear(_delayWriteIndices, 0, _delayWriteIndices.Length); Array.Clear(_delayWriteIndices, 0, _delayWriteIndices.Length);
} }
}
} }
+6 -7
View File
@@ -5,10 +5,10 @@ using ADOFAIRenderer.Util.Audio.Filter;
using MelonLoader; using MelonLoader;
using UnityEngine; using UnityEngine;
namespace ADOFAIRenderer.Util.Audio namespace ADOFAIRenderer.Util.Audio;
internal class AudioClipCache
{ {
internal class AudioClipCache
{
private readonly Dictionary<string, CachedClipData> _cache = new(); private readonly Dictionary<string, CachedClipData> _cache = new();
public class CachedClipData public class CachedClipData
@@ -67,10 +67,10 @@ namespace ADOFAIRenderer.Util.Audio
_cache.Clear(); _cache.Clear();
} }
} }
} }
internal class OfflineAudioMixer internal class OfflineAudioMixer
{ {
public class SoundEvent public class SoundEvent
{ {
public string ClipName = null!; public string ClipName = null!;
@@ -413,5 +413,4 @@ namespace ADOFAIRenderer.Util.Audio
} }
} }
} }
}
} }