using System;
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 BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GlassCybergrindStartRoom")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f782a1f999cbdb58e878ab6685c40e06287d27d9")]
[assembly: AssemblyProduct("GlassCybergrindStartRoom")]
[assembly: AssemblyTitle("GlassCybergrindStartRoom")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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;
}
}
[CompilerGenerated]
[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 GlassCybergrindStartRoom
{
[BepInPlugin("com.github.end-4.glassCybergrindStartRoom", "GlassCybergrindStartRoom", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource? Log;
public static string workingPath = Assembly.GetExecutingAssembly().Location;
public static string workingDir = Path.GetDirectoryName(workingPath);
public const string PluginGUID = "com.github.end-4.glassCybergrindStartRoom";
public const string PluginName = "GlassCybergrindStartRoom";
public const string PluginVersion = "1.0.2";
internal static GameObject? RoomCeilingPrefab;
internal static GameObject? RoomWallsPrefab;
internal static GameObject? RoomFloorPrefab;
internal static GameObject? HallwayPrefab;
internal static GameObject? HallwayWallsPrefab;
private static readonly string BundlePath = Path.Combine(workingDir, "assets", "stained_glass_cybergrind_start_room.bundle");
internal static GameObject? FindNestedObject(GameObject baseObject, string path)
{
Transform val = baseObject.transform;
string[] array = path.Split("/");
foreach (string text in array)
{
val = ((Component)val).transform.Find(text);
if ((Object)(object)val == (Object)null)
{
Log.LogWarning((object)(text + " not found for object path " + ((Object)baseObject).name + "/" + path));
return null;
}
}
return ((Component)val).gameObject;
}
private void LoadObjects()
{
AssetBundle val = AssetBundle.LoadFromFile(BundlePath);
if ((Object)(object)val == (Object)null)
{
Log.LogError((object)"Couldn't load asset bundle. Aborting.");
return;
}
RoomCeilingPrefab = val.LoadAsset<GameObject>("Ceiling");
RoomWallsPrefab = val.LoadAsset<GameObject>("Walls");
RoomFloorPrefab = val.LoadAsset<GameObject>("Floor");
HallwayWallsPrefab = val.LoadAsset<GameObject>("HallwayWalls");
val.Unload(false);
}
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
LoadObjects();
SceneManager.sceneLoaded += delegate
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
if (!(SceneHelper.CurrentScene != "Endless"))
{
Scene activeScene = SceneManager.GetActiveScene();
GameObject val = ((IEnumerable<GameObject>)((Scene)(ref activeScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject obj) => ((Object)obj).name == "FirstRoom"));
if ((Object)(object)val != (Object)null)
{
Transform transform = FindNestedObject(val, "Room/Room").transform;
Transform transform2 = FindNestedObject(val, "Room/Hallway").transform;
GameObject val2 = FindNestedObject(((Component)transform).gameObject, "Floor");
GameObject val3 = FindNestedObject(((Component)transform).gameObject, "Ceiling");
GameObject val4 = FindNestedObject(((Component)transform).gameObject, "Walls");
GameObject val5 = FindNestedObject(((Component)transform2).gameObject, "Walls");
if (val2 != null)
{
val2.SetActive(false);
}
if (val3 != null)
{
val3.SetActive(false);
}
if (val4 != null)
{
val4.SetActive(false);
}
if (val5 != null)
{
val5.SetActive(false);
}
GameObject val6 = Object.Instantiate<GameObject>(RoomFloorPrefab, transform, true);
GameObject val7 = Object.Instantiate<GameObject>(RoomCeilingPrefab, transform, true);
GameObject val8 = Object.Instantiate<GameObject>(RoomWallsPrefab, transform, true);
GameObject val9 = Object.Instantiate<GameObject>(HallwayWallsPrefab, transform2, true);
if ((Object)(object)val6 != (Object)null && (Object)(object)val2 != (Object)null)
{
val6.transform.localPosition = val2.transform.localPosition;
}
if ((Object)(object)val7 != (Object)null && (Object)(object)val3 != (Object)null)
{
val7.transform.localPosition = val3.transform.localPosition;
}
if ((Object)(object)val8 != (Object)null && (Object)(object)val4 != (Object)null)
{
val8.transform.localPosition = val4.transform.localPosition;
}
if ((Object)(object)val9 != (Object)null && (Object)(object)val5 != (Object)null)
{
val9.transform.localPosition = val5.transform.localPosition;
}
}
}
};
Log.LogInfo((object)"GlassCybergrindStartRoom loaded!");
}
}
}