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 Night And Day v1.0.1
Kart Arena.dll
Decompiled a week agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; [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("Kart Arena")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Kart Arena")] [assembly: AssemblyTitle("Kart Arena")] [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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace ArenaMusicTest { [BepInPlugin("com.dgdarel.kartarenamusic", "Kart Arena Music", "1.0.0")] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class <CheckArena>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Plugin <>4__this; private MonoBehaviour[] <objects>5__1; private bool <foundArena>5__2; private MonoBehaviour[] <>s__3; private int <>s__4; private MonoBehaviour <mb>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CheckArena>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <objects>5__1 = null; <>s__3 = null; <mb>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; <objects>5__1 = Object.FindObjectsOfType<MonoBehaviour>(); <foundArena>5__2 = false; <>s__3 = <objects>5__1; for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++) { <mb>5__5 = <>s__3[<>s__4]; if (!((Object)(object)<mb>5__5 == (Object)null)) { if (((object)<mb>5__5).GetType().Name == "ArenaRace") { <foundArena>5__2 = true; break; } <mb>5__5 = null; } } <>s__3 = null; if (<foundArena>5__2) { <>4__this.StartMusic(); } else { <>4__this.StopMusic(); } <objects>5__1 = null; break; } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; 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(); } } [CompilerGenerated] private sealed class <LoadAudio>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Plugin <>4__this; private string <path>5__1; private UnityWebRequest <www>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadAudio>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <path>5__1 = null; <www>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Invalid comparison between Unknown and I4 bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; <path>5__1 = Path.Combine(Paths.PluginPath, "DgDarel-Night_And_Day", "Night&Day.wav"); ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("Loading audio: " + <path>5__1)); if (!File.Exists(<path>5__1)) { ((BaseUnityPlugin)<>4__this).Logger.LogError((object)"FILE NOT FOUND"); result = false; break; } <www>5__2 = UnityWebRequestMultimedia.GetAudioClip("file://" + <path>5__1, (AudioType)20); <>1__state = -3; <>2__current = <www>5__2.SendWebRequest(); <>1__state = 1; result = true; break; case 1: <>1__state = -3; if ((int)<www>5__2.result != 1) { ((BaseUnityPlugin)<>4__this).Logger.LogError((object)<www>5__2.error); result = false; } else { <>4__this.clip = DownloadHandlerAudioClip.GetContent(<www>5__2); if (!((Object)(object)<>4__this.clip == (Object)null)) { ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"AUDIO LOADED"); <>m__Finally1(); <www>5__2 = null; result = false; break; } ((BaseUnityPlugin)<>4__this).Logger.LogError((object)"CLIP IS NULL"); result = false; } <>m__Finally1(); break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<www>5__2 != null) { ((IDisposable)<www>5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private AudioSource source; private AudioClip clip; private bool playing = false; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Kart Arena Music loaded!"); CreateAudioSource(); ((MonoBehaviour)this).StartCoroutine(LoadAudio()); ((MonoBehaviour)this).StartCoroutine(CheckArena()); } private void CreateAudioSource() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (!((Object)(object)source != (Object)null)) { GameObject val = new GameObject("CUSTOM_ARENA_AUDIO"); Object.DontDestroyOnLoad((Object)(object)val); source = val.AddComponent<AudioSource>(); source.loop = true; source.playOnAwake = false; source.spatialBlend = 0f; source.volume = 1f; source.ignoreListenerPause = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"AudioSource created"); } } [IteratorStateMachine(typeof(<LoadAudio>d__5))] private IEnumerator LoadAudio() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadAudio>d__5(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<CheckArena>d__6))] private IEnumerator CheckArena() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CheckArena>d__6(0) { <>4__this = this }; } private void StartMusic() { if ((Object)(object)clip == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"CLIP NULL"); return; } if ((Object)(object)source == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"AudioSource destroyed. Recreating..."); CreateAudioSource(); } if ((Object)(object)source == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"FAILED TO CREATE AUDIOSOURCE"); } else if (!playing) { source.clip = clip; source.Play(); playing = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"PLAYING CUSTOM ARENA MUSIC"); } } private void StopMusic() { if (!((Object)(object)source == (Object)null) && playing) { source.Stop(); playing = false; ((BaseUnityPlugin)this).Logger.LogInfo((object)"STOPPED MUSIC"); } } } }