using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using Elements.Core;
using FrooxEngine;
using FrooxEngine.UIX;
using HarmonyLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
[assembly: AssemblyCompany("eia485")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2+03d1d8ab3faed0e6f80058c11953b6733f672583")]
[assembly: AssemblyProduct("MoreReferenceProxies")]
[assembly: AssemblyTitle("MoreReferenceProxies")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/EIA485/NeosMoreReferenceProxies")]
[assembly: AssemblyVersion("1.1.2.0")]
[module: RefSafetyRules(11)]
namespace MoreReferenceProxies;
[ResonitePlugin("net.eia485.MoreReferenceProxies", "MoreReferenceProxies", "1.1.2", "eia485", "https://github.com/EIA485/NeosMoreReferenceProxies")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MoreReferenceProxies : BasePlugin
{
[HarmonyPatch]
private class MoreReferenceProxiesPatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(SyncMemberEditorBuilder), "BuildBag")]
public static void BuildBagPostFix(ISyncBag bag, UIBuilder ui)
{
BuildProxy((IWorldElement)(object)bag, ui);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(UserInspectorItem), "RebuildUser")]
public static void RebuildUserPostFix(UserInspectorItem __instance, SyncRef<User> ____user)
{
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Expected O, but got Unknown
((SyncRef<IWorldElement>)(object)((ContainerWorker<Component>)(object)((Component)__instance).Slot[0]).AttachComponent<ReferenceProxySource>(true, (Action<ReferenceProxySource>)null).Reference).Target = (IWorldElement)(object)____user.Target;
((SyncRef<IWorldElement>)(object)((ContainerWorker<Component>)(object)((Component)__instance).Slot[1][1][0]).AttachComponent<ReferenceProxySource>(true, (Action<ReferenceProxySource>)null).Reference).Target = (IWorldElement)(object)(WorkerBag<UserComponent>)AccessTools.Field(typeof(User), "componentBag").GetValue((object)____user.Target);
for (int i = 0; i < ____user.Target.StreamGroupManager.Groups.Count; i++)
{
((SyncRef<IWorldElement>)(object)((ContainerWorker<Component>)(object)((Component)__instance).Slot[1][1][i + 1]).AttachComponent<ReferenceProxySource>(true, (Action<ReferenceProxySource>)null).Reference).Target = (IWorldElement)(StreamBag)AccessTools.Field(typeof(User), "streamBag").GetValue((object)____user.Target);
}
}
}
public override void Load()
{
((BasePlugin)this).HarmonyInstance.PatchAll();
}
private static void BuildProxy(IWorldElement target, UIBuilder ui)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
Slot obj = ui.Current[0];
((SyncRef<IWorldElement>)(object)((ContainerWorker<Component>)(object)obj).AttachComponent<ReferenceProxySource>(true, (Action<ReferenceProxySource>)null).Reference).Target = target;
ColorDriver val = ((SyncElementList<ColorDriver>)(object)((InteractionElement)((ContainerWorker<Component>)(object)obj).AttachComponent<Button>(true, (Action<Button>)null)).ColorDrivers).Add();
Text component = ((ContainerWorker<Component>)(object)obj).GetComponent<Text>((Predicate<Text>)null, false);
((SyncRef<IField<colorX>>)(object)val.ColorDrive).Target = (IField<colorX>)(object)component.Color;
((SyncField<colorX>)(object)val.NormalColor).Value = RadiantUI_Constants.TEXT_COLOR;
((SyncField<colorX>)(object)val.HighlightColor).Value = RadiantUI_Constants.LABEL_COLOR;
((SyncField<colorX>)(object)val.PressColor).Value = RadiantUI_Constants.HEADING_COLOR;
}
}
public static class PluginMetadata
{
public const string GUID = "net.eia485.MoreReferenceProxies";
public const string NAME = "MoreReferenceProxies";
public const string VERSION = "1.1.2";
public const string AUTHORS = "eia485";
public const string REPOSITORY_URL = "https://github.com/EIA485/NeosMoreReferenceProxies";
}