Decompiled source of bonechange v1.1.0

Mods/bonechange.dll

Decompiled 6 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Windows.Forms;
using MelonLoader;
using UnityEngine;
using bonechange;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(UnifiedEditorMod), "BONEWORKS Standalone Editor", "1.0.1", "Dev", null)]
[assembly: MelonGame("Stress Level Zero", "BONEWORKS")]
[assembly: AssemblyTitle("bonechange")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("bonechange")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("59fe0679-c044-42d6-ad9e-1875f2ce016c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace bonechange;

public class UnifiedEditorMod : MelonMod
{
	private Thread windowThread;

	private static readonly Queue<Action> mainThreadQueue = new Queue<Action>();

	private static List<GameObject> spawnedObjects = new List<GameObject>();

	private static Camera editorCamera;

	private static GameObject editorCameraObj;

	public static GameObject SelectedObject { get; private set; } = null;

	public override void OnApplicationStart()
	{
		MelonLogger.Msg("Starting Unified PC Control Window & Viewport Thread...");
		windowThread = new Thread(RunDesktopWindow);
		windowThread.SetApartmentState(ApartmentState.STA);
		windowThread.Start();
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		SpawnEditorCamera();
	}

	public override void OnUpdate()
	{
		lock (mainThreadQueue)
		{
			while (mainThreadQueue.Count > 0)
			{
				mainThreadQueue.Dequeue()?.Invoke();
			}
		}
		UpdateEditorCameraMovement();
	}

	private void RunDesktopWindow()
	{
		Application.EnableVisualStyles();
		Application.SetCompatibleTextRenderingDefault(false);
		EditorDesktopForm editorDesktopForm = new EditorDesktopForm();
		Application.Run((Form)(object)editorDesktopForm);
	}

	public static void QueueVRTask(Action task)
	{
		lock (mainThreadQueue)
		{
			mainThreadQueue.Enqueue(task);
		}
	}

	private static void SpawnEditorCamera()
	{
		QueueVRTask(delegate
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)editorCameraObj == (Object)null)
			{
				editorCameraObj = new GameObject("BoneworksEditorCamera");
				editorCamera = editorCameraObj.AddComponent<Camera>();
				((Component)editorCamera).tag = "MainCamera";
				editorCameraObj.transform.position = new Vector3(0f, 2f, -3f);
				editorCameraObj.transform.rotation = Quaternion.Euler(15f, 0f, 0f);
				MelonLogger.Msg("[Editor] Spawned Custom Editor Camera in World.");
			}
		});
	}

	private static void UpdateEditorCameraMovement()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)editorCameraObj == (Object)null))
		{
			float num = 5f * Time.deltaTime;
			Vector3 val = Vector3.zero;
			if (Input.GetKey((KeyCode)119) || Input.GetKey((KeyCode)273))
			{
				val += Vector3.forward;
			}
			if (Input.GetKey((KeyCode)115) || Input.GetKey((KeyCode)274))
			{
				val += Vector3.back;
			}
			if (Input.GetKey((KeyCode)97) || Input.GetKey((KeyCode)276))
			{
				val += Vector3.left;
			}
			if (Input.GetKey((KeyCode)100) || Input.GetKey((KeyCode)275))
			{
				val += Vector3.right;
			}
			if (Input.GetKey((KeyCode)101) || Input.GetKey((KeyCode)280))
			{
				val += Vector3.up;
			}
			if (Input.GetKey((KeyCode)113) || Input.GetKey((KeyCode)281))
			{
				val += Vector3.down;
			}
			editorCameraObj.transform.Translate(val * num, (Space)1);
		}
	}

	public static void SpawnPrimitiveInVR(PrimitiveType pType, bool enablePhysics)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		QueueVRTask(delegate
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = (Vector3)(((Object)(object)editorCameraObj != (Object)null) ? (editorCameraObj.transform.position + editorCameraObj.transform.forward * 3f) : new Vector3(0f, 1.5f, 2f));
			GameObject val = GameObject.CreatePrimitive(pType);
			((Object)val).name = $"{pType}_{spawnedObjects.Count + 1}";
			val.transform.position = position;
			if (enablePhysics)
			{
				Rigidbody val2 = val.AddComponent<Rigidbody>();
				val2.mass = 1f;
				val2.useGravity = true;
			}
			spawnedObjects.Add(val);
			SelectedObject = val;
			MelonLogger.Msg("[Editor -> VR] Spawned primitive: " + ((Object)val).name);
		});
	}

	public static void SpawnBoneworksObject(string objectName)
	{
		QueueVRTask(delegate
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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)
			Vector3 val = (Vector3)(((Object)(object)editorCameraObj != (Object)null) ? (editorCameraObj.transform.position + editorCameraObj.transform.forward * 3f) : new Vector3(0f, 1.5f, 2f));
			Quaternion identity = Quaternion.identity;
			try
			{
				GameObject val2 = null;
				GameObject val3 = Resources.Load<GameObject>(objectName);
				if ((Object)(object)val3 != (Object)null)
				{
					val2 = Object.Instantiate<GameObject>(val3, val, identity);
				}
				else
				{
					val2 = GameObject.CreatePrimitive((PrimitiveType)3);
					((Object)val2).name = "BW_Prop_" + objectName;
					val2.transform.position = val;
					Rigidbody val4 = val2.AddComponent<Rigidbody>();
					val4.mass = 2f;
				}
				if ((Object)(object)val2 != (Object)null)
				{
					spawnedObjects.Add(val2);
					SelectedObject = val2;
					MelonLogger.Msg("[Editor -> VR] Spawned Boneworks Object: " + objectName);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Failed to spawn Boneworks object " + objectName + ": " + ex.Message);
			}
		});
	}

	public static void DeleteSelectedInVR()
	{
		QueueVRTask(delegate
		{
			if ((Object)(object)SelectedObject != (Object)null)
			{
				string name = ((Object)SelectedObject).name;
				spawnedObjects.Remove(SelectedObject);
				Object.Destroy((Object)(object)SelectedObject);
				SelectedObject = null;
				MelonLogger.Msg("[Editor -> VR] Deleted: " + name);
			}
		});
	}

	public static void DeleteAllInVR()
	{
		QueueVRTask(delegate
		{
			foreach (GameObject spawnedObject in spawnedObjects)
			{
				if ((Object)(object)spawnedObject != (Object)null)
				{
					Object.Destroy((Object)(object)spawnedObject);
				}
			}
			spawnedObjects.Clear();
			SelectedObject = null;
			MelonLogger.Msg("[Editor -> VR] Deleted ALL spawned objects.");
		});
	}

	public static void UpdateObjectTransform(Vector3 pos, Vector3 scale, Vector3 rot, bool hasPhysics)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//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_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		QueueVRTask(delegate
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)SelectedObject != (Object)null)
			{
				SelectedObject.transform.position = pos;
				SelectedObject.transform.localScale = scale;
				SelectedObject.transform.eulerAngles = rot;
				Rigidbody component = SelectedObject.GetComponent<Rigidbody>();
				if (hasPhysics && (Object)(object)component == (Object)null)
				{
					component = SelectedObject.AddComponent<Rigidbody>();
					component.mass = 1f;
				}
				else if (!hasPhysics && (Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
			}
		});
	}

	public static Vector3 GetSelectedPosition()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		return ((Object)(object)SelectedObject != (Object)null) ? SelectedObject.transform.position : Vector3.zero;
	}

	public static Vector3 GetSelectedScale()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		return ((Object)(object)SelectedObject != (Object)null) ? SelectedObject.transform.localScale : Vector3.one;
	}

	public static Vector3 GetSelectedRotation()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		return ((Object)(object)SelectedObject != (Object)null) ? SelectedObject.transform.eulerAngles : Vector3.zero;
	}

	public static bool GetSelectedHasPhysics()
	{
		return (Object)(object)SelectedObject != (Object)null && (Object)(object)SelectedObject.GetComponent<Rigidbody>() != (Object)null;
	}
}
public class EditorDesktopForm : Form
{
	private Panel viewportPanel;

