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

25 lines
575 B
C#
Raw Normal View History

2023-08-26 17:59:50 -04:00
using HarmonyLib;
using System;
using UnityEngine;
namespace CustomCosmeticLoader.Patches
{
2023-09-02 23:19:35 -04:00
[HarmonyPatch(typeof(MarbleHolder), nameof(MarbleHolder.SetMarble))]
2023-08-26 17:59:50 -04:00
internal class MarbleHolderSetMarblePatch
{
static void Postfix(MarbleHolder __instance, Cosmetic marbleObject)
{
if (!Config.enabled)
return;
2023-09-03 02:06:53 -04:00
if (marbleObject.Id != Config.skinNameToHijack && Config.skinNameToHijack != "*")
return;
if (!Config.inCosmeticMenu && __instance == CosmeticPanel.cosmHolder)
return;
2023-08-26 17:59:50 -04:00
2023-09-03 02:06:53 -04:00
Shared.ApplyCustomTexture(__instance.currentMarble);
2023-08-26 17:59:50 -04:00
}
}
}