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 GlowingSigns v1.5.3
GlowingSigns.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 GlowingSigns { [BepInPlugin("saymonn.GlowingSigns", "GlowingSigns", "1.5.3")] public class Plugin : BaseUnityPlugin { private class State { public Color color; public Shader shader; public Color face = Color.white; public bool unlit; } [HarmonyPatch(typeof(Sign), "Awake")] private static class SignAwakePatch { private static void Postfix(Sign __instance) { Apply(__instance); } } private static ConfigEntry<bool> modEnabled; private static ConfigEntry<bool> colorEnabled; private static ConfigEntry<string> textColor; private static ConfigEntry<bool> glowEnabled; private static ConfigEntry<int> luminance; private static readonly Dictionary<Sign, State> signs = new Dictionary<Sign, State>(); private static Shader unlitShader; private const float MinBrightness = 0.12f; private const float MaxBrightness = 0.8f; private void Awake() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master switch. When off, the whole mod is inactive and signs look like vanilla."); colorEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Color", "Enabled", true, "Paint sign text in the soft grey colour below."); textColor = ((BaseUnityPlugin)this).Config.Bind<string>("Color", "TextColor", "EDEDED", "Sign text colour as an RGB hex code (6 digits, e.g. EDEDED). Always fully opaque. Default is a soft, almost white grey."); glowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Luminance", "Enabled", true, "Make sign text self-lit so it is readable in the dark."); luminance = ((BaseUnityPlugin)this).Config.Bind<int>("Luminance", "Level", 5, new ConfigDescription("Self-lit brightness of the sign text, 1 (faint) to 10 (brightest). Works day and night. To turn it off, untick Enabled.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())); ((BaseUnityPlugin)this).Config.SettingChanged += delegate { RefreshAll(); }; new Harmony("saymonn.GlowingSigns").PatchAll(); } private static Shader FindUnlit() { if (Object.op_Implicit((Object)(object)unlitShader)) { return unlitShader; } if (Object.op_Implicit((Object)(object)Hud.instance) && Object.op_Implicit((Object)(object)Hud.instance.m_staminaText)) { unlitShader = Hud.instance.m_staminaText.fontSharedMaterial.shader; } if (!Object.op_Implicit((Object)(object)unlitShader)) { unlitShader = Shader.Find("TextMeshPro/Distance Field"); } if (Object.op_Implicit((Object)(object)unlitShader)) { Debug.Log((object)("[GlowingSigns] unlit shader: " + ((Object)unlitShader).name)); } return unlitShader; } private static void RefreshAll() { List<Sign> list = new List<Sign>(); foreach (KeyValuePair<Sign, State> sign in signs) { if (!Object.op_Implicit((Object)(object)sign.Key)) { list.Add(sign.Key); } else { Apply(sign.Key); } } foreach (Sign item in list) { signs.Remove(item); } } private static Color GetTextColor() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) string text = (textColor.Value ?? "").Trim().TrimStart('#'); Color result = default(Color); if (text.Length == 6 && ColorUtility.TryParseHtmlString("#" + text, ref result)) { result.a = 1f; return result; } return new Color(0.93f, 0.93f, 0.93f, 1f); } private static void Apply(Sign sign) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = (Object.op_Implicit((Object)(object)sign) ? sign.m_textWidget : null); if (!Object.op_Implicit((Object)(object)val)) { return; } if (!signs.TryGetValue(sign, out var value)) { value = new State { color = ((Graphic)val).color, shader = ((TMP_Text)val).fontMaterial.shader }; if (((TMP_Text)val).fontMaterial.HasProperty("_FaceColor")) { value.face = ((TMP_Text)val).fontMaterial.GetColor("_FaceColor"); } signs[sign] = value; } bool value2 = modEnabled.Value; Color val2 = ((value2 && colorEnabled.Value) ? GetTextColor() : value.color); bool num = value2 && glowEnabled.Value && (Object)(object)FindUnlit() != (Object)null; Material fontMaterial = ((TMP_Text)val).fontMaterial; if (num) { float num2 = Mathf.Lerp(0.12f, 0.8f, (float)(luminance.Value - 1) / 9f); ((Color)(ref val2))..ctor(val2.r * num2, val2.g * num2, val2.b * num2, 1f); if (!value.unlit) { fontMaterial.shader = unlitShader; value.unlit = true; } if (fontMaterial.HasProperty("_FaceColor")) { fontMaterial.SetColor("_FaceColor", Color.white); } } else if (value.unlit) { fontMaterial.shader = value.shader; value.unlit = false; if (fontMaterial.HasProperty("_FaceColor")) { fontMaterial.SetColor("_FaceColor", value.face); } } ((Graphic)val).color = val2; ((Graphic)val).SetMaterialDirty(); ((Graphic)val).SetVerticesDirty(); ((TMP_Text)val).ForceMeshUpdate(true, true); } } }