From 5e9c0272dd8752eaae75aefa385f5850ec2eb3718a2136d5e5d7d980ee82d3f9 Mon Sep 17 00:00:00 2001 From: copecone Date: Fri, 2 Oct 2026 20:16:30 +0900 Subject: [PATCH] Add Planet Color Configuration --- Data/RenderConfig.cs | 5 +++++ Patch/Game/PlanetRendererPatch.cs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Patch/Game/PlanetRendererPatch.cs diff --git a/Data/RenderConfig.cs b/Data/RenderConfig.cs index b6629d8..11d7596 100644 --- a/Data/RenderConfig.cs +++ b/Data/RenderConfig.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using ADOFAIRenderer.Util.FFmpeg; +using UnityEngine; namespace ADOFAIRenderer.Data; @@ -27,6 +28,10 @@ public class AdvancedConfig public bool ProcessAudio { get; set; } = true; public bool NonTile { get; set; } = false; public string FileExtension { get; set; } = "mkv"; + + public Color? firePlanetColor = null; + public Color? icePlanetColor = null; + public Color? windPlanetColor = null; } public class VideoEncodingConfig diff --git a/Patch/Game/PlanetRendererPatch.cs b/Patch/Game/PlanetRendererPatch.cs new file mode 100644 index 0000000..bba0c31 --- /dev/null +++ b/Patch/Game/PlanetRendererPatch.cs @@ -0,0 +1,30 @@ +using ADOFAIRenderer.Core; +using HarmonyLib; +using UnityEngine; + +namespace ADOFAIRenderer.Patch.Game; + +[HarmonyPatch(typeof(PlanetRenderer))] +public static class PlanetRendererPatch +{ + [HarmonyPrefix] + [HarmonyPatch("SetColor")] + // ReSharper disable once InconsistentNaming + private static void OverrideColor(PlanetRenderer __instance, ref PlanetColor planetColor) + { + if (RenderManager.Instance.stage == RenderStage.None) return; + + var advConf = RenderManager.Instance.Configuration.AdvancedConfig; + ApplyColor(ref planetColor, scrController.instance.planetRed, advConf.firePlanetColor); + ApplyColor(ref planetColor, scrController.instance.planetBlue, advConf.icePlanetColor); + ApplyColor(ref planetColor, scrController.instance.planetGreen, advConf.windPlanetColor); + + return; + + void ApplyColor(ref PlanetColor planetColor, scrPlanet targetPlanet, Color? customColor) + { + if (__instance == targetPlanet.planetRenderer && customColor != null) + planetColor = new PlanetColor(customColor.Value); + } + } +} \ No newline at end of file