	private Label lblViewportInfo;

	private Button btnCube;

	private Button btnSphere;

	private Button btnCylinder;

	private Button btnPlane;

	private Button btnCapsule;

	private Button btnSpawnCrate;

	private Button btnSpawnScythe;

	private Button btnSpawnPistol;

	private Button btnSpawnNullBody;

	private CheckBox chkSpawnPhysics;

	private Button btnDelete;

	private Button btnDeleteAll;

	private TextBox txtPosX;

	private TextBox txtPosY;

	private TextBox txtPosZ;

	private TextBox txtScaleX;

	private TextBox txtScaleY;

	private TextBox txtScaleZ;

	private TextBox txtRotX;

	private TextBox txtRotY;

	private TextBox txtRotZ;

	private CheckBox chkSelectedPhysics;

	private Button btnApplyTransform;

	public EditorDesktopForm()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		InitializeComponent();
		Timer val = new Timer();
		val.Interval = 100;
		val.Tick += delegate
		{
			RefreshInspectorValues();
		};
		val.Start();
	}

	private void InitializeComponent()
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: 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_006b: 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_0083: 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_00a2: Expected O, but got Unknown
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Expected O, but got Unknown
		//IL_0106: Expected O, but got Unknown
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Expected O, but got Unknown
		//IL_017f: Expected O, but got Unknown
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Unknown result type (might be due to invalid IL or missing references)
		//IL_0383: Unknown result type (might be due to invalid IL or missing references)
		//IL_038f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0398: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ba: Expected O, but got Unknown
		//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Expected O, but got Unknown
		//IL_03db: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0401: Unknown result type (might be due to invalid IL or missing references)
		//IL_040d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0416: Unknown result type (might be due to invalid IL or missing references)
		//IL_042a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0436: Unknown result type (might be due to invalid IL or missing references)
		//IL_043e: Unknown result type (might be due to invalid IL or missing references)
		//IL_044a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0454: Expected O, but got Unknown
		//IL_045a: Expected O, but got Unknown
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0503: Expected O, but got Unknown
		//IL_0505: Expected O, but got Unknown
		//IL_0506: Unknown result type (might be due to invalid IL or missing references)
		//IL_050b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0517: Unknown result type (might be due to invalid IL or missing references)
		//IL_0520: Unknown result type (might be due to invalid IL or missing references)
		//IL_0529: Unknown result type (might be due to invalid IL or missing references)
		//IL_0535: Unknown result type (might be due to invalid IL or missing references)
		//IL_053e: Unknown result type (might be due to invalid IL or missing references)
		//IL_054a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0557: Expected O, but got Unknown
		//IL_0637: Unknown result type (might be due to invalid IL or missing references)
		//IL_063c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0648: Unknown result type (might be due to invalid IL or missing references)
		//IL_0651: Unknown result type (might be due to invalid IL or missing references)
		//IL_065d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0669: Unknown result type (might be due to invalid IL or missing references)
		//IL_0672: Unknown result type (might be due to invalid IL or missing references)
		//IL_067e: Unknown result type (might be due to invalid IL or missing references)
		//IL_068a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0694: Expected O, but got Unknown
		//IL_0696: Expected O, but got Unknown
		((Control)this).Text = "BONEWORKS Real-Time PC Scene & Viewport Editor";
		((Control)this).Width = 920;
		((Control)this).Height = 650;
		((Control)this).BackColor = Color.FromArgb(45, 45, 48);
		((Control)this).ForeColor = Color.White;
		((Form)this).FormBorderStyle = (FormBorderStyle)1;
		((Form)this).MaximizeBox = false;
		viewportPanel = new Panel
		{
			Left = 15,
			Top = 15,
			Width = 540,
			Height = 175,
			BackColor = Color.FromArgb(30, 30, 30),
			BorderStyle = (BorderStyle)1
		};
		lblViewportInfo = new Label
		{
			Text = "\ud83d\udda5\ufe0f PC Viewport & Camera Controller\n\n- Use WASD or Arrow Keys to fly the Unity Camera around.\n- Use Q/E or PageUp/PageDown to move up and down.\n- Spawn primitives or official BONEWORKS items below!",
			Left = 15,
			Top = 15,
			Width = 510,
			Height = 145,
			ForeColor = Color.LightGreen,
			Font = new Font("Segoe UI", 9.5f, (FontStyle)1)
		};
		((Control)viewportPanel).Controls.Add((Control)(object)lblViewportInfo);
		GroupBox val = new GroupBox
		{
			Text = "Object Inspector (Move, Resize, Turn & Physics)",
			Left = 15,
			Top = 205,
			Width = 540,
			Height = 385,
			ForeColor = Color.White,
			Font = new Font("Segoe UI", 9f, (FontStyle)1)
		};
		((Control)val).Controls.Add((Control)(object)CreateLabel("Position (X,Y,Z):", 15, 30));
		txtPosX = CreateTextBox("0", 140, 27, 90);
		txtPosY = CreateTextBox("1.5", 240, 27, 90);
		txtPosZ = CreateTextBox("2", 340, 27, 90);
		((Control)val).Controls.Add((Control)(object)txtPosX);
		((Control)val).Controls.Add((Control)(object)txtPosY);
		((Control)val).Controls.Add((Control)(object)txtPosZ);
		((Control)val).Controls.Add((Control)(object)CreateLabel("Scale (X,Y,Z):", 15, 75));
		txtScaleX = CreateTextBox("1", 140, 72, 90);
		txtScaleY = CreateTextBox("1", 240, 72, 90);
		txtScaleZ = CreateTextBox("1", 340, 72, 90);
		((Control)val).Controls.Add((Control)(object)txtScaleX);
		((Control)val).Controls.Add((Control)(object)txtScaleY);
		((Control)val).Controls.Add((Control)(object)txtScaleZ);
		((Control)val).Controls.Add((Control)(object)CreateLabel("Rotation (Turn):", 15, 120));
		txtRotX = CreateTextBox("0", 140, 117, 90);
		txtRotY = CreateTextBox("0", 240, 117, 90);
		txtRotZ = CreateTextBox("0", 340, 117, 90);
		((Control)val).Controls.Add((Control)(object)txtRotX);
		((Control)val).Controls.Add((Control)(object)txtRotY);
		((Control)val).Controls.Add((Control)(object)txtRotZ);
		chkSelectedPhysics = new CheckBox
		{
			Text = "Enable Physics for Selected Object",
			Left = 15,
			Top = 165,
			Width = 300,
			Height = 25,
			ForeColor = Color.Yellow,
			Font = new Font("Segoe UI", 9f, (FontStyle)1),
			Checked = true
		};
		((Control)val).Controls.Add((Control)(object)chkSelectedPhysics);
		btnApplyTransform = new Button
		{
			Text = "Apply Changes to VR Object",
			Left = 15,
			Top = 210,
			Width = 400,
			Height = 40,
			BackColor = Color.FromArgb(0, 122, 204),
			ForeColor = Color.White,
			FlatStyle = (FlatStyle)0,
			Font = new Font("Segoe UI", 10f, (FontStyle)1)
		};
		((Control)btnApplyTransform).Click += delegate
		{
			ApplyTransformChanges();
		};
		((Control)val).Controls.Add((Control)(object)btnApplyTransform);
		((Control)this).Controls.Add((Control)(object)viewportPanel);
		((Control)this).Controls.Add((Control)(object)val);
		GroupBox val2 = new GroupBox
		{
			Text = "Shape & Boneworks Object Spawner",
			Left = 570,
			Top = 15,
			Width = 320,
			Height = 575,
			ForeColor = Color.White,
			Font = new Font("Segoe UI", 9f, (FontStyle)1)
		};
		chkSpawnPhysics = new CheckBox
		{
			Text = "Spawn with Physics Enabled",
			Left = 15,
			Top = 25,
			Width = 280,
			Height = 25,
			ForeColor = Color.LightBlue,
			Checked = true
		};
		((Control)val2).Controls.Add((Control)(object)chkSpawnPhysics);
		btnCube = CreateStyledButton("➕ Cube", 15, 55, 135);
		((Control)btnCube).Click += delegate
		{
			UnifiedEditorMod.SpawnPrimitiveInVR((PrimitiveType)3, chkSpawnPhysics.Checked);
		};
		btnSphere = CreateStyledButton("➕ Sphere", 165, 55, 135);
		((Control)btnSphere).Click += delegate
		{
			UnifiedEditorMod.SpawnPrimitiveInVR((PrimitiveType)0, chkSpawnPhysics.Checked);
		};
		btnCylinder = CreateStyledButton("➕ Cylinder", 15, 100, 135);
		((Control)btnCylinder).Click += delegate
		{
			UnifiedEditorMod.SpawnPrimitiveInVR((PrimitiveType)2, chkSpawnPhysics.Checked);
		};
		btnPlane = CreateStyledButton("➕ Plane (Flat)", 165, 100, 135);
		((Control)btnPlane).Click += delegate
		{
			UnifiedEditorMod.SpawnPrimitiveInVR((PrimitiveType)4, chkSpawnPhysics.Checked);
		};
		Label val3 = new Label
		{
			Text = "BONEWORKS Objects & Props:",
			Left = 15,
			Top = 150,
			Width = 280,
			Height = 20,
			ForeColor = Color.Orange,
			Font = new Font("Segoe UI", 9f, (FontStyle)1)
		};
		((Control)val2).Controls.Add((Control)(object)val3);
		btnSpawnCrate = CreateStyledButton("\ud83d\udce6 BW Wooden Crate", 15, 175, 285);
		((Control)btnSpawnCrate).Click += delegate
		{
			UnifiedEditorMod.SpawnBoneworksObject("CrateWood");
		};
		btnSpawnPistol = CreateStyledButton("\ud83d\udd2b BW 1911 Pistol", 15, 220, 285);
		((Control)btnSpawnPistol).Click += delegate
		{
			UnifiedEditorMod.SpawnBoneworksObject("Gun1911");
		};
		btnSpawnScythe = CreateStyledButton("⚔\ufe0f BW Melee Weapon", 15, 265, 285);
		((Control)btnSpawnScythe).Click += delegate
		{
			UnifiedEditorMod.SpawnBoneworksObject("Scythe");
		};
		btnSpawnNullBody = CreateStyledButton("\ud83d\udc7e BW Nullbody NPC", 15, 310, 285);
		((Control)btnSpawnNullBody).Click += delegate
		{
			UnifiedEditorMod.SpawnBoneworksObject("Nullbody");
		};
		btnDelete = CreateStyledButton("\ud83d\uddd1\ufe0f Delete Selected", 15, 435, 285);
		((Control)btnDelete).BackColor = Color.FromArgb(160, 40, 40);
		((Control)btnDelete).Click += delegate
		{
			UnifiedEditorMod.DeleteSelectedInVR();
		};
		btnDeleteAll = CreateStyledButton("⚠\ufe0f Delete ALL Objects", 15, 490, 285);
		((Control)btnDeleteAll).BackColor = Color.FromArgb(120, 20, 20);
		((Control)btnDeleteAll).Click += delegate
		{
			UnifiedEditorMod.DeleteAllInVR();
		};
		((Control)val2).Controls.Add((Control)(object)btnCube);
		((Control)val2).Controls.Add((Control)(object)btnSphere);
		((Control)val2).Controls.Add((Control)(object)btnCylinder);
		((Control)val2).Controls.Add((Control)(object)btnPlane);
		((Control)val2).Controls.Add((Control)(object)btnSpawnCrate);
		((Control)val2).Controls.Add((Control)(object)btnSpawnPistol);
		((Control)val2).Controls.Add((Control)(object)btnSpawnScythe);
		((Control)val2).Controls.Add((Control)(object)btnSpawnNullBody);
		((Control)val2).Controls.Add((Control)(object)btnDelete);
		((Control)val2).Controls.Add((Control)(object)btnDeleteAll);
		((Control)this).Controls.Add((Control)(object)val2);
	}

	private Label CreateLabel(string text, int left, int top)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: 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_0052: Expected O, but got Unknown
		//IL_0054: Expected O, but got Unknown
		return new Label
		{
			Text = text,
			Left = left,
			Top = top,
			Width = 120,
			Height = 25,
			ForeColor = Color.White,
			Font = new Font("Segoe UI", 9f, (FontStyle)0)
		};
	}

	private TextBox CreateTextBox(string defVal, int left, int top, int width)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Expected O, but got Unknown
		return new TextBox
		{
			Text = defVal,
			Left = left,
			Top = top,
			Width = width,
			Height = 25,
			BackColor = Color.FromArgb(60, 60, 65),
			ForeColor = Color.White
		};
	}

	private Button CreateStyledButton(string text, int left, int top, int width)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: 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_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_006e: Expected O, but got Unknown
		return new Button
		{
			Text = text,
			Left = left,
			Top = top,
			Width = width,
			Height = 35,
			BackColor = Color.FromArgb(60, 60, 65),
			ForeColor = Color.White,
			FlatStyle = (FlatStyle)0,
			Font = new Font("Segoe UI", 9f, (FontStyle)0)
		};
	}

	private void ApplyTransformChanges()
	{
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			float num = float.Parse(((Control)txtPosX).Text);
			float num2 = float.Parse(((Control)txtPosY).Text);
			float num3 = float.Parse(((Control)txtPosZ).Text);
			float num4 = float.Parse(((Control)txtScaleX).Text);
			float num5 = float.Parse(((Control)txtScaleY).Text);
			float num6 = float.Parse(((Control)txtScaleZ).Text);
			float num7 = float.Parse(((Control)txtRotX).Text);
			float num8 = float.Parse(((Control)txtRotY).Text);
			float num9 = float.Parse(((Control)txtRotZ).Text);
			bool hasPhysics = chkSelectedPhysics.Checked;
			UnifiedEditorMod.UpdateObjectTransform(new Vector3(num, num2, num3), new Vector3(num4, num5, num6), new Vector3(num7, num8, num9), hasPhysics);
		}
		catch (Exception)
		{
		}
	}

	private void RefreshInspectorValues()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: 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)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		Vector3 selectedPosition = UnifiedEditorMod.GetSelectedPosition();
		Vector3 selectedScale = UnifiedEditorMod.GetSelectedScale();
		Vector3 selectedRotation = UnifiedEditorMod.GetSelectedRotation();
		bool selectedHasPhysics = UnifiedEditorMod.GetSelectedHasPhysics();
		if (!((Control)txtPosX).Focused)
		{
			((Control)txtPosX).Text = selectedPosition.x.ToString("F2");
		}
		if (!((Control)txtPosY).Focused)
		{
			((Control)txtPosY).Text = selectedPosition.y.ToString("F2");
		}
		if (!((Control)txtPosZ).Focused)
		{
			((Control)txtPosZ).Text = selectedPosition.z.ToString("F2");
		}
		if (!((Control)txtScaleX).Focused)
		{
			((Control)txtScaleX).Text = selectedScale.x.ToString("F2");
		}
		if (!((Control)txtScaleY).Focused)
		{
			((Control)txtScaleY).Text = selectedScale.y.ToString("F2");
		}
		if (!((Control)txtScaleZ).Focused)
		{
			((Control)txtScaleZ).Text = selectedScale.z.ToString("F2");
		}
		if (!((Control)txtRotX).Focused)
		{
			((Control)txtRotX).Text = selectedRotation.x.ToString("F1");
		}
		if (!((Control)txtRotY).Focused)
		{
			((Control)txtRotY).Text = selectedRotation.y.ToString("F1");
		}
		if (!((Control)txtRotZ).Focused)
		{
			((Control)txtRotZ).Text = selectedRotation.z.ToString("F1");
		}
		chkSelectedPhysics.Checked = selectedHasPhysics;
	}
}