Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of CustomColors v1.1.1
CustomColors.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CustomColors")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A mod for REPO that lets you change your color with RGB sliders")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+4bcde4ebec2db39237802dc00215ea1ce569b180")] [assembly: AssemblyProduct("CustomColors")] [assembly: AssemblyTitle("CustomColors")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CustomColors { [BepInPlugin("x753.CustomColors", "CustomColors", "1.1.1")] public class CustomColorsMod : BaseUnityPlugin { [HarmonyPatch(typeof(PlayerAvatar), "Awake")] private class PlayerAvatar_Awake_Patch { [HarmonyPostfix] public static void PlayerAvatar_Awake_Postfix(PlayerAvatar __instance) { ((Component)__instance).gameObject.AddComponent<ModdedColorPlayerAvatar>(); } } public class ModdedColorPlayerAvatar : MonoBehaviour, IPunObservable { public Color moddedColor; public static Color LocalColor = new Color(1f, 0f, 0f); public static bool ColorLock = false; public PlayerAvatar avatar; public PlayerAvatarVisuals visuals; public Material bodyMaterial; public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { throw new NotImplementedException(); } private void Awake() { avatar = ((Component)this).gameObject.GetComponent<PlayerAvatar>(); visuals = avatar.playerAvatarVisuals; } public static void LocalPlayerAvatarSetColor() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown if (!GameManager.Multiplayer()) { ((Component)PlayerAvatar.instance).GetComponent<ModdedColorPlayerAvatar>().ModdedSetColorRPC(LocalColor.r, LocalColor.g, LocalColor.b); } else { PlayerAvatar.instance.photonView.RPC("ModdedSetColorRPC", (RpcTarget)3, new object[3] { LocalColor.r, LocalColor.g, LocalColor.b }); } try { ES3Settings val = new ES3Settings("ModSettingsData.es3", new Enum[1] { (Enum)(object)(Location)0 }); ES3.Save<string>("PlayerBodyColorR", LocalColor.r.ToString(), val); ES3.Save<string>("PlayerBodyColorG", LocalColor.g.ToString(), val); ES3.Save<string>("PlayerBodyColorB", LocalColor.b.ToString(), val); } catch (Exception) { Debug.Log((object)"Failed to save ModSettingsData.es3 file!"); } } [PunRPC] public void ModdedSetColorRPC(float r, float g, float b) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); ((Color)(ref val))..ctor(r, g, b); moddedColor = val; visuals.color = val; if ((Object)(object)bodyMaterial == (Object)null) { bodyMaterial = avatar.playerHealth.bodyMaterial; } bodyMaterial.SetColor(Shader.PropertyToID("_AlbedoColor"), val); if (SemiFunc.RunIsLobbyMenu() && Object.op_Implicit((Object)(object)MenuPageLobby.instance)) { foreach (MenuPlayerListed menuPlayerListed in MenuPageLobby.instance.menuPlayerListedList) { if ((Object)(object)menuPlayerListed.playerAvatar == (Object)(object)avatar) { menuPlayerListed.playerHead.SetColor(val); break; } } } visuals.colorSet = true; } } public class SliderReinitializer : MonoBehaviour { public string elementName = ""; public MenuSlider menuSlider; public float startValue; public void Start() { ((Component)this).gameObject.GetComponent<MenuSlider>().elementName = elementName; ((TMP_Text)((Component)((Component)this).gameObject.transform.Find("Element Name")).GetComponent<TextMeshProUGUI>()).SetText(elementName, true); ((Object)((Component)this).gameObject).name = "Slider - " + elementName; menuSlider.SetBar(startValue); } } [HarmonyPatch(typeof(MenuPageColor), "Start")] private class MenuPageColor_Start_Patch { [HarmonyPostfix] public static void MenuPageColor_Start_Postfix(MenuPageColor __instance) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) ((Component)__instance).transform.Find("Color Button Holder"); ((Component)__instance).transform.Find("Menu Button - Confirm").localPosition = new Vector3(330f, 80f, 0f); foreach (MenuPages menuPage2 in MenuManager.instance.menuPages) { GameObject menuPage = menuPage2.menuPage; if (((Object)menuPage).name == "Menu Page Settings Audio") { Transform obj = menuPage.transform.Find("Menu Scroll Box"); Transform obj2 = ((obj != null) ? obj.Find("Mask") : null); Transform obj3 = ((obj2 != null) ? obj2.Find("Scroller") : null); Transform val = ((obj3 != null) ? obj3.Find("Slider - Master volume") : null); if ((Object)(object)val != (Object)null) { RedSlider = CreateColorSlider(((Component)val).gameObject, ((Component)__instance).transform, new Vector3(60f, 525f, 0f), "Color [RED]", Color.red, 753); GreenSlider = CreateColorSlider(((Component)val).gameObject, ((Component)__instance).transform, new Vector3(60f, 495f, 0f), "Color [GREEN]", Color.green, 754); BlueSlider = CreateColorSlider(((Component)val).gameObject, ((Component)__instance).transform, new Vector3(60f, 465f, 0f), "Color [BLUE]", Color.blue, 755); } } } } } [HarmonyPatch(typeof(MenuButtonColor), "Start")] private class MenuButtonColor_Start_Patch { [HarmonyPostfix] public static void MenuButtonColor_Start_Postfix(MenuButtonColor __instance) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (DataDirector.instance.ColorGetBody() == __instance.colorID) { ModdedColorPlayerAvatar.ColorLock = true; __instance.menuPageColor.menuColorSelected.SetColor(AssetManager.instance.playerColors[__instance.colorID], ((Component)__instance).transform.position - new Vector3(0f, 405f, 0f)); } } } [HarmonyPatch(typeof(PlayerAvatar), "PlayerAvatarSetColor")] private class PlayerAvatar_PlayerAvatarSetColor_Patch { [HarmonyPostfix] public static void PlayerAvatar_PlayerAvatarSetColor_Postfix(PlayerAvatar __instance, int colorIndex) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ModdedColorPlayerAvatar component = ((Component)__instance).GetComponent<ModdedColorPlayerAvatar>(); if (component != null) { _ = component.moddedColor; if (true) { ModdedColorPlayerAvatar.LocalPlayerAvatarSetColor(); } } } } [HarmonyPatch(typeof(PlayerAvatarVisuals), "MenuAvatarGetColorsFromRealAvatar")] private class PlayerAvatarVisuals_MenuAvatarGetColorsFromRealAvatar_Patch { public static Material bodyMaterial; [HarmonyPrefix] public static bool PlayerAvatarVisuals_MenuAvatarGetColorsFromRealAvatar_Prefix(PlayerAvatarVisuals __instance) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (__instance.isMenuAvatar && !Object.op_Implicit((Object)(object)__instance.playerAvatar)) { __instance.playerAvatar = PlayerAvatar.instance; } bodyMaterial = ((Component)((Component)__instance).transform).GetComponentInParent<PlayerHealth>().bodyMaterial; bodyMaterial.SetColor(Shader.PropertyToID("_AlbedoColor"), ModdedColorPlayerAvatar.LocalColor); return false; } } [HarmonyPatch(typeof(MenuColorSelected), "SetColor")] private class MenuColorSelected_SetColor_Patch { [HarmonyPostfix] public static void MenuColorSelected_SetColor_Postfix(MenuColorSelected __instance, Color color, Vector3 position) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (ModdedColorPlayerAvatar.ColorLock) { ModdedColorPlayerAvatar.ColorLock = false; return; } if ((Object)(object)RedSlider != (Object)null) { RedSlider.SetBar(color.r); } if ((Object)(object)GreenSlider != (Object)null) { GreenSlider.SetBar(color.g); } if ((Object)(object)BlueSlider != (Object)null) { BlueSlider.SetBar(color.b); } ModdedColorPlayerAvatar.LocalColor = color; } } [HarmonyPatch(typeof(MenuPageColor), "ConfirmButton")] private class MenuPageColor_ConfirmButton_Patch { [HarmonyPrefix] public static void MenuPageColor_ConfirmButton_Prefix(MenuPageColor __instance) { ModdedColorPlayerAvatar.LocalPlayerAvatarSetColor(); } } [HarmonyPatch(typeof(DataDirector), "SettingValueSet")] private class DataDirector_SettingValueSet_Patch { [HarmonyPrefix] public static bool DataDirector_SettingValueSet_Prefix(DataDirector __instance, Setting setting, int value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 if ((int)setting == 753) { ModdedColorPlayerAvatar.LocalColor.r = (float)value / 100f; return false; } if ((int)setting == 754) { ModdedColorPlayerAvatar.LocalColor.g = (float)value / 100f; return false; } if ((int)setting == 755) { ModdedColorPlayerAvatar.LocalColor.b = (float)value / 100f; return false; } return true; } } private const string modGUID = "x753.CustomColors"; private const string modName = "CustomColors"; private const string modVersion = "1.1.1"; private readonly Harmony harmony = new Harmony("x753.CustomColors"); private static CustomColorsMod Instance; public static MenuSlider RedSlider; public static MenuSlider GreenSlider; public static MenuSlider BlueSlider; private void Awake() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CustomColors is loaded!"); ES3Settings val = new ES3Settings("ModSettingsData.es3", new Enum[1] { (Enum)(object)(Location)0 }); try { if (ES3.KeyExists("PlayerBodyColorR", val)) { string s = ES3.Load<string>("PlayerBodyColorR", "0", val); string s2 = ES3.Load<string>("PlayerBodyColorG", "1", val); string s3 = ES3.Load<string>("PlayerBodyColorB", "0", val); ModdedColorPlayerAvatar.LocalColor.r = float.Parse(s); ModdedColorPlayerAvatar.LocalColor.g = float.Parse(s2); ModdedColorPlayerAvatar.LocalColor.b = float.Parse(s3); } } catch (Exception) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Failed to load ModSettingsData.es3 file!"); ES3.DeleteFile(val); } } public static MenuSlider CreateColorSlider(GameObject sliderPrefab, Transform parentTransform, Vector3 position, string elementName, Color color, int settingNum) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(sliderPrefab, parentTransform); obj.transform.position = position; ((Graphic)((Component)obj.transform.Find("SliderBG").Find("RawImage (1)")).GetComponent<RawImage>()).color = Color.black; ((Component)obj.transform.Find("SliderBG").Find("RawImage (2)")).gameObject.SetActive(false); ((Graphic)((Component)obj.transform.Find("SliderBG").Find("RawImage (3)")).GetComponent<RawImage>()).color = new Color(0.1f, 0.1f, 0.1f); ((Component)obj.transform.Find("MaskedText")).gameObject.SetActive(false); ((Graphic)((Component)obj.transform.Find("Bar").Find("RawImage")).GetComponent<RawImage>()).color = color; MenuSlider component = obj.GetComponent<MenuSlider>(); component.pointerSegmentJump = 1; component.buttonSegmentJump = 1; obj.GetComponent<MenuSetting>().setting = (Setting)settingNum; Object.Destroy((Object)(object)obj.GetComponent<MenuSettingElement>()); SliderReinitializer sliderReinitializer = obj.AddComponent<SliderReinitializer>(); sliderReinitializer.menuSlider = component; sliderReinitializer.elementName = elementName; if (color == Color.red) { sliderReinitializer.startValue = ModdedColorPlayerAvatar.LocalColor.r; } else if (color == Color.green) { sliderReinitializer.startValue = ModdedColorPlayerAvatar.LocalColor.g; } else if (color == Color.blue) { sliderReinitializer.startValue = ModdedColorPlayerAvatar.LocalColor.b; } return component; } } }