Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of SimpleLabels v1.2.9
Mods/SimpleLabels.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.EntityFramework; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Management; using Il2CppScheduleOne.ObjectScripts; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.Persistence.Datas; using Il2CppScheduleOne.Persistence.Loaders; using Il2CppScheduleOne.Storage; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Management; using Il2CppScheduleOne.UI.Stations; using Il2CppSystem; using Il2CppSystem.Collections; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using SimpleLabels; using SimpleLabels.Data; using SimpleLabels.Settings; using SimpleLabels.UI; using SimpleLabels.Utils; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(LabelMod), "SimpleLabels", "1.2.9", "tiagovito", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: AssemblyMetadata("NexusModID", "680")] [assembly: AssemblyTitle("SimpleLabels")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SimpleLabels")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("0815B6B1-596A-4C00-B58C-9C171C427E90")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [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 SimpleLabels { public class LabelMod : MelonMod { public override void OnInitializeMelon() { ((MelonBase)this).OnInitializeMelon(); ModSettings.Initialize(); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (!(sceneName == "Main")) { if (sceneName == "Menu") { DeactivateMod(); } } else { LabelPrefabManager.Initialize(); ActivateMod(); } } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { } private static void ActivateMod() { LabelDataManager.Initialize(); InputFieldManager.Initialize(); Singleton<SaveManager>.Instance.onSaveStart.AddListener(UnityAction.op_Implicit((Action)delegate { LabelDataManager.SaveLabelTrackerData(); })); if (MelonTypeBase<MelonMod>.RegisteredMelons.Any((MelonMod mod) => ((MelonBase)mod).Info.Name == "Mod Manager & Phone App")) { ModManagerIntegration.Initialize(); } } private static void DeactivateMod() { InputFieldManager.Terminate(); LabelPrefabManager.Terminate(); LabelApplier.Terminate(); } } } namespace SimpleLabels.Utils { public class DevUtils { public static bool IsStorageOrStationOpen() { return Singleton<StorageMenu>.Instance.IsOpen || Singleton<BrickPressCanvas>.Instance.isOpen || Singleton<CauldronCanvas>.Instance.isOpen || Singleton<ChemistryStationCanvas>.Instance.isOpen || Singleton<DryingRackCanvas>.Instance.isOpen || Singleton<LabOvenCanvas>.Instance.isOpen || Singleton<MixingStationCanvas>.Instance.isOpen || Singleton<PackagingStationCanvas>.Instance.isOpen; } } public static class Logger { private static readonly bool ShowInConsole = ModSettings.ShowDebug.Value; public static void Msg(string message) { if (ShowInConsole) { MelonLogger.Msg(message); } } public static void Warning(string message) { MelonLogger.Warning(message); } public static void Error(string message) { MelonLogger.Error(message); } } public class SpriteManager { public static Sprite LoadEmbeddedSprite(string resourceName, Vector4 customBorders) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = executingAssembly.GetName().Name + ".Resources." + resourceName; using Stream stream = executingAssembly.GetManifestResourceStream(name); byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array))) { MelonLogger.Error("Failed to load texture"); return null; } ((Object)val).name = resourceName.Replace(".png", ""); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, customBorders); } public static Sprite LoadGameSprite(string spriteName, Vector4 customBorders = default(Vector4)) { Sprite val = null; val = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).Where((Sprite s) => ((Object)s).name == spriteName).FirstOrDefault(); if ((Object)(object)val != (Object)null) { Logger.Msg("Found sprite '" + spriteName + "' using Resources.FindObjectsOfTypeAll"); return val; } Logger.Warning("Could not find sprite '" + spriteName + "'"); return null; } public static Color GetAverageColor(Sprite sprite, float brightnessAdjustment = 1.5f) { //IL_0038: 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_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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)sprite == (Object)null || (Object)(object)sprite.texture == (Object)null) { return Color.white; } Texture2D val = MakeReadableCopy(sprite.texture); Rect rect = sprite.rect; int num = Mathf.FloorToInt(((Rect)(ref rect)).x); rect = sprite.rect; int num2 = Mathf.FloorToInt(((Rect)(ref rect)).y); rect = sprite.rect; int num3 = Mathf.FloorToInt(((Rect)(ref rect)).width); rect = sprite.rect; int num4 = Mathf.FloorToInt(((Rect)(ref rect)).height); Color[] array = Il2CppArrayBase<Color>.op_Implicit((Il2CppArrayBase<Color>)(object)val.GetPixels(num, num2, num3, num4)); float num5 = 0f; float num6 = 0f; float num7 = 0f; int num8 = 0; Color[] array2 = array; foreach (Color val2 in array2) { if (!(val2.a < 0.01f)) { num5 += val2.r; num6 += val2.g; num7 += val2.b; num8++; } } if (num8 == 0) { Logger.Error("No non-transparent pixels found in sprite"); Object.Destroy((Object)(object)val); return Color.white; } Color color = default(Color); ((Color)(ref color))..ctor(num5 / (float)num8, num6 / (float)num8, num7 / (float)num8); Color result = AdjustBrightness(color, brightnessAdjustment); Object.Destroy((Object)(object)val); return result; } private static Color AdjustBrightness(Color color, float factor) { //IL_0001: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(color, ref num, ref num2, ref num3); num3 = Mathf.Clamp01(num3 * factor); return Color.HSVToRGB(num, num2, num3); } private static Texture2D MakeReadableCopy(Texture2D source) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) RenderTexture temporary = RenderTexture.GetTemporary(((Texture)source).width, ((Texture)source).height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)1); Graphics.Blit((Texture)(object)source, temporary); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; Texture2D val = new Texture2D(((Texture)source).width, ((Texture)source).height); val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); return val; } public static void ExportSprite(Sprite sprite, string fileName) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "ExportedSprites", fileName + ".png"); try { if ((Object)(object)sprite == (Object)null) { Logger.Error("Cannot export null sprite"); return; } Texture2D texture = sprite.texture; if ((Object)(object)texture == (Object)null) { Logger.Error("Sprite has no texture"); return; } Texture2D val = new Texture2D(((Texture)texture).width, ((Texture)texture).height); RenderTexture temporary = RenderTexture.GetTemporary(((Texture)texture).width, ((Texture)texture).height); Graphics.Blit((Texture)(object)texture, temporary); RenderTexture.active = temporary; val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0); val.Apply(); RenderTexture.active = null; RenderTexture.ReleaseTemporary(temporary); byte[] bytes = Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)ImageConversion.EncodeToPNG(val)); File.WriteAllBytes(text, bytes); Logger.Msg("Successfully exported sprite to " + text); } catch (Exception ex) { Logger.Error("Failed to export sprite: " + ex.Message); } } } } namespace SimpleLabels.UI { public enum ColorPickerType { Label, Font } public static class ColorPickerManager { public static Dictionary<TMP_InputField, GameObject> LabelColorPickers = new Dictionary<TMP_InputField, GameObject>(); public static Dictionary<TMP_InputField, GameObject> FontColorPickers = new Dictionary<TMP_InputField, GameObject>(); public static void CreateColorPicker(TMP_InputField inputField, ColorPickerType type) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) try { string text = ((type == ColorPickerType.Label) ? "LabelColorPicker" : "FontColorPicker"); Dictionary<TMP_InputField, GameObject> dictionary = ((type == ColorPickerType.Label) ? LabelColorPickers : FontColorPickers); Dictionary<string, MelonPreferences_Entry<string>> dictionary2 = ((type == ColorPickerType.Label) ? ModSettings.LabelColorOptionsDictionary : ModSettings.FontColorOptionsDictionary); GameObject val = new GameObject(text); val.transform.SetParent(((Component)inputField).transform, false); val.layer = 5; RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 0.5f); val2.anchorMax = new Vector2(0.5f, 0.5f); val2.pivot = new Vector2(0.5f, 0.5f); val2.anchoredPosition = new Vector2((float)((type == ColorPickerType.Font) ? 245 : (-110)), -80f); val2.sizeDelta = new Vector2(300f, 40f); float num = 30f; float num2 = 3f; int count = dictionary2.Values.Count; float num3 = (0f - ((float)count * num + (float)(count - 1) * num2)) / 2f; Color val6 = default(Color); for (int i = 0; i < count; i++) { GameObject val3 = new GameObject($"ColorButton_{i}"); val3.transform.SetParent(val.transform, false); val3.layer = 5; RectTransform val4 = val3.AddComponent<RectTransform>(); val4.sizeDelta = new Vector2(num, num); val4.anchoredPosition = new Vector2(num3 + (float)i * (num + num2), 0f); Image val5 = val3.AddComponent<Image>(); val5.type = (Type)1; val5.sprite = SpriteManager.LoadEmbeddedSprite("UISmallSprite.png", new Vector4(5f, 5f, 5f, 5f)); ((Graphic)val5).color = (ColorUtility.TryParseHtmlString(dictionary2.Values.ElementAt(i).Value, ref val6) ? val6 : Color.white); Button buttonComponent = val3.AddComponent<Button>(); ((UnityEvent)buttonComponent.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { OnColorSelected(inputField, buttonComponent, type); })); } dictionary.Add(inputField, val); val.SetActive(true); } catch (Exception ex) { Logger.Error($"Failed to create {type} color picker: {ex.Message}"); } } private static void OnColorSelected(TMP_InputField inputField, Button colorButton, ColorPickerType type) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) Image component = ((Component)colorButton).GetComponent<Image>(); if (!((Object)(object)component == (Object)null)) { Color color = ((Graphic)component).color; string text = "#" + ColorUtility.ToHtmlStringRGB(color); if (type == ColorPickerType.Label) { ((Graphic)((Component)inputField).GetComponent<Image>()).color = color; LabelTracker.UpdateLabel(LabelTracker.GetCurrentlyManagedEntityGuid(), null, text); return; } ((Graphic)((Component)inputField).GetComponentInChildren<TextMeshProUGUI>()).color = color; string currentlyManagedEntityGuid = LabelTracker.GetCurrentlyManagedEntityGuid(); string newFontColor = text; LabelTracker.UpdateLabel(currentlyManagedEntityGuid, null, null, null, null, newFontColor); } } public static void UpdateAllColorPickers(ColorPickerType type) { Dictionary<TMP_InputField, GameObject> dictionary = ((type == ColorPickerType.Label) ? LabelColorPickers : FontColorPickers); foreach (KeyValuePair<TMP_InputField, GameObject> item in dictionary) { UpdateColorPickerButtons(item.Value, type); } } private static void UpdateColorPickerButtons(GameObject colorPicker, ColorPickerType type) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, MelonPreferences_Entry<string>> dictionary = ((type == ColorPickerType.Label) ? ModSettings.LabelColorOptionsDictionary : ModSettings.FontColorOptionsDictionary); Color val = default(Color); for (int i = 0; i < colorPicker.transform.childCount; i++) { Transform child = colorPicker.transform.GetChild(i); Image component = ((Component)child).GetComponent<Image>(); if (!((Object)(object)component == (Object)null)) { ((Graphic)component).color = (ColorUtility.TryParseHtmlString(dictionary.Values.ElementAt(i).Value, ref val) ? val : Color.red); } } } public static void SetLabelColorPickerButtonColor(int buttonIndex, Color color) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) try { foreach (KeyValuePair<TMP_InputField, GameObject> labelColorPicker in LabelColorPickers) { GameObject value = labelColorPicker.Value; if (!((Object)(object)value == (Object)null) && value.transform.childCount > buttonIndex && buttonIndex >= 0) { Transform child = value.transform.GetChild(buttonIndex); Image component = ((Component)child).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; } } } } catch (Exception ex) { Logger.Error($"Failed to update label color picker button at index {buttonIndex}: {ex.Message}"); } } public static void Terminate() { TerminatePickers(LabelColorPickers); TerminatePickers(FontColorPickers); } private static void TerminatePickers(Dictionary<TMP_InputField, GameObject> pickers) { foreach (GameObject value in pickers.Values) { if (!((Object)(object)value == (Object)null)) { Object.Destroy((Object)(object)value); } } pickers.Clear(); } } public class GUIManager { private static bool _isOn; public static Image toggleButtonBackGround; public static GameObject InitializeGUI(GameObject parent, Vector2 anchorPosition, string namePrefix) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Expected O, but got Unknown //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Expected O, but got Unknown //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Expected O, but got Unknown //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) namePrefix = namePrefix.Substring(namePrefix.LastIndexOf('/') + 1); GameObject val = new GameObject(namePrefix + "_Container"); val.layer = 5; val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = anchorPosition; val2.anchorMax = anchorPosition; val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = new Vector2(700f, 200f); Image val3 = val.AddComponent<Image>(); val3.type = (Type)1; val3.sprite = SpriteManager.LoadEmbeddedSprite("UIBigSprite.png", new Vector4(20f, 20f, 20f, 20f)); ((Graphic)val3).color = new Color(20f / 51f, 20f / 51f, 20f / 51f, 20f / 51f); GameObject val4 = new GameObject("EntityNameText"); val4.layer = 5; val4.transform.SetParent(val.transform, false); TextMeshProUGUI val5 = val4.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val5).text = "Entity Name"; ((Graphic)val5).color = Color.white; ((TMP_Text)val5).fontSize = 22f; ((TMP_Text)val5).fontStyle = (FontStyles)17; ((TMP_Text)val5).alignment = (TextAlignmentOptions)514; ((TMP_Text)val5).enableWordWrapping = false; ((TMP_Text)val5).overflowMode = (TextOverflowModes)0; ((TMP_Text)val5).margin = new Vector4(15f, 10f, 0f, 0f); InputFieldManager.EntityInicatorNames.Add(namePrefix, val5); RectTransform component = val4.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = new Vector2(0f, 75f); component.sizeDelta = new Vector2(700f, 50f); GameObject val6 = new GameObject("IndicatorNameText"); val6.layer = 5; val6.transform.SetParent(val.transform, false); TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val7).text = "Name:"; ((Graphic)val7).color = Color.white; ((TMP_Text)val7).fontSize = 16f; ((TMP_Text)val7).fontStyle = (FontStyles)17; ((TMP_Text)val7).alignment = (TextAlignmentOptions)513; ((TMP_Text)val7).enableWordWrapping = false; ((TMP_Text)val7).overflowMode = (TextOverflowModes)0; RectTransform component2 = val6.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.pivot = new Vector2(0.5f, 0.5f); component2.anchoredPosition = new Vector2(-275f, 45f); component2.sizeDelta = new Vector2(100f, 25f); GameObject val8 = new GameObject("IndicatorSizeText"); val8.layer = 5; val8.transform.SetParent(val.transform, false); TextMeshProUGUI val9 = val8.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val9).text = "Size:"; ((Graphic)val9).color = Color.white; ((TMP_Text)val9).fontSize = 16f; ((TMP_Text)val9).fontStyle = (FontStyles)17; ((TMP_Text)val9).alignment = (TextAlignmentOptions)513; ((TMP_Text)val9).enableWordWrapping = false; ((TMP_Text)val9).overflowMode = (TextOverflowModes)0; RectTransform component3 = val8.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0.5f, 0.5f); component3.anchorMax = new Vector2(0.5f, 0.5f); component3.pivot = new Vector2(0.5f, 0.5f); component3.anchoredPosition = new Vector2(288f, 45f); component3.sizeDelta = new Vector2(100f, 25f); GameObject val10 = new GameObject("IndicatorFontColorText"); val10.layer = 5; val10.transform.SetParent(val.transform, false); TextMeshProUGUI val11 = val10.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val11).text = "Label Color:"; ((Graphic)val11).color = Color.white; ((TMP_Text)val11).fontSize = 16f; ((TMP_Text)val11).fontStyle = (FontStyles)17; ((TMP_Text)val11).alignment = (TextAlignmentOptions)513; ((TMP_Text)val11).enableWordWrapping = false; ((TMP_Text)val11).overflowMode = (TextOverflowModes)0; RectTransform component4 = val10.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0.5f, 0.5f); component4.anchorMax = new Vector2(0.5f, 0.5f); component4.pivot = new Vector2(0.5f, 0.5f); component4.anchoredPosition = new Vector2(-275f, -35f); component4.sizeDelta = new Vector2(100f, 25f); GameObject val12 = new GameObject("IndicatorLabelColorText"); val12.layer = 5; val12.transform.SetParent(val.transform, false); TextMeshProUGUI val13 = val12.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val13).text = "Font Color:"; ((Graphic)val13).color = Color.white; ((TMP_Text)val13).fontSize = 16f; ((TMP_Text)val13).fontStyle = (FontStyles)17; ((TMP_Text)val13).alignment = (TextAlignmentOptions)513; ((TMP_Text)val13).enableWordWrapping = false; ((TMP_Text)val13).overflowMode = (TextOverflowModes)0; RectTransform component5 = val12.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0.5f, 0.5f); component5.anchorMax = new Vector2(0.5f, 0.5f); component5.pivot = new Vector2(0.5f, 0.5f); component5.anchoredPosition = new Vector2(80f, -35f); component5.sizeDelta = new Vector2(100f, 25f); return val; } public static Button createOnOffButton(GameObject parent, string namePrefix) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) namePrefix = namePrefix.Substring(namePrefix.LastIndexOf('/') + 1); GameObject val = new GameObject(namePrefix + "_ToggleButton"); val.layer = 5; val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0f, 0f); val2.anchorMax = new Vector2(0f, 0f); val2.pivot = new Vector2(0f, 0f); val2.anchoredPosition = new Vector2(10f, 10f); val2.sizeDelta = new Vector2(50f, 46.2f); toggleButtonBackGround = val.AddComponent<Image>(); ((Graphic)toggleButtonBackGround).color = new Color(1f, 1f, 1f, 0.9f); toggleButtonBackGround.sprite = SpriteManager.LoadEmbeddedSprite("On.png", Vector4.zero); _isOn = true; Button val3 = val.AddComponent<Button>(); ((Selectable)val3).image = toggleButtonBackGround; string keepNamePrefix = namePrefix; ((UnityEvent)val3.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { _isOn = !_isOn; if (_isOn) { InputFieldManager.ActivateInputField(keepNamePrefix); ModSettings.ShowInput.Value = true; } else { InputFieldManager.DeactivateInputField(keepNamePrefix); ModSettings.ShowInput.Value = false; } })); return val3; } } public class InputFieldManager { public static Dictionary<string, TMP_InputField> InputFields = new Dictionary<string, TMP_InputField>(); public static Dictionary<string, TMP_InputField> NumericInputFields = new Dictionary<string, TMP_InputField>(); public static Dictionary<string, GameObject> ContainersGameObjects = new Dictionary<string, GameObject>(); public static Dictionary<string, Button> ToggleOnOffButtons = new Dictionary<string, Button>(); public static Dictionary<string, TextMeshProUGUI> EntityInicatorNames = new Dictionary<string, TextMeshProUGUI>(); public static Dictionary<string, Vector2> SupportedUITypes = new Dictionary<string, Vector2> { { "UI/StorageMenu", new Vector2(0.5f, 0.75f) }, { "UI/Stations/PackagingStation", new Vector2(0.5f, 0.75f) }, { "UI/Stations/ChemistryStation", new Vector2(0.5f, 0.75f) }, { "UI/Stations/LabOven", new Vector2(0.5f, 0.75f) }, { "UI/Stations/BrickPress", new Vector2(0.5f, 0.75f) }, { "UI/Stations/Cauldron", new Vector2(0.5f, 0.75f) }, { "UI/Stations/MixingStation", new Vector2(0.5f, 0.75f) }, { "UI/Stations/DryingRack", new Vector2(0.5f, 0.75f) } }; public static TMP_InputField _currentInputField; public static TMP_InputField _currentNumericInputField; public static void Initialize() { CreateInputFields(); } public static void Terminate() { foreach (TMP_InputField value in InputFields.Values) { if (!((Object)(object)value == (Object)null)) { Object.Destroy((Object)(object)((Component)value).gameObject); } } InputFields.Clear(); foreach (TMP_InputField value2 in NumericInputFields.Values) { if (!((Object)(object)value2 == (Object)null)) { Object.Destroy((Object)(object)((Component)value2).gameObject); } } NumericInputFields.Clear(); foreach (GameObject value3 in ContainersGameObjects.Values) { if (!((Object)(object)value3 == (Object)null)) { Object.Destroy((Object)(object)value3); } } ContainersGameObjects.Clear(); foreach (Button value4 in ToggleOnOffButtons.Values) { if (!((Object)(object)value4 == (Object)null)) { Object.Destroy((Object)(object)((Component)value4).gameObject); } } ToggleOnOffButtons.Clear(); foreach (TextMeshProUGUI value5 in EntityInicatorNames.Values) { if (!((Object)(object)value5 == (Object)null)) { Object.Destroy((Object)(object)((Component)value5).gameObject); } } EntityInicatorNames.Clear(); ColorPickerManager.Terminate(); _currentInputField = null; _currentNumericInputField = null; Logger.Msg("InputFieldManager terminated."); } public static void ActivateInputField(string gameObjectName) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) ContainersGameObjects.First((KeyValuePair<string, GameObject> x) => x.Key.Contains(gameObjectName)).Value.gameObject.SetActive(true); ((Component)ToggleOnOffButtons.First((KeyValuePair<string, Button> x) => x.Key.Contains(gameObjectName)).Value).GetComponent<Image>().sprite = SpriteManager.LoadEmbeddedSprite("On.png", Vector4.zero); ((Component)ToggleOnOffButtons.First((KeyValuePair<string, Button> x) => x.Key.Contains(gameObjectName)).Value).gameObject.SetActive(true); } public static void DeactivateInputField(string gameObjectName) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) ContainersGameObjects.First((KeyValuePair<string, GameObject> x) => x.Key.Contains(gameObjectName)).Value.gameObject.SetActive(false); ((Component)ToggleOnOffButtons.First((KeyValuePair<string, Button> x) => x.Key.Contains(gameObjectName)).Value).GetComponent<Image>().sprite = SpriteManager.LoadEmbeddedSprite("Off.png", Vector4.zero); ((Component)ToggleOnOffButtons.First((KeyValuePair<string, Button> x) => x.Key.Contains(gameObjectName)).Value).gameObject.SetActive(true); } public static void DisableToggleOnOffButton(string gameObjectName) { ((Component)ToggleOnOffButtons.First((KeyValuePair<string, Button> x) => x.Key.Contains(gameObjectName)).Value).gameObject.SetActive(false); } public static TMP_InputField GetInputField(string gameObjectName) { return InputFields.First((KeyValuePair<string, TMP_InputField> x) => x.Key.Contains(gameObjectName)).Value; } public static TMP_InputField GetNumericInputField(string gameObjectName) { return NumericInputFields.First((KeyValuePair<string, TMP_InputField> x) => x.Key.Contains(gameObjectName)).Value; } public static TextMeshProUGUI GetEntityNameIndicator(string gameObjectName) { return EntityInicatorNames.First((KeyValuePair<string, TextMeshProUGUI> x) => x.Key.Contains(gameObjectName)).Value; } private static void CreateInputFields() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<string, Vector2> supportedUIType in SupportedUITypes) { GameObject val = GameObject.Find(supportedUIType.Key); if ((Object)(object)val == (Object)null) { Logger.Error($"Couldn't find {supportedUIType} GameObject."); continue; } GameObject val2 = GUIManager.InitializeGUI(val, supportedUIType.Value, supportedUIType.Key); ContainersGameObjects.Add(supportedUIType.Key, val2); Button value = GUIManager.createOnOffButton(val, supportedUIType.Key); ToggleOnOffButtons.Add(supportedUIType.Key, value); TMP_InputField value2 = CreateInputField(val2, supportedUIType.Key); InputFields.Add(supportedUIType.Key, value2); TMP_InputField value3 = CreateNumericInputField(val2, supportedUIType.Key); NumericInputFields.Add(supportedUIType.Key, value3); ColorPickerManager.CreateColorPicker(InputFields[supportedUIType.Key], ColorPickerType.Label); ColorPickerManager.CreateColorPicker(InputFields[supportedUIType.Key], ColorPickerType.Font); Logger.Msg("Created input fields for " + supportedUIType.Key); } } private static TMP_InputField CreateInputField(GameObject parent, string namePrefix) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_0108: Unknown result type (might be due to invalid IL or missing references) try { namePrefix = namePrefix.Substring(namePrefix.LastIndexOf('/') + 1); GameObject val = new GameObject(namePrefix + "_InputField"); val.layer = 5; val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 0.5f); val2.anchorMax = new Vector2(0.5f, 0.5f); val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = new Vector2(550f, 40f); val2.anchoredPosition = new Vector2(-55f, 10f); Image val3 = val.AddComponent<Image>(); val3.type = (Type)1; val3.sprite = SpriteManager.LoadEmbeddedSprite("UISmallSprite.png", new Vector4(5f, 5f, 5f, 5f)); Color val4 = default(Color); ((Graphic)val3).color = (ColorUtility.TryParseHtmlString(ModSettings.LabelDefaultColor.Value, ref val4) ? val4 : Color.red); GameObject val5 = createTextArea(val.transform); GameObject val6 = createPlaceholder(val5.transform); TMP_InputField inputField = val.AddComponent<TMP_InputField>(); inputField.textViewport = val5.GetComponent<RectTransform>(); inputField.textComponent = (TMP_Text)(object)val5.GetComponent<TextMeshProUGUI>(); inputField.placeholder = (Graphic)(object)val6.GetComponent<TextMeshProUGUI>(); inputField.characterLimit = 30; ((UnityEvent<string>)(object)inputField.onValueChanged).AddListener(UnityAction<string>.op_Implicit((Action<string>)delegate(string text) { if (DevUtils.IsStorageOrStationOpen()) { OnInputTextChange(text, inputField); } })); val.SetActive(true); return inputField; } catch (Exception ex) { Logger.Error("Failed to create input field: " + ex.Message); return null; } } private static TMP_InputField CreateNumericInputField(GameObject parent, string namePrefix) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) try { namePrefix = namePrefix.Substring(namePrefix.LastIndexOf('/') + 1); GameObject val = new GameObject(namePrefix + "_NumericInputField"); val.layer = 5; val.transform.SetParent(parent.transform, false); RectTransform component = parent.GetComponent<RectTransform>(); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 0.5f); val2.anchorMax = new Vector2(0.5f, 0.5f); val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = new Vector2(90f, 40f); val2.anchoredPosition = new Vector2(280f, 10f); Image val3 = val.AddComponent<Image>(); val3.type = (Type)1; val3.sprite = SpriteManager.LoadEmbeddedSprite("UISmallSprite.png", new Vector4(5f, 5f, 5f, 5f)); ((Graphic)val3).color = Color.white; Outline val4 = val.AddComponent<Outline>(); ((Shadow)val4).effectColor = new Color(0f, 0f, 0f, 0.15f); ((Shadow)val4).effectDistance = new Vector2(1f, 1f); GameObject val5 = createTextArea(val.transform); GameObject val6 = createNumericPlaceholder(val.transform); TMP_InputField inputField = val.AddComponent<TMP_InputField>(); inputField.textViewport = val5.GetComponent<RectTransform>(); inputField.textComponent = (TMP_Text)(object)val5.GetComponent<TextMeshProUGUI>(); inputField.placeholder = (Graphic)(object)val6.GetComponent<TextMeshProUGUI>(); inputField.characterLimit = 2; inputField.contentType = (ContentType)2; inputField.contentType = (ContentType)2; inputField.characterLimit = 2; ((UnityEvent<string>)(object)inputField.onValueChanged).AddListener(UnityAction<string>.op_Implicit((Action<string>)delegate(string text) { ValidateNumericRange(text, inputField); })); ((UnityEvent<string>)(object)inputField.onSubmit).AddListener(UnityAction<string>.op_Implicit((Action<string>)delegate(string text) { ValidateNumericRange(text, inputField); OnNumericInputTextChange(text, inputField); })); val.SetActive(true); return inputField; } catch (Exception ex) { Logger.Error("Failed to create numeric input field: " + ex.Message); return null; } } private static void OnInputTextChange(string text, TMP_InputField inputField) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (!DevUtils.IsStorageOrStationOpen()) { inputField.DeactivateInputField(false); _currentInputField = null; } string currentlyManagedEntityGuid = LabelTracker.GetCurrentlyManagedEntityGuid(); LabelTracker.UpdateLabel(currentlyManagedEntityGuid, text); string firstTextInCurlyBrackets = GetFirstTextInCurlyBrackets(text); if (!string.IsNullOrEmpty(firstTextInCurlyBrackets) && Registry.ItemExists(firstTextInCurlyBrackets)) { ItemDefinition item = Registry.GetItem(firstTextInCurlyBrackets); Sprite icon = item.Icon; Color averageColor = SpriteManager.GetAverageColor(item.Icon); string newLabelColor = "#" + ColorUtility.ToHtmlStringRGB(averageColor); LabelTracker.UpdateLabel(currentlyManagedEntityGuid, null, newLabelColor); string text2 = RemoveCurlyBracketsContent(text); if (string.IsNullOrEmpty(text2)) { text2 = item.Name; } inputField.text = text2; LabelTracker.UpdateLabel(currentlyManagedEntityGuid, text2); ((Graphic)((Component)inputField).GetComponent<Image>()).color = averageColor; } } private static void ValidateNumericRange(string text, TMP_InputField inputField) { if (string.IsNullOrEmpty(text)) { return; } if (int.TryParse(text, out var result)) { int num = Mathf.Clamp(result, 1, 30); if (result != num) { inputField.text = num.ToString(); } } else { inputField.text = "1"; } } private static void OnNumericInputTextChange(string text, TMP_InputField inputField) { inputField.DeactivateInputField(false); _currentNumericInputField = null; if (!string.IsNullOrEmpty(text) && int.TryParse(text, out var result)) { Logger.Msg($"Numeric value on guid: {LabelTracker.GetCurrentlyManagedEntityGuid()} changed to: {result}"); LabelTracker.UpdateLabel(LabelTracker.GetCurrentlyManagedEntityGuid(), null, null, result); } } private static GameObject createTextArea(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("TextArea"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.pivot = new Vector2(0.5f, 0.5f); val2.offsetMin = new Vector2(10f, 0f); val2.offsetMax = new Vector2(-10f, 0f); TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val3).fontSize = ModSettings.DEFAULT_FONT_SIZE; Color val4 = default(Color); ((Graphic)val3).color = (ColorUtility.TryParseHtmlString(ModSettings.FontDefaultColor.Value, ref val4) ? val4 : Color.red); ((TMP_Text)val3).alignment = (TextAlignmentOptions)513; ((TMP_Text)val3).enableWordWrapping = false; ((TMP_Text)val3).fontStyle = (FontStyles)1; return val; } private static GameObject createPlaceholder(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002c: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Placeholder"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 0.5f); val2.anchorMax = new Vector2(0.5f, 0.5f); val2.pivot = new Vector2(0.5f, 0.5f); val2.offsetMax = new Vector2(0f, 0f); val2.offsetMin = new Vector2(-265f, 0f); TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val3).text = "Press Enter to confirm changes..."; ((TMP_Text)val3).fontSize = ModSettings.DEFAULT_FONT_SIZE; ((Graphic)val3).color = new Color(0.5f, 0.5f, 0.5f); ((TMP_Text)val3).alignment = (TextAlignmentOptions)513; ((TMP_Text)val3).enableWordWrapping = false; return val; } private static GameObject createNumericPlaceholder(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002c: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("NumericPlaceholder"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 0.5f); val2.anchorMax = new Vector2(0.5f, 0.5f); val2.pivot = new Vector2(0.5f, 0.5f); val2.offsetMax = new Vector2(75f, 25f); val2.offsetMin = new Vector2(-100f, -25f); TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val3).text = "Size"; ((TMP_Text)val3).fontSize = ModSettings.DEFAULT_FONT_SIZE; ((Graphic)val3).color = new Color(0.5f, 0.5f, 0.5f); ((TMP_Text)val3).alignment = (TextAlignmentOptions)514; ((TMP_Text)val3).enableWordWrapping = true; return val; } public static string GetFirstTextInCurlyBrackets(string text) { Match match = Regex.Match(text, "\\{([^}]*)\\}"); if (match.Success) { return match.Groups[1].Value; } return null; } private static string RemoveCurlyBracketsContent(string input) { if (string.IsNullOrEmpty(input)) { return input; } return Regex.Replace(input, "{[^{}]*}", "").Trim(); } } public class LabelApplier { private static readonly Dictionary<string, List<GameObject>> _entityLabels = new Dictionary<string, List<GameObject>>(); public static void ApplyOrUpdateLabel(string guid) { if (string.IsNullOrEmpty(guid)) { return; } LabelTracker.EntityData entityData = LabelTracker.GetEntityData(guid); if ((Object)(object)entityData?.GameObject == (Object)null) { return; } string key = CleanEntityName(((Object)entityData.GameObject).name); if (!LabelPlacementConfigs.LabelPlacementConfigsDictionary.TryGetValue(key, out var value)) { return; } if (string.IsNullOrEmpty(entityData.LabelText)) { RemoveLabels(guid); return; } EnsureLabelCount(guid, value.Count); for (int i = 0; i < value.Count; i++) { ConfigureLabel(_entityLabels[guid][i], entityData, value[i]); } } private static void ConfigureLabel(GameObject labelInstance, LabelTracker.EntityData entityData, LabelPlacement placement) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)labelInstance == (Object)null) { Logger.Warning("Received null label instance, creating new one"); labelInstance = LabelPrefabManager.GetLabelInstance(); } labelInstance.transform.SetParent(entityData.GameObject.transform, false); labelInstance.transform.localPosition = placement.LocalPosition; labelInstance.transform.localRotation = placement.Rotation; float num = 0.1f; float num2 = 1f + (float)(entityData.LabelSize - 1) / 9f; float num3 = num * num2; labelInstance.transform.localScale = new Vector3(num3, num3, num); Transform val = labelInstance.transform.Find("LabelObject/PaperBackground"); Renderer val2 = default(Renderer); if ((Object)(object)val != (Object)null && ((Component)val).TryGetComponent<Renderer>(ref val2)) { Color val3 = default(Color); val2.material.color = (ColorUtility.TryParseHtmlString(entityData.LabelColor, ref val3) ? val3 : Color.red); } Transform obj = labelInstance.transform.Find("LabelObject/LabelText"); TextMeshPro val4 = ((obj != null) ? ((Component)obj).GetComponent<TextMeshPro>() : null); if ((Object)(object)val4 != (Object)null) { ((TMP_Text)val4).text = entityData.LabelText; Color val5 = default(Color); ((Graphic)val4).color = (ColorUtility.TryParseHtmlString(entityData.FontColor, ref val5) ? val5 : Color.red); } } private static void EnsureLabelCount(string guid, int requiredCount) { if (!_entityLabels.TryGetValue(guid, out var value)) { value = new List<GameObject>(); _entityLabels.Add(guid, value); } while (value.Count < requiredCount) { value.Add(LabelPrefabManager.GetLabelInstance()); } while (value.Count > requiredCount) { LabelPrefabManager.ReturnToPool(value[value.Count - 1]); value.RemoveAt(value.Count - 1); } } private static string CleanEntityName(string originalName) { return originalName.Replace("(Clone)", "").Replace("_Built", "").Trim(); } public static void RemoveLabels(string guid) { if (!_entityLabels.TryGetValue(guid, out var value)) { return; } foreach (GameObject item in value) { if (!((Object)(object)item == (Object)null)) { LabelPrefabManager.ReturnToPool(item); } } _entityLabels.Remove(guid); } public static void Terminate() { foreach (List<GameObject> value in _entityLabels.Values) { foreach (GameObject item in value) { if (!((Object)(object)item == (Object)null)) { LabelPrefabManager.ReturnToPool(item); } } } _entityLabels.Clear(); } } public class LabelInputDataLoader { public static void LoadLabelData(string entityGuid, GameObject entityGameObject, GameObject inputGameObject, string entityName = "") { //IL_00fd: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) string gameObjectName = ((Object)inputGameObject).name.Replace("(Clone)", "").Replace("_Built", "").Replace("Mk2", "") .Replace("_", "") .Trim(); InputFieldManager.DeactivateInputField(gameObjectName); if (!ModSettings.ShowInput.Value) { return; } InputFieldManager.ActivateInputField(gameObjectName); try { if (!string.IsNullOrEmpty(entityGuid)) { LabelTracker.SetCurrentlyManagedEntity(entityGuid); TMP_InputField inputField = InputFieldManager.GetInputField(gameObjectName); TMP_InputField numericInputField = InputFieldManager.GetNumericInputField(gameObjectName); TextMeshProUGUI entityNameIndicator = InputFieldManager.GetEntityNameIndicator(gameObjectName); LabelTracker.EntityData entityData = LabelTracker.GetEntityData(entityGuid); inputField.text = entityData?.LabelText ?? string.Empty; ((TMP_Text)entityNameIndicator).text = entityName; Color val = default(Color); ((Graphic)((Component)inputField).GetComponent<Image>()).color = (ColorUtility.TryParseHtmlString(entityData?.LabelColor ?? ModSettings.LabelDefaultColor.Value, ref val) ? val : Color.red); ((Graphic)((Component)inputField).GetComponentInChildren<TextMeshProUGUI>()).color = (ColorUtility.TryParseHtmlString(entityData?.FontColor ?? ModSettings.FontDefaultColor.Value, ref val) ? val : Color.red); numericInputField.text = entityData?.LabelSize.ToString() ?? ModSettings.LabelDefaultSize.Value.ToString(); if (ModSettings.AutoFocusInput.Value) { inputField.ActivateInputField(); InputFieldManager._currentInputField = inputField; InputFieldManager._currentNumericInputField = numericInputField; } if (LabelTracker.GetEntityData(entityGuid) == null) { LabelTracker.TrackEntity(entityGuid, entityGameObject, entityData?.LabelText ?? string.Empty, entityData?.LabelColor ?? ModSettings.LabelDefaultColor.Value, entityData?.LabelSize ?? ModSettings.LabelDefaultSize.Value, entityData?.FontSize ?? ModSettings.DEFAULT_FONT_SIZE, entityData?.FontColor ?? ModSettings.FontDefaultColor.Value); } } } catch (Exception ex) { Logger.Error("Failed to handle storage open: " + ex.Message); } } } public class LabelPrefabManager { private static readonly Queue<GameObject> _prefabPool = new Queue<GameObject>(); private static Transform _poolContainer; private static Material _labelMaterial; private static GameObject _prefabTemplate; public static void Initialize() { CreatePoolContainer(); CreatePrefabTemplate(); PrewarmPool(10); } private static void CreatePoolContainer() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _poolContainer = new GameObject("LabelPrefabPool").transform; ((Component)_poolContainer).gameObject.SetActive(false); Object.DontDestroyOnLoad((Object)(object)((Component)_poolContainer).gameObject); } private static void CreatePrefabTemplate() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_015f: 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_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) _prefabTemplate = new GameObject("LabelPrefab"); _prefabTemplate.SetActive(false); _prefabTemplate.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); GameObject val = new GameObject("LabelObject"); val.transform.SetParent(_prefabTemplate.transform); val.transform.localPosition = Vector3.zero; val.transform.localScale = Vector3.one; GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val2).name = "PaperBackground"; val2.transform.SetParent(val.transform); val2.transform.localPosition = Vector3.zero; val2.transform.localScale = new Vector3(2f, 0.6f, 0.1f); val2.GetComponent<BoxCollider>().extents = Vector3.zero; _labelMaterial = new Material(Shader.Find("Universal Render Pipeline/Simple Lit")); if ((Object)(object)_labelMaterial != (Object)null) { val2.GetComponent<Renderer>().material = _labelMaterial; } else { Logger.Error("Couldn't find material to reuse."); } GameObject val3 = new GameObject("LabelText"); val3.transform.SetParent(val.transform); val3.transform.localPosition = new Vector3(0f, 0f, -0.052f); val3.transform.localScale = new Vector3(1.1f, 1.25f, 1f); TextMeshPro val4 = val3.AddComponent<TextMeshPro>(); ((TMP_Text)val4).fontSizeMin = 1.4f; ((TMP_Text)val4).fontSizeMax = 3f; ((TMP_Text)val4).fontSize = 2f; ((TMP_Text)val4).fontStyle = (FontStyles)1; ((TMP_Text)val4).enableAutoSizing = true; ((TMP_Text)val4).alignment = (TextAlignmentOptions)514; ((Graphic)val4).color = Color.black; ((TMP_Text)val4).enableWordWrapping = true; ((TMP_Text)val4).margin = new Vector4(0.02f, 0.02f, 0.02f, 0.02f); RectTransform component = val3.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(1.8f, 0.5f); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); Logger.Msg("Label prefab initialized successfully"); } private static void TrySetOpenSansFont(TextMeshPro textMesh) { try { TMP_FontAsset[] array = Il2CppArrayBase<TMP_FontAsset>.op_Implicit(Resources.FindObjectsOfTypeAll<TMP_FontAsset>()); TMP_FontAsset[] array2 = array; foreach (TMP_FontAsset val in array2) { if (((Object)val).name.Contains("OpenSans-Bold")) { ((TMP_Text)textMesh).font = val; if ((Object)(object)((TMP_Asset)val).material != (Object)null && ((Object)((TMP_Asset)val).material).name.Contains("OpenSans-Bold")) { ((TMP_Text)textMesh).fontSharedMaterial = ((TMP_Asset)val).material; } Logger.Msg("Successfully set font from found font asset: " + ((Object)val).name); return; } } Logger.Warning("Could not find OpenSans-Bold font in scene"); } catch (Exception ex) { Logger.Error("Error setting font: " + ex.Message); } } private static void PrewarmPool(int count) { int num = count / 4; int num2 = num * 4 + (count - num); for (int i = 0; i < num2; i++) { ReturnToPool(CreateNewLabelInstance()); } Logger.Msg($"Prewarmed pool with {num2} label instances"); } private static GameObject CreateNewLabelInstance() { GameObject val = Object.Instantiate<GameObject>(_prefabTemplate); ((Object)val).name = "LabelInstance"; return val; } public static GameObject GetLabelInstance() { if (_prefabPool.Count > 0) { GameObject val = _prefabPool.Dequeue(); if ((Object)(object)val == (Object)null) { val = CreateNewLabelInstance(); } val.SetActive(true); return val; } GameObject result = CreateNewLabelInstance(); for (int i = 0; i < 25; i++) { ReturnToPool(CreateNewLabelInstance()); } return result; } public static void ReturnToPool(GameObject labelInstance) { labelInstance.SetActive(false); labelInstance.transform.SetParent(_poolContainer); _prefabPool.Enqueue(labelInstance); } public static void Terminate() { while (_prefabPool.Count > 0) { GameObject val = _prefabPool.Dequeue(); if (!((Object)(object)val == (Object)null)) { Object.Destroy((Object)(object)val); } } if ((Object)(object)_prefabTemplate != (Object)null) { Object.Destroy((Object)(object)_prefabTemplate); } if ((Object)(object)_poolContainer != (Object)null) { Object.Destroy((Object)(object)((Component)_poolContainer).gameObject); } if ((Object)(object)_labelMaterial != (Object)null) { Object.Destroy((Object)(object)_labelMaterial); } } } } namespace SimpleLabels.Settings { public class ColorPickerSettings : MelonMod { public static string[] colorNames = new string[9] { "Color 1", "Color 2", "Color 3", "Color 4", "Color 5", "Color 6", "Color 7", "Color 8", "Color 9" }; public static void Initialize() { ModSettings.LabelColorOptionsDictionary = new Dictionary<string, MelonPreferences_Entry<string>>(); ModSettings.FontColorOptionsDictionary = new Dictionary<string, MelonPreferences_Entry<string>>(); CreateDefaultColorOptions(); } private static void CreateDefaultColorOptions() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) Color[] array = (Color[])(object)new Color[9] { new Color(0.3f, 0.45f, 0.65f), new Color(0.4f, 0.6f, 0.35f), new Color(0.7f, 0.55f, 0.3f), new Color(0.65f, 0.4f, 0.4f), new Color(0.4f, 0.35f, 0.6f), new Color(0.55f, 0.6f, 0.6f), new Color(0.3f, 0.65f, 0.55f), new Color(0.8f, 0.7f, 0.5f), Color.white }; Color[] array2 = (Color[])(object)new Color[9] { new Color(0.85f, 0.85f, 0.3f), new Color(0.3f, 0.7f, 0.3f), new Color(0.8f, 0.4f, 0.2f), new Color(0.6f, 0.3f, 0.6f), new Color(0.3f, 0.5f, 0.7f), new Color(0.75f, 0.75f, 0.75f), new Color(0.2f, 0.25f, 0.4f), new Color(0.5f, 0.3f, 0.2f), Color.black }; for (int i = 0; i < colorNames.Length; i++) { MelonPreferences_Entry<string> val = ModSettings.LabelColorPickerCategory.CreateEntry<string>(colorNames[i], "#" + ColorUtility.ToHtmlStringRGB(array[i]), (string)null, (string)null, false, false, (ValueValidator)null, (string)null); int colorIndex2 = i; ((MelonEventBase<LemonAction<string, string>>)(object)val.OnEntryValueChanged).Subscribe((LemonAction<string, string>)delegate(string oldVal, string newVal) { OnColorChanged(colorIndex2, "Label", oldVal, newVal); }, 0, false); ModSettings.LabelColorOptionsDictionary.Add(colorNames[i], val); MelonPreferences_Entry<string> val2 = ModSettings.FontColorPickerCategory.CreateEntry<string>(colorNames[i], "#" + ColorUtility.ToHtmlStringRGB(array2[i]), (string)null, (string)null, false, false, (ValueValidator)null, (string)null); int fontColorIndex = i; ((MelonEventBase<LemonAction<string, string>>)(object)val2.OnEntryValueChanged).Subscribe((LemonAction<string, string>)delegate(string oldVal, string newVal) { OnColorChanged(fontColorIndex, "Font", oldVal, newVal); }, 0, false); ModSettings.FontColorOptionsDictionary.Add(colorNames[i], val2); } static void OnColorChanged(int colorIndex, string pickerType, string oldVal, string newVal) { if (!Regex.IsMatch(newVal, "^#[0-9A-Fa-f]{6}$")) { if (pickerType == "Label") { ModSettings.LabelColorOptionsDictionary[colorNames[colorIndex]].Value = oldVal; } else if (pickerType == "Font") { ModSettings.FontColorOptionsDictionary[colorNames[colorIndex]].Value = oldVal; } Logger.Warning("Invalid color format for " + pickerType + " color '" + colorNames[colorIndex] + "': " + newVal + ". Reverted to " + oldVal); } else { ModManagerIntegration.RequestUIRefresh(); if (pickerType == "Label") { ColorPickerManager.UpdateAllColorPickers(ColorPickerType.Label); } else if (pickerType == "Font") { ColorPickerManager.UpdateAllColorPickers(ColorPickerType.Font); } } } } } public static class ModManagerIntegration { private static MethodInfo _requestUIRefreshMethod; public static void Initialize() { try { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetType("ModManagerPhoneApp.ModSettingsEvents") != null); if (!(assembly == null)) { _requestUIRefreshMethod = assembly.GetType("ModManagerPhoneApp.ModSettingsEvents")?.GetMethod("RequestUIRefresh"); } } catch (Exception ex) { Logger.Error("Failed to initialize Mod Manager integration: " + ex.Message); } } public static void RequestUIRefresh() { try { _requestUIRefreshMethod?.Invoke(null, null); } catch (Exception ex) { Logger.Error("Failed to request UI refresh: " + ex.Message); } } } public class ModSettings { public static readonly int DEFAULT_FONT_SIZE = 24; public static MelonPreferences_Category GeneralCategory { get; private set; } public static MelonPreferences_Category ClipboardCategory { get; private set; } public static MelonPreferences_Category LabelColorPickerCategory { get; private set; } public static MelonPreferences_Category LabelCategory { get; private set; } public static MelonPreferences_Category FontColorPickerCategory { get; private set; } public static MelonPreferences_Category FontCategory { get; private set; } public static MelonPreferences_Category DebugCategory { get; private set; } public static MelonPreferences_Entry<bool> ShowInput { get; private set; } public static MelonPreferences_Entry<bool> AutoFocusInput { get; private set; } public static MelonPreferences_Entry<bool> ShowClipboardRoutes { get; private set; } public static MelonPreferences_Entry<bool> ShowClipboardStations { get; private set; } public static MelonPreferences_Entry<bool> ShowClipboardStationsOutput { get; private set; } public static Dictionary<string, MelonPreferences_Entry<string>> LabelColorOptionsDictionary { get; set; } public static MelonPreferences_Entry<int> LabelDefaultSize { get; private set; } public static MelonPreferences_Entry<string> LabelDefaultColor { get; private set; } public static MelonPreferences_Entry<bool> AutomaticallySetLabelColorOptions { get; private set; } public static Dictionary<string, MelonPreferences_Entry<string>> FontColorOptionsDictionary { get; set; } public static MelonPreferences_Entry<string> FontDefaultColor { get; private set; } public static MelonPreferences_Entry<bool> ShowDebug { get; private set; } public static void Initialize() { CreateGeneralSettings(); CreateClipboardSettings(); CreateLabelColorPickerSettings(); CreateFontColorPickerSettings(); ColorPickerSettings.Initialize(); CreateLabelSettings(); CreateFontSettings(); CreateDebugSettings(); } private static void CreateGeneralSettings() { GeneralCategory = MelonPreferences.CreateCategory("SimpleLabels_01_General", "General"); ShowInput = GeneralCategory.CreateEntry<bool>("Show input", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase<LemonAction<bool, bool>>)(object)ShowInput.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)OnShowInputChanged, 0, false); AutoFocusInput = GeneralCategory.CreateEntry<bool>("Auto focus input", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase<LemonAction<bool, bool>>)(object)AutoFocusInput.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)OnAutoFocusInputChanged, 0, false); } private static void CreateClipboardSettings() { ClipboardCategory = MelonPreferences.CreateCategory("SimpleLabels_02_Clipboard", "Clipboard"); ShowClipboardRoutes = ClipboardCategory.CreateEntry<bool>("Show routes", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase<LemonAction<bool, bool>>)(object)ShowClipboardRoutes.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)OnShowClipboardRoutesChanged, 0, false); ShowClipboardStations = ClipboardCategory.CreateEntry<bool>("Show stations", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase<LemonAction<bool, bool>>)(object)ShowClipboardStations.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)OnShowClipboardStationsChanged, 0, false); ShowClipboardStationsOutput = ClipboardCategory.CreateEntry<bool>("Show stations output", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase<LemonAction<bool, bool>>)(object)ShowClipboardStationsOutput.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)OnShowClipboardStationsOutputChanged, 0, false); } private static void CreateLabelColorPickerSettings() { LabelColorPickerCategory = MelonPreferences.CreateCategory("SimpleLabels_03_ColorPicker", "Label Color Picker"); AutomaticallySetLabelColorOptions = LabelColorPickerCategory.CreateEntry<bool>("Auto-detect Colors from Stored Items", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase<LemonAction<bool, bool>>)(object)AutomaticallySetLabelColorOptions.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)OnAutomaticallySetLabelColorOptionsChanged, 0, false); } private static void CreateFontColorPickerSettings() { FontColorPickerCategory = MelonPreferences.CreateCategory("SimpleLabels_04_ColorPicker", "Font Color Picker"); } private static void CreateLabelSettings() { LabelCategory = MelonPreferences.CreateCategory("SimpleLabels_05_Label", "Labels"); LabelDefaultSize = LabelCategory.CreateEntry<int>("Default size (1 - 30)", 1, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase<LemonAction<int, int>>)(object)LabelDefaultSize.OnEntryValueChanged).Subscribe((LemonAction<int, int>)OnLabelDefaultSizeChanged, 0, false); LabelDefaultColor = LabelCategory.CreateEntry<string>("Default color", "#FFFFFF", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase<LemonAction<string, string>>)(object)LabelDefaultColor.OnEntryValueChanged).Subscribe((LemonAction<string, string>)OnLabelDefaultColorChanged, 0, false); } private static void CreateFontSettings() { FontCategory = MelonPreferences.CreateCategory("SimpleLabels_06_Font", "Font"); FontDefaultColor = FontCategory.CreateEntry<string>("Default color", "#000000", (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase<LemonAction<string, string>>)(object)FontDefaultColor.OnEntryValueChanged).Subscribe((LemonAction<string, string>)OnFontDefaultColorChanged, 0, false); } private static void CreateDebugSettings() { DebugCategory = MelonPreferences.CreateCategory("SimpleLabels_07_Debug", "Debug"); ShowDebug = DebugCategory.CreateEntry<bool>("Show console debug", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); ((MelonEventBase<LemonAction<bool, bool>>)(object)ShowDebug.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)OnShowDebugChanged, 0, false); } private static void OnShowInputChanged(bool oldValue, bool newValue) { ShowInput.Value = newValue; } private static void OnAutoFocusInputChanged(bool oldValue, bool newValue) { AutoFocusInput.Value = newValue; } private static void OnShowClipboardRoutesChanged(bool oldValue, bool newValue) { ShowClipboardRoutes.Value = newValue; } private static void OnShowClipboardStationsChanged(bool oldValue, bool newValue) { ShowClipboardStations.Value = newValue; } private static void OnShowClipboardStationsOutputChanged(bool oldValue, bool newValue) { ShowClipboardStationsOutput.Value = newValue; } private static void OnLabelDefaultSizeChanged(int oldValue, int newValue) { CheckValidSizeAndUpdate(newValue, LabelDefaultSize); } private static void OnLabelDefaultColorChanged(string oldValue, string newValue) { CheckCorrectFormatAndUpdate(newValue, LabelDefaultColor); } private static void OnAutomaticallySetLabelColorOptionsChanged(bool oldValue, bool newValue) { AutomaticallySetLabelColorOptions.Value = newValue; } private static void OnFontDefaultColorChanged(string oldValue, string newValue) { CheckCorrectFormatAndUpdate(newValue, FontDefaultColor); } private static void OnShowDebugChanged(bool oldValue, bool newValue) { ShowDebug.Value = newValue; } private static void CheckCorrectFormatAndUpdate(string newValue, MelonPreferences_Entry<string> entry) { if (Regex.IsMatch(newValue, "^#[0-9A-Fa-f]{6}$")) { entry.Value = newValue; ColorPickerManager.UpdateAllColorPickers(ColorPickerType.Label); ColorPickerManager.UpdateAllColorPickers(ColorPickerType.Font); } else { Logger.Warning("Invalid color format: " + newValue + ". Reverted to " + entry.DefaultValue); entry.Value = entry.DefaultValue; ModManagerIntegration.RequestUIRefresh(); } } private static void CheckValidSizeAndUpdate(int newValue, MelonPreferences_Entry<int> entry) { if (newValue >= 1 && newValue <= 30) { entry.Value = newValue; return; } Logger.Warning($"Invalid size value: {newValue}. Must be between 1 and 30. Reverted to {entry.DefaultValue}"); entry.Value = entry.DefaultValue; ModManagerIntegration.RequestUIRefresh(); } } } namespace SimpleLabels.Patches { [HarmonyPatch] public class ClipboardPatches { [HarmonyPatch(typeof(RouteListFieldUI), "Refresh")] [HarmonyPostfix] public static void OnRouteListRefresh(RouteListFieldUI __instance, List<AdvancedTransitRoute> newVal) { if (!ModSettings.ShowClipboardRoutes.Value) { return; } Transform obj = ((Component)__instance).gameObject.transform.Find("Contents"); object obj2 = ((obj != null) ? ((Component)obj).gameObject : null); if (obj2 == null) { Transform obj3 = ((Component)__instance).gameObject.transform.Find("ScrollArea/Contents"); obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null); } GameObject val = (GameObject)obj2; if ((Object)(object)val == (Object)null) { Logger.Error("[Clipboard] Couldn't find RouteList contents container"); return; } IEnumerator enumerator = val.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { Object current = enumerator.Current; Transform val2 = ((Il2CppObjectBase)current).TryCast<Transform>(); if (!((Object)(object)val2 == (Object)null) && ((Object)val2).name.Contains("Entry") && ((Component)val2).gameObject.active) { RouteEntryUI component = ((Component)val2).GetComponent<RouteEntryUI>(); object obj4; if (component == null) { obj4 = null; } else { AdvancedTransitRoute assignedRoute = component.AssignedRoute; obj4 = ((assignedRoute != null) ? assignedRoute.GetData() : null); } if (obj4 == null) { Logger.Warning("[Clipboard] Missing route data on " + ((Object)val2).name); continue; } AdvancedTransitRouteData data = component.AssignedRoute.GetData(); UpdateRouteLabel(val2, "Source/Label", data.SourceGUID); UpdateRouteLabel(val2, "Destination/Label", data.DestinationGUID); } } } finally { if (enumerator is IDisposable disposable) { disposable.Dispose(); } } } private static void UpdateRouteLabel(Transform entryTransform, string labelPath, string guid) { Transform val = entryTransform.Find(labelPath); if ((Object)(object)val == (Object)null) { Logger.Warning("[Clipboard] Missing label path: " + labelPath); return; } TextMeshProUGUI componentInChildren = ((Component)val).GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren == (Object)null) { Logger.Warning("[Clipboard] Missing TextMeshPro component at " + labelPath); return; } LabelTracker.EntityData entityData = LabelTracker.GetEntityData(guid); if (entityData != null && !string.IsNullOrEmpty(entityData.LabelText)) { ((TMP_Text)componentInChildren).text = entityData.LabelText; } } [HarmonyPatch(typeof(ObjectListFieldUI), "Refresh")] [HarmonyPostfix] public static void OnObjectListRefresh(ObjectListFieldUI __instance, List<BuildableItem> newVal) { //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) if (!ModSettings.ShowClipboardStations.Value) { return; } Transform obj = ((Component)__instance).gameObject.transform.Find("Contents"); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val == (Object)null) { Logger.Error("[Clipboard] Couldn't find ObjectList contents container"); return; } IEnumerator enumerator = val.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { Object current = enumerator.Current; Transform val2 = ((Il2CppObjectBase)current).TryCast<Transform>(); if ((Object)(object)val2 == (Object)null || !((Object)val2).name.Contains("Entry") || !((Component)val2).gameObject.active) { continue; } Transform val3 = val2.Find("Title"); if ((Object)(object)val3 == (Object)null) { Logger.Warning("[Clipboard] Missing title on " + ((Object)val2).name); continue; } TextMeshProUGUI componentInChildren = ((Component)val3).GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren == (Object)null) { Logger.Warning("[Clipboard] Missing text component on " + ((Object)val2).name); continue; } int siblingIndex = val2.GetSiblingIndex(); if (siblingIndex >= newVal.Count) { Logger.Warning($"[Clipboard] Index out of range: {siblingIndex}"); continue; } Guid gUID = newVal._items[siblingIndex].GUID; string guid = ((object)(Guid)(ref gUID)).ToString(); LabelTracker.EntityData entityData = LabelTracker.GetEntityData(guid); if (entityData != null && !string.IsNullOrEmpty(entityData.LabelText)) { ((TMP_Text)componentInChildren).text = entityData.LabelText; } } } finally { if (enumerator is IDisposable disposable) { disposable.Dispose(); } } } [HarmonyPatch(typeof(ObjectFieldUI), "Refresh")] [HarmonyPostfix] public static void OnObjectFieldRefresh(ObjectFieldUI __instance, BuildableItem newVal) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (!ModSettings.ShowClipboardStationsOutput.Value) { return; } if ((Object)(object)newVal == (Object)null) { Logger.Warning("[Clipboard] Received null BuildableItem"); return; } Transform val = ((Component)__instance).gameObject.transform.Find("Selection/Label"); if ((Object)(object)val == (Object)null) { Logger.Error("[Clipboard] Missing label transform in ObjectField"); return; } TextMeshProUGUI componentInChildren = ((Component)val).GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren == (Object)null) { Logger.Error("[Clipboard] Missing text component in ObjectField"); return; } Guid gUID = newVal.GUID; LabelTracker.EntityData entityData = LabelTracker.GetEntityData(((object)(Guid)(ref gUID)).ToString()); if (entityData != null && !string.IsNullOrEmpty(entityData.LabelText)) { ((TMP_Text)componentInChildren).text = entityData.LabelText; } } } [HarmonyPatch] public class LoaderPatches { [HarmonyPatch(typeof(GridItemLoader), "LoadAndCreate")] [HarmonyPostfix] private static void OnGridItemLoaded(GridItem __result) { //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) if (!((Object)(object)__result == (Object)null)) { GameObject gameObject = ((Component)__result).gameObject; Guid gUID = ((BuildableItem)__result).GUID; TryCreateLabelsForEntity(gameObject, ((object)(Guid)(ref gUID)).ToString(), ((Object)__result).name); } } [HarmonyPatch(typeof(SurfaceItemLoader), "LoadAndCreate")] [HarmonyPostfix] private static void OnSurfaceItemLoaded(SurfaceItem __result) { //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) if (!((Object)(object)__result == (Object)null)) { GameObject gameObject = ((Component)__result).gameObject; Guid gUID = ((BuildableItem)__result).GUID; TryCreateLabelsForEntity(gameObject, ((object)(Guid)(ref gUID)).ToString(), ((Object)__result).name); } } private static void TryCreateLabelsForEntity(GameObject gameObject, string guid, string originalName) { if ((Object)(object)gameObject == (Object)null || string.IsNullOrEmpty(guid)) { return; } try { string text = CleanEntityName(originalName); if (LabelPlacementConfigs.LabelPlacementConfigsDictionary.ContainsKey(text)) { if (LabelTracker.GetEntityData(guid) == null) { LabelTracker.TrackEntity(guid, gameObject, string.Empty, ModSettings.LabelDefaultColor.Value, ModSettings.LabelDefaultSize.Value, ModSettings.DEFAULT_FONT_SIZE, ModSettings.FontDefaultColor.Value); } else { LabelTracker.UpdateGameObjectReference(guid, gameObject); } if (!string.IsNullOrEmpty(LabelTracker.GetEntityData(guid)?.LabelText)) { LabelApplier.ApplyOrUpdateLabel(guid); Logger.Msg("Processed entity: " + text + " (GUID: " + guid + ")"); } } } catch (Exception ex) { Logger.Error("Failed to process " + originalName + ": " + ex.Message); } } public static string CleanEntityName(string originalName) { return originalName.Replace("(Clone)", "").Replace("_Built", "").Trim(); } } public class StationPatches { [HarmonyPatch(typeof(PackagingStationCanvas), "SetIsOpen")] private static class PackagingStationPatch { [HarmonyPostfix] public static void Postfix(PackagingStation station, bool open) { if (open) { HandleStationOpen((GridItem)(object)station, "Packaging Station"); } } } [HarmonyPatch(typeof(DryingRackCanvas), "SetIsOpen")] private static class DryingRackPatch { [HarmonyPostfix] public static void Postfix(DryingRack rack, bool open) { if (open) { HandleStationOpen((GridItem)(object)rack, "Drying Rack"); } } } [HarmonyPatch(typeof(BrickPressCanvas), "SetIsOpen")] private static class BrickPressPatch { [HarmonyPostfix] public static void Postfix(BrickPress press, bool open) { if (open) { HandleStationOpen((GridItem)(object)press, "Brick Press"); } } } [HarmonyPatch(typeof(CauldronCanvas), "SetIsOpen")] private static class CauldronPatch { [HarmonyPostfix] public static void Postfix(Cauldron cauldron, bool open) { if (open) { HandleStationOpen((GridItem)(object)cauldron, "Cauldron"); } } } [HarmonyPatch(typeof(LabOvenCanvas), "SetIsOpen")] private static class LabOvenPatch { [HarmonyPostfix] public static void Postfix(LabOven oven, bool open, bool removeUI) { if (open) { HandleStationOpen((GridItem)(object)oven, "Lab Oven"); } } } [HarmonyPatch(typeof(MixingStationCanvas), "Open")] private static class MixingStationPatch { [HarmonyPostfix] public static void Postfix(MixingStationCanvas __instance, MixingStation station) { HandleStationOpen((GridItem)(object)station, "Mixing Station"); } } [HarmonyPatch(typeof(ChemistryStationCanvas), "Open")] private static class ChemistryStationPatch { [HarmonyPostfix] public static void Postfix(ChemistryStationCanvas __instance, ChemistryStation station) { HandleStationOpen((GridItem)(object)station, "Chemistry Station"); } } private static string _currentStationGuid; private static GameObject _currentStationGameObject; private static string _currentStationGameObjectCleanName; private static void HandleStationOpen(GridItem station, string stationType) { //IL_000d: 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) _currentStationGameObject = ((Component)station).gameObject; Guid gUID = ((BuildableItem)station).GUID; _currentStationGuid = ((object)(Guid)(ref gUID)).ToString(); _currentStationGameObjectCleanName = ((Object)_currentStationGameObject).name.Replace("(Clone)", "").Replace("_Built", "").Replace("Mk2", "") .Replace("_", "") .Trim(); Logger.Msg("CurrentStationGameObject = " + _currentStationGameObjectCleanName); Logger.Msg("CurrentStationGuid = " + _currentStationGuid); Logger.Msg("CurrentStationType = " + stationType); LabelInputDataLoader.LoadLabelData(_currentStationGuid, _currentStationGameObject, _currentStationGameObject, stationType); } } [HarmonyPatch(typeof(StorageMenu))] public class StoragePatches { [HarmonyPatch] public class StorageMenuAllOpenPatches { [CompilerGenerated] private sealed class <TargetMethods>d__0 : IEnumerable<MethodBase>, IEnumerable, IEnumerator<MethodBase>, IDisposable, IEnumerator { private int <>1__state; private MethodBase <>2__current; private int <>l__initialThreadId; MethodBase IEnumerator<MethodBase>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TargetMethods>d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = typeof(StorageMenu).GetMethod("Open", new Type[1] { typeof(StorageEntity) }); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = typeof(StorageMenu).GetMethod("Open", new Type[3] { typeof(IItemSlotOwner), typeof(string), typeof(string) }); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = typeof(StorageMenu).GetMethod("Open", new Type[3] { typeof(string), typeof(string), typeof(IItemSlotOwner) }); <>1__state = 3; return true; case 3: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<MethodBase> IEnumerable<MethodBase>.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new <TargetMethods>d__0(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<MethodBase>)this).GetEnumerator(); } } [IteratorStateMachine(typeof(<TargetMethods>d__0))] private static IEnumerable<MethodBase> TargetMethods() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TargetMethods>d__0(-2); } private static void Postfix(StorageMenu __instance) { try { if ((Object)(object)__instance.OpenedStorageEntity == (Object)null) { DisableInputField(__instance); return; } } catch (Exception) { return; } string key = LoaderPatches.CleanEntityName(((Object)__instance.OpenedStorageEntity).name); if (!LabelPlacementConfigs.LabelPlacementConfigsDictionary.ContainsKey(key)) { DisableInputField(__instance); } } } private static string _currentStorageGuid; private static GameObject _currentStorageGameObject; private static GameObject _currentInputGameObject; [HarmonyPatch(typeof(StorageMenu), "Open", new Type[] { typeof(StorageEntity) })] [HarmonyPostfix] public static void OnStorageOpened(StorageMenu __instance, StorageEntity entity) { string key = LoaderPatches.CleanEntityName(((Object)__instance.OpenedStorageEntity).name); if (LabelPlacementConfigs.LabelPlacementConfigsDictionary.ContainsKey(key)) { _currentInputGameObject = ((Component)__instance).gameObject; _currentStorageGameObject = ((Component)entity).gameObject; _currentStorageGuid = GetStorageGuid(entity); string storageEntityName = entity.StorageEntityName; Logger.Msg("CurrentStorageGameObject = " + ((Object)_currentStorageGameObject).name); string gameObjectName = ((Object)_currentInputGameObject).name.Replace("(Clone)", "").Replace("_Built", "").Replace("Mk2", "") .Replace("_", "") .Trim(); InputFieldManager.DeactivateInputField(gameObjectName); LabelInputDataLoader.LoadLabelData(_currentStorageGuid, _currentStorageGameObject, _currentInputGameObject, storageEntityName); ColorPickerManager.UpdateAllColorPickers(ColorPickerType.Label); UpdateColorPickersFromStorageItems(entity); } } private static void UpdateColorPickersFromStorageItems(StorageEntity entity) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_009e: 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) if (!ModSettings.AutomaticallySetLabelColorOptions.Value) { return; } List<ItemInstance> allItems = entity.GetAllItems(); if (allItems == null || allItems.Count == 0) { return; } HashSet<Color32> hashSet = new HashSet<Color32>(new ColorComparer()); List<Color> list = new List<Color>(); Enumerator<ItemInstance> enumerator = allItems.GetEnumerator(); while (enumerator.MoveNext()) { ItemInstance current = enumerator.Current; Sprite icon = current.Icon; if ((Object)(object)icon == (Object)null) { continue; } Color averageColor = SpriteManager.GetAverageColor(icon); Color32 item = Color32.op_Implicit(averageColor); if (hashSet.Add(item)) { list.Add(averageColor); if (list.Count >= 8) { break; } } } for (int i = 0; i < list.Count; i++) { ColorPickerManager.SetLabelColorPickerButtonColor(i, list[i]); } } private static string GetStorageGuid(StorageEntity entity) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) PlaceableStorageEntity val = default(PlaceableStorageEntity); Guid gUID; if (((Component)entity).TryGetComponent<PlaceableStorageEntity>(ref val)) { gUID = ((BuildableItem)val).GUID; return ((object)(Guid)(ref gUID)).ToString(); } SurfaceStorageEntity val2 = default(SurfaceStorageEntity); if (((Component)entity).TryGetComponent<SurfaceStorageEntity>(ref val2)) { gUID = ((BuildableItem)val2).GUID; return ((object)(Guid)(ref gUID)).ToString(); } Logger.Warning("No GUID found for storage entity: " + entity.StorageEntityName); return null; } private static void DisableInputField(StorageMenu instance) { _currentInputGameObject = ((Component)instance).gameObject; string gameObjectName = ((Object)_currentInputGameObject).name.Replace("(Clone)", "").Replace("_Built", "").Replace("Mk2", "") .Replace("_", "") .Trim(); InputFieldManager.DeactivateInputField(gameObjectName); InputFieldManager.DisableToggleOnOffButton(gameObjectName); } } public class ColorComparer : IEqualityComparer<Color32> { private const int ColorTolerance = 15; public bool Equals(Color32 x, Color32 y) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) return Math.Abs(x.r - y.r) <= 15 && Math.Abs(x.g - y.g) <= 15 && Math.Abs(x.b - y.b) <= 15; } public int GetHashCode(Color32 color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) int num = color.r / 15; int num2 = color.g / 15; int num3 = color.b / 15; return (num << 16) | (num2 << 8) | num3; } } } namespace SimpleLabels.Data { public class LabelDataManager { private static string _dataDirectory; private static string _dataFilePath; public static void Initialize() { _dataDirectory = Path.Combine(Melon