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

30 lines
840 B
C#
Raw Permalink Normal View History

using HarmonyLib;
2023-10-25 00:16:13 -04:00
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(Cosmetic c, CosmeticType ctype)
2023-10-25 00:16:13 -04:00
{
if (!Config.enabled)
return;
if (ctype == CosmeticType.Skin && Config.inCosmeticMenu)
2023-10-25 00:16:13 -04:00
{
MarbleHolder holder = CosmeticPanel.cosmHolder;
if (Config.skinNameToHijack != "*")
holder.SetMarble(Shared.SkinToHijack);
2023-10-25 00:16:13 -04:00
Shared.ApplyCustomTexture(holder.currentMarble);
}
if (Config.showSkinIds)
CosmeticPanel.instance.CosmTitle.text += " (" + c.Id + ")";
2023-10-25 00:16:13 -04:00
}
}
}