Document Harmony Patches

This commit is contained in:
copecone committed 2026-10-15 16:17:13 +09:00
1 parent 8deb64fd4d
commit d2bd655118
19 files changed
+499 -4

No files matched your search

+13 -1
View File
@@ -5,11 +5,19 @@ using UnityEngine;
namespace ADOFAIRenderer.Patch.Game;
/// <summary>
/// Synchronizes mod localization with ADOFAI's in-game language settings.
/// Keeps the mod UI language (<see cref="LocalizationManager"/>) equal to the game language.
/// <para>
/// Patched members: <c>RDString.Setup()</c>, which initializes the game's string table and sets <c>RDString.language</c> from
/// <c>Persistence.language</c> (it returns immediately when already initialized); and <c>RDString.ChangeLanguage(SystemLanguage)</c>,
/// which stores the language in <c>Persistence.language</c>, clears the initialized flag and calls Setup again.
/// </para>
/// <para>Always active (independent of the render stage). Runs on the Unity main thread.</para>
/// </summary>
[HarmonyPatch(typeof(RDString))]
internal static class LanguageSyncPatch
{
/// <summary>Postfix of <c>RDString.ChangeLanguage</c>: applies the selected language to the mod UI.</summary>
/// <param name="language">Language passed to ChangeLanguage.</param>
[HarmonyPatch(nameof(RDString.ChangeLanguage))]
[HarmonyPostfix]
public static void OnChangeLanguage(SystemLanguage language)
@@ -17,6 +25,10 @@ internal static class LanguageSyncPatch
LocalizationManager.SetLanguage(language);
}
/// <summary>
/// Postfix of <c>RDString.Setup</c>: applies <c>RDString.language</c> (the language resolved by the game) to the mod UI.
/// Runs on every Setup call, including the early-return calls made when the string table is already initialized.
/// </summary>
[HarmonyPatch(nameof(RDString.Setup))]
[HarmonyPostfix]
public static void OnSetup()