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

33 lines
861 B
C#
Raw Normal View History

2023-09-03 02:06:53 -04:00
using HarmonyLib;
using System;
namespace CustomCosmeticLoader.Patches
{
2023-09-08 00:24:00 -04:00
/*
* Show your custom marble skin on the "My Marble" display on the main menu (if configured).
*/
2023-09-03 02:06:53 -04:00
[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 (__instance.cosmeticDisplay)
{
if (Config.skinNameToHijack != "*")
{
__instance.cosmeticDisplay.Clear();
GameObjectAllocator.Deinitialize(__instance.cosmeticDisplay.gameObject);
__instance.cosmeticDisplay.Setup(Shared.SkinToHijack, CosmeticType.Skin, true, true);
}
2023-09-03 02:06:53 -04:00
Shared.ApplyCustomTexture(__instance.cosmeticDisplay.CachedCosmeticGameObject);
}
}
}
}