Decompiled source of SULFUR Native UI Lib v0.7.0
SULFUR Native UI Lib.dll
Decompiled 8 hours 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.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Logging; using HarmonyLib; using PerfectRandom.Sulfur.Core; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; 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: AssemblyTitle("SULFUR Native UI Lib")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SULFUR Native UI Lib")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("72a22641-593c-485e-a6bc-6191f7c17244")] [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")] namespace Ryuka.Sulfur.NativeUI; [BepInPlugin("ryuka.sulfur.nativeui", "SULFUR Native UI Lib", "0.7.0")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "ryuka.sulfur.nativeui"; public const string PluginName = "SULFUR Native UI Lib"; public const string PluginVersion = "0.7.0"; private Harmony harmony; internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; harmony = new Harmony("ryuka.sulfur.nativeui"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"SULFUR Native UI Lib loaded."); } private void OnDestroy() { if (harmony != null) { harmony.UnpatchSelf(); harmony = null; } } } internal sealed class SulfurCustomCategoryMarker : MonoBehaviour { public string PageId; private TextMeshProUGUI[] labels; private string lastAppliedText; private int lastLanguageVersion = -1; public void Initialize(string pageId) { PageId = pageId; CacheLabels(); ForceApplyLabel(); } private void OnEnable() { CacheLabels(); ApplyLabelIfNeeded(force: true); } private void LateUpdate() { ApplyLabelIfNeeded(force: false); } public void ApplyLabel() { ForceApplyLabel(); } public void ForceApplyLabel() { if (string.IsNullOrWhiteSpace(PageId)) { return; } SulfurOptionsPage page = SulfurOptionsApi.GetPage(PageId); if (page == null) { return; } string resolvedDisplayName = page.ResolvedDisplayName; if (string.IsNullOrWhiteSpace(resolvedDisplayName)) { return; } lastAppliedText = resolvedDisplayName; lastLanguageVersion = SulfurLocalization.LanguageVersion; CacheLabels(); TextMeshProUGUI[] array = labels; foreach (TextMeshProUGUI val in array) { if ((Object)(object)val != (Object)null) { ((TMP_Text)val).text = resolvedDisplayName; } } } private void ApplyLabelIfNeeded(bool force) { if (!string.IsNullOrWhiteSpace(PageId)) { SulfurLocalization.RefreshCurrentLanguage(force: false); if (!force && lastLanguageVersion == SulfurLocalization.LanguageVersion) { RestoreLabelIfOverwritten(); } else { ForceApplyLabel(); } } } private void RestoreLabelIfOverwritten() { if (string.IsNullOrWhiteSpace(lastAppliedText)) { return; } CacheLabels(); TextMeshProUGUI[] array = labels; foreach (TextMeshProUGUI val in array) { if ((Object)(object)val != (Object)null && ((TMP_Text)val).text != lastAppliedText) { ((TMP_Text)val).text = lastAppliedText; } } } private void CacheLabels() { if (labels == null || labels.Length == 0) { labels = ((Component)this).GetComponentsInChildren<TextMeshProUGUI>(true); } } } internal sealed class SulfurInputCaretOverlay : MonoBehaviour { private TMP_InputField input; private TextMeshProUGUI textComponent; private RectTransform viewport; private RectTransform caretRect; private Image caretImage; private float blinkTimer; private bool blinkVisible = true; public static SulfurInputCaretOverlay Attach(TMP_InputField input, TextMeshProUGUI textComponent, RectTransform viewport, Color color) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)input == (Object)null || (Object)(object)textComponent == (Object)null || (Object)(object)viewport == (Object)null) { return null; } GameObject val = new GameObject("VisibleCaret", new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(SulfurInputCaretOverlay) }); val.transform.SetParent((Transform)(object)viewport, false); SulfurInputCaretOverlay component = val.GetComponent<SulfurInputCaretOverlay>(); component.Initialize(input, textComponent, viewport, color); return component; } private void Initialize(TMP_InputField sourceInput, TextMeshProUGUI sourceText, RectTransform sourceViewport, Color color) { //IL_0032: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00c2: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) input = sourceInput; textComponent = sourceText; viewport = sourceViewport; caretRect = ((Component)this).GetComponent<RectTransform>(); caretRect.anchorMin = new Vector2(0f, 0.5f); caretRect.anchorMax = new Vector2(0f, 0.5f); caretRect.pivot = new Vector2(0f, 0.5f); caretRect.sizeDelta = new Vector2(3f, Mathf.Max(20f, ((TMP_Text)sourceText).fontSize * 1.15f)); caretRect.anchoredPosition = Vector2.zero; caretImage = ((Component)this).GetComponent<Image>(); ((Graphic)caretImage).color = new Color(color.r, color.g, color.b, 1f); ((Graphic)caretImage).raycastTarget = false; ((Behaviour)caretImage).enabled = false; } private void LateUpdate() { if ((Object)(object)input == (Object)null || (Object)(object)textComponent == (Object)null || (Object)(object)viewport == (Object)null || (Object)(object)caretImage == (Object)null) { return; } if (!input.isFocused) { ((Behaviour)caretImage).enabled = false; blinkTimer = 0f; blinkVisible = true; return; } blinkTimer += Time.unscaledDeltaTime; if (blinkTimer >= 0.5f) { blinkTimer = 0f; blinkVisible = !blinkVisible; } UpdateCaretPosition(); ((Behaviour)caretImage).enabled = blinkVisible; } private void UpdateCaretPosition() { //IL_00a5: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0121: 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_0081: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) string text = input.text ?? ""; int num = 0; try { num = Mathf.Clamp(input.caretPosition, 0, text.Length); } catch { num = text.Length; } string text2 = ((num > 0) ? text.Substring(0, num) : ""); float num2 = 0f; Rect rect; if (!string.IsNullOrEmpty(text2)) { TextMeshProUGUI obj2 = textComponent; rect = viewport.rect; Vector2 preferredValues = ((TMP_Text)obj2).GetPreferredValues(text2, 10000f, ((Rect)(ref rect)).height); num2 = preferredValues.x; } rect = viewport.rect; float num3 = Mathf.Max(0f, ((Rect)(ref rect)).width - caretRect.sizeDelta.x); num2 = Mathf.Clamp(num2, 0f, num3); caretRect.sizeDelta = new Vector2(caretRect.sizeDelta.x, Mathf.Max(20f, ((TMP_Text)textComponent).fontSize * 1.15f)); caretRect.anchoredPosition = new Vector2(num2, 0f); } } internal sealed class SulfurInputVisualState : MonoBehaviour { private TMP_InputField input; private Image background; private Color normalColor; private Color focusedColor; private bool lastFocused; public void Configure(TMP_InputField sourceInput, Image sourceBackground) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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) input = sourceInput; background = sourceBackground; if ((Object)(object)background != (Object)null) { normalColor = ((Graphic)background).color; focusedColor = new Color(Mathf.Min(1f, normalColor.r + 0.08f), Mathf.Min(1f, normalColor.g + 0.08f), Mathf.Min(1f, normalColor.b + 0.08f), Mathf.Clamp01(normalColor.a + 0.09f)); } ApplyState(force: true); } private void LateUpdate() { ApplyState(force: false); } private void ApplyState(bool force) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)input == (Object)null) && !((Object)(object)background == (Object)null)) { bool isFocused = input.isFocused; if (force || isFocused != lastFocused) { lastFocused = isFocused; ((Graphic)background).color = (isFocused ? focusedColor : normalColor); } } } } public static class SulfurLocalization { [DataContract] private sealed class SulfurLangFile { [DataMember(Name = "entries")] public SulfurLangEntry[] Entries; } [DataContract] private sealed class SulfurLangEntry { [DataMember(Name = "key")] public string Key; [DataMember(Name = "value")] public string Value; } [CompilerGenerated] private sealed class <GetLanguageFallbacks>d__20 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private string <current>5__1; private int <dash>5__2; string IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetLanguageFallbacks>d__20(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <current>5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <current>5__1 = CurrentLanguageCode; if (!string.IsNullOrWhiteSpace(<current>5__1)) { <>2__current = <current>5__1; <>1__state = 1; return true; } goto IL_00ba; case 1: <>1__state = -1; <dash>5__2 = <current>5__1.IndexOf('-'); if (<dash>5__2 > 0) { <>2__current = <current>5__1.Substring(0, <dash>5__2); <>1__state = 2; return true; } goto IL_00ba; case 2: <>1__state = -1; goto IL_00ba; case 3: { <>1__state = -1; return false; } IL_00ba: <>2__current = "en"; <>1__state = 3; return true; } } 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<string> IEnumerable<string>.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new <GetLanguageFallbacks>d__20(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <GetLocalizationSearchDirectories>d__13 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private string pluginDir; public string <>3__pluginDir; private string <langDir>5__1; private DirectoryInfo <parent>5__2; private string <parentLangDir>5__3; string IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetLocalizationSearchDirectories>d__13(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <langDir>5__1 = null; <parent>5__2 = null; <parentLangDir>5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (string.IsNullOrWhiteSpace(pluginDir)) { return false; } <langDir>5__1 = Path.Combine(pluginDir, "lang"); if (Directory.Exists(<langDir>5__1)) { <>2__current = <langDir>5__1; <>1__state = 1; return true; } goto IL_0089; case 1: <>1__state = -1; goto IL_0089; case 2: <>1__state = -1; goto IL_00b4; case 3: { <>1__state = -1; goto IL_011d; } IL_00b4: <parent>5__2 = Directory.GetParent(pluginDir); if (<parent>5__2 == null) { break; } <parentLangDir>5__3 = Path.Combine(<parent>5__2.FullName, "lang"); if (Directory.Exists(<parentLangDir>5__3)) { <>2__current = <parentLangDir>5__3; <>1__state = 3; return true; } goto IL_011d; IL_011d: <parentLangDir>5__3 = null; break; IL_0089: if (Directory.Exists(pluginDir)) { <>2__current = pluginDir; <>1__state = 2; return true; } goto IL_00b4; } 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<string> IEnumerable<string>.GetEnumerator() { <GetLocalizationSearchDirectories>d__13 <GetLocalizationSearchDirectories>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetLocalizationSearchDirectories>d__ = this; } else { <GetLocalizationSearchDirectories>d__ = new <GetLocalizationSearchDirectories>d__13(0); } <GetLocalizationSearchDirectories>d__.pluginDir = <>3__pluginDir; return <GetLocalizationSearchDirectories>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } private static readonly Dictionary<string, Dictionary<string, Dictionary<string, string>>> data = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>(StringComparer.OrdinalIgnoreCase); private static string cachedRawLanguage; private static string cachedLanguageCode = "en"; private static DateTime lastLanguageCheckUtc = DateTime.MinValue; public static int LanguageVersion { get; private set; } public static string CurrentLanguageCode { get { RefreshCurrentLanguage(force: false); return cachedLanguageCode; } } public static void LoadPluginLocalization(string pluginGuid, string pluginAssemblyLocation) { if (string.IsNullOrWhiteSpace(pluginGuid) || string.IsNullOrWhiteSpace(pluginAssemblyLocation)) { return; } string text = (File.Exists(pluginAssemblyLocation) ? Path.GetDirectoryName(pluginAssemblyLocation) : pluginAssemblyLocation); if (string.IsNullOrWhiteSpace(text)) { return; } if (!data.TryGetValue(pluginGuid, out var value)) { value = new Dictionary<string, Dictionary<string, string>>(StringComparer.OrdinalIgnoreCase); data[pluginGuid] = value; } HashSet<string> loadedFiles = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (string localizationSearchDirectory in GetLocalizationSearchDirectories(text)) { LoadLocalizationDirectory(pluginGuid, value, localizationSearchDirectory, loadedFiles); } } public static string Get(string pluginGuid, string key, string fallback) { if (string.IsNullOrWhiteSpace(pluginGuid) || string.IsNullOrWhiteSpace(key)) { return fallback ?? ""; } if (!data.TryGetValue(pluginGuid, out var value)) { return fallback ?? ""; } foreach (string languageFallback in GetLanguageFallbacks()) { if (!value.TryGetValue(languageFallback, out var value2) || !value2.TryGetValue(key, out var value3)) { continue; } return value3 ?? ""; } return fallback ?? ""; } public static void RefreshCurrentLanguage(bool force) { DateTime utcNow = DateTime.UtcNow; if (force || !((utcNow - lastLanguageCheckUtc).TotalSeconds < 0.5)) { lastLanguageCheckUtc = utcNow; string currentGameLanguageName = GetCurrentGameLanguageName(); string currentGameLanguageCode = GetCurrentGameLanguageCode(); string text = NormalizeLanguageCode(currentGameLanguageCode); if (string.IsNullOrWhiteSpace(text)) { text = MapGameLanguageToCode(currentGameLanguageName); } if (!string.Equals(currentGameLanguageName, cachedRawLanguage, StringComparison.Ordinal) || !string.Equals(text, cachedLanguageCode, StringComparison.OrdinalIgnoreCase)) { cachedRawLanguage = currentGameLanguageName; cachedLanguageCode = text; LanguageVersion++; } } } [IteratorStateMachine(typeof(<GetLocalizationSearchDirectories>d__13))] private static IEnumerable<string> GetLocalizationSearchDirectories(string pluginDir) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GetLocalizationSearchDirectories>d__13(-2) { <>3__pluginDir = pluginDir }; } private static void LoadLocalizationDirectory(string pluginGuid, Dictionary<string, Dictionary<string, string>> pluginMap, string directory, HashSet<string> loadedFiles) { if (string.IsNullOrWhiteSpace(directory) || !Directory.Exists(directory)) { return; } string[] files; try { files = Directory.GetFiles(directory, "*.json", SearchOption.TopDirectoryOnly); } catch (Exception ex) { if (Plugin.Log != null) { Plugin.Log.LogWarning((object)("Failed to list localization directory: " + directory + " / " + ex.Message)); } return; } string[] array = files; foreach (string text in array) { if (string.IsNullOrWhiteSpace(text) || loadedFiles.Contains(text)) { continue; } loadedFiles.Add(text); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text); if (!IsLikelyLanguageFileName(fileNameWithoutExtension)) { continue; } try { Dictionary<string, string> dictionary = LoadLangFile(text); if (dictionary.Count == 0) { if (Plugin.Log != null) { Plugin.Log.LogWarning((object)("Localization file has 0 entries: " + text)); } continue; } MergeLangMap(pluginMap, fileNameWithoutExtension, dictionary); if (Plugin.Log != null) { Plugin.Log.LogInfo((object)("Loaded localization: " + pluginGuid + " / " + fileNameWithoutExtension + " / " + dictionary.Count + " entries / " + text)); } } catch (Exception ex2) { if (Plugin.Log != null) { Plugin.Log.LogWarning((object)("Failed to load localization file: " + text + " / " + ex2.Message)); } } } } private static void MergeLangMap(Dictionary<string, Dictionary<string, string>> pluginMap, string langCode, Dictionary<string, string> newMap) { if (pluginMap == null || string.IsNullOrWhiteSpace(langCode) || newMap == null || newMap.Count == 0) { return; } if (!pluginMap.TryGetValue(langCode, out var value)) { pluginMap[langCode] = new Dictionary<string, string>(newMap, StringComparer.OrdinalIgnoreCase); return; } foreach (KeyValuePair<string, string> item in newMap) { if (!string.IsNullOrWhiteSpace(item.Key) && !value.ContainsKey(item.Key)) { value[item.Key] = item.Value ?? ""; } } } private static bool IsLikelyLanguageFileName(string name) { if (string.IsNullOrWhiteSpace(name)) { return false; } string text = name.Trim(); if (text.Equals("manifest", StringComparison.OrdinalIgnoreCase)) { return false; } if (text.Equals("package", StringComparison.OrdinalIgnoreCase)) { return false; } if (text.Equals("config", StringComparison.OrdinalIgnoreCase)) { return false; } if (text.Equals("localization_manifest", StringComparison.OrdinalIgnoreCase)) { return false; } if (text.Length < 2 || text.Length > 32) { return false; } string text2 = text.Replace('_', '-'); string[] array = text2.Split(new char[1] { '-' }); if (array.Length == 0) { return false; } if (!IsAlpha(array[0])) { return false; } if (array[0].Length < 2 || array[0].Length > 3) { return false; } for (int i = 1; i < array.Length; i++) { if (string.IsNullOrWhiteSpace(array[i])) { return false; } if (array[i].Length < 2 || array[i].Length > 8) { return false; } if (!IsAlphaNumeric(array[i])) { return false; } } return true; } private static bool IsAlpha(string value) { if (string.IsNullOrWhiteSpace(value)) { return false; } for (int i = 0; i < value.Length; i++) { if (!char.IsLetter(value[i])) { return false; } } return true; } private static bool IsAlphaNumeric(string value) { if (string.IsNullOrWhiteSpace(value)) { return false; } for (int i = 0; i < value.Length; i++) { if (!char.IsLetterOrDigit(value[i])) { return false; } } return true; } private static Dictionary<string, string> LoadLangFile(string file) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); string s = File.ReadAllText(file, Encoding.UTF8); DataContractJsonSerializer val = new DataContractJsonSerializer(typeof(SulfurLangFile)); using (MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(s))) { if (!(((XmlObjectSerializer)val).ReadObject((Stream)memoryStream) is SulfurLangFile sulfurLangFile) || sulfurLangFile.Entries == null) { return dictionary; } SulfurLangEntry[] entries = sulfurLangFile.Entries; foreach (SulfurLangEntry sulfurLangEntry in entries) { if (sulfurLangEntry != null && !string.IsNullOrWhiteSpace(sulfurLangEntry.Key)) { dictionary[sulfurLangEntry.Key] = sulfurLangEntry.Value ?? ""; } } } return dictionary; } [IteratorStateMachine(typeof(<GetLanguageFallbacks>d__20))] private static IEnumerable<string> GetLanguageFallbacks() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GetLanguageFallbacks>d__20(-2); } private static string GetCurrentGameLanguageName() { try { Type type = FindTypeByFullName("I2.Loc.LocalizationManager"); if (type == null) { return ""; } PropertyInfo property = type.GetProperty("CurrentLanguage", BindingFlags.Static | BindingFlags.Public); if (property == null) { return ""; } object value = property.GetValue(null, null); return (value != null) ? value.ToString() : ""; } catch { return ""; } } private static string GetCurrentGameLanguageCode() { try { Type type = FindTypeByFullName("I2.Loc.LocalizationManager"); if (type == null) { return ""; } PropertyInfo property = type.GetProperty("CurrentLanguageCode", BindingFlags.Static | BindingFlags.Public); if (property == null) { return ""; } object value = property.GetValue(null, null); return (value != null) ? value.ToString() : ""; } catch { return ""; } } private static string NormalizeLanguageCode(string code) { if (string.IsNullOrWhiteSpace(code)) { return ""; } string text = code.Trim().Replace('_', '-'); if (text.Equals("zh-cn", StringComparison.OrdinalIgnoreCase)) { return "zh-CN"; } if (text.Equals("zh-tw", StringComparison.OrdinalIgnoreCase)) { return "zh-TW"; } if (text.Equals("pt-br", StringComparison.OrdinalIgnoreCase)) { return "pt-BR"; } if (text.Equals("es-es", StringComparison.OrdinalIgnoreCase)) { return "es-ES"; } return text.ToLowerInvariant(); } private static string MapGameLanguageToCode(string gameLanguage) { if (string.IsNullOrWhiteSpace(gameLanguage)) { return "en"; } string text = gameLanguage.Trim(); if (text.Equals("Chinese (Simplified)", StringComparison.OrdinalIgnoreCase)) { return "zh-CN"; } if (text.Equals("Chinese (Traditional)", StringComparison.OrdinalIgnoreCase)) { return "zh-TW"; } if (text.Equals("English", StringComparison.OrdinalIgnoreCase)) { return "en"; } if (text.Equals("Swedish", StringComparison.OrdinalIgnoreCase)) { return "sv"; } if (text.Equals("French", StringComparison.OrdinalIgnoreCase)) { return "fr"; } if (text.Equals("Italian", StringComparison.OrdinalIgnoreCase)) { return "it"; } if (text.Equals("German", StringComparison.OrdinalIgnoreCase)) { return "de"; } if (text.Equals("Spanish", StringComparison.OrdinalIgnoreCase)) { return "es"; } if (text.Equals("Portuguese", StringComparison.OrdinalIgnoreCase)) { return "pt"; } if (text.Equals("Russian", StringComparison.OrdinalIgnoreCase)) { return "ru"; } if (text.Equals("Polish", StringComparison.OrdinalIgnoreCase)) { return "pl"; } if (text.Equals("Japanese", StringComparison.OrdinalIgnoreCase)) { return "ja"; } if (text.Equals("Korean", StringComparison.OrdinalIgnoreCase)) { return "ko"; } if (text.Equals("Turkish", StringComparison.OrdinalIgnoreCase)) { return "tr"; } if (text.Equals("Arabic", StringComparison.OrdinalIgnoreCase)) { return "ar"; } if (text.Contains("简体") || text.Contains("简体中文") || text.Contains("简中")) { return "zh-CN"; } if (text.Contains("繁體") || text.Contains("繁体") || text.Contains("繁中")) { return "zh-TW"; } if (text.IndexOf("Chinese", StringComparison.OrdinalIgnoreCase) >= 0) { return "zh-CN"; } if (text.IndexOf("Japanese", StringComparison.OrdinalIgnoreCase) >= 0) { return "ja"; } return "en"; } private static Type FindTypeByFullName(string fullName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { Type type = assembly.GetType(fullName); if (type != null) { return type; } } catch { } } return null; } } public enum SulfurMessageKind { Info, Warning, Error, Success } internal sealed class SulfurOptionBinding : MonoBehaviour { public Action OnUse; public Action<int> OnHorizontal; public List<string> CycleValues; public int CycleIndex; public TextMeshProUGUI CycleLabel; public Action<int, string> OnCycleChanged; public void InvokeUse() { if (OnUse != null) { OnUse(); } } public void InvokeHorizontal(int delta) { if (OnHorizontal != null) { OnHorizontal(delta); } } public void MoveCycle(int delta) { if (CycleValues != null && CycleValues.Count != 0) { CycleIndex += delta; if (CycleIndex < 0) { CycleIndex = CycleValues.Count - 1; } if (CycleIndex >= CycleValues.Count) { CycleIndex = 0; } string text = CycleValues[CycleIndex]; if ((Object)(object)CycleLabel != (Object)null) { ((TMP_Text)CycleLabel).text = text; } if (OnCycleChanged != null) { OnCycleChanged(CycleIndex, text); } } } } public static class SulfurOptionsApi { private static readonly List<SulfurOptionsPage> pages = new List<SulfurOptionsPage>(); public static IReadOnlyList<SulfurOptionsPage> Pages => pages; public static void RegisterPage(SulfurOptionsPage page) { if (page == null) { throw new ArgumentNullException("page"); } if (string.IsNullOrWhiteSpace(page.PageId)) { throw new ArgumentException("PageId is required."); } if (page.BuildPage == null) { throw new ArgumentException("BuildPage is required."); } pages.RemoveAll((SulfurOptionsPage x) => string.Equals(x.PageId, page.PageId, StringComparison.OrdinalIgnoreCase)); pages.Add(page); pages.Sort(delegate(SulfurOptionsPage a, SulfurOptionsPage b) { int num = a.SortOrder.CompareTo(b.SortOrder); return (num != 0) ? num : string.Compare(a.DisplayName, b.DisplayName, StringComparison.OrdinalIgnoreCase); }); if (Plugin.Log != null) { Plugin.Log.LogInfo((object)("Registered SULFUR native options page: " + page.PageId)); } } public static void UnregisterPage(string pageId) { if (!string.IsNullOrWhiteSpace(pageId)) { pages.RemoveAll((SulfurOptionsPage x) => string.Equals(x.PageId, pageId, StringComparison.OrdinalIgnoreCase)); } } internal static SulfurOptionsPage GetPage(string pageId) { return pages.FirstOrDefault((SulfurOptionsPage x) => string.Equals(x.PageId, pageId, StringComparison.OrdinalIgnoreCase)); } } public sealed class SulfurOptionsContext { private sealed class SulfurContainerScope : IDisposable { private readonly SulfurOptionsContext context; private readonly RectTransform groupRoot; private readonly bool active; private bool disposed; public SulfurContainerScope(SulfurOptionsContext context, RectTransform groupRoot, bool active) { this.context = context; this.groupRoot = groupRoot; this.active = active; } public void Dispose() { if (!disposed) { disposed = true; BringBordersToFront(groupRoot); if (active && context != null) { context.EndThemedGroup(); } } } private static void BringBordersToFront(RectTransform root) { if (!((Object)(object)root == (Object)null)) { MoveLast((Transform)(object)root, "BorderOverlay"); } } private static void MoveLast(Transform root, string childName) { Transform val = root.Find(childName); if ((Object)(object)val != (Object)null) { val.SetAsLastSibling(); } } } [CompilerGenerated] private sealed class <GetChildrenFrom>d__63 : IEnumerable<Transform>, IEnumerable, IEnumerator<Transform>, IDisposable, IEnumerator { private int <>1__state; private Transform <>2__current; private int <>l__initialThreadId; private int startIndex; public int <>3__startIndex; public SulfurOptionsContext <>4__this; private int <start>5__1; private int <i>5__2; private Transform <child>5__3; Transform IEnumerator<Transform>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetChildrenFrom>d__63(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <child>5__3 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_00b3; } <>1__state = -1; if ((Object)(object)<>4__this.OptionsContainer == (Object)null) { return false; } <start>5__1 = Mathf.Clamp(startIndex, 0, ((Transform)<>4__this.OptionsContainer).childCount); <i>5__2 = <start>5__1; goto IL_00cb; IL_00b3: <child>5__3 = null; <i>5__2++; goto IL_00cb; IL_00cb: if (<i>5__2 < ((Transform)<>4__this.OptionsContainer).childCount) { <child>5__3 = ((Transform)<>4__this.OptionsContainer).GetChild(<i>5__2); if ((Object)(object)<child>5__3 != (Object)null) { <>2__current = <child>5__3; <>1__state = 1; return true; } goto IL_00b3; } 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<Transform> IEnumerable<Transform>.GetEnumerator() { <GetChildrenFrom>d__63 <GetChildrenFrom>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetChildrenFrom>d__ = this; } else { <GetChildrenFrom>d__ = new <GetChildrenFrom>d__63(0) { <>4__this = <>4__this }; } <GetChildrenFrom>d__.startIndex = <>3__startIndex; return <GetChildrenFrom>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<Transform>)this).GetEnumerator(); } } private readonly OptionsScreen optionsScreen; private readonly RectTransform rootOptionsContainer; private RectTransform currentOptionsContainer; private readonly Stack<RectTransform> containerStack = new Stack<RectTransform>(); private readonly List<OptionsScreenOption> nativeOptions; private readonly string pageId; private TextMeshProUGUI sampleTextCache; private bool sampleTextCacheInitialized; private float nativeOptionWidthCache = -1f; public OptionsScreen OptionsScreen => optionsScreen; public RectTransform OptionsContainer => currentOptionsContainer ?? rootOptionsContainer; public string PageId => pageId; internal SulfurOptionsContext(OptionsScreen optionsScreen, RectTransform optionsContainer, List<OptionsScreenOption> nativeOptions, string pageId) { this.optionsScreen = optionsScreen; rootOptionsContainer = optionsContainer; currentOptionsContainer = optionsContainer; this.nativeOptions = nativeOptions; this.pageId = pageId; } public void Rebuild() { SulfurOptionsScreenBridge.RebuildCurrentCustomPage(optionsScreen); } public void SetFooter(string leftText, string statusText, string primaryButtonText, Action onPrimaryPressed) { SulfurOptionsScreenBridge.SetCustomPageFooter(optionsScreen, leftText, statusText, primaryButtonText, onPrimaryPressed); } public void SetFooterStatus(string statusText) { SulfurOptionsScreenBridge.SetCustomPageFooterStatus(optionsScreen, statusText); } public IDisposable BeginThemedGroup(string name) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = FindSampleText(); Color themeColor = (Color)(((Object)(object)val != (Object)null) ? ((Graphic)val).color : new Color(1f, 0.65f, 0.15f, 1f)); return BeginThemedGroup(name, themeColor, 32f); } public IDisposable BeginThemedGroup(string name, Color themeColor, float indentPixels) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) RectTransform optionsContainer = OptionsContainer; if ((Object)(object)optionsContainer == (Object)null) { return new SulfurContainerScope(this, null, active: false); } float num = Mathf.Max(360f, GetNativeOptionWidth() - indentPixels + 24f); GameObject val = new GameObject(string.IsNullOrWhiteSpace(name) ? "SULFUR_ThemedGroup" : name, new Type[6] { typeof(RectTransform), typeof(LayoutElement), typeof(CanvasRenderer), typeof(Image), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter) }); val.transform.SetParent((Transform)(object)optionsContainer, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(0f, 1f); component.pivot = new Vector2(0f, 1f); component.anchoredPosition = new Vector2(indentPixels, 0f); component.sizeDelta = new Vector2(num, 0f); LayoutElement component2 = val.GetComponent<LayoutElement>(); component2.minWidth = num; component2.preferredWidth = num; component2.flexibleWidth = 0f; Image component3 = val.GetComponent<Image>(); ((Graphic)component3).color = new Color(themeColor.r, themeColor.g, themeColor.b, 0.004f); ((Graphic)component3).raycastTarget = false; VerticalLayoutGroup component4 = val.GetComponent<VerticalLayoutGroup>(); ((LayoutGroup)component4).padding = new RectOffset(18, 14, 10, 12); ((HorizontalOrVerticalLayoutGroup)component4).spacing = 6f; ((LayoutGroup)component4).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)component4).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component4).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)component4).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)component4).childForceExpandHeight = false; ContentSizeFitter component5 = val.GetComponent<ContentSizeFitter>(); component5.horizontalFit = (FitMode)0; component5.verticalFit = (FitMode)2; Color borderColor = default(Color); ((Color)(ref borderColor))..ctor(themeColor.r, themeColor.g, themeColor.b, 0.75f); GameObject val2 = CreateBorderOverlay(val.transform, borderColor); ((Object)val2).name = "BorderOverlay"; containerStack.Push(currentOptionsContainer); currentOptionsContainer = component; return new SulfurContainerScope(this, component, active: true); } private void EndThemedGroup() { if (containerStack.Count > 0) { currentOptionsContainer = containerStack.Pop(); } else { currentOptionsContainer = rootOptionsContainer; } } private static void CreateBorderLine(Transform parent, string name, Color color, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin, Vector2 offsetMax) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[4] { typeof(RectTransform), typeof(LayoutElement), typeof(CanvasRenderer), typeof(Image) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; component.offsetMin = offsetMin; component.offsetMax = offsetMax; LayoutElement component2 = val.GetComponent<LayoutElement>(); component2.ignoreLayout = true; Image component3 = val.GetComponent<Image>(); ((Graphic)component3).color = color; ((Graphic)component3).raycastTarget = false; } private static GameObject CreateBorderOverlay(Transform parent, Color borderColor) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BorderOverlay", new Type[2] { typeof(RectTransform), typeof(LayoutElement) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; LayoutElement component2 = val.GetComponent<LayoutElement>(); component2.ignoreLayout = true; CreateBorderLine(val.transform, "BorderLeft", borderColor, new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(2f, 0f), new Vector2(6f, 0f)); CreateBorderLine(val.transform, "BorderRight", borderColor, new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(-6f, 0f), new Vector2(-2f, 0f)); CreateBorderLine(val.transform, "BorderTop", borderColor, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(2f, -3f), new Vector2(-2f, -1f)); CreateBorderLine(val.transform, "BorderBottom", borderColor, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(2f, 1f), new Vector2(-2f, 3f)); return val; } public void ClearFooter() { SulfurOptionsScreenBridge.ClearCustomPageFooter(optionsScreen); } public OptionsScreenOption AddButton(string label, Action onPressed) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown GameObject optionButtonPrefab = SulfurOptionsScreenBridge.GetOptionButtonPrefab(optionsScreen); OptionsScreenOption val = InstantiateOption(optionButtonPrefab); val.SetLabel(label ?? ""); SulfurOptionBinding sulfurOptionBinding = ((Component)val).gameObject.AddComponent<SulfurOptionBinding>(); sulfurOptionBinding.OnUse = delegate { if (onPressed != null) { onPressed(); } }; val.onButtonPressed = new OnButtonPressed(sulfurOptionBinding.InvokeUse); RegisterOption(val); return val; } public OptionsScreenOption AddButton(string label, string description, Action onPressed) { OptionsScreenOption result = AddButton(label, onPressed); AddDescription(description); return result; } public OptionsScreenOption AddInfo(string label) { GameObject val = SulfurOptionsScreenBridge.GetOptionInfoPrefab(optionsScreen); if ((Object)(object)val == (Object)null) { val = SulfurOptionsScreenBridge.GetOptionButtonPrefab(optionsScreen); } OptionsScreenOption val2 = InstantiateOption(val); val2.SetLabel(label ?? ""); RegisterOption(val2); return val2; } public OptionsScreenOption AddToggle(string label, bool value, Action<bool> onChanged) { GameObject optionBoolPrefab = SulfurOptionsScreenBridge.GetOptionBoolPrefab(optionsScreen); OptionsScreenOption val = InstantiateOption(optionBoolPrefab); val.SetLabel(label ?? ""); Toggle componentInChildren = ((Component)val).GetComponentInChildren<Toggle>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.SetIsOnWithoutNotify(value); ((UnityEventBase)componentInChildren.onValueChanged).RemoveAllListeners(); ((UnityEvent<bool>)(object)componentInChildren.onValueChanged).AddListener((UnityAction<bool>)delegate(bool state) { if (onChanged != null) { onChanged(state); } }); } val.onButtonPressed = null; RegisterOption(val); return val; } public OptionsScreenOption AddToggle(string label, string description, bool value, Action<bool> onChanged) { OptionsScreenOption result = AddToggle(label, value, onChanged); AddDescription(description); return result; } public OptionsScreenOption AddCycle(string label, IReadOnlyList<string> values, int currentIndex, Action<int, string> onChanged) { GameObject optionAlternativePrefab = SulfurOptionsScreenBridge.GetOptionAlternativePrefab(optionsScreen); OptionsScreenOption val = InstantiateOption(optionAlternativePrefab); val.SetLabel(label ?? ""); List<string> list = new List<string>(); if (values != null) { list.AddRange(values); } if (list.Count == 0) { list.Add(""); } int num = Mathf.Clamp(currentIndex, 0, list.Count - 1); TextMeshProUGUI alternativeLabelText = SulfurOptionsScreenBridge.GetAlternativeLabelText(val); if ((Object)(object)alternativeLabelText != (Object)null) { ((TMP_Text)alternativeLabelText).text = list[num]; } SulfurOptionBinding sulfurOptionBinding = ((Component)val).gameObject.AddComponent<SulfurOptionBinding>(); sulfurOptionBinding.CycleValues = list; sulfurOptionBinding.CycleIndex = num; sulfurOptionBinding.CycleLabel = alternativeLabelText; sulfurOptionBinding.OnCycleChanged = onChanged; BindCycleButtons(val, sulfurOptionBinding); sulfurOptionBinding.OnUse = null; sulfurOptionBinding.OnHorizontal = sulfurOptionBinding.MoveCycle; val.onButtonPressed = null; RegisterOption(val); return val; } public OptionsScreenOption AddCycle(string label, string description, IReadOnlyList<string> values, int currentIndex, Action<int, string> onChanged) { OptionsScreenOption result = AddCycle(label, values, currentIndex, onChanged); AddDescription(description); return result; } public OptionsScreenOption AddSlider(string label, float value, float min, float max, float step, Action<float> onChanged) { GameObject optionSliderPrefab = SulfurOptionsScreenBridge.GetOptionSliderPrefab(optionsScreen); OptionsScreenOption val = InstantiateOption(optionSliderPrefab); val.SetLabel(label ?? ""); Slider slider = ((Component)val).GetComponentInChildren<Slider>(true); TextMeshProUGUI valueText = SulfurOptionsScreenBridge.GetSliderValueText(val); if ((Object)(object)slider != (Object)null) { slider.minValue = min; slider.maxValue = max; slider.SetValueWithoutNotify(Mathf.Clamp(value, min, max)); SetSliderText(valueText, slider.value); ((UnityEventBase)slider.onValueChanged).RemoveAllListeners(); ((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float v) { SetSliderText(valueText, v); if (onChanged != null) { onChanged(v); } }); } SulfurOptionBinding sulfurOptionBinding = ((Component)val).gameObject.AddComponent<SulfurOptionBinding>(); sulfurOptionBinding.OnHorizontal = delegate(int delta) { if (!((Object)(object)slider == (Object)null)) { float num = ((step > 0f) ? step : ((max - min) / 20f)); slider.value = Mathf.Clamp(slider.value + num * (float)delta, min, max); } }; RegisterOption(val); return val; } public OptionsScreenOption AddSlider(string label, string description, float value, float min, float max, float step, Action<float> onChanged) { OptionsScreenOption result = AddSlider(label, value, min, max, step, onChanged); AddDescription(description); return result; } private TMP_InputField CreateStandaloneInputField(string name, string value, string placeholder, ContentType contentType) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_00be: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Expected O, but got Unknown //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[4] { typeof(RectTransform), typeof(LayoutElement), typeof(CanvasRenderer), typeof(Image) }); val.transform.SetParent((Transform)(object)OptionsContainer, false); RectTransform component = val.GetComponent<RectTransform>(); ApplyNativeRowRect(component, 48f); LayoutElement component2 = val.GetComponent<LayoutElement>(); component2.minHeight = 48f; component2.preferredHeight = 48f; component2.minWidth = GetNativeOptionWidth(); component2.preferredWidth = GetNativeOptionWidth(); Image component3 = val.GetComponent<Image>(); ((Graphic)component3).color = new Color(1f, 1f, 1f, 0.055f); ((Graphic)component3).raycastTarget = true; TMP_InputField val2 = val.AddComponent<TMP_InputField>(); ((Selectable)val2).targetGraphic = (Graphic)(object)component3; val2.contentType = contentType; val2.lineType = (LineType)0; val2.shouldHideMobileInput = true; val2.shouldHideSoftKeyboard = true; val2.shouldActivateOnSelect = true; val2.onFocusSelectAll = false; val2.resetOnDeActivation = false; val2.restoreOriginalTextOnEscape = false; TextMeshProUGUI val3 = FindSampleText(); TMP_FontAsset val4 = (((Object)(object)val3 != (Object)null) ? ((TMP_Text)val3).font : null); Color val5 = (((Object)(object)val3 != (Object)null) ? ((Graphic)val3).color : Color.white); float fontSize = (((Object)(object)val3 != (Object)null) ? ((TMP_Text)val3).fontSize : 22f); val2.customCaretColor = true; val2.caretColor = val5; val2.caretWidth = 2; val2.caretBlinkRate = 0.85f; val2.selectionColor = new Color(val5.r, val5.g, val5.b, 0.25f); GameObject val6 = new GameObject("TextArea", new Type[2] { typeof(RectTransform), typeof(RectMask2D) }); val6.transform.SetParent(val.transform, false); RectTransform component4 = val6.GetComponent<RectTransform>(); component4.anchorMin = Vector2.zero; component4.anchorMax = Vector2.one; component4.offsetMin = new Vector2(24f, 0f); component4.offsetMax = new Vector2(-24f, 0f); GameObject val7 = new GameObject("Text", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI) }); val7.transform.SetParent(val6.transform, false); RectTransform component5 = val7.GetComponent<RectTransform>(); component5.anchorMin = Vector2.zero; component5.anchorMax = Vector2.one; component5.offsetMin = Vector2.zero; component5.offsetMax = Vector2.zero; TextMeshProUGUI component6 = val7.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component6).text = value ?? ""; ((TMP_Text)component6).fontSize = fontSize; ((Graphic)component6).color = val5; ((TMP_Text)component6).alignment = (TextAlignmentOptions)4097; ((Graphic)component6).raycastTarget = false; ((TMP_Text)component6).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component6).overflowMode = (TextOverflowModes)0; if ((Object)(object)val4 != (Object)null) { ((TMP_Text)component6).font = val4; } GameObject val8 = new GameObject("Placeholder", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI) }); val8.transform.SetParent(val6.transform, false); RectTransform component7 = val8.GetComponent<RectTransform>(); component7.anchorMin = Vector2.zero; component7.anchorMax = Vector2.one; component7.offsetMin = Vector2.zero; component7.offsetMax = Vector2.zero; TextMeshProUGUI component8 = val8.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component8).text = placeholder ?? ""; ((TMP_Text)component8).fontSize = fontSize; ((Graphic)component8).color = new Color(val5.r, val5.g, val5.b, 0.38f); ((TMP_Text)component8).alignment = (TextAlignmentOptions)4097; ((Graphic)component8).raycastTarget = false; ((TMP_Text)component8).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component8).overflowMode = (TextOverflowModes)0; if ((Object)(object)val4 != (Object)null) { ((TMP_Text)component8).font = val4; } val2.textViewport = component4; val2.textComponent = (TMP_Text)(object)component6; val2.placeholder = (Graphic)(object)component8; val2.SetTextWithoutNotify(value ?? ""); SulfurInputCaretOverlay.Attach(val2, component6, component4, val5); SulfurTextInputBinding sulfurTextInputBinding = ((Component)val2).gameObject.AddComponent<SulfurTextInputBinding>(); sulfurTextInputBinding.Configure(val2); SulfurInputVisualState sulfurInputVisualState = ((Component)val2).gameObject.AddComponent<SulfurInputVisualState>(); sulfurInputVisualState.Configure(val2, component3); return val2; } internal TextMeshProUGUI FindSampleText() { if (sampleTextCacheInitialized) { return sampleTextCache; } sampleTextCacheInitialized = true; sampleTextCache = null; if ((Object)(object)OptionsContainer == (Object)null) { return null; } TextMeshProUGUI[] componentsInChildren = ((Component)OptionsContainer).GetComponentsInChildren<TextMeshProUGUI>(true); TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val in array) { if ((Object)(object)val != (Object)null && (Object)(object)((TMP_Text)val).font != (Object)null) { sampleTextCache = val; return sampleTextCache; } } return null; } private void ApplyNativeRowRect(RectTransform rectTransform, float height) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rectTransform == (Object)null)) { rectTransform.anchorMin = new Vector2(0f, 1f); rectTransform.anchorMax = new Vector2(0f, 1f); rectTransform.pivot = new Vector2(0f, 1f); rectTransform.anchoredPosition = Vector2.zero; rectTransform.sizeDelta = new Vector2(GetNativeOptionWidth(), height); } } internal float GetNativeOptionWidth() { //IL_004a: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (nativeOptionWidthCache > 100f) { return nativeOptionWidthCache; } GameObject optionButtonPrefab = SulfurOptionsScreenBridge.GetOptionButtonPrefab(optionsScreen); if ((Object)(object)optionButtonPrefab != (Object)null) { RectTransform component = optionButtonPrefab.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null && component.sizeDelta.x > 100f) { nativeOptionWidthCache = component.sizeDelta.x; return nativeOptionWidthCache; } } if ((Object)(object)OptionsContainer != (Object)null) { RectTransform component2 = ((Component)OptionsContainer).GetComponent<RectTransform>(); if ((Object)(object)component2 != (Object)null) { Rect rect = component2.rect; if (((Rect)(ref rect)).width > 100f) { rect = component2.rect; nativeOptionWidthCache = ((Rect)(ref rect)).width; return nativeOptionWidthCache; } } } nativeOptionWidthCache = 900f; return nativeOptionWidthCache; } private static bool TryParseNumber(string text, out float value) { value = 0f; if (string.IsNullOrWhiteSpace(text)) { return false; } string s = text.Trim().Replace(',', '.'); return float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out value); } private static float RoundNumber(float value, int decimals) { if (decimals <= 0) { return Mathf.Round(value); } float num = Mathf.Pow(10f, (float)decimals); return Mathf.Round(value * num) / num; } public void AddSection(string label) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0210: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrWhiteSpace(label)) { GameObject val = new GameObject("SULFUR_Section", new Type[2] { typeof(RectTransform), typeof(LayoutElement) }); val.transform.SetParent((Transform)(object)OptionsContainer, false); RectTransform component = val.GetComponent<RectTransform>(); ApplyNativeRowRect(component, 54f); LayoutElement component2 = val.GetComponent<LayoutElement>(); component2.minHeight = 54f; component2.preferredHeight = 54f; component2.minWidth = GetNativeOptionWidth(); component2.preferredWidth = GetNativeOptionWidth(); component2.flexibleWidth = 0f; GameObject val2 = new GameObject("SectionText", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI) }); val2.transform.SetParent(val.transform, false); RectTransform component3 = val2.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = new Vector2(12f, 0f); component3.offsetMax = new Vector2(-12f, 0f); TextMeshProUGUI val3 = FindSampleText(); TextMeshProUGUI component4 = val2.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component4).text = label; ((TMP_Text)component4).alignment = (TextAlignmentOptions)4097; ((Graphic)component4).raycastTarget = false; ((TMP_Text)component4).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component4).overflowMode = (TextOverflowModes)0; ((TMP_Text)component4).fontStyle = (FontStyles)1; if ((Object)(object)val3 != (Object)null) { ((TMP_Text)component4).font = ((TMP_Text)val3).font; ((TMP_Text)component4).fontSharedMaterial = ((TMP_Text)val3).fontSharedMaterial; ((TMP_Text)component4).fontSize = Mathf.Max(18f, ((TMP_Text)val3).fontSize * 0.95f); ((Graphic)component4).color = ((Graphic)val3).color; } else { ((TMP_Text)component4).fontSize = 20f; ((Graphic)component4).color = new Color(1f, 0.65f, 0.15f, 1f); } GameObject val4 = new GameObject("SectionLine", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val4.transform.SetParent(val.transform, false); RectTransform component5 = val4.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0f, 0f); component5.anchorMax = new Vector2(1f, 0f); component5.pivot = new Vector2(0.5f, 0.5f); component5.offsetMin = new Vector2(0f, 4f); component5.offsetMax = new Vector2(0f, 8f); Image component6 = val4.GetComponent<Image>(); if ((Object)(object)val3 != (Object)null) { ((Graphic)component6).color = new Color(((Graphic)val3).color.r, ((Graphic)val3).color.g, ((Graphic)val3).color.b, 0.85f); } else { ((Graphic)component6).color = new Color(1f, 0.65f, 0.15f, 0.85f); } ((Graphic)component6).raycastTarget = false; } } public OptionsScreenOption AddDescription(string text) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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) //IL_0220: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(text)) { return null; } GameObject val = new GameObject("Description", new Type[2] { typeof(RectTransform), typeof(LayoutElement) }); val.transform.SetParent((Transform)(object)OptionsContainer, false); RectTransform component = val.GetComponent<RectTransform>(); ApplyNativeRowRect(component, 42f); LayoutElement component2 = val.GetComponent<LayoutElement>(); component2.minHeight = 42f; component2.preferredHeight = 42f; component2.minWidth = GetNativeOptionWidth(); component2.preferredWidth = GetNativeOptionWidth(); GameObject val2 = new GameObject("DescriptionText", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI) }); val2.transform.SetParent(val.transform, false); RectTransform component3 = val2.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = new Vector2(28f, 0f); component3.offsetMax = new Vector2(-12f, 0f); TextMeshProUGUI val3 = FindSampleText(); TextMeshProUGUI component4 = val2.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component4).text = "— " + text; ((TMP_Text)component4).alignment = (TextAlignmentOptions)4097; ((Graphic)component4).raycastTarget = false; ((TMP_Text)component4).textWrappingMode = (TextWrappingModes)1; ((TMP_Text)component4).overflowMode = (TextOverflowModes)0; if ((Object)(object)val3 != (Object)null) { ((TMP_Text)component4).font = ((TMP_Text)val3).font; ((TMP_Text)component4).fontSize = Mathf.Max(14f, ((TMP_Text)val3).fontSize * 0.72f); ((Graphic)component4).color = new Color(((Graphic)val3).color.r, ((Graphic)val3).color.g, ((Graphic)val3).color.b, 0.58f); } else { ((TMP_Text)component4).fontSize = 16f; ((Graphic)component4).color = new Color(1f, 1f, 1f, 0.58f); } return null; } public void AddWarning(string text) { AddMessage(text, SulfurMessageKind.Warning); } public void AddError(string text) { AddMessage(text, SulfurMessageKind.Error); } public void AddSuccess(string text) { AddMessage(text, SulfurMessageKind.Success); } public void AddMessage(string text, SulfurMessageKind kind) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrWhiteSpace(text)) { GameObject val = new GameObject("SULFUR_Message_" + kind, new Type[4] { typeof(RectTransform), typeof(LayoutElement), typeof(CanvasRenderer), typeof(Image) }); val.transform.SetParent((Transform)(object)OptionsContainer, false); RectTransform component = val.GetComponent<RectTransform>(); ApplyNativeRowRect(component, 40f); LayoutElement component2 = val.GetComponent<LayoutElement>(); component2.minHeight = 40f; component2.preferredHeight = 40f; component2.minWidth = GetNativeOptionWidth(); component2.preferredWidth = GetNativeOptionWidth(); Image component3 = val.GetComponent<Image>(); ((Graphic)component3).color = GetMessageBackground(kind); ((Graphic)component3).raycastTarget = false; GameObject val2 = new GameObject("MessageText", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI) }); val2.transform.SetParent(val.transform, false); RectTransform component4 = val2.GetComponent<RectTransform>(); component4.anchorMin = Vector2.zero; component4.anchorMax = Vector2.one; component4.offsetMin = new Vector2(20f, 0f); component4.offsetMax = new Vector2(-20f, 0f); TextMeshProUGUI val3 = FindSampleText(); TextMeshProUGUI component5 = val2.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component5).text = GetMessagePrefix(kind) + text; ((TMP_Text)component5).alignment = (TextAlignmentOptions)4097; ((Graphic)component5).raycastTarget = false; ((TMP_Text)component5).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component5).overflowMode = (TextOverflowModes)1; if ((Object)(object)val3 != (Object)null) { ((TMP_Text)component5).font = ((TMP_Text)val3).font; ((TMP_Text)component5).fontSize = Mathf.Max(13f, ((TMP_Text)val3).fontSize * 0.66f); ((Graphic)component5).color = new Color(((Graphic)val3).color.r, ((Graphic)val3).color.g, ((Graphic)val3).color.b, 0.9f); } else { ((TMP_Text)component5).fontSize = 17f; ((Graphic)component5).color = new Color(1f, 1f, 1f, 0.9f); } } } public void AddBadgeRow(params string[] badges) { if (badges == null || badges.Length == 0) { return; } List<string> list = new List<string>(); foreach (string text in badges) { if (!string.IsNullOrWhiteSpace(text)) { list.Add(text.Trim()); } } AddBadgeRow(list); } public void AddBadgeRow(IReadOnlyList<string> badges) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown if (badges == null || badges.Count == 0) { return; } GameObject val = new GameObject("SULFUR_BadgeRow", new Type[3] { typeof(RectTransform), typeof(LayoutElement), typeof(HorizontalLayoutGroup) }); val.transform.SetParent((Transform)(object)OptionsContainer, false); RectTransform component = val.GetComponent<RectTransform>(); ApplyNativeRowRect(component, 30f); LayoutElement component2 = val.GetComponent<LayoutElement>(); component2.minHeight = 30f; component2.preferredHeight = 30f; component2.minWidth = GetNativeOptionWidth(); component2.preferredWidth = GetNativeOptionWidth(); HorizontalLayoutGroup component3 = val.GetComponent<HorizontalLayoutGroup>(); ((LayoutGroup)component3).padding = new RectOffset(24, 12, 5, 5); ((HorizontalOrVerticalLayoutGroup)component3).spacing = 8f; ((LayoutGroup)component3).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)component3).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)component3).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component3).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)component3).childForceExpandHeight = true; foreach (string badge in badges) { if (!string.IsNullOrWhiteSpace(badge)) { CreateBadge(val.transform, badge.Trim()); } } } public void AddDefaultButton(Action onPressed) { AddSmallButton("Default", onPressed); } public void AddSmallButton(string label, Action onPressed) { AddSmallButton(label, onPressed, 0f); } public void AddSmallButton(string label, Action onPressed, float minWidth) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown string label2 = (string.IsNullOrWhiteSpace(label) ? "Default" : label); float num = ((minWidth > 0f) ? minWidth : CalculateSmallButtonWidth(label2)); GameObject val = new GameObject("SULFUR_SmallButtonRow", new Type[3] { typeof(RectTransform), typeof(LayoutElement), typeof(HorizontalLayoutGroup) }); val.transform.SetParent((Transform)(object)OptionsContainer, false); RectTransform component = val.GetComponent<RectTransform>(); ApplyNativeRowRect(component, 42f); LayoutElement component2 = val.GetComponent<LayoutElement>(); component2.minHeight = 42f; component2.preferredHeight = 42f; component2.minWidth = GetNativeOptionWidth(); component2.preferredWidth = GetNativeOptionWidth(); HorizontalLayoutGroup component3 = val.GetComponent<HorizontalLayoutGroup>(); ((LayoutGroup)component3).padding = new RectOffset(12, 16, 4, 4); ((HorizontalOrVerticalLayoutGroup)component3).spacing = 8f; ((LayoutGroup)component3).childAlignment = (TextAnchor)5; ((HorizontalOrVerticalLayoutGroup)component3).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)component3).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)component3).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)component3).childForceExpandHeight = true; GameObject val2 = new GameObject("Spacer", new Type[2] { typeof(RectTransform), typeof(LayoutElement) }); val2.transform.SetParent(val.transform, false); LayoutElement component4 = val2.GetComponent<LayoutElement>(); component4.flexibleWidth = 1f; Button val3 = CreateSmallButton(val.transform, label2, onPressed); if ((Object)(object)val3 != (Object)null) { LayoutElement component5 = ((Component)val3).GetComponent<LayoutElement>(); if ((Object)(object)component5 != (Object)null) { component5.minWidth = num; component5.preferredWidth = num; } } } private static float CalculateSmallButtonWidth(string label) { if (string.IsNullOrWhiteSpace(label)) { return 96f; } int length = label.Trim().Length; return Mathf.Clamp(72f + (float)length * 14f, 96f, 180f); } public void AddSpacer(float height = 20f) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown GameObject val = new GameObject("SULFUR_Spacer", new Type[2] { typeof(RectTransform), typeof(LayoutElement) }); val.transform.SetParent((Transform)(object)OptionsContainer, false); LayoutElement component = val.GetComponent<LayoutElement>(); component.minHeight = Mathf.Max(0f, height); component.preferredHeight = Mathf.Max(0f, height); component.flexibleHeight = 0f; } public OptionsScreenOption AddReadonlyText(string label, string value) { string text = (string.IsNullOrWhiteSpace(value) ? (label ?? "") : (label + ": " + value)); return AddDescription(text); } public OptionsScreenOption AddTextInput(string label, string value, Action<string> onChanged) { return AddTextInput(label, null, value, onChanged); } public OptionsScreenOption AddTextInput(string label, string description, string value, Action<string> onChanged) { OptionsScreenOption result = AddInfo(label); AddDescription(description); TMP_InputField val = CreateStandaloneInputField("TextInput_" + label, value ?? "", "Enter text...", (ContentType)0); ((UnityEventBase)val.onValueChanged).RemoveAllListeners(); ((UnityEvent<string>)(object)val.onValueChanged).AddListener((UnityAction<string>)delegate(string text) { if (onChanged != null) { onChanged(text); } }); return result; } public OptionsScreenOption AddNumberInput(string label, float value, float min, float max, int decimals, Action<float> onChanged) { return AddNumberInput(label, null, value, min, max, decimals, onChanged); } public OptionsScreenOption AddNumberInput(string label, string description, float value, float min, float max, int decimals, Action<float> onChanged) { OptionsScreenOption result = AddInfo(label); AddDescription(description); TMP_InputField input = CreateStandaloneInputField("NumberInput_" + label, FormatNumber(value, decimals), "Enter number...", (ContentType)3); ((UnityEventBase)input.onEndEdit).RemoveAllListeners(); ((UnityEvent<string>)(object)input.onEndEdit).AddListener((UnityAction<string>)delegate(string text) { if (!TryParseNumber(text, out var value2)) { input.SetTextWithoutNotify(FormatNumber(value, decimals)); } else { value2 = Mathf.Clamp(value2, min, max); value2 = RoundNumber(value2, decimals); input.SetTextWithoutNotify(FormatNumber(value2, decimals)); if (onChanged != null) { onChanged(value2); } } }); return result; } private OptionsScreenOption AddTextInputInternal(string label, string value, string placeholder, ContentType contentType, Action<string> onChanged, Action<string> onEndEdit) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return AddTextInputInternal(label, value, placeholder, contentType, onChanged, onEndEdit, null); } private OptionsScreenOption AddTextInputInternal(string label, string value, string placeholder, ContentType contentType, Action<string> onChanged, Action<string> onEndEdit, Action<TMP_InputField> afterCreate) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown GameObject optionButtonPrefab = SulfurOptionsScreenBridge.GetOptionButtonPrefab(optionsScreen); OptionsScreenOption val = InstantiateOption(optionButtonPrefab); val.SetLabel(label ?? ""); TMP_InputField input = CreateInputFieldOnOption(val, value ?? "", placeholder ?? "", contentType); SulfurTextInputBinding sulfurTextInputBinding = ((Component)input).gameObject.AddComponent<SulfurTextInputBinding>(); sulfurTextInputBinding.Configure(input); ((UnityEventBase)input.onValueChanged).RemoveAllListeners(); ((UnityEvent<string>)(object)input.onValueChanged).AddListener((UnityAction<string>)delegate(string text) { if (onChanged != null) { onChanged(text); } }); ((UnityEventBase)input.onEndEdit).RemoveAllListeners(); ((UnityEvent<string>)(object)input.onEndEdit).AddListener((UnityAction<string>)delegate(string text) { if (onEndEdit != null) { onEndEdit(text); } }); val.onButtonPressed = (OnButtonPressed)delegate { if ((Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)input).gameObject); } input.ActivateInputField(); }; afterCreate?.Invoke(input); RegisterOption(val); return val; } private TMP_InputField CreateInputFieldOnOption(OptionsScreenOption option, string value, string placeholder, ContentType contentType) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0079: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) RectTransform component = ((Component)option).GetComponent<RectTransform>(); TextMeshProUGUI optionLabelText = SulfurOptionsScreenBridge.GetOptionLabelText(option); GameObject val = new GameObject("SULFUR_TMP_InputField", new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(TMP_InputField) }); val.transform.SetParent(((Component)option).transform, false); RectTransform component2 = val.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.52f, 0.18f); component2.anchorMax = new Vector2(0.98f, 0.82f); component2.pivot = new Vector2(0.5f, 0.5f); component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; Image component3 = val.GetComponent<Image>(); ((Graphic)component3).color = new Color(1f, 1f, 1f, 0.08f); ((Graphic)component3).raycastTarget = true; GameObject val2 = new GameObject("Text Area", new Type[2] { typeof(RectTransform), typeof(RectMask2D) }); val2.transform.SetParent(val.transform, false); RectTransform component4 = val2.GetComponent<RectTransform>(); component4.anchorMin = Vector2.zero; component4.anchorMax = Vector2.one; component4.offsetMin = new Vector2(8f, 2f); component4.offsetMax = new Vector2(-8f, -2f); TextMeshProUGUI val3 = CreateInputText(val2.transform, "Placeholder", placeholder, optionLabelText); ((Graphic)val3).color = new Color(1f, 1f, 1f, 0.35f); ((TMP_Text)val3).fontStyle = (FontStyles)2; TextMeshProUGUI val4 = CreateInputText(val2.transform, "Text", value, optionLabelText); ((Graphic)val4).color = (((Object)(object)optionLabelText != (Object)null) ? ((Graphic)optionLabelText).color : Color.white); TMP_InputField component5 = val.GetComponent<TMP_InputField>(); component5.textViewport = component4; component5.textComponent = (TMP_Text)(object)val4; component5.placeholder = (Graphic)(object)val3; ((Selectable)component5).targetGraphic = (Graphic)(object)component3; component5.contentType = contentType; component5.lineType = (LineType)0; component5.shouldActivateOnSelect = true; component5.onFocusSelectAll = false; component5.resetOnDeActivation = false; component5.restoreOriginalTextOnEscape = false; component5.SetTextWithoutNotify(value ?? ""); return component5; } private TextMeshProUGUI CreateInputText(Transform parent, string name, string text, TextMeshProUGUI template) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_010c: 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) GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; TextMeshProUGUI component2 = val.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component2).text = text ?? ""; ((Graphic)component2).raycastTarget = false; ((TMP_Text)component2).alignment = (TextAlignmentOptions)4097; ((TMP_Text)component2).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component2).overflowMode = (TextOverflowModes)0; if ((Object)(object)template != (Object)null) { ((TMP_Text)component2).font = ((TMP_Text)template).font; ((TMP_Text)component2).fontSharedMaterial = ((TMP_Text)template).fontSharedMaterial; ((TMP_Text)component2).fontSize = ((TMP_Text)template).fontSize; ((Graphic)component2).color = ((Graphic)template).color; } else { ((TMP_Text)component2).fontSize = 20f; ((Graphic)component2).color = Color.white; } return component2; } [IteratorStateMachine(typeof(<GetChildrenFrom>d__63))] internal IEnumerable<Transform> GetChildrenFrom(int startIndex) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GetChildrenFrom>d__63(-2) { <>4__this = this, <>3__startIndex = startIndex }; } internal int GetChildCount() { return ((Object)(object)OptionsContainer != (Object)null) ? ((Transform)OptionsContainer).childCount : 0; } private OptionsScreenOption InstantiateOption(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { throw new InvalidOperationException("Option prefab is null."); } GameObject val = Object.Instantiate<GameObject>(prefab, (Transform)(object)OptionsContainer); val.SetActive(true); OptionsScreenOption component = val.GetComponent<OptionsScreenOption>(); if ((Object)(object)component == (Object)null) { throw new InvalidOperationException("Instantiated prefab does not contain OptionsScreenOption."); } return component; } private void RegisterOption(OptionsScreenOption option) { if (!((Object)(object)option == (Object)null)) { nativeOptions.Add(option); } } private static void BindCycleButtons(OptionsScreenOption option, SulfurOptionBinding binding) { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown if ((Object)(object)option == (Object)null || (Object)(object)binding == (Object)null) { return; } Button[] componentsInChildren = ((Component)option).GetComponentsInChildren<Button>(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return; } List<Button> list = new List<Button>(); Button[] array = componentsInChildren; foreach (Button val in array) { if (!((Object)(object)val == (Object)null)) { list.Add(val); } } if (list.Count == 0) { return; } list.Sort(delegate(Button a, Button b) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) RectTransform component = ((Component)a).GetComponent<RectTransform>(); RectTransform component2 = ((Component)b).GetComponent<RectTransform>(); float num = (((Object)(object)component != (Object)null) ? component.anchoredPosition.x : 0f); float value = (((Object)(object)component2 != (Object)null) ? component2.anchoredPosition.x : 0f); return num.CompareTo(value); }); for (int j = 0; j < list.Count; j++) { Button button = list[j]; int direction = DetectCycleButtonDirection(button, j, list.Count); ReplaceButtonClick(button, (UnityAction)delegate { binding.MoveCycle(direction); }); } } private static int DetectCycleButtonDirection(Button button, int index, int count) { if ((Object)(object)button != (Object)null) { string text = ((Object)((Component)button).gameObject).name.ToLowerInvariant(); if (text.Contains("left") || text.Contains("prev") || text.Contains("previous") || text.Contains("minus")) { return -1; } if (text.Contains("right") || text.Contains("next") || text.Contains("plus")) { return 1; } } if (count <= 1) { return 1; } return (index != 0) ? 1 : (-1); } private static void ReplaceButtonClick(Button button, UnityAction action) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!((Object)(object)button == (Object)null)) { button.onClick = new ButtonClickedEvent(); if (action != null) { ((UnityEvent)button.onClick).AddListener(action); } } } private void CreateBadge(Transform parent, string text) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0251: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = FindSampleText(); GameObject val2 = new GameObject("Badge_" + text, new Type[4] { typeof(RectTransform), typeof(LayoutElement), typeof(CanvasRenderer), typeof(Image) }); val2.transform.SetParent(parent, false); Image component = val2.GetComponent<Image>(); ((Graphic)component).color = new Color(1f, 1f, 1f, 0.08f); ((Graphic)component).raycastTarget = false; LayoutElement component2 = val2.GetComponent<LayoutElement>(); component2.minWidth = Mathf.Clamp((float)text.Length * 9f + 26f, 70f, 220f); component2.preferredWidth = component2.minWidth; component2.minHeight = 26f; component2.preferredHeight = 26f; GameObject val3 = new GameObject("Label", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI) }); val3.transform.SetParent(val2.transform, false); RectTransform component3 = val3.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = new Vector2(8f, 0f); component3.offsetMax = new Vector2(-8f, 0f); TextMeshProUGUI component4 = val3.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component4).text = text; ((TMP_Text)component4).alignment = (TextAlignmentOptions)514; ((Graphic)component4).raycastTarget = false; ((TMP_Text)component4).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component4).overflowMode = (TextOverflowModes)1; if ((Object)(object)val != (Object)null) { ((TMP_Text)component4).font = ((TMP_Text)val).font; ((TMP_Text)component4).fontSize = Mathf.Max(11f, ((TMP_Text)val).fontSize * 0.52f); ((Graphic)component4).color = new Color(((Graphic)val).color.r, ((Graphic)val).color.g, ((Graphic)val).color.b, 0.82f); } else { ((TMP_Text)component4).fontSize = 14f; ((Graphic)component4).color = new Color(1f, 1f, 1f, 0.82f); } } private Button CreateSmallButton(Transform parent, string label, Action onPressed) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SULFUR_SmallButton", new Type[5] { typeof(RectTransform), typeof(LayoutElement), typeof(CanvasRenderer), typeof(Image), typeof(Button) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(120f, 34f); LayoutElement component2 = val.GetComponent<LayoutElement>(); component2.minHeight = 34f; component2.preferredHeight = 34f; component2.minWidth = 120f; component2.preferredWidth = 120f; Image component3 = val.GetComponent<Image>(); ((Graphic)component3).color = new Color(1f, 1f, 1f, 0.08f); ((Graphic)component3).raycastTarget = true; Button component4 = val.GetComponent<Button>(); ((Selectable)component4).targetGraphic = (Graphic)(object)component3; ((Selectable)component4).transition = (Transition)1; ((UnityEventBase)component4.onClick).RemoveAllListeners(); if (onPressed != null) { ((UnityEvent)component4.onClick).AddListener(new UnityAction(onPressed.Invoke)); } GameObject val2 = new GameObject("Text", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI) }); val2.transform.SetParent(val.transform, false); RectTransform component5 = val2.GetComponent<RectTransform>(); component5.anchorMin = Vector2.zero; component5.anchorMax = Vector2.one; component5.offsetMin = new Vector2(8f, 0f); component5.offsetMax = new Vector2(-8f, 0f); TextMeshProUGUI val3 = FindSampleText(); TextMeshProUGUI component6 = val2.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component6).text = label ?? ""; ((TMP_Text)component6).alignment = (TextAlignmentOptions)4098; ((Graphic)component6).raycastTarget = false; ((TMP_Text)component6).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component6).overflowMode = (TextOverflowModes)1; if ((Object)(object)val3 != (Object)null) { ((TMP_Text)component6).font = ((TMP_Text)val3).font; ((TMP_Text)component6).fontSharedMaterial = ((TMP_Text)val3).fontSharedMaterial; ((TMP_Text)component6).fontSize = Mathf.Max(13f, ((TMP_Text)val3).fontSize * 0.62f); ((Graphic)component6).color = ((Graphic)val3).color; } else { ((TMP_Text)component6).fontSize = 16f; ((Graphic)component6).color = Color.white; } return component4; } private static Color GetMessageBackground(SulfurMessageKind kind) { //IL_002f: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_006c: 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_0083: 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) return (Color)(kind switch { SulfurMessageKind.Warning => new Color(1f, 0.72f, 0.18f, 0.12f), SulfurMessageKind.Error => new Color(1f, 0.18f, 0.18f, 0.12f), SulfurMessageKind.Success => new Color(0.28f, 1f, 0.46f, 0.1f), _ => new Color(1f, 1f, 1f, 0.06f), }); } private static string GetMessagePrefix(SulfurMessageKind kind) { return kind switch { SulfurMessageKind.Warning => "WARNING: ", SulfurMessageKind.Error => "ERROR: ", SulfurMessageKind.Success => "OK: ", _ => "", }; } private static void SetFirstText(GameObject root, string text) { if (!((Object)(object)root == (Object)null)) { TextMeshProUGUI componentInChildren = root.GetComponentInChildren<TextMeshProUGUI>(true); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).text = text ?? ""; } } } private static void SetSliderText(TextMeshProUGUI text, float value) { if ((Object)(object)text != (Object)null) { ((TMP_Text)text).text = value.ToString("0.###", CultureInfo.InvariantCulture); } } private static bool TryParseFloat(string text, out float value) { if (float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out value)) { return true; } return float.TryParse(text, NumberStyles.Float, CultureInfo.CurrentCulture, out value); } private static string FormatNumber(float value, int decimals) { if (decimals <= 0) { return Mathf.RoundToInt(value).ToString(CultureInfo.InvariantCulture); } string text = "0." + new string('#', decimals); return value.ToString(text, CultureInfo.InvariantCulture); } } public enum SulfurFoldoutStyle { Plugin, Section, Group } public static class SulfurOptionsFoldoutExtensions { public static bool AddFoldout(this SulfurOptionsContext ctx, string key, string label, bool defaultExpanded) { return AddStyledFoldout(ctx, key, label, defaultExpanded, forceExpanded: false, null, SulfurFoldoutStyle.Section); } public static bool AddFoldout(this SulfurOptionsContext ctx, string key, string label, bool defaultExpanded, bool forceExpanded) { return AddStyledFoldout(ctx, key, label, defaultExpanded, forceExpanded, null, SulfurFoldoutStyle.Section); } public static bool AddFoldout(this SulfurOptionsContext ctx, string key, string label, bool defaultExpanded, bool forceExpanded, string description) { return AddStyledFoldout(ctx, key, label, defaultExpanded, forceExpanded, description, SulfurFoldoutStyle.Section); } public s