2023-09-03 02:06:53 -04:00
|
|
|
|
using System;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace CustomCosmeticLoader
|
|
|
|
|
{
|
|
|
|
|
public static class Shared
|
|
|
|
|
{
|
|
|
|
|
private static Cosmetic skinToHijack;
|
|
|
|
|
|
|
|
|
|
public static Cosmetic SkinToHijack
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (skinToHijack == null)
|
|
|
|
|
{
|
|
|
|
|
DetermineSkinToHijack();
|
|
|
|
|
if (skinToHijack == null)
|
2023-09-04 00:57:33 -04:00
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning("Couldn't find skin " + Config.skinNameToHijack + " to hijack");
|
|
|
|
|
Config.skinNameToHijack = "Swirl_M";
|
|
|
|
|
DetermineSkinToHijack();
|
|
|
|
|
}
|
2023-09-03 02:06:53 -04:00
|
|
|
|
}
|
|
|
|
|
return skinToHijack;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void DetermineSkinToHijack()
|
|
|
|
|
{
|
|
|
|
|
foreach (Cosmetic skin in CosmeticManager.Skins)
|
|
|
|
|
{
|
|
|
|
|
if (skin.Id == Config.skinNameToHijack)
|
|
|
|
|
{
|
|
|
|
|
skinToHijack = skin;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ApplyCustomTexture(GameObject marbleObject)
|
|
|
|
|
{
|
|
|
|
|
MeshRenderer[] componentsInChildren = marbleObject.GetComponentsInChildren<MeshRenderer>();
|
|
|
|
|
for (int i = 0; i < componentsInChildren.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
Material[] materials = componentsInChildren[i].materials;
|
|
|
|
|
foreach (Material material in materials)
|
|
|
|
|
material.mainTexture = Config.skins[Config.currentSkin];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|