miuu-custom-cosmetic-loader/Patches/MainMenuPanelPatches.cs

30 lines
755 B
C#
Raw Normal View History

2023-09-03 02:06:53 -04:00
using HarmonyLib;
using System;
namespace CustomCosmeticLoader.Patches
{
[HarmonyPatch(typeof(MainMenuPanel), nameof(MainMenuPanel.SetupImages), new Type[] { typeof(bool) })]
internal class MainMenuPanelSetupImagesPatch
{
static void Postfix(MainMenuPanel __instance)
{
if (!Config.enabled)
return;
if (!Config.inMainMenu)
return;
if (Config.skinNameToHijack == "*")
return;
if (__instance.cosmeticDisplay)
{
__instance.cosmeticDisplay.Clear();
GameObjectAllocator.Deinitialize(__instance.cosmeticDisplay.gameObject);
__instance.cosmeticDisplay.Setup(Shared.SkinToHijack, CosmeticType.Skin, true, true);
Shared.ApplyCustomTexture(__instance.cosmeticDisplay.CachedCosmeticGameObject);
}
}
}
}