Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of AudioController v1.0.1
AudioController.dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; 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: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")] [assembly: AssemblyCompany("AudioController")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AudioController")] [assembly: AssemblyTitle("AudioController")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AudioController { [BepInPlugin("com.maxgamertyper1.audiocontroller", "Audio Controller", "1.0.1")] public class AudioController : BaseUnityPlugin { public static string CustomSongsPath = Path.Combine(Paths.ConfigPath, "CustomSongs"); internal static ConfigFile config; internal static ConfigEntry<bool> OverrideOtherSongs; internal static ConfigEntry<bool> LoadCustomSongs; private void Log(string message) { ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } private void Awake() { Log("Plugin AudioController is loaded!"); DoPatching(); CharacterSelectHandler_online.clientSideMods_you_can_increment_this_to_enable_matchmaking_for_your_mods__please_dont_use_it_to_cheat_thats_really_cringe_especially_if_its_desyncing_others___you_didnt_even_win_on_your_opponents_screen___I_cannot_imagine_a_sadder_existence++; if (!Directory.Exists(CustomSongsPath)) { Directory.CreateDirectory(CustomSongsPath); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Created custom folder at: " + CustomSongsPath)); } config = ((BaseUnityPlugin)this).Config; OverrideOtherSongs = config.Bind<bool>("Songs", "Override Vanilla Songs", false, "Determines if Custom Songs will override the vanilla songs, removes the vanilla songs"); LoadCustomSongs = config.Bind<bool>("Songs", "Load Custom Songs", true, "Determines if Custom Songs will be loaded"); if (LoadCustomSongs.Value) { SongLoader.CustomSongsToSongs(); } } private void DoPatching() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony harmony = new Harmony("com.maxgamertyper1.audiocontroller"); Patch(harmony, typeof(AudioManager), "OnMatchStarted", "OnMatchStartedPrefix", prefix: true, transpiler: false); Patch(harmony, typeof(AudioSource), "Play", "OnSongStartPlaying", prefix: false, transpiler: false); } private void OnDestroy() { Log("Bye Bye From AudioController"); } public static Stream GetResourceStream(string path) { return Assembly.GetExecutingAssembly().GetManifestResourceStream("AudioController." + path); } public static Texture2D GetTextureFromPng(string path) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown using Stream stream = GetResourceStream(path); using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); byte[] array = memoryStream.ToArray(); Texture2D val = new Texture2D(400, 400, (TextureFormat)4, false); ((Object)val).name = path; ImageConversion.LoadImage(val, array); return val; } private void Update() { try { AudioSource musicPlayer = AudioManager.Get().musicPlayer; if (!musicPlayer.isPlaying && (Object)(object)musicPlayer.clip != (Object)null && !Patches.IsPaused) { Patches.NextButtonClicked(); } } catch { } } private void Patch(Harmony harmony, Type OriginalClass, string OriginalMethod, string PatchMethod, bool prefix, bool transpiler) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(OriginalClass, OriginalMethod, (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Patches), PatchMethod, (Type[])null, (Type[])null); if (prefix) { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else if (transpiler) { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null); } else { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } Log("Patched " + OriginalMethod + " in " + OriginalClass.ToString()); } } public class SongLoader : MonoBehaviour { [CompilerGenerated] private sealed class <LoadMP3>d__1 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string filePath; public SongLoader <>4__this; private UnityWebRequest <www>5__1; private AudioClip <newaudio>5__2; private string <actualfile>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadMP3>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <www>5__1 = null; <newaudio>5__2 = null; <actualfile>5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <www>5__1 = UnityWebRequestMultimedia.GetAudioClip(filePath, (AudioType)13); <>2__current = <www>5__1.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -1; if (<www>5__1.isNetworkError || <www>5__1.isHttpError) { Debug.LogError((object)("Error loading MP3: " + <www>5__1.error)); } else { <newaudio>5__2 = DownloadHandlerAudioClip.GetContent(<www>5__1); <actualfile>5__3 = filePath.Replace(AudioController.CustomSongsPath + "\\", "").Replace("file://", "file:"); ((Object)<newaudio>5__2).name = <actualfile>5__3; Patches.CustomSongs.Add(<newaudio>5__2); Debug.Log((object)(<actualfile>5__3 + " Loaded Successfully!")); <newaudio>5__2 = null; <actualfile>5__3 = null; } 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(); } } public static void CustomSongsToSongs() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown GameObject val = new GameObject("MP3Loader", new Type[1] { typeof(SongLoader) }); SongLoader component = val.GetComponent<SongLoader>(); string[] files = Directory.GetFiles(AudioController.CustomSongsPath); string[] array = files; foreach (string text in array) { if (text.Contains("mp3")) { Debug.Log((object)("Attempting Conversion of " + text + " to AudioClip")); ((MonoBehaviour)component).StartCoroutine(component.LoadMP3("file://" + text)); } } } [IteratorStateMachine(typeof(<LoadMP3>d__1))] private IEnumerator LoadMP3(string filePath) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadMP3>d__1(0) { <>4__this = this, filePath = filePath }; } } public class Patches { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__29_0; public static UnityAction <>9__29_1; public static UnityAction <>9__29_2; public static UnityAction <>9__29_3; public static UnityAction <>9__29_4; public static UnityAction <>9__29_5; public static UnityAction <>9__29_6; public static UnityAction<float> <>9__29_7; internal void <CreateUIElements>b__29_0() { SwitchButtonClicked(); } internal void <CreateUIElements>b__29_1() { PrevButtonClicked(); } internal void <CreateUIElements>b__29_2() { NextButtonClicked(); } internal void <CreateUIElements>b__29_3() { PauseButtonClicked(); } internal void <CreateUIElements>b__29_4() { VolumeButtonClicked(); } internal void <CreateUIElements>b__29_5() { ShuffleButtonClicked(); } internal void <CreateUIElements>b__29_6() { LoopButtonClicked(); } internal void <CreateUIElements>b__29_7(float val) { SliderChanged(val); } } public static AudioManager AudioManager; public static bool SliderActive = false; public static GameObject SliderObject; public static TextMeshProUGUI SongText; public static TextMeshProUGUI VolumeText; public static TextMeshProUGUI ShuffleText; public static Image PauseButtonImage; public static bool? ShuffleButtonState; public static List<AudioClip> CustomSongs = new List<AudioClip>(); public static bool HasLoadedSongs = false; public static int CurrentIndex = 0; public static List<int> SongQueue = null; public static List<int> PrevSongQueue = null; public static bool Looping = true; public static TextMeshProUGUI LoopText; public static bool IsPaused = false; public static bool IsOpened = true; public static void ChangeIndex() { Song[] array = ((AudioManager.test_songs != null && AudioManager.test_songs.Length != 0) ? AudioManager.test_songs : AudioManager.songs); if (CurrentIndex <= 0) { CurrentIndex += array.Length; } CurrentIndex %= array.Length; AudioManager.currentSongIndex = CurrentIndex; } public static void LoopButtonClicked() { Looping = !Looping; AudioManager.musicPlayer.loop = Looping; ((TMP_Text)LoopText).text = (Looping ? "True" : "False"); } public static void SwitchButtonClicked() { IsOpened = !IsOpened; ((Component)((TMP_Text)VolumeText).transform.parent).gameObject.SetActive(IsOpened); } public static void NextButtonClicked() { //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) AudioManager.musicPlayer.loop = false; AudioManager.introMusicPlayer.loop = false; if (!IsPaused) { PauseButtonClicked(); } if (!ShuffleButtonState.HasValue) { CurrentIndex++; ChangeIndex(); AudioManager.StartMusic(AudioManager.currentSongIndex); } else if (ShuffleButtonState.GetValueOrDefault()) { int index = Random.Range(0, SongQueue.Count); int currentIndex = SongQueue[index]; SongQueue.RemoveAt(index); PrevSongQueue.Insert(0, CurrentIndex); CurrentIndex = currentIndex; ChangeIndex(); AudioManager.StartMusic(AudioManager.currentSongIndex); if (SongQueue.Count == 0) { SongQueue = Enumerable.Range(0, AudioManager.songs.Length).ToList(); } if (PrevSongQueue.Count >= AudioManager.songs.Length * 4) { PrevSongQueue.RemoveAt(PrevSongQueue.Count - 1); } } else { int num = Random.Range(0, AudioManager.songs.Length); Song val = AudioManager.songs[num]; PrevSongQueue.Insert(0, num); CurrentIndex = num; ChangeIndex(); AudioManager.StartMusic(AudioManager.currentSongIndex); if (PrevSongQueue.Count >= AudioManager.songs.Length * 4) { PrevSongQueue.RemoveAt(PrevSongQueue.Count - 1); } } } public static void PrevButtonClicked() { if (!IsPaused) { PauseButtonClicked(); } if (!ShuffleButtonState.HasValue) { CurrentIndex--; ChangeIndex(); AudioManager.StartMusic(AudioManager.currentSongIndex); return; } if (ShuffleButtonState.GetValueOrDefault()) { try { int currentIndex = PrevSongQueue[0]; PrevSongQueue.RemoveAt(0); SongQueue.Insert(0, CurrentIndex); CurrentIndex = currentIndex; ChangeIndex(); AudioManager.StartMusic(AudioManager.currentSongIndex); if (PrevSongQueue.Count == 0) { CurrentIndex--; ChangeIndex(); AudioManager.StartMusic(AudioManager.currentSongIndex); } if (SongQueue.Count >= AudioManager.songs.Length) { SongQueue.RemoveAt(SongQueue.Count - 1); } return; } catch (Exception) { Debug.LogWarning((object)"No More Previous Song Data"); return; } } try { int currentIndex2 = PrevSongQueue[0]; PrevSongQueue.RemoveAt(0); CurrentIndex = currentIndex2; ChangeIndex(); AudioManager.StartMusic(AudioManager.currentSongIndex); } catch (Exception) { Debug.LogWarning((object)"No More Previous Song Data"); } } public static void VolumeButtonClicked() { if (SliderActive) { SliderObject.SetActive(false); ((Component)VolumeText).gameObject.SetActive(false); } else { SliderObject.SetActive(true); ((Component)VolumeText).gameObject.SetActive(true); int num; try { num = AudioManager.settings.MusicVolume; } catch (Exception) { num = 10; } SliderObject.GetComponent<Slider>().value = num; } SliderActive = !SliderActive; } public static void SliderChanged(float value) { AudioManager.settings.MusicVolume = (int)value; AudioManager.currentMusicVolume = (((int)value == 0) ? 0f : AudioManager.currentMusicVolume); AudioManager.UpdateMusicMasterVolume(); ((TMP_Text)VolumeText).text = value.ToString(); } public static void PauseButtonClicked() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) IsPaused = !IsPaused; if (IsPaused) { AudioManager.PauseMusic(); Texture2D textureFromPng = AudioController.GetTextureFromPng("play.png"); Sprite val = Sprite.Create(textureFromPng, new Rect(0f, 0f, (float)((Texture)textureFromPng).width, (float)((Texture)textureFromPng).height), new Vector2(0.5f, 0.5f)); ((Object)val).name = "play.png"; PauseButtonImage.sprite = val; } else { AudioManager.UnPauseMusic(); Texture2D textureFromPng2 = AudioController.GetTextureFromPng("pause.png"); Sprite val2 = Sprite.Create(textureFromPng2, new Rect(0f, 0f, (float)((Texture)textureFromPng2).width, (float)((Texture)textureFromPng2).height), new Vector2(0.5f, 0.5f)); ((Object)val2).name = "pause.png"; PauseButtonImage.sprite = val2; } } public static void ShuffleButtonClicked() { Debug.Log((object)"Changing Shuffle"); if (PrevSongQueue == null) { PrevSongQueue = new List<int>(); } if (!ShuffleButtonState.HasValue) { ShuffleButtonState = true; ((TMP_Text)ShuffleText).text = "Queue"; if (SongQueue == null) { SongQueue = Enumerable.Range(0, AudioManager.songs.Length).ToList(); } } else if (ShuffleButtonState.GetValueOrDefault()) { ((TMP_Text)ShuffleText).text = "Random"; ShuffleButtonState = false; } else { ((TMP_Text)ShuffleText).text = "None"; ShuffleButtonState = null; } } public static GameObject CreateGameObject(string name, Vector3 localposition, List<Type> extratypes) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (extratypes == null) { extratypes = new List<Type>(); } if (!extratypes.Contains(typeof(RectTransform))) { extratypes.Add(typeof(RectTransform)); } GameObject val = new GameObject(name, extratypes.ToArray()); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).localPosition = localposition; return val; } public static void AddImageInformation(GameObject gameObject, Vector2 SizeDelta, Vector3 LocalScale, string imagepath) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) RectTransform component = gameObject.GetComponent<RectTransform>(); component.sizeDelta = SizeDelta; ((Transform)component).localScale = LocalScale; Image component2 = gameObject.GetComponent<Image>(); Texture2D textureFromPng = AudioController.GetTextureFromPng(imagepath); Sprite val = Sprite.Create(textureFromPng, new Rect(0f, 0f, (float)((Texture)textureFromPng).width, (float)((Texture)textureFromPng).height), new Vector2(0.5f, 0.5f)); ((Object)val).name = imagepath; component2.sprite = val; } public static TextMeshProUGUI AddTextInformation(GameObject gameObject, Vector3 SizeDelta, string text) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) RectTransform component = gameObject.GetComponent<RectTransform>(); component.sizeDelta = Vector2.op_Implicit(SizeDelta); TextMeshProUGUI component2 = gameObject.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component2).fontStyle = (FontStyles)1; ((TMP_Text)component2).font = LocalizedText.localizationTable.GetFont(Settings.Get().Language, false); ((TMP_Text)component2).text = text; ((TMP_Text)component2).fontSize = 32f; ((TMP_Text)component2).alignment = (TextAlignmentOptions)514; return component2; } public static void CreateUIElements() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0131: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_0a63: Unknown result type (might be due to invalid IL or missing references) //IL_0a7f: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0279: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown //IL_0ad7: Unknown result type (might be due to invalid IL or missing references) //IL_0ade: Expected O, but got Unknown //IL_0b08: Unknown result type (might be due to invalid IL or missing references) //IL_0b1f: Unknown result type (might be due to invalid IL or missing references) //IL_0b3f: Unknown result type (might be due to invalid IL or missing references) //IL_0b47: Unknown result type (might be due to invalid IL or missing references) //IL_0b67: Unknown result type (might be due to invalid IL or missing references) //IL_0b6e: Expected O, but got Unknown //IL_0b8f: Unknown result type (might be due to invalid IL or missing references) //IL_0b94: Unknown result type (might be due to invalid IL or missing references) //IL_0baf: Unknown result type (might be due to invalid IL or missing references) //IL_0bbc: Unknown result type (might be due to invalid IL or missing references) //IL_0bd3: Unknown result type (might be due to invalid IL or missing references) //IL_0bea: Unknown result type (might be due to invalid IL or missing references) //IL_0c17: Unknown result type (might be due to invalid IL or missing references) //IL_0c1e: Expected O, but got Unknown //IL_0c48: Unknown result type (might be due to invalid IL or missing references) //IL_0c4d: Unknown result type (might be due to invalid IL or missing references) //IL_0c6d: Unknown result type (might be due to invalid IL or missing references) //IL_0c84: Unknown result type (might be due to invalid IL or missing references) //IL_0c9b: Unknown result type (might be due to invalid IL or missing references) //IL_0cb2: Unknown result type (might be due to invalid IL or missing references) //IL_0ce1: Unknown result type (might be due to invalid IL or missing references) //IL_0ce6: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Expected O, but got Unknown //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Expected O, but got Unknown //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Expected O, but got Unknown //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Expected O, but got Unknown //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Expected O, but got Unknown //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_072a: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0793: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Expected O, but got Unknown //IL_0818: Unknown result type (might be due to invalid IL or missing references) //IL_085d: Unknown result type (might be due to invalid IL or missing references) //IL_08a3: Unknown result type (might be due to invalid IL or missing references) //IL_08e8: Unknown result type (might be due to invalid IL or missing references) //IL_091c: Unknown result type (might be due to invalid IL or missing references) //IL_0961: Unknown result type (might be due to invalid IL or missing references) //IL_09b0: Unknown result type (might be due to invalid IL or missing references) //IL_09b7: Expected O, but got Unknown //IL_09de: Unknown result type (might be due to invalid IL or missing references) //IL_09e3: Unknown result type (might be due to invalid IL or missing references) GameObject val2 = new GameObject("AudioControllerCanvas", new Type[2] { typeof(CanvasScaler), typeof(GraphicRaycaster) }); Canvas component = val2.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; ((Object)((Component)component).gameObject).name = "AudioControllerCanvas"; GameObject val3 = CreateGameObject("RadioFolder", new Vector3(-810f, -390f, 0f), null); ((Transform)val3.GetComponent<RectTransform>()).SetParent(((Component)component).transform, false); if (!IsOpened) { val3.SetActive(false); } GameObject val4 = CreateGameObject("RadioBackground", new Vector3(156f, 31f, 0f), new List<Type>(2) { typeof(CanvasRenderer), typeof(Image) }); ((Transform)val4.GetComponent<RectTransform>()).SetParent(val3.transform, false); AddImageInformation(val4, new Vector2(700f, 200f), Vector3.one, "slider.png"); ((Graphic)val4.GetComponent<Image>()).color = new Color(1f, 1f, 1f, 0.5f); GameObject val5 = CreateGameObject("SwitchButton", new Vector3(-560f, -330f, 0f), new List<Type>(new <>z__ReadOnlyArray<Type>(new Type[3] { typeof(CanvasRenderer), typeof(Image), typeof(Button) }))); ((Transform)val5.GetComponent<RectTransform>()).SetParent(((Component)component).transform, false); AddImageInformation(val5, new Vector2(60f, 20f), Vector3.one, "slider.png"); Button component2 = val5.GetComponent<Button>(); ButtonClickedEvent onClick = component2.onClick; object obj = <>c.<>9__29_0; if (obj == null) { UnityAction val6 = delegate { SwitchButtonClicked(); }; <>c.<>9__29_0 = val6; obj = (object)val6; } ((UnityEvent)onClick).AddListener((UnityAction)obj); GameObject val7 = CreateGameObject("PrevButton", Vector3.zero, new List<Type>(new <>z__ReadOnlyArray<Type>(new Type[3] { typeof(CanvasRenderer), typeof(Image), typeof(Button) }))); ((Transform)val7.GetComponent<RectTransform>()).SetParent(val3.transform, false); AddImageInformation(val7, new Vector2(100f, 100f), new Vector3(0.75f, 0.75f, 0.75f), "prev.png"); Button component3 = val7.GetComponent<Button>(); ButtonClickedEvent onClick2 = component3.onClick; object obj2 = <>c.<>9__29_1; if (obj2 == null) { UnityAction val8 = delegate { PrevButtonClicked(); }; <>c.<>9__29_1 = val8; obj2 = (object)val8; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); GameObject val9 = CreateGameObject("NextButton", new Vector3(200f, 0f, 0f), new List<Type>(new <>z__ReadOnlyArray<Type>(new Type[3] { typeof(CanvasRenderer), typeof(Image), typeof(Button) }))); ((Transform)val9.GetComponent<RectTransform>()).SetParent(val3.transform, false); AddImageInformation(val9, new Vector2(100f, 100f), new Vector3(0.75f, 0.75f, 0.75f), "next.png"); Button component4 = val9.GetComponent<Button>(); ButtonClickedEvent onClick3 = component4.onClick; object obj3 = <>c.<>9__29_2; if (obj3 == null) { UnityAction val10 = delegate { NextButtonClicked(); }; <>c.<>9__29_2 = val10; obj3 = (object)val10; } ((UnityEvent)onClick3).AddListener((UnityAction)obj3); GameObject val11 = CreateGameObject("PauseButton", new Vector3(100f, 0f, 0f), new List<Type>(new <>z__ReadOnlyArray<Type>(new Type[3] { typeof(CanvasRenderer), typeof(Image), typeof(Button) }))); ((Transform)val11.GetComponent<RectTransform>()).SetParent(val3.transform, false); string imagepath = ((!IsPaused) ? "pause.png" : "play.png"); AddImageInformation(val11, new Vector2(100f, 100f), Vector3.one, imagepath); Button component5 = val11.GetComponent<Button>(); ButtonClickedEvent onClick4 = component5.onClick; object obj4 = <>c.<>9__29_3; if (obj4 == null) { UnityAction val12 = delegate { PauseButtonClicked(); }; <>c.<>9__29_3 = val12; obj4 = (object)val12; } ((UnityEvent)onClick4).AddListener((UnityAction)obj4); PauseButtonImage = val11.GetComponent<Image>(); GameObject val13 = CreateGameObject("VolumeButton", new Vector3(-100f, 0f, 0f), new List<Type>(new <>z__ReadOnlyArray<Type>(new Type[3] { typeof(CanvasRenderer), typeof(Image), typeof(Button) }))); ((Transform)val13.GetComponent<RectTransform>()).SetParent(val3.transform, false); AddImageInformation(val13, new Vector2(100f, 100f), Vector3.one, "volumeicon.png"); Button component6 = val13.GetComponent<Button>(); ButtonClickedEvent onClick5 = component6.onClick; object obj5 = <>c.<>9__29_4; if (obj5 == null) { UnityAction val14 = delegate { VolumeButtonClicked(); }; <>c.<>9__29_4 = val14; obj5 = (object)val14; } ((UnityEvent)onClick5).AddListener((UnityAction)obj5); GameObject val15 = CreateGameObject("ShuffleButton", new Vector3(300f, 0f, 0f), new List<Type>(new <>z__ReadOnlyArray<Type>(new Type[3] { typeof(CanvasRenderer), typeof(Image), typeof(Button) }))); ((Transform)val15.GetComponent<RectTransform>()).SetParent(val3.transform, false); AddImageInformation(val15, new Vector2(100f, 100f), Vector3.one, "shuffle.png"); Button component7 = val15.GetComponent<Button>(); ButtonClickedEvent onClick6 = component7.onClick; object obj6 = <>c.<>9__29_5; if (obj6 == null) { UnityAction val16 = delegate { ShuffleButtonClicked(); }; <>c.<>9__29_5 = val16; obj6 = (object)val16; } ((UnityEvent)onClick6).AddListener((UnityAction)obj6); GameObject val17 = CreateGameObject("LoopButton", new Vector3(410f, 0f, 0f), new List<Type>(new <>z__ReadOnlyArray<Type>(new Type[3] { typeof(CanvasRenderer), typeof(Image), typeof(Button) }))); ((Transform)val17.GetComponent<RectTransform>()).SetParent(val3.transform, false); AddImageInformation(val17, new Vector2(100f, 100f), Vector3.one, "loop.png"); Button component8 = val17.GetComponent<Button>(); ButtonClickedEvent onClick7 = component8.onClick; object obj7 = <>c.<>9__29_6; if (obj7 == null) { UnityAction val18 = delegate { LoopButtonClicked(); }; <>c.<>9__29_6 = val18; obj7 = (object)val18; } ((UnityEvent)onClick7).AddListener((UnityAction)obj7); val17.transform.localScale = Vector2.op_Implicit(new Vector2(0.9f, 0.9f)); GameObject val19 = CreateGameObject("PlayingText", new Vector3(150f, 95f, 0f), new List<Type>(new <>z__ReadOnlySingleElementList<Type>(typeof(TextMeshProUGUI)))); ((Transform)val19.GetComponent<RectTransform>()).SetParent(val3.transform, false); AddTextInformation(val19, new Vector3(350f, 50f, 0f), "Currently Playing: "); GameObject val20 = CreateGameObject("ShuffleText", new Vector3(300f, -50f, 0f), new List<Type>(new <>z__ReadOnlySingleElementList<Type>(typeof(TextMeshProUGUI)))); ((Transform)val20.GetComponent<RectTransform>()).SetParent(val3.transform, false); ShuffleText = AddTextInformation(val20, new Vector3(350f, 50f, 0f), "None"); if (!ShuffleButtonState.HasValue) { ((TMP_Text)ShuffleText).text = "None"; } else if (ShuffleButtonState.GetValueOrDefault()) { ((TMP_Text)ShuffleText).text = "Queue"; } else { ((TMP_Text)ShuffleText).text = "Random"; } GameObject val21 = CreateGameObject("LoopText", new Vector3(410f, -50f, 0f), new List<Type>(new <>z__ReadOnlySingleElementList<Type>(typeof(TextMeshProUGUI)))); ((Transform)val21.GetComponent<RectTransform>()).SetParent(val3.transform, false); LoopText = AddTextInformation(val21, new Vector3(350f, 50f, 0f), "True"); ((TMP_Text)LoopText).text = (Looping ? "True" : "False"); GameObject val22 = CreateGameObject("SongText", new Vector3(150f, 57f, 0f), new List<Type>(new <>z__ReadOnlySingleElementList<Type>(typeof(TextMeshProUGUI)))); ((Transform)val22.GetComponent<RectTransform>()).SetParent(val3.transform, false); SongText = AddTextInformation(val22, new Vector3(600f, 50f, 0f), "<Song Playing>"); ((TMP_Text)SongText).overflowMode = (TextOverflowModes)1; GameObject val23 = CreateGameObject("VolumeText", new Vector3(-100f, 375f, 0f), new List<Type>(new <>z__ReadOnlySingleElementList<Type>(typeof(TextMeshProUGUI)))); ((Transform)val23.GetComponent<RectTransform>()).SetParent(val3.transform, false); VolumeText = AddTextInformation(val23, new Vector3(350f, 50f, 0f), "10"); val23.SetActive(false); GameObject val24 = new GameObject("VolumeSlider", new Type[3] { typeof(RectTransform), typeof(Slider), typeof(Image) }); val24.transform.SetParent(val3.transform, false); SliderObject = val24; AddImageInformation(val24, new Vector2(300f, 30f), Vector3.one, "sliderback.png"); Slider component9 = val24.GetComponent<Slider>(); component9.minValue = 0f; component9.maxValue = 20f; int num; try { num = AudioManager.settings.MusicVolume; } catch (Exception) { num = 10; } component9.value = num; component9.wholeNumbers = true; RectTransform component10 = val24.GetComponent<RectTransform>(); ((Transform)component10).localPosition = new Vector3(-100f, 200f, 0f); ((Transform)component10).rotation = Quaternion.Euler(0f, 0f, 90f); ((UnityEvent<float>)(object)component9.onValueChanged).AddListener((UnityAction<float>)delegate(float val) { SliderChanged(val); }); val24.SetActive(false); GameObject val25 = new GameObject("Fill Area", new Type[1] { typeof(RectTransform) }); val25.transform.SetParent(val24.transform, false); RectTransform component11 = val25.GetComponent<RectTransform>(); component11.anchorMin = new Vector2(0f, 0.25f); component11.anchorMax = new Vector2(1f, 0.75f); Vector2 val26 = default(Vector2); ((Vector2)(ref val26))..ctor(1f, 0f); component11.offsetMax = val26; component11.offsetMin = val26; GameObject val27 = new GameObject("Fill", new Type[1] { typeof(Image) }); val27.transform.SetParent(val25.transform, false); AddImageInformation(val27, new Vector2(-20f, 0f), Vector3.one, "slider.png"); RectTransform component12 = val27.GetComponent<RectTransform>(); component12.anchorMin = Vector2.zero; component12.anchorMax = Vector2.one; component12.offsetMin = new Vector2(10f, 0f); component12.offsetMax = new Vector2(-10f, 0f); component9.fillRect = component12; GameObject val28 = new GameObject("Handle", new Type[1] { typeof(Image) }); val28.transform.SetParent(val24.transform, false); Image component13 = val28.GetComponent<Image>(); ((Graphic)component13).color = Color32.op_Implicit(new Color32((byte)4, (byte)65, (byte)107, byte.MaxValue)); RectTransform component14 = val28.GetComponent<RectTransform>(); component14.sizeDelta = new Vector2(10f, 20f); component14.anchorMin = new Vector2(0.5f, 0.5f); component14.anchorMax = new Vector2(0.5f, 0.5f); component14.pivot = new Vector2(0.5f, 0.5f); ((Selectable)component9).targetGraphic = (Graphic)(object)component13; component9.handleRect = component14; val3.transform.localScale = Vector2.op_Implicit(new Vector2(0.6f, 0.6f)); } private static AudioClip GenerateQuietClip(float duration, float frequency, float amplitude) { int num = 44100; int num2 = Mathf.FloorToInt(duration * (float)num); float[] array = new float[num2]; for (int i = 0; i < num2; i++) { float num3 = (float)i / (float)num; array[i] = amplitude * Mathf.Sin((float)Math.PI * 2f * frequency * num3); } AudioClip val = AudioClip.Create("QuietSound", num2, 1, num, false); val.SetData(array, 0); return val; } public static void OnMatchStartedPrefix(ref AudioManager __instance) { //IL_007e: 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) IsPaused = false; CreateUIElements(); AudioManager = AudioManager.Get(); if (HasLoadedSongs) { return; } if (AudioController.OverrideOtherSongs.Value && AudioController.LoadCustomSongs.Value) { AudioManager.songs = Array.Empty<Song>(); } List<Song> list = new List<Song>(AudioManager.songs); foreach (AudioClip customSong in CustomSongs) { Song item = default(Song); item.name = ((Object)customSong).name; item.songLoop = customSong; item.intro = GenerateQuietClip(0.1f, 100f, 1E-10f); item.pitch = 1f; list.Add(item); } AudioManager.songs = list.ToArray(); HasLoadedSongs = true; } public static void OnSongStartPlaying(ref AudioSource __instance) { AudioManager val = AudioManager.Get(); val.musicPlayer.loop = Looping; try { ((TMP_Text)SongText).text = val.songs[val.currentSongIndex].name; } catch { Debug.Log((object)"Couldn't change text"); } } } public static class PluginInfo { public const string PLUGIN_GUID = "AudioController"; public const string PLUGIN_NAME = "AudioController"; public const string PLUGIN_VERSION = "1.0.0"; } } [CompilerGenerated] internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T> { object IEnumerator.Current => _item; T IEnumerator<T>.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { return !_moveNextCalled && (_moveNextCalled = true); } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => 1; T IReadOnlyList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection<T>.Count => 1; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer<T>.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { return (!EqualityComparer<T>.Default.Equals(_item, (T)value)) ? (-1) : 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return new Enumerator(_item); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return EqualityComparer<T>.Default.Equals(_item, item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return (!EqualityComparer<T>.Default.Equals(_item, item)) ? (-1) : 0; } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }