29 lines
840 B
C#
29 lines
840 B
C#
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(Cosmetic c, CosmeticType ctype)
|
|
{
|
|
if (!Config.enabled)
|
|
return;
|
|
|
|
if (ctype == CosmeticType.Skin && Config.inCosmeticMenu)
|
|
{
|
|
MarbleHolder holder = CosmeticPanel.cosmHolder;
|
|
if (Config.skinNameToHijack != "*")
|
|
holder.SetMarble(Shared.SkinToHijack);
|
|
Shared.ApplyCustomTexture(holder.currentMarble);
|
|
}
|
|
|
|
if (Config.showSkinIds)
|
|
CosmeticPanel.instance.CosmTitle.text += " (" + c.Id + ")";
|
|
}
|
|
}
|
|
}
|