using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using MonoMod.RuntimeDetour;
using On.RoR2;
using On.RoR2.UI;
using RoR2;
using RoR2.UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityExplorer.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("UnityExplorerFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+242e73a99540e4307a4c231f69fe4ee09f6dfb55")]
[assembly: AssemblyProduct("UnityExplorerFix")]
[assembly: AssemblyTitle("UnityExplorerFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace HDeMods;
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.HDeDeDe.UnityExplorerFix", "UnityExplorerFix", "1.0.0")]
public sealed class UnityExplorerFixPlugin : BaseUnityPlugin
{
public const string PluginGUID = "com.HDeDeDe.UnityExplorerFix";
public const string PluginAuthor = "HDeDeDe";
public const string PluginName = "UnityExplorerFix";
public const string PluginVersion = "1.0.0";
private void Awake()
{
UnityExplorerFix.Startup();
}
}
public static class UnityExplorerFix
{
public delegate void ShowMenuDel(Action<bool> orig, bool enable);
private static Hook showMenuHook;
public static bool unsafeToOpen;
private static LocalUser lastKnownUser;
internal static void Startup()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
SurvivorIconController.GetLocalUser += new hook_GetLocalUser(SurvivorIconController_GetLocalUser);
PauseStopController.Awake += new hook_Awake(PauseStopController_Awake);
RuleChoiceController.Start += new hook_Start(RuleChoiceController_Start);
RuleChoiceController.FindNetworkUser += new hook_FindNetworkUser(RuleChoiceController_FindNetworkUser);
showMenuHook = new Hook((MethodBase)AccessTools.PropertySetter(typeof(UIManager), "ShowMenu"), (Delegate)new ShowMenuDel(BlockIfUnsafe));
}
private static NetworkUser RuleChoiceController_FindNetworkUser(orig_FindNetworkUser orig, RuleChoiceController self)
{
if (((Object)EventSystem.current).name != "UniverseLibCanvas")
{
return orig.Invoke(self);
}
LocalUser obj = lastKnownUser;
if (obj == null)
{
return null;
}
return obj.currentNetworkUser;
}
private static void BlockIfUnsafe(Action<bool> orig, bool enable)
{
if (!unsafeToOpen)
{
orig(enable);
}
}
private static void RuleChoiceController_Start(orig_Start orig, RuleChoiceController self)
{
orig.Invoke(self);
unsafeToOpen = false;
}
private static void PauseStopController_Awake(orig_Awake orig, PauseStopController self)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (UIManager.ShowMenu)
{
UIManager.ShowMenu = false;
}
unsafeToOpen = true;
orig.Invoke(self);
lastKnownUser = ((MPEventSystem)EventSystem.current).localUser;
}
private static LocalUser SurvivorIconController_GetLocalUser(orig_GetLocalUser orig, SurvivorIconController self)
{
if (((Object)EventSystem.current).name != "UniverseLibCanvas")
{
lastKnownUser = orig.Invoke(self);
}
return lastKnownUser;
}
}