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

26 lines
729 B
C#
Raw Normal View History

2023-10-25 00:16:13 -04:00
using HarmonyLib;
using System;
namespace CustomCosmeticLoader.Patches
{
/*
* Override the marble cosmetic to be the hijacked marble if configured to appear in cosmetic menu.
*/
[HarmonyPatch(typeof(CosmeticPanel), nameof(CosmeticPanel.SelectCosmetic), new Type[] { typeof(Cosmetic), typeof(CosmeticType), typeof(bool) })]
internal class CosmeticPanelSelectCosmeticPatch
{
static void Postfix(CosmeticType ctype)
{
if (!Config.enabled)
return;
if (ctype == CosmeticType.Skin && Config.inCosmeticMenu && Config.skinNameToHijack != "*")
{
MarbleHolder holder = CosmeticPanel.cosmHolder;
holder.SetMarble(Shared.SkinToHijack);
Shared.ApplyCustomTexture(holder.currentMarble);
}
}
}
}