using System; 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 IceBoxModLib.Config; using IceBoxModLib.Localization; using IceBoxModLib.Runtime; using IceBoxModLib.Utilities; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using ModConfigManager.Api; using ModConfigManager.Configuration; using ModConfigManager.Localization; using ModConfigManager.UI; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ModConfigManager")] [assembly: AssemblyDescription("Mod Config Manager mod for Roadside Research by Ice Box Studio")] [assembly: AssemblyCompany("Ice Box Studio")] [assembly: AssemblyProduct("ModConfigManager")] [assembly: AssemblyCopyright("Copyright © 2026 Ice Box Studio All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("bef278ca-3862-4551-be34-16cb6c2963a8")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("1.0.1.0")] namespace ModConfigManager { [BepInPlugin("IceBoxStudio.RoadsideResearch.ModConfigManager", "ModConfigManager", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ModConfigManager : BasePlugin { private static bool _uiControllerTypeRegistered; public static ModConfigManager Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal ConfigEntry ToggleManagerKey => ConfigManager.Instance?.ToggleManagerKey; public override void Load() { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown Instance = this; Logger = ((BasePlugin)this).Log; bool flag = default(bool); try { ((BasePlugin)this).Log.LogInfo((object)"============================================="); ManualLogSource log = ((BasePlugin)this).Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(1, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("ModConfigManager"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(LocalizationManager.Instance.GetLocalizedText("plugin.initializing")); } log.LogInfo(val); ManualLogSource log2 = ((BasePlugin)this).Log; val = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(LocalizationManager.Instance.GetLocalizedText("plugin.author_prefix")); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Ice Box Studio(https://steamcommunity.com/id/ibox666/)"); } log2.LogInfo(val); ConfigManager.Initialize(((BasePlugin)this).Config); RegisterSelfToApi(); ModConfigManagerUI.Initialize(); EnsureUiControllerLoaded(); ManualLogSource log3 = ((BasePlugin)this).Log; val = new BepInExInfoLogInterpolatedStringHandler(1, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("ModConfigManager"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(LocalizationManager.Instance.GetLocalizedText("plugin.initialized")); } log3.LogInfo(val); ((BasePlugin)this).Log.LogInfo((object)"============================================="); } catch (Exception ex) { ManualLogSource log4 = ((BasePlugin)this).Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(9, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted("ModConfigManager"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" 初始化错误: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("\n"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.StackTrace); } log4.LogError(val2); } } private void RegisterSelfToApi() { ModConfigManagerAPI.RegisterPluginInfo("IceBoxStudio.RoadsideResearch.ModConfigManager", LocalizationManager.Instance.GetLocalizedText("ui.title"), "1.0.1", "Ice Box Studio", LocalizationManager.Instance.GetLocalizedText("plugin.description")); } private static void EnsureUiControllerLoaded() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (!_uiControllerTypeRegistered) { Il2CppTypeRegistry.RegisterType(); _uiControllerTypeRegistered = true; } GameObject val = GameObject.Find("ModConfigManager_UI"); if ((Object)(object)val == (Object)null) { val = new GameObject("ModConfigManager_UI"); } Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } } } public class ModConfigManagerUIController : MonoBehaviour { private GameObject _blockerCanvasGO; public ModConfigManagerUIController(IntPtr pointer) : base(pointer) { } private void Awake() { ((Object)this).hideFlags = (HideFlags)61; if ((Object)(object)_blockerCanvasGO == (Object)null) { CreateBlockerCanvas(); } } private void CreateBlockerCanvas() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) _blockerCanvasGO = new GameObject("ModConfigManager_UIBlockerCanvas"); Object.DontDestroyOnLoad((Object)(object)_blockerCanvasGO); ((Object)_blockerCanvasGO).hideFlags = (HideFlags)61; Canvas obj = _blockerCanvasGO.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 32767; _blockerCanvasGO.AddComponent(); Image obj2 = _blockerCanvasGO.AddComponent(); ((Graphic)obj2).color = new Color(0f, 0f, 0f, 0f); ((Graphic)obj2).raycastTarget = true; RectTransform rectTransform = ((Graphic)obj2).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; _blockerCanvasGO.SetActive(false); } private void Update() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) MainMenuButtonInjector.Update(); ModConfigManager instance = ModConfigManager.Instance; if (KeyboardInputHelper.WasKeyPressed((KeyCode)((instance == null || instance.ToggleManagerKey == null) ? 282 : ((int)instance.ToggleManagerKey.Value)))) { ModConfigManagerUI.Toggle(); } if ((Object)(object)_blockerCanvasGO != (Object)null && _blockerCanvasGO.activeSelf != ModConfigManagerUI.IsWindowVisible) { _blockerCanvasGO.SetActive(ModConfigManagerUI.IsWindowVisible); } } private void OnGUI() { ModConfigManagerUI.OnGUI(); } } public static class PluginInfo { public const string PLUGIN_GUID = "IceBoxStudio.RoadsideResearch.ModConfigManager"; public const string PLUGIN_NAME = "ModConfigManager"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace ModConfigManager.UI { internal static class MainMenuButtonInjector { private const string MenuButtonsPath = "MenuCanvas/Main/MainMenuButtons"; private const string OptionsButtonName = "Button_Base_Menu_Main_Left_Options"; private const string OptionsButtonPath = "MenuCanvas/Main/MainMenuButtons/Button_Base_Menu_Main_Left_Options"; private const string InjectedButtonName = "Button_Base_Menu_Main_Left_ModConfigManager"; private static GameObject _injectedButton; private static float _nextScanTime; public static void Update() { if ((Object)(object)_injectedButton != (Object)null) { SyncLabel(); } else if (!(Time.unscaledTime < _nextScanTime)) { _nextScanTime = Time.unscaledTime + 1f; TryInject(); } } private static void TryInject() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown try { GameObject val = FindExistingButton(); if ((Object)(object)val != (Object)null) { _injectedButton = val; return; } Button val2 = FindOptionsButton(); if (!((Object)(object)val2 == (Object)null)) { CreateButton(val2); } } catch (Exception ex) { ManualLogSource logger = ModConfigManager.Logger; if (logger != null) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Main menu button: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex.Message); } logger.LogWarning(val3); } } } private static GameObject FindExistingButton() { GameObject[] array = Il2CppArrayBase.op_Implicit(Resources.FindObjectsOfTypeAll()); foreach (GameObject val in array) { if ((Object)(object)val != (Object)null && ((Object)val).name == "Button_Base_Menu_Main_Left_ModConfigManager" && IsLoadedSceneObject(val)) { return val; } } return null; } private static Button FindOptionsButton() { GameObject val = GameObject.Find("MenuCanvas/Main/MainMenuButtons/Button_Base_Menu_Main_Left_Options"); if ((Object)(object)val != (Object)null && IsLoadedSceneObject(val)) { Button component = val.GetComponent