using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using BepisLocaleLoader;
using Elements.Core;
using FrooxEngine;
using FrooxEngine.Undo;
using HarmonyLib;
using Renderite.Shared;
[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("LeCloutPanda")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+ca668f81465177467d550a79b00187f0e230102d")]
[assembly: AssemblyProduct("Inspectors Plus")]
[assembly: AssemblyTitle("InspectorsPlus")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/lecloutpanda/InspectorsPlus")]
[assembly: AssemblyVersion("1.0.1.0")]
[module: RefSafetyRules(11)]
namespace InspectorsPlus;
[ResonitePlugin("dev.lecloutpanda.inspectorsplus", "Inspectors Plus", "1.0.1", "LeCloutPanda", "https://github.com/lecloutpanda/InspectorsPlus")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
[HarmonyPatch(typeof(SceneInspector))]
private static class SceneInspectorPatches
{
[CompilerGenerated]
private sealed class <>c__DisplayClass0_0
{
[StructLayout(3)]
private struct <<OnAddChildPressedPrefix>b__0>d : IAsyncStateMachine
{
public int <>1__state;
public AsyncTaskMethodBuilder <>t__builder;
public <>c__DisplayClass0_0 <>4__this;
private <>c__DisplayClass0_1 <>8__1;
private TaskAwaiter<ContextMenu> <>u__1;
private void MoveNext()
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Expected O, but got Unknown
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected O, but got Unknown
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Expected O, but got Unknown
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Expected O, but got Unknown
int num = <>1__state;
<>c__DisplayClass0_0 <>c__DisplayClass0_ = <>4__this;
try
{
TaskAwaiter<ContextMenu> awaiter;
if (num != 0)
{
<>8__1 = new <>c__DisplayClass0_1();
<>8__1.CS$<>8__locals1 = <>c__DisplayClass0_;
awaiter = ContextMenuExtensions.OpenContextMenu(((Worker)<>c__DisplayClass0_.__instance).LocalUser, (IWorldElement)(object)<>c__DisplayClass0_.eventData.source, <>c__DisplayClass0_.eventData.source.Slot, default(ContextMenuOptions)).GetAwaiter();
if (!awaiter.IsCompleted)
{
num = (<>1__state = 0);
<>u__1 = awaiter;
((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter<ContextMenu>, <<OnAddChildPressedPrefix>b__0>d>(ref awaiter, ref this);
return;
}
}
else
{
awaiter = <>u__1;
<>u__1 = default(TaskAwaiter<ContextMenu>);
num = (<>1__state = -1);
}
ContextMenu result = awaiter.GetResult();
<>8__1.menu = result;
if (<>8__1.menu != null)
{
ContextMenu menu = <>8__1.menu;
LocaleString val = LocaleLoader.T("Settings.dev.lecloudpands.inspectorsplus.CreateChildVanilla", (string)null, true, (Dictionary<string, object>)null);
Uri val2 = new Uri("resdb:///95cd25567b32cc84619f2fe0d038c0c46f854472ce1f46cc1f3635ab87ad44cf.png");
colorX? val3 = Hero.CYAN;
menu.AddItem(ref val, val2, ref val3).Button.LocalPressed += (ButtonEventHandler)delegate
{
<>8__1.CS$<>8__locals1.newSlot = <>8__1.CS$<>8__locals1.__instance.ComponentView.Target.AddSlot(<>8__1.CS$<>8__locals1.__instance.ComponentView.Target.Name + " - child", true);
SpawnOrDestroyExtensions.CreateSpawnUndoPoint(<>8__1.CS$<>8__locals1.newSlot, (string)null, (Action<Worker>)null);
<>8__1.menu.Close();
};
ContextMenu menu2 = <>8__1.menu;
val = LocaleLoader.T("Settings.dev.lecloudpands.inspectorsplus.CreateChildNewInspector", (string)null, true, (Dictionary<string, object>)null);
Uri val4 = new Uri("resdb:///003ff2c3b1b7445c55ae3c0e2d2ca2c9fa70ca85d899af238fc08aa63bb5e43e.png");
val3 = Hero.ORANGE;
menu2.AddItem(ref val, val4, ref val3).Button.LocalPressed += (ButtonEventHandler)delegate
{
<>8__1.CS$<>8__locals1.newSlot = <>8__1.CS$<>8__locals1.__instance.ComponentView.Target.AddSlot(<>8__1.CS$<>8__locals1.__instance.ComponentView.Target.Name + " - child", true);
SpawnOrDestroyExtensions.CreateSpawnUndoPoint(<>8__1.CS$<>8__locals1.newSlot, (string)null, (Action<Worker>)null);
InspectorHelper.OpenInspectorForTarget((IWorldElement)(object)<>8__1.CS$<>8__locals1.newSlot, <>8__1.CS$<>8__locals1.newSlot, false);
<>8__1.menu.Close();
};
ContextMenu menu3 = <>8__1.menu;
val = LocaleLoader.T("Settings.dev.lecloudpands.inspectorsplus.CreateChildAutoSelect", (string)null, true, (Dictionary<string, object>)null);
Uri val5 = new Uri("resdb:///7419fe9a8e03e727dfb59b2a018b0c3f4ca0f97bd305fe19ae2caddec7172792.png");
val3 = Hero.PURPLE;
menu3.AddItem(ref val, val5, ref val3).Button.LocalPressed += (ButtonEventHandler)delegate
{
<>8__1.CS$<>8__locals1.newSlot = <>8__1.CS$<>8__locals1.__instance.ComponentView.Target.AddSlot(<>8__1.CS$<>8__locals1.__instance.ComponentView.Target.Name + " - child", true);
SpawnOrDestroyExtensions.CreateSpawnUndoPoint(<>8__1.CS$<>8__locals1.newSlot, (string)null, (Action<Worker>)null);
((SyncRef<Slot>)(object)<>8__1.CS$<>8__locals1.__instance.Root).Target = <>8__1.CS$<>8__locals1.newSlot;
<>8__1.CS$<>8__locals1.__instance.ComponentView.Target = <>8__1.CS$<>8__locals1.newSlot;
<>8__1.menu.Close();
};
}
}
catch (global::System.Exception exception)
{
<>1__state = -2;
<>8__1 = null;
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
return;
}
<>1__state = -2;
<>8__1 = null;
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
}
[DebuggerHidden]
private void SetStateMachine(IAsyncStateMachine stateMachine)
{
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
}
}
public SceneInspector __instance;
public ButtonEventData eventData;
public Slot newSlot;
[AsyncStateMachine(typeof(<<OnAddChildPressedPrefix>b__0>d))]
internal global::System.Threading.Tasks.Task <OnAddChildPressedPrefix>b__0()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<<OnAddChildPressedPrefix>b__0>d <<OnAddChildPressedPrefix>b__0>d = default(<<OnAddChildPressedPrefix>b__0>d);
<<OnAddChildPressedPrefix>b__0>d.<>t__builder = AsyncTaskMethodBuilder.Create();
<<OnAddChildPressedPrefix>b__0>d.<>4__this = this;
<<OnAddChildPressedPrefix>b__0>d.<>1__state = -1;
((AsyncTaskMethodBuilder)(ref <<OnAddChildPressedPrefix>b__0>d.<>t__builder)).Start<<<OnAddChildPressedPrefix>b__0>d>(ref <<OnAddChildPressedPrefix>b__0>d);
return ((AsyncTaskMethodBuilder)(ref <<OnAddChildPressedPrefix>b__0>d.<>t__builder)).Task;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass0_1
{
public ContextMenu menu;
public <>c__DisplayClass0_0 CS$<>8__locals1;
internal void <OnAddChildPressedPrefix>b__1(IButton <p0>, ButtonEventData <p1>)
{
CS$<>8__locals1.newSlot = CS$<>8__locals1.__instance.ComponentView.Target.AddSlot(CS$<>8__locals1.__instance.ComponentView.Target.Name + " - child", true);
SpawnOrDestroyExtensions.CreateSpawnUndoPoint(CS$<>8__locals1.newSlot, (string)null, (Action<Worker>)null);
menu.Close();
}
internal void <OnAddChildPressedPrefix>b__2(IButton <p0>, ButtonEventData <p1>)
{
CS$<>8__locals1.newSlot = CS$<>8__locals1.__instance.ComponentView.Target.AddSlot(CS$<>8__locals1.__instance.ComponentView.Target.Name + " - child", true);
SpawnOrDestroyExtensions.CreateSpawnUndoPoint(CS$<>8__locals1.newSlot, (string)null, (Action<Worker>)null);
InspectorHelper.OpenInspectorForTarget((IWorldElement)(object)CS$<>8__locals1.newSlot, CS$<>8__locals1.newSlot, false);
menu.Close();
}
internal void <OnAddChildPressedPrefix>b__3(IButton <p0>, ButtonEventData <p1>)
{
CS$<>8__locals1.newSlot = CS$<>8__locals1.__instance.ComponentView.Target.AddSlot(CS$<>8__locals1.__instance.ComponentView.Target.Name + " - child", true);
SpawnOrDestroyExtensions.CreateSpawnUndoPoint(CS$<>8__locals1.newSlot, (string)null, (Action<Worker>)null);
((SyncRef<Slot>)(object)CS$<>8__locals1.__instance.Root).Target = CS$<>8__locals1.newSlot;
CS$<>8__locals1.__instance.ComponentView.Target = CS$<>8__locals1.newSlot;
menu.Close();
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass1_0
{
[StructLayout(3)]
private struct <<OnInsertParentPressedPrefix>b__0>d : IAsyncStateMachine
{
public int <>1__state;
public AsyncTaskMethodBuilder <>t__builder;
public <>c__DisplayClass1_0 <>4__this;
private <>c__DisplayClass1_1 <>8__1;
private TaskAwaiter<ContextMenu> <>u__1;
private void MoveNext()
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Expected O, but got Unknown
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected O, but got Unknown
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Expected O, but got Unknown
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Expected O, but got Unknown
int num = <>1__state;
<>c__DisplayClass1_0 <>c__DisplayClass1_ = <>4__this;
try
{
TaskAwaiter<ContextMenu> awaiter;
if (num != 0)
{
<>8__1 = new <>c__DisplayClass1_1();
<>8__1.CS$<>8__locals1 = <>c__DisplayClass1_;
awaiter = ContextMenuExtensions.OpenContextMenu(((Worker)<>c__DisplayClass1_.__instance).LocalUser, (IWorldElement)(object)<>c__DisplayClass1_.eventData.source, <>c__DisplayClass1_.eventData.source.Slot, default(ContextMenuOptions)).GetAwaiter();
if (!awaiter.IsCompleted)
{
num = (<>1__state = 0);
<>u__1 = awaiter;
((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter<ContextMenu>, <<OnInsertParentPressedPrefix>b__0>d>(ref awaiter, ref this);
return;
}
}
else
{
awaiter = <>u__1;
<>u__1 = default(TaskAwaiter<ContextMenu>);
num = (<>1__state = -1);
}
ContextMenu result = awaiter.GetResult();
<>8__1.menu = result;
if (<>8__1.menu != null)
{
ContextMenu menu = <>8__1.menu;
LocaleString val = LocaleLoader.T("Settings.dev.lecloudpands.inspectorsplus.CreateParentVanilla", (string)null, true, (Dictionary<string, object>)null);
Uri val2 = new Uri("resdb:///304fd747d80cfd8c60c9d885def11fc62488e5e7c45c899e29c8577f9f8248db.png");
colorX? val3 = Hero.CYAN;
menu.AddItem(ref val, val2, ref val3).Button.LocalPressed += (ButtonEventHandler)delegate
{
<>8__1.CS$<>8__locals1.newSlot = InserParent(<>8__1.CS$<>8__locals1.__instance);
<>8__1.menu.Close();
};
ContextMenu menu2 = <>8__1.menu;
val = LocaleLoader.T("Settings.dev.lecloudpands.inspectorsplus.CreateParentNewInspector", (string)null, true, (Dictionary<string, object>)null);
Uri val4 = new Uri("resdb:///003ff2c3b1b7445c55ae3c0e2d2ca2c9fa70ca85d899af238fc08aa63bb5e43e.png");
val3 = Hero.ORANGE;
menu2.AddItem(ref val, val4, ref val3).Button.LocalPressed += (ButtonEventHandler)delegate
{
<>8__1.CS$<>8__locals1.newSlot = InserParent(<>8__1.CS$<>8__locals1.__instance);
InspectorHelper.OpenInspectorForTarget((IWorldElement)(object)<>8__1.CS$<>8__locals1.newSlot, <>8__1.CS$<>8__locals1.newSlot, false);
<>8__1.menu.Close();
};
ContextMenu menu3 = <>8__1.menu;
val = LocaleLoader.T("Settings.dev.lecloudpands.inspectorsplus.CreateParentAutoSelect", (string)null, true, (Dictionary<string, object>)null);
Uri val5 = new Uri("resdb:///7419fe9a8e03e727dfb59b2a018b0c3f4ca0f97bd305fe19ae2caddec7172792.png");
val3 = Hero.PURPLE;
menu3.AddItem(ref val, val5, ref val3).Button.LocalPressed += (ButtonEventHandler)delegate
{
<>8__1.CS$<>8__locals1.newSlot = InserParent(<>8__1.CS$<>8__locals1.__instance);
<>8__1.CS$<>8__locals1.__instance.ComponentView.Target = <>8__1.CS$<>8__locals1.newSlot;
<>8__1.menu.Close();
};
}
}
catch (global::System.Exception exception)
{
<>1__state = -2;
<>8__1 = null;
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
return;
}
<>1__state = -2;
<>8__1 = null;
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
}
[DebuggerHidden]
private void SetStateMachine(IAsyncStateMachine stateMachine)
{
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
}
}
public SceneInspector __instance;
public ButtonEventData eventData;
public Slot newSlot;
[AsyncStateMachine(typeof(<<OnInsertParentPressedPrefix>b__0>d))]
internal global::System.Threading.Tasks.Task <OnInsertParentPressedPrefix>b__0()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<<OnInsertParentPressedPrefix>b__0>d <<OnInsertParentPressedPrefix>b__0>d = default(<<OnInsertParentPressedPrefix>b__0>d);
<<OnInsertParentPressedPrefix>b__0>d.<>t__builder = AsyncTaskMethodBuilder.Create();
<<OnInsertParentPressedPrefix>b__0>d.<>4__this = this;
<<OnInsertParentPressedPrefix>b__0>d.<>1__state = -1;
((AsyncTaskMethodBuilder)(ref <<OnInsertParentPressedPrefix>b__0>d.<>t__builder)).Start<<<OnInsertParentPressedPrefix>b__0>d>(ref <<OnInsertParentPressedPrefix>b__0>d);
return ((AsyncTaskMethodBuilder)(ref <<OnInsertParentPressedPrefix>b__0>d.<>t__builder)).Task;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass1_1
{
public ContextMenu menu;
public <>c__DisplayClass1_0 CS$<>8__locals1;
internal void <OnInsertParentPressedPrefix>b__1(IButton <p0>, ButtonEventData <p1>)
{
CS$<>8__locals1.newSlot = InserParent(CS$<>8__locals1.__instance);
menu.Close();
}
internal void <OnInsertParentPressedPrefix>b__2(IButton <p0>, ButtonEventData <p1>)
{
CS$<>8__locals1.newSlot = InserParent(CS$<>8__locals1.__instance);
InspectorHelper.OpenInspectorForTarget((IWorldElement)(object)CS$<>8__locals1.newSlot, CS$<>8__locals1.newSlot, false);
menu.Close();
}
internal void <OnInsertParentPressedPrefix>b__3(IButton <p0>, ButtonEventData <p1>)
{
CS$<>8__locals1.newSlot = InserParent(CS$<>8__locals1.__instance);
CS$<>8__locals1.__instance.ComponentView.Target = CS$<>8__locals1.newSlot;
menu.Close();
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass3_0
{
[StructLayout(3)]
private struct <<OnDuplicatePressedPrefix>b__0>d : IAsyncStateMachine
{
public int <>1__state;
public AsyncTaskMethodBuilder <>t__builder;
public <>c__DisplayClass3_0 <>4__this;
private <>c__DisplayClass3_1 <>8__1;
private TaskAwaiter<ContextMenu> <>u__1;
private void MoveNext()
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Expected O, but got Unknown
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected O, but got Unknown
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Expected O, but got Unknown
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Expected O, but got Unknown
int num = <>1__state;
<>c__DisplayClass3_0 <>c__DisplayClass3_ = <>4__this;
try
{
TaskAwaiter<ContextMenu> awaiter;
if (num != 0)
{
<>8__1 = new <>c__DisplayClass3_1();
<>8__1.CS$<>8__locals1 = <>c__DisplayClass3_;
awaiter = ContextMenuExtensions.OpenContextMenu(((Worker)<>c__DisplayClass3_.__instance).LocalUser, (IWorldElement)(object)<>c__DisplayClass3_.eventData.source, <>c__DisplayClass3_.eventData.source.Slot, default(ContextMenuOptions)).GetAwaiter();
if (!awaiter.IsCompleted)
{
num = (<>1__state = 0);
<>u__1 = awaiter;
((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter<ContextMenu>, <<OnDuplicatePressedPrefix>b__0>d>(ref awaiter, ref this);
return;
}
}
else
{
awaiter = <>u__1;
<>u__1 = default(TaskAwaiter<ContextMenu>);
num = (<>1__state = -1);
}
ContextMenu result = awaiter.GetResult();
<>8__1.menu = result;
if (<>8__1.menu != null)
{
ContextMenu menu = <>8__1.menu;
LocaleString val = LocaleLoader.T("Settings.dev.lecloudpands.inspectorsplus.CreateDuplicateVanilla", (string)null, true, (Dictionary<string, object>)null);
Uri val2 = new Uri("resdb:///e411778432886db3d0da13936f17546698244015d9109de9fefdbd96000ed654.png");
colorX? val3 = Hero.CYAN;
menu.AddItem(ref val, val2, ref val3).Button.LocalPressed += (ButtonEventHandler)delegate
{
<>8__1.CS$<>8__locals1.newSlot = DuplicateSlot(<>8__1.CS$<>8__locals1.__instance);
<>8__1.menu.Close();
};
ContextMenu menu2 = <>8__1.menu;
val = LocaleLoader.T("Settings.dev.lecloudpands.inspectorsplus.CreateDuplicateNewInspector", (string)null, true, (Dictionary<string, object>)null);
Uri val4 = new Uri("resdb:///003ff2c3b1b7445c55ae3c0e2d2ca2c9fa70ca85d899af238fc08aa63bb5e43e.png");
val3 = Hero.ORANGE;
menu2.AddItem(ref val, val4, ref val3).Button.LocalPressed += (ButtonEventHandler)delegate
{
<>8__1.CS$<>8__locals1.newSlot = DuplicateSlot(<>8__1.CS$<>8__locals1.__instance);
InspectorHelper.OpenInspectorForTarget((IWorldElement)(object)<>8__1.CS$<>8__locals1.newSlot, <>8__1.CS$<>8__locals1.newSlot, false);
<>8__1.menu.Close();
};
ContextMenu menu3 = <>8__1.menu;
val = LocaleLoader.T("Settings.dev.lecloudpands.inspectorsplus.CreateDuplicateAutoSelect", (string)null, true, (Dictionary<string, object>)null);
Uri val5 = new Uri("resdb:///7419fe9a8e03e727dfb59b2a018b0c3f4ca0f97bd305fe19ae2caddec7172792.png");
val3 = Hero.PURPLE;
menu3.AddItem(ref val, val5, ref val3).Button.LocalPressed += (ButtonEventHandler)delegate
{
<>8__1.CS$<>8__locals1.newSlot = DuplicateSlot(<>8__1.CS$<>8__locals1.__instance);
<>8__1.CS$<>8__locals1.__instance.ComponentView.Target = <>8__1.CS$<>8__locals1.newSlot;
<>8__1.menu.Close();
};
}
}
catch (global::System.Exception exception)
{
<>1__state = -2;
<>8__1 = null;
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
return;
}
<>1__state = -2;
<>8__1 = null;
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
}
[DebuggerHidden]
private void SetStateMachine(IAsyncStateMachine stateMachine)
{
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
}
}
public SceneInspector __instance;
public ButtonEventData eventData;
public Slot newSlot;
[AsyncStateMachine(typeof(<<OnDuplicatePressedPrefix>b__0>d))]
internal global::System.Threading.Tasks.Task <OnDuplicatePressedPrefix>b__0()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<<OnDuplicatePressedPrefix>b__0>d <<OnDuplicatePressedPrefix>b__0>d = default(<<OnDuplicatePressedPrefix>b__0>d);
<<OnDuplicatePressedPrefix>b__0>d.<>t__builder = AsyncTaskMethodBuilder.Create();
<<OnDuplicatePressedPrefix>b__0>d.<>4__this = this;
<<OnDuplicatePressedPrefix>b__0>d.<>1__state = -1;
((AsyncTaskMethodBuilder)(ref <<OnDuplicatePressedPrefix>b__0>d.<>t__builder)).Start<<<OnDuplicatePressedPrefix>b__0>d>(ref <<OnDuplicatePressedPrefix>b__0>d);
return ((AsyncTaskMethodBuilder)(ref <<OnDuplicatePressedPrefix>b__0>d.<>t__builder)).Task;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass3_1
{
public ContextMenu menu;
public <>c__DisplayClass3_0 CS$<>8__locals1;
internal void <OnDuplicatePressedPrefix>b__1(IButton <p0>, ButtonEventData <p1>)
{
CS$<>8__locals1.newSlot = DuplicateSlot(CS$<>8__locals1.__instance);
menu.Close();
}
internal void <OnDuplicatePressedPrefix>b__2(IButton <p0>, ButtonEventData <p1>)
{
CS$<>8__locals1.newSlot = DuplicateSlot(CS$<>8__locals1.__instance);
InspectorHelper.OpenInspectorForTarget((IWorldElement)(object)CS$<>8__locals1.newSlot, CS$<>8__locals1.newSlot, false);
menu.Close();
}
internal void <OnDuplicatePressedPrefix>b__3(IButton <p0>, ButtonEventData <p1>)
{
CS$<>8__locals1.newSlot = DuplicateSlot(CS$<>8__locals1.__instance);
CS$<>8__locals1.__instance.ComponentView.Target = CS$<>8__locals1.newSlot;
menu.Close();
}
}
[HarmonyPatch("OnAddChildPressed")]
[HarmonyPrefix]
private static bool OnAddChildPressedPrefix(SceneInspector __instance, IButton button, ButtonEventData eventData)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Invalid comparison between Unknown and I4
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
CS$<>8__locals0.__instance = __instance;
CS$<>8__locals0.eventData = eventData;
if (!ENABLED.Value)
{
return true;
}
if (!CS$<>8__locals0.eventData.source.IsUnderLocalUser)
{
return true;
}
CS$<>8__locals0.newSlot = null;
try
{
if ((int)((Worker)CS$<>8__locals0.__instance).LocalUser.HeadDevice == 2 && USE_MODIFIER_KEY.Value && !((Worker)CS$<>8__locals0.__instance).InputInterface.GetKey(MODIFIER_KEY.Value))
{
return true;
}
((Worker)CS$<>8__locals0.__instance).StartTask((Func<global::System.Threading.Tasks.Task>)([AsyncStateMachine(typeof(<>c__DisplayClass0_0.<<OnAddChildPressedPrefix>b__0>d))] () =>
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass0_0.<<OnAddChildPressedPrefix>b__0>d <<OnAddChildPressedPrefix>b__0>d = default(<>c__DisplayClass0_0.<<OnAddChildPressedPrefix>b__0>d);
<<OnAddChildPressedPrefix>b__0>d.<>t__builder = AsyncTaskMethodBuilder.Create();
<<OnAddChildPressedPrefix>b__0>d.<>4__this = CS$<>8__locals0;
<<OnAddChildPressedPrefix>b__0>d.<>1__state = -1;
((AsyncTaskMethodBuilder)(ref <<OnAddChildPressedPrefix>b__0>d.<>t__builder)).Start<<>c__DisplayClass0_0.<<OnAddChildPressedPrefix>b__0>d>(ref <<OnAddChildPressedPrefix>b__0>d);
return ((AsyncTaskMethodBuilder)(ref <<OnAddChildPressedPrefix>b__0>d.<>t__builder)).Task;
}));
return false;
}
catch
{
Slot newSlot = CS$<>8__locals0.newSlot;
if (newSlot != null)
{
newSlot.Destroy();
}
return true;
}
}
[HarmonyPatch("OnInsertParentPressed")]
[HarmonyPrefix]
private static bool OnInsertParentPressedPrefix(SceneInspector __instance, IButton button, ButtonEventData eventData)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Invalid comparison between Unknown and I4
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
CS$<>8__locals0.__instance = __instance;
CS$<>8__locals0.eventData = eventData;
if (!ENABLED.Value)
{
return true;
}
if (!CS$<>8__locals0.eventData.source.IsUnderLocalUser)
{
return true;
}
CS$<>8__locals0.newSlot = null;
try
{
if ((int)((Worker)CS$<>8__locals0.__instance).LocalUser.HeadDevice == 2 && USE_MODIFIER_KEY.Value && !((Worker)CS$<>8__locals0.__instance).InputInterface.GetKey(MODIFIER_KEY.Value))
{
return true;
}
((Worker)CS$<>8__locals0.__instance).StartTask((Func<global::System.Threading.Tasks.Task>)([AsyncStateMachine(typeof(<>c__DisplayClass1_0.<<OnInsertParentPressedPrefix>b__0>d))] () =>
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass1_0.<<OnInsertParentPressedPrefix>b__0>d <<OnInsertParentPressedPrefix>b__0>d = default(<>c__DisplayClass1_0.<<OnInsertParentPressedPrefix>b__0>d);
<<OnInsertParentPressedPrefix>b__0>d.<>t__builder = AsyncTaskMethodBuilder.Create();
<<OnInsertParentPressedPrefix>b__0>d.<>4__this = CS$<>8__locals0;
<<OnInsertParentPressedPrefix>b__0>d.<>1__state = -1;
((AsyncTaskMethodBuilder)(ref <<OnInsertParentPressedPrefix>b__0>d.<>t__builder)).Start<<>c__DisplayClass1_0.<<OnInsertParentPressedPrefix>b__0>d>(ref <<OnInsertParentPressedPrefix>b__0>d);
return ((AsyncTaskMethodBuilder)(ref <<OnInsertParentPressedPrefix>b__0>d.<>t__builder)).Task;
}));
return false;
}
catch
{
Slot newSlot = CS$<>8__locals0.newSlot;
if (newSlot != null)
{
newSlot.Destroy();
}
return true;
}
}
private static Slot InserParent(SceneInspector __instance)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
try
{
if (__instance.ComponentView.Target != null)
{
Slot target = __instance.ComponentView.Target;
UndoManagerExtensions.BeginUndoBatch(((Worker)__instance).World, LocaleString.op_Implicit(LocaleHelper.GetLocalized((IWorldElement)(object)__instance, "Undo.InsertParent", (string)null, "name", (object)target.Name)));
Slot val = target.Parent.AddSlot(target.Name + " - Parent", true);
val.CopyTransform(target);
SpawnOrDestroyExtensions.CreateSpawnUndoPoint(val, (string)null, (Action<Worker>)null);
UpdateTransformExtensions.CreateTransformUndoState(target, true, true, true, true);
target.SetParent(val, true);
target.SetIdentityTransform();
UndoManagerExtensions.EndUndoBatch(((Worker)__instance).World);
((SyncRef<Slot>)(object)__instance.Root).Target = val;
return val;
}
return null;
}
catch
{
return null;
}
}
[HarmonyPatch("OnDuplicatePressed")]
[HarmonyPrefix]
private static bool OnDuplicatePressedPrefix(SceneInspector __instance, IButton button, ButtonEventData eventData)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Invalid comparison between Unknown and I4
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass3_0 CS$<>8__locals0 = new <>c__DisplayClass3_0();
CS$<>8__locals0.__instance = __instance;
CS$<>8__locals0.eventData = eventData;
if (!ENABLED.Value)
{
return true;
}
if (!CS$<>8__locals0.eventData.source.IsUnderLocalUser)
{
return true;
}
CS$<>8__locals0.newSlot = null;
try
{
if ((int)((Worker)CS$<>8__locals0.__instance).LocalUser.HeadDevice == 2 && USE_MODIFIER_KEY.Value && !((Worker)CS$<>8__locals0.__instance).InputInterface.GetKey(MODIFIER_KEY.Value))
{
return true;
}
((Worker)CS$<>8__locals0.__instance).StartTask((Func<global::System.Threading.Tasks.Task>)([AsyncStateMachine(typeof(<>c__DisplayClass3_0.<<OnDuplicatePressedPrefix>b__0>d))] () =>
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass3_0.<<OnDuplicatePressedPrefix>b__0>d <<OnDuplicatePressedPrefix>b__0>d = default(<>c__DisplayClass3_0.<<OnDuplicatePressedPrefix>b__0>d);
<<OnDuplicatePressedPrefix>b__0>d.<>t__builder = AsyncTaskMethodBuilder.Create();
<<OnDuplicatePressedPrefix>b__0>d.<>4__this = CS$<>8__locals0;
<<OnDuplicatePressedPrefix>b__0>d.<>1__state = -1;
((AsyncTaskMethodBuilder)(ref <<OnDuplicatePressedPrefix>b__0>d.<>t__builder)).Start<<>c__DisplayClass3_0.<<OnDuplicatePressedPrefix>b__0>d>(ref <<OnDuplicatePressedPrefix>b__0>d);
return ((AsyncTaskMethodBuilder)(ref <<OnDuplicatePressedPrefix>b__0>d.<>t__builder)).Task;
}));
return false;
}
catch
{
Slot newSlot = CS$<>8__locals0.newSlot;
if (newSlot != null)
{
newSlot.Destroy();
}
return true;
}
}
private static Slot DuplicateSlot(SceneInspector __instance)
{
try
{
if (__instance.ComponentView.Target != null)
{
Slot obj = __instance.ComponentView.Target.Duplicate(__instance.ComponentView.Target.Parent, true, (DuplicationSettings)null, false);
SpawnOrDestroyExtensions.CreateSpawnUndoPoint(obj, (string)null, (Action<Worker>)null);
return obj;
}
return null;
}
catch
{
return null;
}
}
}
internal static ManualLogSource? Log;
private static ConfigEntry<bool> ENABLED;
private static ConfigEntry<bool> USE_MODIFIER_KEY;
private static ConfigEntry<Key> MODIFIER_KEY;
public override void Load()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
((BasePlugin)this).HarmonyInstance.PatchAll();
ENABLED = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, new ConfigDescription("Enable/Disable the mod", (AcceptableValueBase)null, new object[1] { (object)new ConfigLocale("Settings.dev.lecloutpanda.inspectorsplus.General.Enabled", "Settings.dev.lecloutpanda.inspectorsplus.General.Enabled.Description") }));
USE_MODIFIER_KEY = ((BasePlugin)this).Config.Bind<bool>("General", "Use Modifier Key", true, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { (object)new ConfigLocale("Settings.dev.lecloutpanda.inspectorsplus.General.UseModifierKey", "Settings.dev.lecloutpanda.inspectorsplus.General.UseModifierKey.Description") }));
MODIFIER_KEY = ((BasePlugin)this).Config.Bind<Key>("General", "Modifier Key", (Key)512, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { (object)new ConfigLocale("Settings.dev.lecloutpanda.inspectorsplus.General.ModifierKey", "Settings.dev.lecloutpanda.inspectorsplus.General.ModifierKey.Description") }));
}
}
public static class PluginMetadata
{
public const string GUID = "dev.lecloutpanda.inspectorsplus";
public const string NAME = "Inspectors Plus";
public const string VERSION = "1.0.1";
public const string AUTHORS = "LeCloutPanda";
public const string REPOSITORY_URL = "https://github.com/lecloutpanda/InspectorsPlus";
}