Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of CruiserRadioSelector v1.3.0
BepInEx/Plugins/CruiserRadioSelector/CruiserRadioSelector.dll
Decompiled 5 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CruiserRadioSelector")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CruiserRadioSelector")] [assembly: AssemblyTitle("CruiserRadioSelector")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } } namespace CruiserRadioSelector { [BepInPlugin("Potatoh.CruiserRadioSelector", "Cruiser Radio Selector", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; private int currentPage = 0; internal static VehicleController? CachedCar; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Cruiser Radio Selector loaded!"); } private void Update() { if (!Application.isPlaying) { return; } if ((Object)(object)CachedCar == (Object)null || (Object)(object)((Component)CachedCar).gameObject == (Object)null) { CachedCar = Object.FindObjectOfType<VehicleController>(); } Keyboard current = Keyboard.current; if (current == null) { return; } if (((ButtonControl)current.vKey).wasPressedThisFrame) { NextPage(); } else if (((ButtonControl)current.cKey).isPressed) { if (((ButtonControl)current.digit1Key).wasPressedThisFrame) { TrySetTrack(currentPage * 10); } if (((ButtonControl)current.digit2Key).wasPressedThisFrame) { TrySetTrack(currentPage * 10 + 1); } if (((ButtonControl)current.digit3Key).wasPressedThisFrame) { TrySetTrack(currentPage * 10 + 2); } if (((ButtonControl)current.digit4Key).wasPressedThisFrame) { TrySetTrack(currentPage * 10 + 3); } if (((ButtonControl)current.digit5Key).wasPressedThisFrame) { TrySetTrack(currentPage * 10 + 4); } if (((ButtonControl)current.digit6Key).wasPressedThisFrame) { TrySetTrack(currentPage * 10 + 5); } if (((ButtonControl)current.digit7Key).wasPressedThisFrame) { TrySetTrack(currentPage * 10 + 6); } if (((ButtonControl)current.digit8Key).wasPressedThisFrame) { TrySetTrack(currentPage * 10 + 7); } if (((ButtonControl)current.digit9Key).wasPressedThisFrame) { TrySetTrack(currentPage * 10 + 8); } if (((ButtonControl)current.digit0Key).wasPressedThisFrame) { TrySetTrack(currentPage * 10 + 9); } } } private void NextPage() { VehicleController cachedCar = CachedCar; if (!((Object)(object)cachedCar == (Object)null) && cachedCar.radioClips != null && cachedCar.radioClips.Length != 0) { int num = 10; int num2 = Mathf.CeilToInt((float)cachedCar.radioClips.Length / (float)num); currentPage++; if (currentPage >= num2) { currentPage = 0; } Log.LogInfo((object)$"Cruiser Radio Selector page: {currentPage + 1}/{num2}"); } } private static void TrySetTrack(int index) { VehicleController cachedCar = CachedCar; if ((Object)(object)cachedCar == (Object)null) { Log.LogWarning((object)"VehicleController not found."); return; } if (cachedCar.radioClips == null || cachedCar.radioClips.Length == 0) { Log.LogWarning((object)"No radio clips found on cruiser."); return; } if (index < 0 || index >= cachedCar.radioClips.Length) { Log.LogWarning((object)$"Track index {index} is out of range. Tracks count: {cachedCar.radioClips.Length}"); return; } int num = 3; Log.LogInfo((object)$"Setting cruiser radio track: {index + 1}/{cachedCar.radioClips.Length}"); cachedCar.SetRadioStationServerRpc(index, num); } private void OnGUI() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current == null || !((ButtonControl)current.cKey).isPressed) { return; } VehicleController cachedCar = CachedCar; if ((Object)(object)cachedCar == (Object)null || cachedCar.radioClips == null || cachedCar.radioClips.Length == 0) { return; } int num = 10; int num2 = Mathf.CeilToInt((float)cachedCar.radioClips.Length / (float)num); currentPage = Mathf.Clamp(currentPage, 0, Mathf.Max(0, num2 - 1)); GUI.Box(new Rect(20f, 80f, 460f, 350f), ""); GUI.Label(new Rect(35f, 95f, 420f, 25f), $"Cruiser Radio Selector | Page {currentPage + 1}/{num2}"); GUI.Label(new Rect(35f, 120f, 420f, 25f), "Hold C + 1-9/0 - select track | V - next page"); for (int i = 0; i < num; i++) { int num3 = currentPage * num + i; if (num3 >= cachedCar.radioClips.Length) { break; } string arg = ((i == 9) ? "0" : (i + 1).ToString()); string arg2 = (((Object)(object)cachedCar.radioClips[num3] != (Object)null) ? ((Object)cachedCar.radioClips[num3]).name : "Unknown"); GUI.Label(new Rect(35f, (float)(155 + i * 25), 420f, 25f), $"C + {arg} | {num3 + 1}. {arg2}"); } } } }