SHA256
Refactor Every namespace Keyword Usage
This commit is contained in:
1 parent
4e67cb9b09
commit
27be2141f7
44 files changed
+4619
-4545
No files matched your search
@@ -2,73 +2,72 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using ADOFAIRenderer.Core;
|
||||
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]
|
||||
[HarmonyPatch("Show")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool ForceHide(EndscreenLanterns __instance, ref int __result)
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("Show")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static bool ForceHide(EndscreenLanterns __instance, ref int __result)
|
||||
if (!RenderManager.IsActive) return true;
|
||||
if (__instance != null)
|
||||
{
|
||||
if (!RenderManager.IsActive) return true;
|
||||
if (__instance != null)
|
||||
{
|
||||
__instance.Hide();
|
||||
}
|
||||
__result = 0; // Return 0 lanterns shown
|
||||
return false; // Skip original Show method
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("Hide")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static void PrefixHide(EndscreenLanterns __instance)
|
||||
{
|
||||
if (__instance == null) return;
|
||||
if (!RenderManager.IsActive) return;
|
||||
|
||||
var traverse = Traverse.Create(__instance);
|
||||
|
||||
// Kill lampSequences (private Sequence[] lampSequences) via reflection
|
||||
var lampSequencesField = traverse.Field("lampSequences");
|
||||
var lampSequencesObj = lampSequencesField.GetValue();
|
||||
if (lampSequencesObj is System.Array lampSequencesArray)
|
||||
{
|
||||
for (var i = 0; i < lampSequencesArray.Length; i++)
|
||||
{
|
||||
var item = lampSequencesArray.GetValue(i);
|
||||
if (item == null) continue;
|
||||
try
|
||||
{
|
||||
var killMethod = item.GetType().GetMethod("Kill", new[] { typeof(bool) });
|
||||
killMethod?.Invoke(item, new object[] { false });
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore reflection errors
|
||||
}
|
||||
lampSequencesArray.SetValue(null, i);
|
||||
}
|
||||
}
|
||||
|
||||
// Kill chainSequence (private Sequence chainSequence) via reflection
|
||||
var chainSequenceField = traverse.Field("chainSequence");
|
||||
var chainSequenceObj = chainSequenceField.GetValue();
|
||||
if (chainSequenceObj == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
var killMethod = chainSequenceObj.GetType().GetMethod("Kill", new[] { typeof(bool) });
|
||||
killMethod?.Invoke(chainSequenceObj, new object[] { false });
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore reflection errors
|
||||
}
|
||||
chainSequenceField.SetValue(null);
|
||||
__instance.Hide();
|
||||
}
|
||||
__result = 0; // Return 0 lanterns shown
|
||||
return false; // Skip original Show method
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("Hide")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static void PrefixHide(EndscreenLanterns __instance)
|
||||
{
|
||||
if (__instance == null) return;
|
||||
if (!RenderManager.IsActive) return;
|
||||
|
||||
var traverse = Traverse.Create(__instance);
|
||||
|
||||
// Kill lampSequences (private Sequence[] lampSequences) via reflection
|
||||
var lampSequencesField = traverse.Field("lampSequences");
|
||||
var lampSequencesObj = lampSequencesField.GetValue();
|
||||
if (lampSequencesObj is System.Array lampSequencesArray)
|
||||
{
|
||||
for (var i = 0; i < lampSequencesArray.Length; i++)
|
||||
{
|
||||
var item = lampSequencesArray.GetValue(i);
|
||||
if (item == null) continue;
|
||||
try
|
||||
{
|
||||
var killMethod = item.GetType().GetMethod("Kill", new[] { typeof(bool) });
|
||||
killMethod?.Invoke(item, new object[] { false });
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore reflection errors
|
||||
}
|
||||
lampSequencesArray.SetValue(null, i);
|
||||
}
|
||||
}
|
||||
|
||||
// Kill chainSequence (private Sequence chainSequence) via reflection
|
||||
var chainSequenceField = traverse.Field("chainSequence");
|
||||
var chainSequenceObj = chainSequenceField.GetValue();
|
||||
if (chainSequenceObj == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
var killMethod = chainSequenceObj.GetType().GetMethod("Kill", new[] { typeof(bool) });
|
||||
killMethod?.Invoke(chainSequenceObj, new object[] { false });
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore reflection errors
|
||||
}
|
||||
chainSequenceField.SetValue(null);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,21 @@
|
||||
using ADOFAIRenderer.Core;
|
||||
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]
|
||||
[HarmonyPatch("skipIntroBehavior", MethodType.Getter)]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void LockSkipIntroBehavior(ref SkipIntroBehavior __result)
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("skipIntroBehavior", MethodType.Getter)]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void LockSkipIntroBehavior(ref SkipIntroBehavior __result)
|
||||
if (RenderManager.IsActive &&
|
||||
scrConductor.instance != null &&
|
||||
!scrConductor.instance.hasSongStarted)
|
||||
{
|
||||
if (RenderManager.IsActive &&
|
||||
scrConductor.instance != null &&
|
||||
!scrConductor.instance.hasSongStarted)
|
||||
{
|
||||
__result = SkipIntroBehavior.Off;
|
||||
}
|
||||
__result = SkipIntroBehavior.Off;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,48 +4,47 @@ using MelonLoader;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Game
|
||||
{
|
||||
[HarmonyPatch(typeof(scnEditor))]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class scnEditorPatch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("Start")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void AddButtonRender(scnEditor __instance)
|
||||
{
|
||||
if (RenderMod.IsFeatureDisabled) return;
|
||||
if (!__instance || !__instance.buttonExit)
|
||||
{
|
||||
Melon<RenderMod>.Logger.Msg("scnEditor에 렌더 버튼을 만들 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
namespace ADOFAIRenderer.Patch.Game;
|
||||
|
||||
var cloneTarget = __instance.buttonExit!.gameObject;
|
||||
var buttonContainer = cloneTarget.transform.parent!;
|
||||
|
||||
var buttonObj = Object.Instantiate(cloneTarget, buttonContainer)!;
|
||||
buttonObj.name = "buttonRender";
|
||||
|
||||
var button = buttonObj.GetComponent<Button>()!;
|
||||
// Clear persistent and non-persistent listeners from the original button
|
||||
button.onClick = new Button.ButtonClickedEvent();
|
||||
button.onClick.AddListener(RenderManager.StartRender);
|
||||
|
||||
// The button root has an Image component for the background (rounded box).
|
||||
// We want to change the icon sprite, which is on a child GameObject.
|
||||
var images = buttonObj.GetComponentsInChildren<Image>();
|
||||
if (images.Length <= 1) return;
|
||||
|
||||
// ReSharper disable once Unity.UnknownResource
|
||||
// images[0] is the background on the root, images[1] is the icon on the child
|
||||
var sprite = Resources.Load<Sprite>("LevelEditor/LevelEvents/MoveCamera");
|
||||
if (sprite == null) return;
|
||||
|
||||
var iconImage = images[1];
|
||||
iconImage.sprite = sprite;
|
||||
iconImage.rectTransform.sizeDelta = new Vector2(24, 24);
|
||||
[HarmonyPatch(typeof(scnEditor))]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class scnEditorPatch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("Start")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void AddButtonRender(scnEditor __instance)
|
||||
{
|
||||
if (RenderMod.IsFeatureDisabled) return;
|
||||
if (!__instance || !__instance.buttonExit)
|
||||
{
|
||||
Melon<RenderMod>.Logger.Msg("scnEditor에 렌더 버튼을 만들 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
var cloneTarget = __instance.buttonExit!.gameObject;
|
||||
var buttonContainer = cloneTarget.transform.parent!;
|
||||
|
||||
var buttonObj = Object.Instantiate(cloneTarget, buttonContainer)!;
|
||||
buttonObj.name = "buttonRender";
|
||||
|
||||
var button = buttonObj.GetComponent<Button>()!;
|
||||
// Clear persistent and non-persistent listeners from the original button
|
||||
button.onClick = new Button.ButtonClickedEvent();
|
||||
button.onClick.AddListener(RenderManager.StartRender);
|
||||
|
||||
// The button root has an Image component for the background (rounded box).
|
||||
// We want to change the icon sprite, which is on a child GameObject.
|
||||
var images = buttonObj.GetComponentsInChildren<Image>();
|
||||
if (images.Length <= 1) return;
|
||||
|
||||
// ReSharper disable once Unity.UnknownResource
|
||||
// images[0] is the background on the root, images[1] is the icon on the child
|
||||
var sprite = Resources.Load<Sprite>("LevelEditor/LevelEvents/MoveCamera");
|
||||
if (sprite == null) return;
|
||||
|
||||
var iconImage = images[1];
|
||||
iconImage.sprite = sprite;
|
||||
iconImage.rectTransform.sizeDelta = new Vector2(24, 24);
|
||||
}
|
||||
}
|
||||
+124
-125
@@ -4,139 +4,138 @@ using ADOFAIRenderer.Util;
|
||||
using HarmonyLib;
|
||||
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]
|
||||
[HarmonyPatch("Play")]
|
||||
public static void ProcessFloors()
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("Play")]
|
||||
public static void ProcessFloors()
|
||||
var nonTile = RenderManager.Instance.OverrideLoading &&
|
||||
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
|
||||
|
||||
if (!nonTile) return;
|
||||
foreach (var floor in scrLevelMaker.instance.listFloors)
|
||||
{
|
||||
var nonTile = RenderManager.Instance.OverrideLoading &&
|
||||
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
|
||||
|
||||
if (!nonTile) return;
|
||||
foreach (var floor in scrLevelMaker.instance.listFloors)
|
||||
{
|
||||
DisableRenderers(
|
||||
floor.floorRenderer.renderer, floor.legacyFloorSpriteRenderer,
|
||||
floor.iconsprite, floor.outlineSprite,
|
||||
floor.topGlow, floor.bottomGlow,
|
||||
floor.multiplanetLine
|
||||
);
|
||||
DisableRenderers(
|
||||
floor.floorRenderer.renderer, floor.legacyFloorSpriteRenderer,
|
||||
floor.iconsprite, floor.outlineSprite,
|
||||
floor.topGlow, floor.bottomGlow,
|
||||
floor.multiplanetLine
|
||||
);
|
||||
|
||||
if (floor.holdRenderer) DisableRenderer(floor.holdRenderer.m_meshRenderer);
|
||||
if (floor.holdRenderer) DisableRenderer(floor.holdRenderer.m_meshRenderer);
|
||||
|
||||
if (floor.dummyPlanets == null) continue;
|
||||
foreach (var planet in floor.dummyPlanets)
|
||||
DisablePlanetRenderer(planet);
|
||||
}
|
||||
|
||||
var players = scrPlayerManager.instance.players;
|
||||
if (players == null) return;
|
||||
|
||||
foreach (var player in players)
|
||||
{
|
||||
var planets = player.planetarySystem?.planetList;
|
||||
if (planets == null) continue;
|
||||
|
||||
foreach (var planet in planets)
|
||||
DisablePlanetRenderer(planet.planetRenderer);
|
||||
}
|
||||
return;
|
||||
|
||||
void DisablePlanetRenderer(PlanetRenderer planet)
|
||||
{
|
||||
if (planet.sprite) DisableRenderer(planet.sprite.meshRenderer);
|
||||
DisableRenderers(
|
||||
planet.coreParticles.GetRenderer(), planet.tailParticles.GetRenderer(),
|
||||
planet.tailParticlesCoop.GetRenderer(), planet.sparks.GetRenderer(), planet.ring, planet.glow,
|
||||
planet.faceSprite, planet.faceDetails, planet.samuraiSprite
|
||||
);
|
||||
}
|
||||
|
||||
void DisableRenderers(params Renderer?[] renderers)
|
||||
{
|
||||
foreach (var renderer in renderers) DisableRenderer(renderer);
|
||||
}
|
||||
|
||||
void DisableRenderer(Renderer? renderer)
|
||||
{
|
||||
if (renderer) renderer.enabled = false;
|
||||
}
|
||||
if (floor.dummyPlanets == null) continue;
|
||||
foreach (var planet in floor.dummyPlanets)
|
||||
DisablePlanetRenderer(planet);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("UpdateVideo")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool ReplaceVideo(scnGame __instance)
|
||||
{
|
||||
// Only replace when rendering is active
|
||||
if (!RenderManager.IsActive)
|
||||
{
|
||||
// Remove FFmpeg player if it was attached previously
|
||||
var oldPlayer = __instance.videoBG.gameObject.GetComponent<FFmpegVideoBGPlayer>();
|
||||
if (oldPlayer != null)
|
||||
{
|
||||
Object.Destroy(oldPlayer);
|
||||
}
|
||||
// Re-enable native player component
|
||||
__instance.videoBG.enabled = true;
|
||||
return true; // Execute original
|
||||
}
|
||||
|
||||
string text = __instance.levelData.miscSettings.GetString("bgVideo");
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
__instance.videoBG.gameObject.SetActive(false);
|
||||
return false; // Skip original
|
||||
}
|
||||
|
||||
__instance.videoBG.gameObject.SetActive(true);
|
||||
|
||||
// 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.
|
||||
if (ADOBase.isInternalLevel || ADOBase.isBundleLevel)
|
||||
{
|
||||
__instance.videoBG.enabled = true;
|
||||
return true; // Execute original
|
||||
}
|
||||
|
||||
// Custom level video path
|
||||
var videoPath = Path.Combine(Path.GetDirectoryName(ADOBase.levelPath) ?? "", text);
|
||||
if (!File.Exists(videoPath))
|
||||
{
|
||||
return true; // Let the original print error
|
||||
}
|
||||
|
||||
// Disable native VideoPlayer component (to prevent it from attempting real-time playback and sync errors)
|
||||
var targetCamera = __instance.videoBG.targetCamera;
|
||||
if (!targetCamera)
|
||||
{
|
||||
var camGo = GameObject.Find("BGStaticCam");
|
||||
if (camGo != null)
|
||||
{
|
||||
targetCamera = camGo.GetComponent<Camera>();
|
||||
}
|
||||
}
|
||||
|
||||
__instance.videoBG.enabled = false;
|
||||
|
||||
// Add or retrieve our custom FFmpeg video background player
|
||||
var player = __instance.videoBG.gameObject.GetComponent<FFmpegVideoBGPlayer>();
|
||||
if (player == null)
|
||||
{
|
||||
player = __instance.videoBG.gameObject.AddComponent<FFmpegVideoBGPlayer>();
|
||||
}
|
||||
|
||||
var isLooping = __instance.levelData.miscSettings.GetBool("loopVideo");
|
||||
var players = scrPlayerManager.instance.players;
|
||||
if (players == null) return;
|
||||
|
||||
// Initialize player. If targetTexture is null (CameraFarPlane mode), it will build a quad in front of targetCamera.
|
||||
player.Init(videoPath, __instance.videoBG.targetTexture, isLooping, targetCamera, __instance.videoBG.gameObject);
|
||||
foreach (var player in players)
|
||||
{
|
||||
var planets = player.planetarySystem?.planetList;
|
||||
if (planets == null) continue;
|
||||
|
||||
return false; // Skip original UpdateVideo
|
||||
foreach (var planet in planets)
|
||||
DisablePlanetRenderer(planet.planetRenderer);
|
||||
}
|
||||
return;
|
||||
|
||||
void DisablePlanetRenderer(PlanetRenderer planet)
|
||||
{
|
||||
if (planet.sprite) DisableRenderer(planet.sprite.meshRenderer);
|
||||
DisableRenderers(
|
||||
planet.coreParticles.GetRenderer(), planet.tailParticles.GetRenderer(),
|
||||
planet.tailParticlesCoop.GetRenderer(), planet.sparks.GetRenderer(), planet.ring, planet.glow,
|
||||
planet.faceSprite, planet.faceDetails, planet.samuraiSprite
|
||||
);
|
||||
}
|
||||
|
||||
void DisableRenderers(params Renderer?[] renderers)
|
||||
{
|
||||
foreach (var renderer in renderers) DisableRenderer(renderer);
|
||||
}
|
||||
|
||||
void DisableRenderer(Renderer? renderer)
|
||||
{
|
||||
if (renderer) renderer.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("UpdateVideo")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool ReplaceVideo(scnGame __instance)
|
||||
{
|
||||
// Only replace when rendering is active
|
||||
if (!RenderManager.IsActive)
|
||||
{
|
||||
// Remove FFmpeg player if it was attached previously
|
||||
var oldPlayer = __instance.videoBG.gameObject.GetComponent<FFmpegVideoBGPlayer>();
|
||||
if (oldPlayer != null)
|
||||
{
|
||||
Object.Destroy(oldPlayer);
|
||||
}
|
||||
// Re-enable native player component
|
||||
__instance.videoBG.enabled = true;
|
||||
return true; // Execute original
|
||||
}
|
||||
|
||||
string text = __instance.levelData.miscSettings.GetString("bgVideo");
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
__instance.videoBG.gameObject.SetActive(false);
|
||||
return false; // Skip original
|
||||
}
|
||||
|
||||
__instance.videoBG.gameObject.SetActive(true);
|
||||
|
||||
// We can only play external video files via FFmpegNativeDecoder.
|
||||
// Internal/Bundle level background videos are built-in VideoClips, so we fall back to native Unity VideoPlayer.
|
||||
if (ADOBase.isInternalLevel || ADOBase.isBundleLevel)
|
||||
{
|
||||
__instance.videoBG.enabled = true;
|
||||
return true; // Execute original
|
||||
}
|
||||
|
||||
// Custom level video path
|
||||
var videoPath = Path.Combine(Path.GetDirectoryName(ADOBase.levelPath) ?? "", text);
|
||||
if (!File.Exists(videoPath))
|
||||
{
|
||||
return true; // Let the original print error
|
||||
}
|
||||
|
||||
// Disable native VideoPlayer component (to prevent it from attempting real-time playback and sync errors)
|
||||
var targetCamera = __instance.videoBG.targetCamera;
|
||||
if (!targetCamera)
|
||||
{
|
||||
var camGo = GameObject.Find("BGStaticCam");
|
||||
if (camGo != null)
|
||||
{
|
||||
targetCamera = camGo.GetComponent<Camera>();
|
||||
}
|
||||
}
|
||||
|
||||
__instance.videoBG.enabled = false;
|
||||
|
||||
// Add or retrieve our custom FFmpeg video background player
|
||||
var player = __instance.videoBG.gameObject.GetComponent<FFmpegVideoBGPlayer>();
|
||||
if (player == null)
|
||||
{
|
||||
player = __instance.videoBG.gameObject.AddComponent<FFmpegVideoBGPlayer>();
|
||||
}
|
||||
|
||||
var isLooping = __instance.levelData.miscSettings.GetBool("loopVideo");
|
||||
|
||||
// Initialize player. If targetTexture is null (CameraFarPlane mode), it will build a quad in front of targetCamera.
|
||||
player.Init(videoPath, __instance.videoBG.targetTexture, isLooping, targetCamera, __instance.videoBG.gameObject);
|
||||
|
||||
return false; // Skip original UpdateVideo
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,22 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
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]
|
||||
[HarmonyPatch("SetCustomFrameRate")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
private static bool FixCamRT(scrCamera __instance, bool enable, float frame)
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("SetCustomFrameRate")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
private static bool FixCamRT(scrCamera __instance, bool enable, float frame)
|
||||
{
|
||||
// There is an issue that `mainTexture.Release` triggers even if `mainTexture` is `camRT`, so mod tries to fix it
|
||||
if (enable || __instance.enableCustomFPS != enable) return true;
|
||||
// There is an issue that `mainTexture.Release` triggers even if `mainTexture` is `camRT`, so mod tries to fix it
|
||||
if (enable || __instance.enableCustomFPS != enable) return true;
|
||||
|
||||
__instance.enableCustomFPS = enable;
|
||||
__instance.frameRate = frame;
|
||||
return false;
|
||||
}
|
||||
__instance.enableCustomFPS = enable;
|
||||
__instance.frameRate = frame;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,44 @@
|
||||
using ADOFAIRenderer.Core;
|
||||
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]
|
||||
[HarmonyPatch("TogglePauseGame")]
|
||||
public static bool PreventPause()
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("TogglePauseGame")]
|
||||
public static bool PreventPause()
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("PortalTravelAction")]
|
||||
public static bool PreventPortalTravel()
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("PortalTravelAction")]
|
||||
public static bool PreventPortalTravel()
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("FailAction")]
|
||||
public static bool PreventFailAction()
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("FailAction")]
|
||||
public static bool PreventFailAction()
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("Fail2Action")]
|
||||
public static bool PreventFail2Action()
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("Fail2Action")]
|
||||
public static bool PreventFail2Action()
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("OnPlayerDied")]
|
||||
public static bool PreventPlayerDied()
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("OnPlayerDied")]
|
||||
public static bool PreventPlayerDied()
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +1,40 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Game
|
||||
namespace ADOFAIRenderer.Patch.Game;
|
||||
|
||||
[HarmonyPatch(typeof(scrDecoration))]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class scrDecorationPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(scrDecoration))]
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("SetRotation")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class scrDecorationPatch
|
||||
public static bool SetRotationPrefix(scrDecoration __instance)
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("SetRotation")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool SetRotationPrefix(scrDecoration __instance)
|
||||
{
|
||||
return __instance != null && __instance && __instance.pivotTrans != null;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("SetScale")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool SetScalePrefix(scrDecoration __instance)
|
||||
{
|
||||
return __instance != null && __instance && __instance.pivotTrans != null;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("SetOpacity")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool SetOpacityPrefix(scrDecoration __instance)
|
||||
{
|
||||
return __instance != null && __instance;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("UpdatePosition")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool UpdatePositionPrefix(scrDecoration __instance)
|
||||
{
|
||||
return __instance != null && __instance && __instance.pivotTrans != null;
|
||||
}
|
||||
return __instance != null && __instance && __instance.pivotTrans != null;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("SetScale")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool SetScalePrefix(scrDecoration __instance)
|
||||
{
|
||||
return __instance != null && __instance && __instance.pivotTrans != null;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("SetOpacity")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool SetOpacityPrefix(scrDecoration __instance)
|
||||
{
|
||||
return __instance != null && __instance;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("UpdatePosition")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool UpdatePositionPrefix(scrDecoration __instance)
|
||||
{
|
||||
return __instance != null && __instance && __instance.pivotTrans != null;
|
||||
}
|
||||
}
|
||||
+12
-13
@@ -1,22 +1,21 @@
|
||||
using ADOFAIRenderer.Core;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Game
|
||||
namespace ADOFAIRenderer.Patch.Game;
|
||||
|
||||
[HarmonyPatch(typeof(scrFloor))]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class scrFloorPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(scrFloor))]
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("SpawnPortalParticles")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class scrFloorPatch
|
||||
public static bool SkipPortalSpawn(scrFloor __instance)
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("SpawnPortalParticles")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static bool SkipPortalSpawn(scrFloor __instance)
|
||||
{
|
||||
if (!scrLevelMaker.instance.listFloors.Contains(__instance)) return true;
|
||||
if (!scrLevelMaker.instance.listFloors.Contains(__instance)) return true;
|
||||
|
||||
var nonTile = RenderManager.Instance.OverrideLoading &&
|
||||
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
|
||||
return !nonTile;
|
||||
}
|
||||
var nonTile = RenderManager.Instance.OverrideLoading &&
|
||||
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
|
||||
return !nonTile;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
using ADOFAIRenderer.Core;
|
||||
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 } };
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
using ADOFAIRenderer.Core;
|
||||
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]
|
||||
[HarmonyPatch("SaveCustom")]
|
||||
public static bool PreventSaveCustom()
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("SaveCustom")]
|
||||
public static bool PreventSaveCustom()
|
||||
{
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
return !RenderManager.IsActive;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,20 @@
|
||||
using ADOFAIRenderer.Core;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Game
|
||||
{
|
||||
[HarmonyPatch(typeof(scrPlayerManager))]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class scrPlayerManagerPatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("AnyValidInputWasTriggered")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
private static bool IgnoreInput(ref bool __result)
|
||||
{
|
||||
if (!RenderManager.IsActive) return true;
|
||||
namespace ADOFAIRenderer.Patch.Game;
|
||||
|
||||
__result = RenderManager.Instance && RenderManager.Instance.frameCount == 0 && RenderManager.Instance.countdown == 0;
|
||||
return false;
|
||||
}
|
||||
[HarmonyPatch(typeof(scrPlayerManager))]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class scrPlayerManagerPatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("AnyValidInputWasTriggered")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
private static bool IgnoreInput(ref bool __result)
|
||||
{
|
||||
if (!RenderManager.IsActive) return true;
|
||||
|
||||
__result = RenderManager.Instance && RenderManager.Instance.frameCount == 0 && RenderManager.Instance.countdown == 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2,28 +2,27 @@ using ADOFAIRenderer.Core;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Game
|
||||
namespace ADOFAIRenderer.Patch.Game;
|
||||
|
||||
[HarmonyPatch(typeof(scrPortalParticles))]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class scrPortalParticlesPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(scrPortalParticles))]
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("Start")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class scrPortalParticlesPatch
|
||||
public static void ForceScaledTime(scrPortalParticles __instance)
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("Start")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void ForceScaledTime(scrPortalParticles __instance)
|
||||
{
|
||||
if (!RenderManager.Instance || !RenderManager.Instance.OverrideLoading) return;
|
||||
if (__instance == null) return;
|
||||
if (!RenderManager.Instance || !RenderManager.Instance.OverrideLoading) return;
|
||||
if (__instance == null) return;
|
||||
|
||||
var particleSystems = __instance.GetComponentsInChildren<ParticleSystem>(true);
|
||||
foreach (var ps in particleSystems)
|
||||
{
|
||||
if (ps == null) continue;
|
||||
var particleSystems = __instance.GetComponentsInChildren<ParticleSystem>(true);
|
||||
foreach (var ps in particleSystems)
|
||||
{
|
||||
if (ps == null) continue;
|
||||
|
||||
var main = ps.main;
|
||||
main.useUnscaledTime = false;
|
||||
}
|
||||
var main = ps.main;
|
||||
main.useUnscaledTime = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,19 @@
|
||||
using ADOFAIRenderer.Core;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Game
|
||||
{
|
||||
[HarmonyPatch(typeof(scrPressToStart))]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class scrPressToStartPatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("ShowText")]
|
||||
private static bool PreventShowText()
|
||||
{
|
||||
if (!RenderManager.Instance || !RenderManager.Instance.skipPressToStart) return true;
|
||||
namespace ADOFAIRenderer.Patch.Game;
|
||||
|
||||
RenderManager.Instance.skipPressToStart = false;
|
||||
return false;
|
||||
}
|
||||
[HarmonyPatch(typeof(scrPressToStart))]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class scrPressToStartPatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch("ShowText")]
|
||||
private static bool PreventShowText()
|
||||
{
|
||||
if (!RenderManager.Instance || !RenderManager.Instance.skipPressToStart) return true;
|
||||
|
||||
RenderManager.Instance.skipPressToStart = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -4,34 +4,33 @@ using HarmonyLib;
|
||||
using UnityEngine;
|
||||
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]
|
||||
[HarmonyPatch("Update")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
private static void IgnoreInput(Text ___txt, Color ___defaultColor)
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("Update")]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
private static void IgnoreInput(Text ___txt, Color ___defaultColor)
|
||||
if (!RenderManager.IsActive) return;
|
||||
|
||||
___txt.text = "Render";
|
||||
if (RenderManager.Instance)
|
||||
{
|
||||
if (!RenderManager.IsActive) return;
|
||||
if (RenderManager.Instance.countdown > 0) ___txt.text = $"Render in {RenderManager.Instance.countdown}s..";
|
||||
|
||||
___txt.text = "Render";
|
||||
if (RenderManager.Instance)
|
||||
if (RenderManager.Instance.wonFrame != -1)
|
||||
{
|
||||
if (RenderManager.Instance.countdown > 0) ___txt.text = $"Render in {RenderManager.Instance.countdown}s..";
|
||||
|
||||
if (RenderManager.Instance.wonFrame != -1)
|
||||
{
|
||||
var elapsedFrames = RenderManager.Instance.frameCount - RenderManager.Instance.wonFrame;
|
||||
var remainingTime = RenderManager.Instance.Configuration.DelayAfterEnd - elapsedFrames / RenderManager.Instance.Configuration.RenderFPS;
|
||||
if (remainingTime < 0) remainingTime = 0;
|
||||
___txt.text += $"\nWaiting for {remainingTime:F1}s..";
|
||||
}
|
||||
var elapsedFrames = RenderManager.Instance.frameCount - RenderManager.Instance.wonFrame;
|
||||
var remainingTime = RenderManager.Instance.Configuration.DelayAfterEnd - elapsedFrames / RenderManager.Instance.Configuration.RenderFPS;
|
||||
if (remainingTime < 0) remainingTime = 0;
|
||||
___txt.text += $"\nWaiting for {remainingTime:F1}s..";
|
||||
}
|
||||
|
||||
___txt.color = ___defaultColor;
|
||||
}
|
||||
|
||||
___txt.color = ___defaultColor;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,20 @@
|
||||
using ADOFAIRenderer.Core;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Game
|
||||
namespace ADOFAIRenderer.Patch.Game;
|
||||
|
||||
[HarmonyPatch(typeof(scrUIController))]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class scrUIControllerPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(scrUIController))]
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("ShowEndscreenLanterns")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class scrUIControllerPatch
|
||||
public static void PreventEndscreenLanternsPostfix(scrUIController __instance)
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("ShowEndscreenLanterns")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static void PreventEndscreenLanternsPostfix(scrUIController __instance)
|
||||
if (RenderManager.IsActive && __instance != null)
|
||||
{
|
||||
if (RenderManager.IsActive && __instance != null)
|
||||
{
|
||||
__instance.HideEndscreenLanterns();
|
||||
}
|
||||
__instance.HideEndscreenLanterns();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user