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
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user