using 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 BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
[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("Darel_CroodsLastSong")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Darel_CroodsLastSong")]
[assembly: AssemblyTitle("Darel_CroodsLastSong")]
[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;
}
}
}
[BepInPlugin("darel.croodslastsong.perfect", "Croods Perfect", "1.0.2")]
public class CroodsPerfect : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <LoadAudio>d__6 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CroodsPerfect <>4__this;
private string <path>5__1;
private string <url>5__2;
private UnityWebRequest <www>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAudio>d__6(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<path>5__1 = null;
<url>5__2 = null;
<www>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Invalid comparison between Unknown and I4
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<path>5__1 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)<>4__this).Info.Location), "croods.ogg");
if (!File.Exists(<path>5__1))
{
return false;
}
<url>5__2 = "file://" + <path>5__1;
<www>5__3 = UnityWebRequestMultimedia.GetAudioClip(<url>5__2, (AudioType)14);
<>2__current = <www>5__3.SendWebRequest();
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((int)<www>5__3.result == 1)
{
clip = DownloadHandlerAudioClip.GetContent(<www>5__3);
}
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();
}
}
internal static AudioClip clip;
internal static ConfigEntry<float> Volume;
internal static GameObject currentPlayer;
private void Awake()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
Volume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Volume", 1f, "Music volume (0-1)");
((MonoBehaviour)this).StartCoroutine(LoadAudio());
SceneManager.sceneLoaded += OnSceneLoaded;
new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID).PatchAll();
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
StopMusic();
}
public static void StopMusic()
{
if ((Object)(object)currentPlayer != (Object)null)
{
Object.Destroy((Object)(object)currentPlayer);
currentPlayer = null;
}
}
[IteratorStateMachine(typeof(<LoadAudio>d__6))]
private IEnumerator LoadAudio()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAudio>d__6(0)
{
<>4__this = this
};
}
}
[HarmonyPatch]
internal class Patch_Extraction
{
private static MethodBase TargetMethod()
{
Type type = AccessTools.TypeByName("RoundDirector");
if (type == null)
{
return null;
}
return AccessTools.Method(type, "ExtractionCompletedAllRPC", (Type[])null, (Type[])null);
}
private static void Postfix()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
if (!((Object)(object)CroodsPerfect.clip == (Object)null))
{
CroodsPerfect.StopMusic();
GameObject val = new GameObject("CroodsPlayer");
Object.DontDestroyOnLoad((Object)(object)val);
AudioSource val2 = val.AddComponent<AudioSource>();
val2.clip = CroodsPerfect.clip;
val2.volume = CroodsPerfect.Volume.Value;
val2.loop = false;
val2.Play();
CroodsPerfect.currentPlayer = val;
}
}
}
namespace ClassLibrary1
{
public class Class1
{
}
}