2023-09-09 03:38:28 -04:00
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace CustomCosmeticLoader.Patches
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Since the Setup method already uses the hijacked skin pulled from the marble, we just need to apply the custom
|
|
|
|
|
* texture after the fact
|
|
|
|
|
*/
|
|
|
|
|
[HarmonyPatch(typeof(VoteAvatar), nameof(VoteAvatar.Setup))]
|
|
|
|
|
internal class VoteAvatarSetupPatch
|
|
|
|
|
{
|
|
|
|
|
static void Postfix(VoteAvatar __instance, MarbleController marble)
|
|
|
|
|
{
|
|
|
|
|
if (!Config.enabled)
|
|
|
|
|
return;
|
|
|
|
|
|
2023-09-11 01:23:57 -04:00
|
|
|
|
// Don't override zombies
|
|
|
|
|
if (__instance.widget.cosmeticDisplay.cosmetic.Id == "Zombie")
|
|
|
|
|
return;
|
|
|
|
|
|
2023-09-09 03:38:28 -04:00
|
|
|
|
Texture2D skin = null;
|
|
|
|
|
if (marble.isMyClientMarble())
|
|
|
|
|
{
|
|
|
|
|
skin = Config.skins[Config.currentSkin];
|
|
|
|
|
}
|
2023-09-11 01:23:57 -04:00
|
|
|
|
else
|
2023-09-09 03:38:28 -04:00
|
|
|
|
{
|
|
|
|
|
if (Config.otherPlayers.ContainsKey(marble.nickname))
|
|
|
|
|
skin = Config.skins[Config.otherPlayers[marble.nickname]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (skin != null)
|
|
|
|
|
Shared.ApplyCustomTexture(__instance.widget.cosmeticDisplay.gameObject, skin);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|