using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
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("NepuShiro")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2")]
[assembly: AssemblyProduct("BetterInspectorCheckbox")]
[assembly: AssemblyTitle("BetterInspectorCheckbox")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/NepuShiro/BetterInspectorCheckbox")]
[assembly: AssemblyVersion("1.1.2.0")]
[module: RefSafetyRules(11)]
namespace BetterInspectorCheckbox;
[ResonitePlugin("NepuShiro.BetterInspectorCheckbox", "BetterInspectorCheckbox", "1.1.2", "NepuShiro", "https://github.com/NepuShiro/BetterInspectorCheckbox")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
[HarmonyPatch(typeof(SlotInspector), "OnChanges")]
public static class SlotInspector_Patch
{
public static void Postfix(SlotInspector __instance)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
SlotInspector __instance2 = __instance;
SlotInspector obj = __instance2;
object obj2;
if (obj == null)
{
obj2 = null;
}
else
{
Slot slot = ((Component)obj).Slot;
obj2 = ((slot != null) ? slot.GetComponentInParents<SceneInspector>((Predicate<SceneInspector>)null, true, false) : null);
}
Slot val = ((obj2 != null) ? ((Component)obj2).Slot : null);
if (val == null)
{
return;
}
RefID referenceID = ((Worker)val).ReferenceID;
ulong num = default(ulong);
byte b = default(byte);
((RefID)(ref referenceID)).ExtractIDs(ref num, ref b);
User userByAllocationID = ((Worker)val).World.GetUserByAllocationID(b);
if (userByAllocationID == null || num < userByAllocationID.AllocationIDStart || (!userByAllocationID.IsLocalUser && userByAllocationID != ((Worker)val).World.LocalUser))
{
return;
}
if (RunInUpdates.Value)
{
((ComponentBase<Component>)(object)__instance2).RunInUpdates(RunInUpdatesAmount.Value, (Action)delegate
{
BooleanMemberEditorChanger(__instance2);
});
}
else
{
BooleanMemberEditorChanger(__instance2);
}
}
private static void BooleanMemberEditorChanger(SlotInspector instance)
{
try
{
Slot val = ((Component)instance).Slot.FindChild("Horizontal Layout");
if (val == null)
{
return;
}
Slot val2 = val.FindChild("Panel");
if (val2 != null)
{
if (!Checkbox.Value)
{
((ComponentBase<Component>)(object)((ContainerWorker<Component>)(object)val).GetComponent<BooleanMemberEditor>((Predicate<BooleanMemberEditor>)null, false))?.Destroy();
val2.Destroy();
}
else if (BetterVisual.Value)
{
LayoutElement component = ((ContainerWorker<Component>)(object)val2).GetComponent<LayoutElement>((Predicate<LayoutElement>)null, false);
((SyncField<float>)(object)component.MinWidth).Value = 24f;
((SyncField<float>)(object)component.MinHeight).Value = 24f;
((SyncField<float>)(object)component.FlexibleHeight).Value = 1f;
}
}
Slot val3 = val.FindChild("Text");
if (val3 != null && !RightAlign.Value)
{
val3.OrderOffset = 1L;
}
}
catch (global::System.Exception ex)
{
Log.LogError((object)ex);
}
}
}
internal static ManualLogSource Log;
private static ConfigEntry<bool> Checkbox;
private static ConfigEntry<bool> BetterVisual;
private static ConfigEntry<bool> RightAlign;
private static ConfigEntry<bool> RunInUpdates;
private static ConfigEntry<int> RunInUpdatesAmount;
public override void Load()
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
Checkbox = ((BasePlugin)this).Config.Bind<bool>("General", "Checkbox", true, "Enable the Checkbox?");
BetterVisual = ((BasePlugin)this).Config.Bind<bool>("General", "Better Visual", true, "Use the better Visual?");
RightAlign = ((BasePlugin)this).Config.Bind<bool>("General", "Right Align", false, "Right Align the checkbox?");
RunInUpdates = ((BasePlugin)this).Config.Bind<bool>("General", "RunInUpdates", false, "RunInUpdates? Use this if you're having issues with it not applying");
RunInUpdatesAmount = ((BasePlugin)this).Config.Bind<int>("General", "RunInUpdatesAmount", 1, "Amount of updates to wait");
((BasePlugin)this).HarmonyInstance.PatchAll();
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("NepuShiro.BetterInspectorCheckbox");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
}
}
public static class PluginMetadata
{
public const string GUID = "NepuShiro.BetterInspectorCheckbox";
public const string NAME = "BetterInspectorCheckbox";
public const string VERSION = "1.1.2";
public const string AUTHORS = "NepuShiro";
public const string REPOSITORY_URL = "https://github.com/NepuShiro/BetterInspectorCheckbox";
}