using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using PluginUtilities;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("RForRotatePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("D20ArmyKnife")]
[assembly: AssemblyProduct("RForRotatePlugin")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4e4deb5e-97f9-4901-bf67-6748a9c1229a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AssetToolTip
{
[BepInPlugin("org.hollofox.plugins.AssetToolTip", "Asset Tool Tip", "1.3.3.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class AssetToolTip : DependencyUnityPlugin
{
public const string Guid = "org.hollofox.plugins.AssetToolTip";
private const string Version = "1.3.3.0";
private const string Name = "Asset Tool Tip";
private Harmony harmony;
protected override void OnAwake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogDebug((object)"In Awake for AssetToolTip");
harmony = new Harmony("org.hollofox.plugins.AssetToolTip");
harmony.PatchAll();
Object[] array = Resources.FindObjectsOfTypeAll(typeof(UI_AssetBrowserSlotItem));
FieldInfo field = typeof(UI_AssetBrowserSlotItem).GetField("_gridData", BindingFlags.Instance | BindingFlags.NonPublic);
Object[] array2 = array;
foreach (Object obj in array2)
{
UI_AssetBrowserSlotItem val = (UI_AssetBrowserSlotItem)(object)((obj is UI_AssetBrowserSlotItem) ? obj : null);
if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).GetComponent<MouseTextOnHover>() != (Object)null))
{
object? value = field.GetValue(val);
DataItem val2 = (DataItem)((value is DataItem) ? value : null);
if (val2 != null)
{
((Component)val).gameObject.AddComponent<MouseTextOnHover>().mouseHoverText = val2.Name;
}
}
}
}
protected override void OnDestroyed()
{
((BaseUnityPlugin)this).Logger.LogDebug((object)"In OnDestroyed for AssetToolTip");
harmony.UnpatchSelf();
((BaseUnityPlugin)this).Logger.LogDebug((object)"Unpatched all Harmony patches for AssetToolTip");
Object[] array = Resources.FindObjectsOfTypeAll(typeof(UI_AssetBrowserSlotItem));
foreach (Object obj in array)
{
UI_AssetBrowserSlotItem val = (UI_AssetBrowserSlotItem)(object)((obj is UI_AssetBrowserSlotItem) ? obj : null);
if ((Object)(object)val != (Object)null)
{
MouseTextOnHover component = ((Component)val).GetComponent<MouseTextOnHover>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
}
}
}
}
}
namespace AssetToolTip.Patches
{
[HarmonyPatch(typeof(UI_AssetBrowserSlotItem), "Setup")]
internal sealed class UI_AssetBrowserSlotItemConstructorPatch
{
private static void Postfix(UI_AssetBrowserSlotItem __instance, ref DataItem dataItem)
{
((Component)__instance).gameObject.AddComponent<MouseTextOnHover>().mouseHoverText = dataItem.Name;
}
}
}