using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[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("LoadingScreenFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LoadingScreenFix")]
[assembly: AssemblyTitle("LoadingScreenFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LoadingScreenFix;
[BepInPlugin("Nebby1999.LoadingScreenFix", "LoadingScreenFix", "1.0.0")]
public class LoadingScreenFix : BaseUnityPlugin
{
public const string PluginGUID = "Nebby1999.LoadingScreenFix";
public const string PluginAuthor = "Nebby1999";
public const string PluginName = "LoadingScreenFix";
public const string PluginVersion = "1.0.0";
private GameObject _blackBackground;
private void Awake()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
PickRandomObjectOnAwake.Awake += new hook_Awake(AddBlackBackground);
SceneManager.sceneLoaded += ShouldDestroyObjectAndSuicide;
Log("Awake Called");
}
private void ShouldDestroyObjectAndSuicide(Scene arg0, LoadSceneMode arg1)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
Log("Checking if splash");
if (((Scene)(ref arg0)).name == "splash")
{
Log("Its splash, killing unhooking, destroying background and killing self.");
PickRandomObjectOnAwake.Awake -= new hook_Awake(AddBlackBackground);
SceneManager.sceneLoaded -= ShouldDestroyObjectAndSuicide;
if (Object.op_Implicit((Object)(object)_blackBackground))
{
Object.Destroy((Object)(object)_blackBackground);
}
Object.Destroy((Object)(object)this);
}
else
{
Log("Not Splash");
}
}
private void AddBlackBackground(orig_Awake orig, PickRandomObjectOnAwake self)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
if (((Object)((Component)self).gameObject).name != "MiniScene")
{
return;
}
GameObject[] objectsToSelect = self.ObjectsToSelect;
foreach (GameObject val in objectsToSelect)
{
if (val.activeSelf)
{
Log("adding Background to " + (object)val);
_blackBackground = new GameObject("BlackBackground");
RectTransform obj = _blackBackground.AddComponent<RectTransform>();
((Transform)obj).SetParent(((Component)self).transform.parent);
((Transform)obj).SetAsFirstSibling();
obj.sizeDelta = new Vector2(256f, 256f);
((Transform)obj).localPosition = new Vector3(64f, 16f, -16f);
((Graphic)_blackBackground.AddComponent<Image>()).color = Color.black;
}
}
}
private void Log(object thing)
{
}
}