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.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using ModSettingsMenu.Api; using ModSettingsMenu.Configuration; using ModSettingsMenu.Localization; using ModSettingsMenu.Runtime; using ShiftAtMidnightLocalizationAPI.Api; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ModSettingsMenu")] [assembly: AssemblyDescription("Mod Settings Menu mod for Shift At Midnight by Ice Box Studio")] [assembly: AssemblyCompany("Ice Box Studio")] [assembly: AssemblyProduct("ModSettingsMenu")] [assembly: AssemblyCopyright("Copyright © 2026 Ice Box Studio All rights reserved.")] [assembly: ComVisible(false)] [assembly: Guid("6d512f55-e9ee-445c-9fb4-93ed6c1ef50a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("1.0.0.0")] namespace ModSettingsMenu { [BepInPlugin("IceBoxStudio.ShiftAtMidnight.ModSettingsMenu", "ModSettingsMenu", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ModSettingsMenu : BasePlugin { public static ModSettingsMenu _Instance; private Harmony _harmony; public static ModSettingsMenu Instance => _Instance; internal static ManualLogSource Logger { get; private set; } public override void Load() { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown _Instance = this; Logger = ((BasePlugin)this).Log; LocalizationApi.LanguageChanged += OnLanguageChanged; ModSettingsRegistry.RefreshRequested += ModSettingsMenuController.RefreshLocalizedText; bool flag = default(bool); try { Logger.LogInfo((object)"============================================="); ManualLogSource logger = Logger; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(1, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("ModSettingsMenu"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(I18n.Text("plugin.initializing")); } logger.LogInfo(val); ManualLogSource logger2 = Logger; val = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(I18n.Text("plugin.author_prefix")); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Ice Box Studio(https://steamcommunity.com/id/ibox666/)"); } logger2.LogInfo(val); _harmony = new Harmony("IceBoxStudio.ShiftAtMidnight.ModSettingsMenu"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); ManualLogSource logger3 = Logger; val = new BepInExInfoLogInterpolatedStringHandler(1, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("ModSettingsMenu"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(I18n.Text("plugin.initialized")); } logger3.LogInfo(val); Logger.LogInfo((object)"============================================="); } catch (Exception ex) { ManualLogSource logger4 = Logger; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to initialize Mod Settings Menu: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex); } logger4.LogError(val2); } } private static void OnLanguageChanged(string _) { ModSettingsMenuController.RefreshLocalizedText(); } } public static class PluginInfo { public const string PLUGIN_GUID = "IceBoxStudio.ShiftAtMidnight.ModSettingsMenu"; public const string PLUGIN_NAME = "ModSettingsMenu"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace ModSettingsMenu.Runtime { internal sealed class ConfigRows { private readonly Transform _content; private readonly GameObject _slider; private readonly GameObject _toggle; private readonly GameObject _dropdown; private readonly GameObject _input; private readonly GameObject _keybind; private readonly KeybindCapture _keybindCapture; private readonly DescriptionLayout _description; private readonly ModInfoRow _modInfo; private readonly List _createdRows = new List(); public ConfigRows(Transform content, GameObject slider, GameObject toggle, GameObject dropdown, GameObject input, GameObject keybind, KeybindCapture keybindCapture, DescriptionLayout description, ModInfoRow modInfo) { _content = content; _slider = slider; _toggle = toggle; _dropdown = dropdown; _input = input; _keybind = keybind; _keybindCapture = keybindCapture; _description = description; _modInfo = modInfo; } public void Build(ModConfig mod) { ClearRows(); if (mod == null) { CreateHeading(I18n.Text("menu.no_configurable_mods")); } else { AddModInfo(mod); foreach (ConfigEntryBase item in mod.ConfigFile.Values.OrderBy((ConfigEntryBase entry) => entry.Definition.Section, StringComparer.OrdinalIgnoreCase).ThenBy((ConfigEntryBase entry) => entry.Definition.Key, StringComparer.OrdinalIgnoreCase).ToList()) { CreateEntryRow(item); } } LayoutRebuild(); } private void ClearRows() { foreach (GameObject createdRow in _createdRows) { if ((Object)(object)createdRow != (Object)null) { createdRow.SetActive(false); Object.Destroy((Object)(object)createdRow); } } _createdRows.Clear(); } private void CreateHeading(string text) { GameObject val = NewRow(_slider, "Mod Settings Heading"); string[] array = new string[2] { "Slider", "Value" }; foreach (string text2 in array) { Transform val2 = val.transform.Find(text2); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(false); } } NativeUi.SetRowTitle(val, text); CompleteRow(val); } private void CreateEntryRow(ConfigEntryBase entry) { Type settingType = entry.SettingType; ConfigDescription description = entry.Description; AcceptableValueBase acceptable = ((description != null) ? description.AcceptableValues : null); IReadOnlyList values; float min; float max; if (settingType == typeof(bool)) { CreateBoolRow(entry); } else if (settingType == typeof(KeyCode)) { CreateKeybindRow(entry); } else if (settingType.IsEnum) { CreateDropdownRow(entry, Enum.GetValues(settingType).Cast().ToList()); } else if (ConfigValues.TryGetAcceptableValues(acceptable, out values)) { CreateDropdownRow(entry, values); } else if (ConfigValues.TryGetNumericRange(acceptable, out min, out max) && ConfigValues.IsSliderType(settingType)) { CreateSliderRow(entry, min, max); } else { CreateInputRow(entry); } } private void CreateBoolRow(ConfigEntryBase entry) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown GameObject val = NewRow(_toggle, GetRowName(entry)); Toggle toggle = val.GetComponentInChildren(true); if ((Object)(object)toggle == (Object)null) { Object.Destroy((Object)(object)val); CreateInputRow(entry); return; } toggle.onValueChanged = new ToggleEvent(); toggle.SetIsOnWithoutNotify((bool)entry.BoxedValue); ((UnityEvent)(object)toggle.onValueChanged).AddListener(DelegateSupport.ConvertDelegate>((Delegate)(Action)delegate(bool value) { if (!ConfigValues.TrySetValue(entry, value)) { toggle.SetIsOnWithoutNotify((bool)entry.BoxedValue); } })); NativeUi.SetRowTitle(val, entry.Definition.Key); _description.Apply(val, entry, 6f); NativeUi.CenterControl(((Component)toggle).GetComponent()); CompleteRow(val); } private void CreateKeybindRow(ConfigEntryBase entry) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown GameObject val = NewRow(_keybind, GetRowName(entry)); Button button = val.GetComponentInChildren