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 SignEditor v1.0.0
plugins\SignEditor\SignEditor.dll
Decompiled 3 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("SignEditor")] [assembly: AssemblyDescription("Enhanced Valheim sign editor with colors, sizes, emojis, and rich-text editing.")] [assembly: AssemblyCompany("LEGIOmods")] [assembly: AssemblyProduct("SignEditor")] [assembly: AssemblyCopyright("Copyright © 2026 LEGIOmods")] [assembly: ComVisible(false)] [assembly: Guid("4fcb2435-77bf-4d04-af4c-5f34fb7ef7dc")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially created with the assistance of Generative AI for code changes, localization, documentation, and package preparation.")] [assembly: AssemblyMetadata("AI_Model_Vendor", "OpenAI")] [assembly: AssemblyMetadata("AI_Agent", "OpenAI Codex")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.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 SignEditor { [BepInPlugin("legiomods.signeditor", "SignEditor", "1.0.0")] public sealed class SignEditorPlugin : BaseUnityPlugin { private readonly struct ColorChoice { internal readonly string EnglishName; internal readonly string GermanName; internal readonly string HexTag; internal ColorChoice(string englishName, string germanName, string hex) { EnglishName = englishName; GermanName = germanName; HexTag = "<" + hex + ">"; } } private readonly struct EmojiChoice { internal readonly string Value; internal readonly string EnglishLabel; internal readonly string GermanLabel; internal EmojiChoice(string value, string englishLabel, string germanLabel) { Value = value; EnglishLabel = englishLabel; GermanLabel = germanLabel; } } private static class TextInputAccessor { private static FieldInfo inputFieldInfo; private static FieldInfo panelInfo; private static MethodInfo isVisibleMethod; private static MethodInfo setTextMethod; private static MethodInfo onEnterMethod; private static PropertyInfo textProperty; private static PropertyInfo caretProperty; private static PropertyInfo selectionFocusProperty; private static PropertyInfo selectionAnchorProperty; private static MethodInfo activateMethod; private static CanvasGroup blockedPanelGroup; private static bool panelGroupWasAdded; private static bool previousInteractable; private static bool previousBlocksRaycasts; internal static bool IsTextInputOpen() { TextInput instance = TextInput.instance; if (!Object.op_Implicit((Object)(object)instance)) { return false; } isVisibleMethod = isVisibleMethod ?? typeof(TextInput).GetMethod("IsVisible", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (isVisibleMethod != null) { object obj = isVisibleMethod.Invoke(instance, null); if (obj is bool) { return (bool)obj; } } GameObject panel = GetPanel(); if (Object.op_Implicit((Object)(object)panel)) { return panel.activeInHierarchy; } return false; } internal static void BlockUnderlyingPanel() { if (Object.op_Implicit((Object)(object)blockedPanelGroup)) { return; } GameObject panel = GetPanel(); if (Object.op_Implicit((Object)(object)panel)) { blockedPanelGroup = panel.GetComponent<CanvasGroup>(); panelGroupWasAdded = !Object.op_Implicit((Object)(object)blockedPanelGroup); if (panelGroupWasAdded) { blockedPanelGroup = panel.AddComponent<CanvasGroup>(); } previousInteractable = blockedPanelGroup.interactable; previousBlocksRaycasts = blockedPanelGroup.blocksRaycasts; blockedPanelGroup.interactable = false; blockedPanelGroup.blocksRaycasts = true; } } internal static void UnblockUnderlyingPanel() { if (Object.op_Implicit((Object)(object)blockedPanelGroup)) { if (panelGroupWasAdded) { Object.Destroy((Object)(object)blockedPanelGroup); } else { blockedPanelGroup.interactable = previousInteractable; blockedPanelGroup.blocksRaycasts = previousBlocksRaycasts; } blockedPanelGroup = null; panelGroupWasAdded = false; } } internal static string GetText() { object inputField = GetInputField(); if (inputField == null) { return null; } return (textProperty?.GetValue(inputField, null) as string) ?? string.Empty; } internal static void ReplaceText(string value) { object inputField = GetInputField(); if (inputField != null) { string text = value ?? string.Empty; textProperty?.SetValue(inputField, text, null); setTextMethod = setTextMethod ?? typeof(TextInput).GetMethod("setText", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); setTextMethod?.Invoke(TextInput.instance, new object[1] { text }); SetCaret(inputField, text.Length); activateMethod?.Invoke(inputField, null); } } internal static void Confirm() { TextInput instance = TextInput.instance; if (Object.op_Implicit((Object)(object)instance)) { onEnterMethod = onEnterMethod ?? typeof(TextInput).GetMethod("OnEnter", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); onEnterMethod?.Invoke(instance, null); } } private static object GetInputField() { TextInput instance = TextInput.instance; if (!Object.op_Implicit((Object)(object)instance)) { return null; } inputFieldInfo = inputFieldInfo ?? typeof(TextInput).GetField("m_inputField", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); object obj = inputFieldInfo?.GetValue(instance); if (obj == null) { return null; } Type type = obj.GetType(); textProperty = textProperty ?? type.GetProperty("text", BindingFlags.Instance | BindingFlags.Public); caretProperty = caretProperty ?? type.GetProperty("caretPosition", BindingFlags.Instance | BindingFlags.Public); selectionFocusProperty = selectionFocusProperty ?? type.GetProperty("selectionFocusPosition", BindingFlags.Instance | BindingFlags.Public); selectionAnchorProperty = selectionAnchorProperty ?? type.GetProperty("selectionAnchorPosition", BindingFlags.Instance | BindingFlags.Public); activateMethod = activateMethod ?? type.GetMethod("ActivateInputField", BindingFlags.Instance | BindingFlags.Public); return obj; } private static GameObject GetPanel() { TextInput instance = TextInput.instance; if (!Object.op_Implicit((Object)(object)instance)) { return null; } panelInfo = panelInfo ?? typeof(TextInput).GetField("m_panel", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); object? obj = panelInfo?.GetValue(instance); return (GameObject)((obj is GameObject) ? obj : null); } private static int GetCaret(object inputField, int fallback) { object obj = selectionFocusProperty?.GetValue(inputField, null) ?? caretProperty?.GetValue(inputField, null); if (obj is int) { return (int)obj; } return fallback; } private static void SetCaret(object inputField, int position) { caretProperty?.SetValue(inputField, position, null); selectionAnchorProperty?.SetValue(inputField, position, null); selectionFocusProperty?.SetValue(inputField, position, null); } } public const string PluginGuid = "legiomods.signeditor"; public const string PluginName = "SignEditor"; public const string PluginVersion = "1.0.0"; private static Harmony harmony; private static Sign lastEditedSign; private static float lastSignInteractTime; private readonly EmojiChoice[][] emojiRows = new EmojiChoice[4][] { new EmojiChoice[7] { E("↑", "Up", "Hoch"), E("↓", "Down", "Runter"), E("←", "Left", "Links"), E("→", "Right", "Rechts"), E("❤\ufe0f", "Heart", "Herz"), E("\ud83e\udd55", "Carrot", "Karotte"), E("\ud83e\uddc5", "Onion", "Zwiebel") }, new EmojiChoice[7] { E("⚡", "Lightning", "Blitz"), E("⚒\ufe0f", "Hammer", "Hammer"), E("⚙\ufe0f", "Gear", "Zahnrad"), E("⛓\ufe0f", "Chain", "Kette"), E("\ud83d\udee1\ufe0f", "Shield", "Schild"), E("\ud83c\udff9", "Bow", "Bogen"), E("\ud83d\udde1\ufe0f", "Dagger", "Dolch") }, new EmojiChoice[7] { E("⚔\ufe0f", "Swords", "Schwerter"), E("\ud83e\ude9a", "Saw", "Säge"), E("\ud83d\udca3", "Bomb", "Bombe"), E("\ud83e\uddd9\u200d♂\ufe0f", "Mage", "Magier"), E("\ud83c\udf44", "Mushroom", "Pilz"), E("\ud83c\udf53", "Berry", "Beere"), E("\ud83c\udf47", "Grapes", "Trauben") }, new EmojiChoice[5] { E("\ud83e\uded8", "Beans", "Bohnen"), E("\ud83c\udf31", "Sprout", "Keim"), E("\ud83e\ude84", "Magic", "Zauber"), E("\ud83c\udf3e", "Grain", "Korn"), E("\ud83d\udc80", "Skull", "Totenkopf") } }; private readonly ColorChoice[] colors = new ColorChoice[7] { new ColorChoice("White", "Weiß", "#FFFFFF"), new ColorChoice("Red", "Rot", "#FF0000"), new ColorChoice("Yellow", "Gelb", "#E5FF00"), new ColorChoice("Blue", "Blau", "#6495ED"), new ColorChoice("Orange", "Orange", "#FFB90F"), new ColorChoice("Green", "Grün", "#00FF00"), new ColorChoice("Black", "Schwarz", "#000000") }; private int selectedColor; private int fontSize = 10; private string editText = string.Empty; private string markupText = string.Empty; private bool editorInitialized; private Vector2 editorScroll; private Rect editorRect; private GUIStyle overlayStyle; private GUIStyle panelStyle; private GUIStyle titleStyle; private GUIStyle buttonStyle; private GUIStyle selectedStyle; private GUIStyle labelStyle; private GUIStyle previewStyle; private Font editorFont; private Texture2D overlayTexture; private Texture2D panelTexture; private Texture2D buttonTexture; private Texture2D selectedTexture; private void Awake() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown editorRect = new Rect(0f, 0f, 1380f, 900f); harmony = new Harmony("legiomods.signeditor"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"SignEditor 1.0.0 loaded."); } private void OnDestroy() { TextInputAccessor.UnblockUnderlyingPanel(); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } private void OnGUI() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (ShouldShowEditor()) { if (!editorInitialized) { LoadExistingText(); } EnsureStyles(); GUI.depth = -2000; GUI.ModalWindow(493812, new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), new WindowFunction(DrawOverlay), string.Empty, overlayStyle); } } internal static void RememberSign(Sign sign) { lastEditedSign = sign; lastSignInteractTime = Time.time; } private bool ShouldShowEditor() { if (!Object.op_Implicit((Object)(object)lastEditedSign) || Time.time - lastSignInteractTime > 600f || !TextInputAccessor.IsTextInputOpen()) { bool num = editorInitialized; lastEditedSign = null; editorInitialized = false; if (num) { TextInputAccessor.UnblockUnderlyingPanel(); RestoreGameCursor(); } return false; } Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; return true; } private void DrawOverlay(int id) { //IL_004d: 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_0058: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(1380f, (float)Screen.width - 20f); float num2 = Mathf.Min(900f, (float)Screen.height - 20f); editorRect = new Rect(((float)Screen.width - num) * 0.5f, ((float)Screen.height - num2) * 0.5f, num, num2); GUILayout.BeginArea(editorRect, panelStyle); DrawEditor(); GUILayout.EndArea(); } private void DrawEditor() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(Text("Sign Editor", "Schild-Editor"), titleStyle, Array.Empty<GUILayoutOption>()); GUILayout.Space(8f); float num = Mathf.Max(180f, ((Rect)(ref editorRect)).height - 345f); editorScroll = GUILayout.BeginScrollView(editorScroll, false, false, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) }); GUILayout.Label(Text("Color", "Farbe"), labelStyle, Array.Empty<GUILayoutOption>()); for (int i = 0; i < colors.Length; i += 7) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int j = i; j < Mathf.Min(i + 7, colors.Length); j++) { DrawColorButton(j); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(Text("Size", "Größe"), labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (GUILayout.Button("-10", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(76f), GUILayout.Height(50f) })) { fontSize = Mathf.Max(1, fontSize - 10); RebuildMarkup(); } if (GUILayout.Button("-", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(64f), GUILayout.Height(50f) })) { fontSize = Mathf.Max(1, fontSize - 1); RebuildMarkup(); } GUILayout.Label(fontSize.ToString(), labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(56f) }); if (GUILayout.Button("+", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(64f), GUILayout.Height(50f) })) { fontSize = Mathf.Min(9000, fontSize + 1); RebuildMarkup(); } if (GUILayout.Button("+10", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(76f), GUILayout.Height(50f) })) { fontSize = Mathf.Min(9000, fontSize + 10); RebuildMarkup(); } GUILayout.EndHorizontal(); GUILayout.Space(14f); GUILayout.Label(Text("Insert emoji", "Emoji einfügen"), labelStyle, Array.Empty<GUILayoutOption>()); float num2 = Mathf.Clamp((((Rect)(ref editorRect)).width - 135f) / 7f, 90f, 175f); for (int k = 0; k < emojiRows.Length; k++) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int l = 0; l < emojiRows[k].Length; l++) { EmojiChoice emojiChoice = emojiRows[k][l]; if (GUILayout.Button(Text(emojiChoice.EnglishLabel, emojiChoice.GermanLabel), buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(num2), GUILayout.Height(54f) })) { editText = (editText ?? string.Empty) + emojiChoice.Value; RebuildMarkup(); GUI.FocusControl("SignEditorMarkup"); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.Space(10f); GUILayout.Label(Text("Sign text (edit directly)", "Schild-Text (direkt bearbeiten)"), labelStyle, Array.Empty<GUILayoutOption>()); GUI.SetNextControlName("SignEditorMarkup"); string text = GUILayout.TextArea(markupText ?? string.Empty, previewStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(130f) }); if (!string.Equals(text, markupText, StringComparison.Ordinal)) { LoadMarkup(text); } GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(Text("Apply & OK", "Übernehmen & OK"), selectedStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(60f) })) { TextInputAccessor.ReplaceText(markupText); TextInputAccessor.Confirm(); CloseEditor(); } if (GUILayout.Button(Text("Clear", "Leeren"), buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(60f) })) { editText = string.Empty; markupText = string.Empty; } GUILayout.EndHorizontal(); } private void CloseEditor() { lastEditedSign = null; editorInitialized = false; TextInputAccessor.UnblockUnderlyingPanel(); RestoreGameCursor(); } private static void RestoreGameCursor() { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } private void DrawColorButton(int index) { bool flag = selectedColor == index; string text = (flag ? "[x] " : "[ ] ") + Text(colors[index].EnglishName, colors[index].GermanName); float num = Mathf.Clamp((((Rect)(ref editorRect)).width - 135f) / 7f, 90f, 175f); if (GUILayout.Button(text, flag ? selectedStyle : buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(num), GUILayout.Height(50f) })) { selectedColor = index; RebuildMarkup(); } } private void LoadExistingText() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) selectedColor = 0; fontSize = 10; editorScroll = Vector2.zero; string text = TextInputAccessor.GetText(); if (text == null && Object.op_Implicit((Object)(object)lastEditedSign)) { text = lastEditedSign.GetText(); } LoadMarkup(text ?? string.Empty); TextInputAccessor.BlockUnderlyingPanel(); editorInitialized = true; } private void LoadMarkup(string value) { markupText = value ?? string.Empty; string text = markupText; for (int i = 0; i < colors.Length; i++) { if (text.StartsWith(colors[i].HexTag, StringComparison.OrdinalIgnoreCase)) { selectedColor = i; text = text.Substring(colors[i].HexTag.Length); break; } } if (text.StartsWith("<color=", StringComparison.OrdinalIgnoreCase)) { int num = text.IndexOf('>'); if (num > 7) { SelectNamedColor(text.Substring(7, num - 7)); text = text.Substring(num + 1); } } if (text.StartsWith("<size=", StringComparison.OrdinalIgnoreCase)) { int num2 = text.IndexOf('>'); if (num2 > 6 && int.TryParse(text.Substring(6, num2 - 6), out var result)) { fontSize = Mathf.Clamp(result, 1, 9000); text = text.Substring(num2 + 1); } } editText = text; } private void SelectNamedColor(string value) { string text = (value ?? string.Empty).Trim().ToLowerInvariant(); string text2; switch (text) { case "weiss": case "white": text2 = "#FFFFFF"; break; case "red": case "rot": text2 = "#FF0000"; break; case "yellow": case "gelb": text2 = "#E5FF00"; break; case "blau": case "blue": text2 = "#6495ED"; break; case "orange": text2 = "#FFB90F"; break; case "green": case "gruen": text2 = "#00FF00"; break; case "black": case "schwarz": text2 = "#000000"; break; default: text2 = text; break; } for (int i = 0; i < colors.Length; i++) { if (string.Equals(colors[i].HexTag, "<" + text2 + ">", StringComparison.OrdinalIgnoreCase)) { selectedColor = i; break; } } } private void RebuildMarkup() { string text = editText ?? string.Empty; markupText = (string.IsNullOrEmpty(text) ? string.Empty : (colors[selectedColor].HexTag + "<size=" + fontSize + ">" + text)); } private static EmojiChoice E(string value, string englishLabel, string germanLabel) { return new EmojiChoice(value, englishLabel, germanLabel); } private static string Text(string english, string german) { if (Localization.instance == null) { return english; } string text = Localization.instance.GetSelectedLanguage() ?? string.Empty; if (!text.Equals("German", StringComparison.OrdinalIgnoreCase) && !text.Equals("Deutsch", StringComparison.OrdinalIgnoreCase) && !text.StartsWith("de", StringComparison.OrdinalIgnoreCase)) { return english; } return german; } private void EnsureStyles() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00de: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown //IL_0127: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Expected O, but got Unknown if (panelStyle == null) { overlayTexture = MakeTexture(new Color(0f, 0f, 0f, 0.45f)); panelTexture = MakeTexture(new Color(0.08f, 0.075f, 0.065f, 0.98f)); buttonTexture = MakeTexture(new Color(0.2f, 0.18f, 0.15f, 0.98f)); selectedTexture = MakeTexture(new Color(0.38f, 0.27f, 0.12f, 1f)); GUIStyle val = new GUIStyle(GUI.skin.box); val.normal.background = overlayTexture; val.normal.textColor = Color.white; val.padding = new RectOffset(0, 0, 0, 0); overlayStyle = val; GUIStyle val2 = new GUIStyle(GUI.skin.box); val2.normal.background = panelTexture; val2.normal.textColor = Color.white; val2.padding = new RectOffset(24, 24, 22, 22); panelStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 36, fontStyle = (FontStyle)1 }; val3.normal.textColor = new Color(1f, 0.82f, 0.42f, 1f); titleStyle = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 24 }; val4.normal.textColor = new Color(0.92f, 0.88f, 0.78f, 1f); labelStyle = val4; GUIStyle val5 = new GUIStyle(GUI.skin.button) { fontSize = 22, wordWrap = true }; val5.normal.background = buttonTexture; val5.normal.textColor = Color.white; val5.hover.background = selectedTexture; val5.hover.textColor = Color.white; val5.active.background = selectedTexture; val5.active.textColor = Color.white; buttonStyle = val5; GUIStyle val6 = new GUIStyle(buttonStyle); val6.normal.background = selectedTexture; val6.normal.textColor = Color.white; selectedStyle = val6; editorFont = Font.CreateDynamicFontFromOSFont(new string[3] { "Arial", "Segoe UI Emoji", "Segoe UI Symbol" }, 26); previewStyle = new GUIStyle(GUI.skin.textArea) { font = editorFont, fontSize = 24, wordWrap = true }; } } private static Texture2D MakeTexture(Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, color); val.Apply(); return val; } } [HarmonyPatch(typeof(Sign), "Interact")] internal static class SignInteractPatch { private static void Postfix(Sign __instance, bool __result) { if (__result) { SignEditorPlugin.RememberSign(__instance); } } } }