using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using UnityEngine;
using UnityEngine.SceneManagement;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("WWAG_MinecraftBed")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WWAG_MinecraftBed")]
[assembly: AssemblyTitle("WWAG_MinecraftBed")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace WWAG_MinecraftBed;
[BepInPlugin("org.NikoTheFox.MinecraftBed", "WWAG Minecraft Bed", "0.0.1")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (!(((Scene)(ref scene)).name == "title-screen"))
{
return;
}
Debug.Log((object)"Found scene, changing Midground");
string location = Assembly.GetExecutingAssembly().Location;
string directoryName = Path.GetDirectoryName(location);
AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(directoryName, "minecraft_bed_midground"));
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)"Failed to load AssetBundle.");
return;
}
Sprite val2 = val.LoadAsset<Sprite>("midground-lights-modified");
if (Object.op_Implicit((Object)(object)val2))
{
GameObject val3 = GameObject.Find("background-canvas/background/midground");
if ((Object)(object)val3 != (Object)null)
{
Image component = val3.GetComponent<Image>();
if ((Object)(object)component != (Object)null)
{
Animator component2 = val3.GetComponent<Animator>();
if ((Object)(object)component2 != (Object)null)
{
Object.Destroy((Object)(object)component2);
}
component.sprite = val2;
}
else
{
Debug.LogError((object)"No Image component found!");
}
}
else
{
Debug.LogError((object)"Target GameObject not found!");
}
}
val.Unload(false);
}
private void OnEnable()
{
Debug.Log((object)"Plugin enabled");
SceneManager.sceneLoaded += OnSceneLoaded;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "WWAG_MinecraftBed";
public const string PLUGIN_NAME = "WWAG_MinecraftBed";
public const string PLUGIN_VERSION = "1.0.0";
}