Decompiled source of WristSpawner v1.0.0

Mods/WristSpawner.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Data;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.VRMK;
using Il2CppSystem.Collections.Generic;
using Il2CppTMPro;
using LabFusion.Entities;
using LabFusion.Network;
using LabFusion.RPC;
using LabFusion.SDK.Modules;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UI;
using WristSpawner;
using WristSpawner.Catalog;
using WristSpawner.Config;
using WristSpawner.Fusion;
using WristSpawner.Interaction;
using WristSpawner.Menu;
using WristSpawner.Spawning;
using WristSpawner.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("WristSpawner")]
[assembly: AssemblyProduct("WristSpawner")]
[assembly: AssemblyCompany("Rocner")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: MelonInfo(typeof(WristSpawnerMod), "WristSpawner", "1.0.0", "Rocner", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonOptionalDependencies(new string[] { "LabFusion" })]
[assembly: MelonAdditionalDependencies(new string[] { "BoneLib" })]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WristSpawner
{
	public sealed class WristSpawnerMod : MelonMod
	{
		private readonly HoloPanel _panel = new HoloPanel();

		private readonly HoloOrb _orb = new HoloOrb();

		private readonly HoloDeploy _deploy = new HoloDeploy();

		private readonly HoloLaser _laser = new HoloLaser();

		private readonly HandPointer _pointer = new HandPointer();

		private bool _hoverViaRay;

		private bool _focusValid;

		private Vector3 _focusPoint;

		private HoloWidget _focusWidget;

		private float _pokeDepth = float.MaxValue;

		private Transform _anchor;

		private bool _pokeArmed = true;

		private float _nextPressTime;

		private HoloWidget _hovered;

		private const float HoverDepth = 0.07f;

		private const float PressCooldown = 0.25f;

		private int _updateFailures;

		private float _nextCatalogAttempt;

		public override void OnInitializeMelon()
		{
			Step("preferences", delegate
			{
				Prefs.Register();
				SpawnCatalog.LoadFavorites();
			});
			Step("fusion", delegate
			{
				FusionSupport.Detect();
				FusionSupport.RegisterModule();
				((MelonBase)this).LoggerInstance.Msg(FusionSupport.Available ? "LabFusion detected — spawns will replicate in lobbies." : "LabFusion not present — running singleplayer.");
			});
			Step("status event", delegate
			{
				SpawnService.OnStatus += OnSpawnStatus;
			});
			Step("catalog event", delegate
			{
				SpawnCatalog.OnChanged += OnCatalogChanged;
			});
			Step("warehouse hook", delegate
			{
				Hooking.OnWarehouseReady += OnWarehouseReady;
			});
			Step("level loading hook", delegate
			{
				Hooking.OnLevelLoading += OnLevelLoading;
			});
			Step("level loaded hook", delegate
			{
				Hooking.OnLevelLoaded += OnLevelLoaded;
			});
			Step("bonemenu", delegate
			{
				MenuPage.Build(_panel, RebuildPanel, SummonOrb);
			});
			((MelonBase)this).LoggerInstance.Msg("WristSpawner initialised.");
		}

		private void Step(string name, Action action)
		{
			try
			{
				action();
			}
			catch (Exception ex)
			{
				((MelonBase)this).LoggerInstance.Error("Init step '" + name + "' failed (mod continues): " + ex);
			}
		}

		public override void OnDeinitializeMelon()
		{
			Step("unhook", delegate
			{
				SpawnService.OnStatus -= OnSpawnStatus;
				SpawnCatalog.OnChanged -= OnCatalogChanged;
				Hooking.OnWarehouseReady -= OnWarehouseReady;
				Hooking.OnLevelLoading -= OnLevelLoading;
				Hooking.OnLevelLoaded -= OnLevelLoaded;
			});
			_panel.Destroy();
			_orb.Destroy();
			_deploy.Destroy();
			_laser.Destroy();
		}

		private void SummonOrb()
		{
			if (_orb.Exists)
			{
				_orb.PlaceInFront();
			}
		}

		private void OnWarehouseReady()
		{
			SpawnCatalog.Rebuild();
			if (_panel.Exists)
			{
				_panel.Refresh();
			}
		}

		private void OnLevelLoading(LevelInfo info)
		{
			CancelDeploy();
			_deploy.Destroy();
			_panel.Destroy();
			_orb.Destroy();
			_laser.Destroy();
			_pointer.Invalidate();
			_anchor = null;
			_hovered = null;
			SpawnService.Reset();
			HoloTheme.Reset();
		}

		private void OnLevelLoaded(LevelInfo info)
		{
			_anchor = null;
			if (!SpawnCatalog.Ready)
			{
				SpawnCatalog.Rebuild();
			}
		}

		public override void OnUpdate()
		{
			try
			{
				Run();
			}
			catch (Exception ex)
			{
				_updateFailures++;
				if (_updateFailures <= 3)
				{
					((MelonBase)this).LoggerInstance.Error($"Update failed ({_updateFailures}): " + ex);
				}
				if (_updateFailures == 3)
				{
					((MelonBase)this).LoggerInstance.Error("Further update errors will be suppressed.");
				}
			}
		}

		private void Run()
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (HelperMethods.IsLoading())
			{
				return;
			}
			float deltaTime = Time.deltaTime;
			EnsureCatalog();
			UpdateOrb(deltaTime);
			if (!Prefs.PanelEnabled)
			{
				if (_panel.Exists)
				{
					_panel.Destroy();
					_anchor = null;
					_hovered = null;
				}
				_laser.Hide();
				return;
			}
			if (!EnsurePanel())
			{
				_laser.Hide();
				return;
			}
			UpdateVisibility();
			_pointer.Update();
			ResolveFocus();
			_panel.SetPointer(_focusPoint, _focusValid);
			_panel.Tick(deltaTime);
			if (!_panel.Visible)
			{
				ClearHover();
				_laser.Hide();
			}
			else
			{
				UpdateInteraction();
			}
		}

		private void ResolveFocus()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			_hoverViaRay = false;
			_focusValid = false;
			_focusWidget = null;
			_pokeDepth = float.MaxValue;
			if (!_pointer.Valid || !_panel.Visible)
			{
				_laser.Hide();
				return;
			}
			float depth;
			HoloWidget focusWidget = _panel.HitTest(_pointer.Position, out depth);
			_pokeDepth = depth;
			if (depth <= 0.07f)
			{
				_focusPoint = _pointer.Position;
				_focusValid = true;
				_focusWidget = focusWidget;
				_laser.Hide();
				return;
			}
			if (!Prefs.LaserEnabled)
			{
				_laser.Hide();
				return;
			}
			if (!_laser.Exists)
			{
				_laser.Build();
			}
			Vector3 hitPoint;
			bool onPanel;
			HoloWidget holoWidget = _panel.RayTest(_pointer.Position, _pointer.Direction, out hitPoint, out onPanel);
			if (!onPanel)
			{
				_laser.Hide();
				return;
			}
			Transform head = Player.Head;
			Vector3 viewer = (((Object)(object)head != (Object)null) ? head.position : _pointer.Position);
			_laser.Show(_pointer.Position, hitPoint, viewer, holoWidget?.Enabled ?? false);
			_focusPoint = hitPoint;
			_focusValid = true;
			_focusWidget = holoWidget;
			_hoverViaRay = true;
		}

		private void EnsureCatalog()
		{
			if (SpawnCatalog.Ready || Time.time < _nextCatalogAttempt)
			{
				return;
			}
			_nextCatalogAttempt = Time.time + 2f;
			try
			{
				SpawnCatalog.Rebuild();
				if (SpawnCatalog.Ready)
				{
					((MelonBase)this).LoggerInstance.Msg($"Catalog recovered with {SpawnCatalog.Count} spawnables.");
				}
			}
			catch (Exception ex)
			{
				((MelonBase)this).LoggerInstance.Error("Catalog rebuild failed: " + ex);
			}
		}

		private void UpdateOrb(float dt)
		{
			if (!Prefs.OrbEnabled)
			{
				if (_orb.Exists)
				{
					CancelDeploy();
					_orb.Destroy();
				}
			}
			else if (!((Object)(object)Player.Head == (Object)null))
			{
				if (!_orb.Exists)
				{
					_orb.Build();
					((MelonBase)this).LoggerInstance.Msg("Orb summoned.");
				}
				_orb.Tick(dt);
				if (_orb.ConsumeDeployRequest())
				{
					ToggleDeployed();
				}
				TickDeploy(dt);
			}
		}

		private void ToggleDeployed()
		{
			if (!_orb.Exists)
			{
				return;
			}
			if (_orb.Deployed)
			{
				_orb.SetDeployed(value: false);
				_orb.EnergyBoost(1f);
				((MelonBase)this).LoggerInstance.Msg("Favorites recalled.");
				return;
			}
			_orb.SetDeployed(value: true);
			_orb.EnergyBoost(1f);
			if (Prefs.DeployEnabled && _deploy.Begin())
			{
				_orb.Suspend();
			}
			((MelonBase)this).LoggerInstance.Msg("Favorites deployed.");
		}

		private void TickDeploy(float dt)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if (!_deploy.Active)
			{
				return;
			}
			if (!_orb.Exists)
			{
				_deploy.Abort();
				return;
			}
			_deploy.Tick(dt);
			_orb.SetDeployGlow(_deploy.OrbGlow);
			if (_deploy.OrbFloating)
			{
				_orb.DriveTo(_deploy.OrbTarget(), dt, 6f);
			}
			if (!_deploy.Active)
			{
				FinishDeploy();
			}
		}

		private void FinishDeploy()
		{
			_orb.SetDeployGlow(0f);
			_orb.EnergyBoost(1f);
			_orb.Resume();
		}

		private void CancelDeploy()
		{
			if (_deploy.Active || _orb.Suspended)
			{
				_deploy.Abort();
				if (_orb.Exists)
				{
					_orb.SetDeployGlow(0f);
					_orb.Resume();
				}
			}
		}

		private void OnCatalogChanged()
		{
			if (_panel.Exists)
			{
				_panel.Refresh();
			}
			if (_orb.Exists)
			{
				_orb.Refresh();
			}
		}

		private bool EnsurePanel()
		{
			Transform wristTransform = GetWristTransform();
			if ((Object)(object)wristTransform == (Object)null)
			{
				if (_panel.Exists)
				{
					_panel.Destroy();
				}
				_anchor = null;
				return false;
			}
			if (_panel.Exists && (Object)(object)_anchor == (Object)(object)wristTransform)
			{
				return true;
			}
			_anchor = wristTransform;
			_panel.Build(wristTransform);
			_pointer.Invalidate();
			_hovered = null;
			((MelonBase)this).LoggerInstance.Msg("Wrist panel attached to " + ((Object)wristTransform).name + ".");
			return _panel.Exists;
		}

		private static Transform GetWristTransform()
		{
			if (!Player.HandsExist)
			{
				return null;
			}
			Hand val = (Prefs.LeftWrist ? Player.LeftHand : Player.RightHand);
			if (!((Object)(object)val != (Object)null))
			{
				return null;
			}
			return ((Component)val).transform;
		}

		private void UpdateVisibility()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (!Prefs.RequireWristLook)
			{
				_panel.SetVisible(visible: true);
				return;
			}
			Transform head = Player.Head;
			Transform transform = _panel.Transform;
			if (!((Object)(object)head == (Object)null) && !((Object)(object)transform == (Object)null))
			{
				Vector3 val = head.position - transform.position;
				if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f))
				{
					float num = Vector3.Dot(-transform.forward, ((Vector3)(ref val)).normalized);
					_panel.SetVisible(num >= Prefs.LookThreshold);
				}
			}
		}

		private void UpdateInteraction()
		{
			if (!_focusValid)
			{
				ClearHover();
				_pokeArmed = true;
				return;
			}
			if (_hoverViaRay)
			{
				_pokeArmed = true;
			}
			HoloWidget focusWidget = _focusWidget;
			if (focusWidget == null)
			{
				ClearHover();
				return;
			}
			if (focusWidget != _hovered)
			{
				_hovered = focusWidget;
				_panel.SetHover(focusWidget);
				Pulse(0.25f, 0.02f);
			}
			if (!(Time.time < _nextPressTime) && ShouldPress(_pokeDepth))
			{
				_panel.Press(focusWidget);
				_nextPressTime = Time.time + 0.25f;
				_pokeArmed = false;
				Pulse(0.7f, 0.06f);
			}
		}

		private bool ShouldPress(float depth)
		{
			if (_hoverViaRay)
			{
				return TriggerDown();
			}
			if (_pokeArmed && depth <= Prefs.PokeDepth)
			{
				return true;
			}
			if (depth > Prefs.PokeDepth + 0.015f)
			{
				_pokeArmed = true;
			}
			return TriggerDown();
		}

		private bool TriggerDown()
		{
			BaseController controller = _pointer.Controller;
			if ((Object)(object)controller == (Object)null)
			{
				return false;
			}
			try
			{
				return controller.GetPrimaryInteractionButtonDown();
			}
			catch
			{
				return false;
			}
		}

		private void ClearHover()
		{
			if (_hovered != null)
			{
				_hovered = null;
				_panel.ClearHover();
			}
		}

		private void Pulse(float amplitude, float duration)
		{
			if (!Prefs.HapticFeedback)
			{
				return;
			}
			BaseController controller = _pointer.Controller;
			if ((Object)(object)controller == (Object)null)
			{
				return;
			}
			try
			{
				controller.HapticAction(0f, duration, 220f, amplitude);
			}
			catch
			{
			}
		}

		private void OnSpawnStatus(string message)
		{
			if (_panel.Exists)
			{
				_panel.SetStatus(message);
			}
		}

		private void RebuildPanel()
		{
			_anchor = null;
			_panel.Destroy();
			_pointer.Invalidate();
			_hovered = null;
		}
	}
	internal static class BuildInfo
	{
		public const string Name = "WristSpawner";

		public const string Author = "Rocner";

		public const string Version = "1.0.0";
	}
}
namespace WristSpawner.UI
{
	internal static class Ease
	{
		public static float OutCubic(float t)
		{
			float num = 1f - Mathf.Clamp01(t);
			return 1f - num * num * num;
		}

		public static float OutQuint(float t)
		{
			float num = 1f - Mathf.Clamp01(t);
			return 1f - num * num * num * num * num;
		}

		public static float OutBack(float t)
		{
			t = Mathf.Clamp01(t);
			float num = t - 1f;
			return 1f + 2.70158f * num * num * num + 1.70158f * num * num;
		}

		public static float OutElastic(float t)
		{
			t = Mathf.Clamp01(t);
			if (t <= 0f)
			{
				return 0f;
			}
			if (t >= 1f)
			{
				return 1f;
			}
			return Mathf.Pow(2f, -9f * t) * Mathf.Sin((t - 0.08f) * ((float)Math.PI * 2f) / 0.32f) + 1f;
		}

		public static float InOutSine(float t)
		{
			return (0f - (Mathf.Cos((float)Math.PI * Mathf.Clamp01(t)) - 1f)) * 0.5f;
		}
	}
	internal sealed class HoloDeploy
	{
		private sealed class Element
		{
			public GameObject Root;

			public Material Mat;

			public float Angle;

			public float Height;

			public float Phase;

			public float Spin;
		}

		private const int MaxPanels = 16;

		private const int MaxArcs = 10;

		private const int MaxMotes = 32;

		private const int RingCount = 3;

		private const float P1End = 0.075f;

		private const float P2Start = 0.075f;

		private const float P2End = 0.2f;

		private const float P3Start = 0.15f;

		private const float P3End = 0.35f;

		private const float P4Start = 0.25f;

		private const float P4End = 0.65f;

		private const float P5Start = 0.35f;

		private const float P5End = 0.75f;

		private const float P6Start = 0.6f;

		private const float P6End = 0.85f;

		private const float P7Start = 0.85f;

		private GameObject _root;

		private readonly Element[] _rings = new Element[3];

		private readonly Element[] _panels = new Element[16];

		private readonly Element[] _arcs = new Element[10];

		private readonly Element[] _motes = new Element[32];

		private Element _scanRing;

		private Element _flash;

		private bool _built;

		private bool _active;

		private bool _completed;

		private float _time;

		private float _duration = 2f;

		private Vector3 _feet;

		private float _height = 1.78f;

		private Vector3 _forward = Vector3.forward;

		private Vector3 _right = Vector3.right;

		private Vector3 _viewer;

		public bool Active => _active;

		public bool Completed => _completed;

		public float Progress
		{
			get
			{
				if (!(_duration > 0f))
				{
					return 0f;
				}
				return Mathf.Clamp01(_time / _duration);
			}
		}

		public float OrbPulse => 1f - Span(Progress, 0f, 0.075f);

		public float OrbGlow
		{
			get
			{
				float progress = Progress;
				if (progress < 0.075f)
				{
					return Span(progress, 0f, 0.075f);
				}
				if (progress < 0.85f)
				{
					return 1f;
				}
				return 1f - Span(progress, 0.85f, 1f);
			}
		}

		public bool OrbFloating => Progress >= 0.075f;

		public bool Begin()
		{
			if (!ResolveBody())
			{
				return false;
			}
			if (_built && (Object)(object)_root == (Object)null)
			{
				_built = false;
			}
			if (!_built && !Build())
			{
				return false;
			}
			_time = 0f;
			_duration = Mathf.Max(0.4f, Prefs.DeployDuration);
			_active = true;
			_completed = false;
			_root.SetActive(true);
			return true;
		}

		public void Abort()
		{
			_active = false;
			_completed = false;
			_time = 0f;
			if ((Object)(object)_root != (Object)null)
			{
				_root.SetActive(false);
			}
		}

		private bool ResolveBody()
		{
			//IL_0036: 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_004c: 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_005b: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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)
			Transform head = Player.Head;
			if ((Object)(object)head == (Object)null)
			{
				return false;
			}
			RigManager rigManager = Player.RigManager;
			if ((Object)(object)rigManager == (Object)null)
			{
				return false;
			}
			Transform transform = ((Component)rigManager).transform;
			if ((Object)(object)transform == (Object)null)
			{
				return false;
			}
			_feet = new Vector3(head.position.x, transform.position.y, head.position.z);
			float num = head.position.y - transform.position.y;
			if (num < 0.6f || num > 3f)
			{
				num = TryAvatarHeight();
			}
			_height = Mathf.Clamp(num, 0.7f, 2.8f);
			Vector3 forward = head.forward;
			forward.y = 0f;
			_forward = ((((Vector3)(ref forward)).sqrMagnitude > 0.001f) ? ((Vector3)(ref forward)).normalized : Vector3.forward);
			_right = Vector3.Cross(Vector3.up, _forward);
			_viewer = head.position;
			return true;
		}

		private static float TryAvatarHeight()
		{
			try
			{
				Avatar avatar = Player.Avatar;
				if ((Object)(object)avatar != (Object)null && avatar._height > 0.6f && avatar._height < 3f)
				{
					return avatar._height;
				}
			}
			catch
			{
			}
			return 1.78f;
		}

		private bool Build()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				_root = new GameObject("WristSpawner.Deploy");
				for (int i = 0; i < 3; i++)
				{
					_rings[i] = MakeQuad("Ring" + i, HoloTextures.Ring(24 + i * 8), 3700 + i);
				}
				_scanRing = MakeQuad("ScanRing", HoloTextures.Ring(48), 3710);
				for (int j = 0; j < 16; j++)
				{
					_panels[j] = MakeQuad("Panel" + j, HoloTextures.Plate(new Vector2(0.16f, 0.1f), PlateStyle.Chip), 3715);
					_panels[j].Angle = (float)j / 16f * (float)Math.PI * 2f;
					_panels[j].Height = 0.12f + (float)j * 0.0637f % 0.8f;
					_panels[j].Phase = (float)j * 0.137f % 1f;
					_panels[j].Spin = ((j % 2 == 0) ? 1f : (-1f)) * (60f + (float)j * 11f);
				}
				for (int k = 0; k < 10; k++)
				{
					_arcs[k] = MakeCylinder("Arc" + k, 3712);
					_arcs[k].Angle = (float)k / 10f * (float)Math.PI * 2f;
					_arcs[k].Phase = (float)k * 0.211f % 1f;
				}
				for (int l = 0; l < 32; l++)
				{
					_motes[l] = MakeQuad("Mote" + l, HoloTextures.Plate(new Vector2(0.02f, 0.02f), PlateStyle.Glow), 3720);
					_motes[l].Angle = (float)l * 1.618f;
					_motes[l].Phase = (float)l * 0.0731f % 1f;
					_motes[l].Height = (float)l * 0.0397f % 1f;
				}
				_flash = MakeQuad("Flash", HoloTextures.Plate(new Vector2(1f, 1f), PlateStyle.Glow), 3725);
				_root.SetActive(false);
				_built = true;
				return true;
			}
			catch (Exception ex)
			{
				Melon<WristSpawnerMod>.Logger.Warning("Deploy effect build failed: " + ex.Message);
				Destroy();
				return false;
			}
		}

		private Element MakeQuad(string name, Texture2D texture, int queue)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)5);
			((Object)val).name = name;
			val.transform.SetParent(_root.transform, false);
			Collider component = val.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			Material val2 = HoloTheme.CreateMaterial(HoloTheme.Frame, onTop: false, texture);
			val2.renderQueue = queue;
			Renderer component2 = val.GetComponent<Renderer>();
			component2.material = val2;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			component2.receiveShadows = false;
			val.SetActive(false);
			return new Element
			{
				Root = val,
				Mat = val2
			};
		}

		private Element MakeCylinder(string name, int queue)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)2);
			((Object)val).name = name;
			val.transform.SetParent(_root.transform, false);
			Collider component = val.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			Material val2 = HoloTheme.CreateMaterial(HoloTheme.Frame, onTop: false, null);
			val2.renderQueue = queue;
			Renderer component2 = val.GetComponent<Renderer>();
			component2.material = val2;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			component2.receiveShadows = false;
			val.SetActive(false);
			return new Element
			{
				Root = val,
				Mat = val2
			};
		}

		public void Tick(float dt)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (!_active)
			{
				return;
			}
			if (!ResolveBody())
			{
				Abort();
				return;
			}
			_time += dt;
			float t = Mathf.Clamp01(_time / _duration);
			float intensity = Mathf.Max(0f, Prefs.DeployIntensity);
			float deployHue = Prefs.DeployHue;
			_root.transform.position = _feet;
			TickRings(t, intensity, deployHue);
			TickScan(t, intensity, deployHue);
			TickPanels(dt, t, intensity, deployHue);
			TickArcs(t, intensity, deployHue);
			TickMotes(t, intensity, deployHue);
			TickFlash(t, intensity, deployHue);
			if (!(_time < _duration))
			{
				Abort();
				_completed = true;
			}
		}

		private static float Span(float t, float from, float to)
		{
			if (to <= from)
			{
				if (!(t >= to))
				{
					return 0f;
				}
				return 1f;
			}
			return Mathf.Clamp01((t - from) / (to - from));
		}

		private static float Pulse(float t, float from, float to)
		{
			return Mathf.Sin(Span(t, from, to) * (float)Math.PI);
		}

		private static float Profile(float h)
		{
			if (h < 0.08f)
			{
				return Mathf.Lerp(0.3f, 0.22f, h / 0.08f);
			}
			if (h < 0.5f)
			{
				return Mathf.Lerp(0.22f, 0.3f, (h - 0.08f) / 0.42f);
			}
			if (h < 0.82f)
			{
				return Mathf.Lerp(0.3f, 0.36f, (h - 0.5f) / 0.32f);
			}
			return Mathf.Lerp(0.36f, 0.14f, (h - 0.82f) / 0.18f);
		}

		private Vector3 Around(float angle, float heightFraction, float radius)
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			return _feet + Vector3.up * (_height * heightFraction) + (_right * Mathf.Cos(angle) + _forward * Mathf.Sin(angle)) * radius;
		}

		private Quaternion Billboard(Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_000c: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = position - _viewer;
			if (!(((Vector3)(ref val)).sqrMagnitude < 1E-06f))
			{
				return Quaternion.LookRotation(val, Vector3.up);
			}
			return Quaternion.identity;
		}

		private void TickRings(float t, float intensity, float hue)
		{
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			float deployRingSpin = Prefs.DeployRingSpin;
			float num = Mathf.Max(0.2f, Prefs.DeployRingSize) * (_height / 1.78f);
			for (int i = 0; i < 3; i++)
			{
				Element element = _rings[i];
				float num2 = (float)i * 0.06f;
				float num3 = Span(t, 0.15f + num2, 0.35f + num2 + 0.12f);
				bool flag = num3 > 0f && num3 < 1f;
				Show(element, flag);
				if (flag)
				{
					float num4 = Ease.OutQuint(num3);
					float num5 = Mathf.Lerp(0.15f, num * (1f + (float)i * 0.22f), num4);
					float num6 = _height * (0.06f + (float)i * 0.16f);
					float t2 = Span(t, 0.85f, 1f);
					num5 *= Mathf.Lerp(1f, 0.12f, Ease.OutQuint(t2));
					element.Root.transform.position = _feet + Vector3.up * num6;
					element.Root.transform.rotation = Quaternion.Euler(90f, 0f, 0f) * Quaternion.Euler(0f, 0f, Time.time * deployRingSpin * ((i % 2 == 0) ? 1f : (-0.7f)));
					element.Root.transform.localScale = new Vector3(num5 * 2f, num5 * 2f, 1f);
					Color color = HoloTheme.Shift(HoloTheme.Frame, hue);
					color.a = Mathf.Sin(num3 * (float)Math.PI) * 0.85f * intensity;
					HoloTheme.Tint(element.Mat, color);
				}
			}
		}

		private void TickScan(float t, float intensity, float hue)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(0.2f, Prefs.DeployScanSpeed);
			float num2 = Span(t, 0.25f, Mathf.Lerp(0.25f, 0.65f, 1f / num));
			bool flag = num2 > 0f && num2 < 1f;
			Show(_scanRing, flag);
			if (flag)
			{
				float num3 = Mathf.Clamp01(num2);
				float num4 = Profile(num3) * (_height / 1.78f) * 1.25f;
				_scanRing.Root.transform.position = _feet + Vector3.up * (_height * num3);
				_scanRing.Root.transform.rotation = Quaternion.Euler(90f, 0f, 0f) * Quaternion.Euler(0f, 0f, Time.time * 220f);
				_scanRing.Root.transform.localScale = new Vector3(num4 * 2f, num4 * 2f, 1f);
				Color color = HoloTheme.Shift(HoloTheme.ButtonActive, hue);
				float num5 = Mathf.Min(Span(t, 0.25f, 0.3f), 1f - Span(t, 0.59999996f, 0.65f));
				color.a = Mathf.Clamp01(num5) * intensity;
				HoloTheme.Tint(_scanRing.Mat, color);
			}
		}

		private void TickPanels(float dt, float t, float intensity, float hue)
		{
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: 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)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Clamp(Prefs.DeployPanelCount, 0, 16);
			float num2 = Prefs.DeployPanelOrbit * ((float)Math.PI / 180f);
			float num3 = Ease.OutQuint(Span(t, 0.85f, 1f));
			for (int i = 0; i < 16; i++)
			{
				Element element = _panels[i];
				if (i >= num)
				{
					Show(element, visible: false);
					continue;
				}
				float num4 = Span(t, 0.35f + element.Phase * 0.12f, 0.75f);
				bool flag = num4 > 0f;
				Show(element, flag);
				if (flag)
				{
					element.Angle += num2 * dt;
					float num5 = Ease.OutBack(num4);
					float num6 = Mathf.Lerp(0.05f, Profile(element.Height) * (_height / 1.78f) * 1.9f, num5);
					num6 *= Mathf.Lerp(1f, 0.1f, num3);
					Vector3 val = Around(element.Angle, element.Height, num6);
					element.Root.transform.position = val;
					Vector3 val2 = val - (_feet + Vector3.up * (_height * element.Height));
					Quaternion val3 = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up) : Quaternion.identity);
					element.Root.transform.rotation = val3 * Quaternion.Euler(0f, 0f, element.Spin * (1f - num5));
					float num7 = Mathf.Lerp(0.1f, 1f, num5) * (1f - num3 * 0.7f);
					element.Root.transform.localScale = new Vector3(0.16f * num7, 0.1f * num7, 1f);
					Color color = HoloTheme.Shift(HoloTheme.ButtonHover, hue);
					float num8 = Mathf.Min(num4 * 2.2f, 1f) * (1f - num3 * 0.85f);
					color.a = num8 * 0.9f * intensity;
					HoloTheme.Tint(element.Mat, color);
				}
			}
		}

		private void TickArcs(float t, float intensity, float hue)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			float num = Span(t, 0.6f, 0.85f);
			float num2 = Pulse(t, 0.6f, 1f);
			for (int i = 0; i < 10; i++)
			{
				Element element = _arcs[i];
				bool flag = num > element.Phase * 0.5f && t < 1f;
				Show(element, flag);
				if (flag)
				{
					float num3 = Profile(0.5f) * (_height / 1.78f) * 1.5f;
					float num4 = element.Angle + Time.time * 0.8f;
					Vector3 val = Around(num4, 0.04f, num3);
					Vector3 val2 = Around(num4 + 0.5f, 0.95f, num3 * 0.7f) - val;
					float magnitude = ((Vector3)(ref val2)).magnitude;
					if (!(magnitude < 0.01f))
					{
						element.Root.transform.position = val + val2 * 0.5f;
						element.Root.transform.rotation = Quaternion.FromToRotation(Vector3.up, val2 / magnitude);
						element.Root.transform.localScale = new Vector3(0.008f, magnitude * 0.5f, 0.008f);
						Color color = HoloTheme.Shift(HoloTheme.Scanline, hue);
						color.a = num2 * 0.75f * intensity;
						HoloTheme.Tint(element.Mat, color);
					}
				}
			}
		}

		private void TickMotes(float t, float intensity, float hue)
		{
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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)
			int num = Mathf.Clamp(Mathf.RoundToInt(32f * Mathf.Clamp01(Prefs.DeployParticles)), 0, 32);
			float num2 = Span(t, 0.15f, 1f);
			float num3 = Ease.OutQuint(Span(t, 0.85f, 1f));
			for (int i = 0; i < 32; i++)
			{
				Element element = _motes[i];
				if (i >= num || num2 <= 0f)
				{
					Show(element, visible: false);
					continue;
				}
				Show(element, visible: true);
				float num4 = Mathf.Repeat(num2 * 1.6f + element.Phase, 1f);
				float angle = element.Angle + Time.time * 1.4f + num4 * 2f;
				float num5 = Profile(num4) * (_height / 1.78f) * Mathf.Lerp(2.1f, 0.6f, num4);
				num5 *= Mathf.Lerp(1f, 0.08f, num3);
				element.Root.transform.position = Around(angle, num4, num5);
				element.Root.transform.rotation = Billboard(element.Root.transform.position);
				float num6 = 0.02f * Mathf.Lerp(1.3f, 0.4f, num4);
				element.Root.transform.localScale = new Vector3(num6, num6, 1f);
				Color color = HoloTheme.Shift(HoloTheme.Shard, hue);
				color.a = Mathf.Sin(num4 * (float)Math.PI) * 0.85f * intensity;
				HoloTheme.Tint(element.Mat, color);
			}
		}

		private void TickFlash(float t, float intensity, float hue)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			float num = Span(t, 0.85f, 1f);
			bool flag = num > 0f && num < 1f;
			Show(_flash, flag);
			if (flag)
			{
				float num2 = Mathf.Max(0f, Prefs.DeployBurst);
				float num3 = Mathf.Lerp(0.2f, 2.4f * num2 * (_height / 1.78f), Ease.OutQuint(num));
				Vector3 position = _feet + Vector3.up * (_height * 0.55f);
				_flash.Root.transform.position = position;
				_flash.Root.transform.rotation = Billboard(position);
				_flash.Root.transform.localScale = new Vector3(num3, num3, 1f);
				Color color = HoloTheme.Shift(HoloTheme.ButtonActive, hue);
				color.a = (1f - num) * (1f - num) * 0.9f * intensity * num2;
				HoloTheme.Tint(_flash.Mat, color);
			}
		}

		private static void Show(Element element, bool visible)
		{
			if ((Object)(object)element?.Root != (Object)null && element.Root.activeSelf != visible)
			{
				element.Root.SetActive(visible);
			}
		}

		public Vector3 OrbTarget()
		{
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			return _feet + Vector3.up * (_height * 0.62f) + _forward * Mathf.Max(0.05f, Prefs.DeployOrbDistance);
		}

		public void Destroy()
		{
			DestroyElements(_rings);
			DestroyElements(_panels);
			DestroyElements(_arcs);
			DestroyElements(_motes);
			if ((Object)(object)_scanRing?.Mat != (Object)null)
			{
				Object.Destroy((Object)(object)_scanRing.Mat);
			}
			if ((Object)(object)_flash?.Mat != (Object)null)
			{
				Object.Destroy((Object)(object)_flash.Mat);
			}
			if ((Object)(object)_root != (Object)null)
			{
				Object.Destroy((Object)(object)_root);
			}
			_root = null;
			_scanRing = null;
			_flash = null;
			_built = false;
			_active = false;
			_time = 0f;
			for (int i = 0; i < _rings.Length; i++)
			{
				_rings[i] = null;
			}
			for (int j = 0; j < _panels.Length; j++)
			{
				_panels[j] = null;
			}
			for (int k = 0; k < _arcs.Length; k++)
			{
				_arcs[k] = null;
			}
			for (int l = 0; l < _motes.Length; l++)
			{
				_motes[l] = null;
			}
		}

		private static void DestroyElements(Element[] elements)
		{
			for (int i = 0; i < elements.Length; i++)
			{
				if ((Object)(object)elements[i]?.Mat != (Object)null)
				{
					Object.Destroy((Object)(object)elements[i].Mat);
				}
			}
		}
	}
	internal sealed class HoloLaser
	{
		private const float BeamWidth = 0.005f;

		private const float DotSize = 0.018f;

		private GameObject _root;

		private GameObject _beam;

		private GameObject _dot;

		private Material _beamMat;

		private Material _dotMat;

		private float _fade;

		public bool Exists => (Object)(object)_root != (Object)null;

		public void Build()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			Destroy();
			_root = new GameObject("WristSpawner.Laser");
			_beam = GameObject.CreatePrimitive((PrimitiveType)2);
			((Object)_beam).name = "Beam";
			_beam.transform.SetParent(_root.transform, false);
			Strip(_beam);
			_beamMat = HoloTheme.CreateMaterial(HoloTheme.ButtonHover, onTop: true, null);
			_beamMat.renderQueue = 4014;
			Apply(_beam, _beamMat);
			_dot = GameObject.CreatePrimitive((PrimitiveType)5);
			((Object)_dot).name = "Dot";
			_dot.transform.SetParent(_root.transform, false);
			Strip(_dot);
			_dotMat = HoloTheme.CreateMaterial(HoloTheme.ButtonActive, onTop: true, HoloTextures.Plate(new Vector2(0.018f, 0.018f), PlateStyle.Glow));
			_dotMat.renderQueue = 4015;
			Apply(_dot, _dotMat);
			_root.SetActive(false);
		}

		private static void Strip(GameObject go)
		{
			Collider component = go.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component);
			}
		}

		private static void Apply(GameObject go, Material material)
		{
			Renderer component = go.GetComponent<Renderer>();
			component.material = material;
			component.shadowCastingMode = (ShadowCastingMode)0;
			component.receiveShadows = false;
		}

		public void Show(Vector3 from, Vector3 to, Vector3 viewer, bool armed)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			if (!Exists)
			{
				return;
			}
			if (!_root.activeSelf)
			{
				_root.SetActive(true);
			}
			_fade = Mathf.MoveTowards(_fade, 1f, Time.deltaTime * 10f);
			Vector3 val = to - from;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (!(magnitude < 0.002f))
			{
				Vector3 val2 = val / magnitude;
				_beam.transform.position = from + val2 * (magnitude * 0.5f);
				_beam.transform.rotation = Quaternion.FromToRotation(Vector3.up, val2);
				_beam.transform.localScale = new Vector3(0.005f, magnitude * 0.5f, 0.005f);
				Vector3 val3 = to - viewer;
				if (((Vector3)(ref val3)).sqrMagnitude < 1E-06f)
				{
					val3 = val2;
				}
				float num = 1f + Mathf.Sin(Time.time * 12f) * 0.14f;
				float num2 = 0.018f * num * (armed ? 1.25f : 1f);
				_dot.transform.position = to - val2 * 0.005f;
				_dot.transform.rotation = Quaternion.LookRotation(val3, Vector3.up);
				_dot.transform.localScale = new Vector3(num2, num2, 1f);
				Color color = (armed ? HoloTheme.ButtonActive : HoloTheme.ButtonHover);
				color.a *= 0.55f * _fade;
				HoloTheme.Tint(_beamMat, color);
				Color color2 = (armed ? HoloTheme.ButtonActive : HoloTheme.ButtonHover);
				color2.a *= 0.95f * _fade;
				HoloTheme.Tint(_dotMat, color2);
			}
		}

		public void Hide()
		{
			if (Exists)
			{
				_fade = 0f;
				if (_root.activeSelf)
				{
					_root.SetActive(false);
				}
			}
		}

		public void Destroy()
		{
			if ((Object)(object)_beamMat != (Object)null)
			{
				Object.Destroy((Object)(object)_beamMat);
			}
			if ((Object)(object)_dotMat != (Object)null)
			{
				Object.Destroy((Object)(object)_dotMat);
			}
			if ((Object)(object)_root != (Object)null)
			{
				Object.Destroy((Object)(object)_root);
			}
			_root = null;
			_beam = null;
			_dot = null;
			_beamMat = null;
			_dotMat = null;
			_fade = 0f;
		}
	}
	internal sealed class HoloOrb
	{
		private sealed class Satellite
		{
			public GameObject Root;

			public GameObject Body;

			public Material BodyMat;

			public GameObject Icon;

			public Material IconMat;

			public GameObject Panel;

			public Material PanelMat;

			public GameObject Header;

			public Material HeaderMat;

			public TextMeshPro Label;

			public CatalogEntry Entry;

			public float Angle;

			public float Hover;

			public float Press;

			public float Detach;

			public bool Held;

			public bool HeldByLeft;

			public bool Free;

			public Vector3 FreePosition;

			public Vector3 Velocity;

			public Vector3 GrabOffset;

			public Quaternion Facing;

			public float ReturnAt;
		}

		private const int SatelliteCount = 20;

		private const float CoreRadius = 0.055f;

		private const float OrbitRadius = 0.17f;

		private const float SatelliteRadius = 0.03f;

		private const float GrabRadius = 0.13f;

		private const float SatelliteGrabRadius = 0.16f;

		private const float GripEngage = 0.5f;

		private const float GripRelease = 0.14f;

		private const float PokeRadius = 0.05f;

		private const float PressCooldown = 0.3f;

		private const float PanelWidth = 0.235f;

		private const float PanelHeight = 0.15f;

		private GameObject _root;

		private GameObject _core;

		private GameObject _shell;

		private GameObject _halo;

		private Material _coreMat;

		private Material _shellMat;

		private Material _haloMat;

		private GameObject _ringPulse;

		private Material _ringPulseMat;

		private float _ringLife;

		private readonly List<Satellite> _satellites = new List<Satellite>();

		private GameObject _guideRoot;

		private readonly GameObject[] _guides = (GameObject[])(object)new GameObject[2];

		private readonly Material[] _guideMats = (Material[])(object)new Material[2];

		private readonly List<GameObject> _dust = new List<GameObject>();

		private readonly List<Material> _dustMats = new List<Material>();

		private TextMeshPro _title;

		private float _clock;

		private float _open;

		private bool _openTarget;

		private float _corePulse;

		private float _appear;

		private bool _held;

		private bool _heldByLeft;

		private Vector3 _grabOffset;

		private float _nextPress;

		private bool _triggerWasDown;

		private float _lastTapTime = -10f;

		private float _nextDeployTime;

		private float _deployGlow;

		private bool _deployed;

		private float _deployBlend;

		private float _blend;

		private Vector3 _deployForward = Vector3.forward;

		private bool _deployRequested;

		public bool Deployed => _deployed;

		public bool Exists => (Object)(object)_root != (Object)null;

		public bool Held => _held;

		public bool Suspended { get; private set; }

		public Vector3 Position
		{
			get
			{
				//IL_001f: 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)
				if (!((Object)(object)_root != (Object)null))
				{
					return Vector3.zero;
				}
				return _root.transform.position;
			}
		}

		public BaseController HeldController
		{
			get
			{
				if (!_held)
				{
					return null;
				}
				if (!_heldByLeft)
				{
					return Player.RightController;
				}
				return Player.LeftController;
			}
		}

		public void SetDeployed(bool value)
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			_deployed = value;
			if (!value)
			{
				for (int i = 0; i < _satellites.Count; i++)
				{
					_satellites[i].Free = false;
					_satellites[i].Held = false;
					_satellites[i].Velocity = Vector3.zero;
				}
				return;
			}
			_openTarget = true;
			for (int j = 0; j < _satellites.Count; j++)
			{
				_satellites[j].Free = false;
				_satellites[j].Held = false;
				_satellites[j].Velocity = Vector3.zero;
			}
			if (PlayerBody.TryResolve(out var _, out var _, out var forward))
			{
				_deployForward = forward;
			}
		}

		public bool ConsumeDeployRequest()
		{
			if (!_deployRequested)
			{
				return false;
			}
			_deployRequested = false;
			return true;
		}

		public void Suspend()
		{
			Suspended = true;
			_held = false;
			_triggerWasDown = false;
			_lastTapTime = -10f;
			_deployRequested = false;
			for (int i = 0; i < _satellites.Count; i++)
			{
				_satellites[i].Held = false;
			}
		}

		public void Resume()
		{
			Suspended = false;
			_triggerWasDown = false;
			_lastTapTime = -10f;
			_nextDeployTime = Time.time + Prefs.DeployCooldown;
		}

		public void EnergyBoost(float amount)
		{
			_corePulse = Mathf.Max(_corePulse, amount);
		}

		public void SetDeployGlow(float amount)
		{
			_deployGlow = Mathf.Clamp01(amount);
		}

		public void DriveTo(Vector3 target, float dt, float speed)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_root == (Object)null))
			{
				_root.transform.position = Vector3.Lerp(_root.transform.position, target, 1f - Mathf.Exp((0f - Mathf.Max(0.1f, speed)) * dt));
			}
		}

		public void Build()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0022: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			Destroy();
			_root = new GameObject("WristSpawner.Orb");
			_core = MakeSphere("Core", 0.0341f, HoloTheme.ButtonActive, 3600, out _coreMat);
			_shell = MakeSphere("Shell", 0.055f, HoloTheme.Frame, 3601, out _shellMat);
			_halo = MakeSphere("Halo", 0.08525f, new Color(1f, 0.55f, 0.1f, 0.14f), 3602, out _haloMat);
			HoloTheme.SetTexture(_shellMat, HoloTextures.Globe(12, 7));
			_ringPulse = MakeQuad("RingPulse", new Vector2(0.2f, 0.2f), HoloTheme.ButtonActive, PlateStyle.Glow, 3612, out _ringPulseMat);
			_ringPulse.SetActive(false);
			BuildGuides();
			BuildDust();
			BuildSatellites();
			BuildTitle();
			_appear = 0f;
			_open = 0f;
			_openTarget = false;
			PlaceInFront();
			Refresh();
		}

		private GameObject MakeSphere(string name, float radius, Color color, int queue, out Material material)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0);
			((Object)obj).name = name;
			obj.transform.SetParent(_root.transform, false);
			obj.transform.localScale = Vector3.one * (radius * 2f);
			Collider component = obj.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			material = HoloTheme.CreateMaterial(color, onTop: false, null);
			material.renderQueue = queue;
			Renderer component2 = obj.GetComponent<Renderer>();
			component2.material = material;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			component2.receiveShadows = false;
			return obj;
		}

		private GameObject MakeQuad(string name, Vector2 size, Color color, PlateStyle style, int queue, out Material material)
		{
			//IL_002a: 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_003b: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)5);
			((Object)obj).name = name;
			obj.transform.SetParent(_root.transform, false);
			obj.transform.localScale = new Vector3(size.x, size.y, 1f);
			Collider component = obj.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			material = HoloTheme.CreateMaterial(color, onTop: false, HoloTextures.Plate(size, style));
			material.renderQueue = queue;
			Renderer component2 = obj.GetComponent<Renderer>();
			component2.material = material;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			component2.receiveShadows = false;
			return obj;
		}

		private void BuildGuides()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			_guideRoot = new GameObject("WristSpawner.Guides");
			for (int i = 0; i < _guides.Length; i++)
			{
				GameObject val = GameObject.CreatePrimitive((PrimitiveType)5);
				((Object)val).name = "Guide" + i;
				val.transform.SetParent(_guideRoot.transform, false);
				Collider component = val.GetComponent<Collider>();
				if ((Object)(object)component != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)component);
				}
				Material val2 = HoloTheme.CreateMaterial(HoloTheme.Frame, onTop: false, HoloTextures.Ring(40 - i * 8));
				val2.renderQueue = 3598;
				Renderer component2 = val.GetComponent<Renderer>();
				component2.material = val2;
				component2.shadowCastingMode = (ShadowCastingMode)0;
				component2.receiveShadows = false;
				val.SetActive(false);
				_guides[i] = val;
				_guideMats[i] = val2;
			}
		}

		private void TickGuides()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			bool flag = _blend > 0.02f;
			for (int i = 0; i < _guides.Length; i++)
			{
				if ((Object)(object)_guides[i] != (Object)null && _guides[i].activeSelf != flag)
				{
					_guides[i].SetActive(flag);
				}
			}
			if (!flag || !PlayerBody.TryResolve(out var feet, out var height, out var _))
			{
				return;
			}
			float num = height / 1.78f;
			float num2 = Mathf.Max(0.25f, Prefs.DeployOrbitRadius) * num;
			float num3 = feet.y + height * 0.78f;
			float num4 = 0.085f * height;
			for (int j = 0; j < _guides.Length; j++)
			{
				if (!((Object)(object)_guides[j] == (Object)null))
				{
					bool flag2 = j == 0;
					float num5 = num3 + (flag2 ? num4 : (0f - num4));
					float num6 = num2 * (flag2 ? 1f : 0.93f) * 2.5f;
					Transform transform = _guides[j].transform;
					transform.position = new Vector3(feet.x, num5, feet.z);
					transform.rotation = Quaternion.Euler(90f, 0f, 0f) * Quaternion.Euler(0f, 0f, _clock * (flag2 ? 12f : (-9f)));
					transform.localScale = new Vector3(num6, num6, 1f);
					Color frame = HoloTheme.Frame;
					frame.a *= 0.2f * _blend * _appear;
					HoloTheme.Tint(_guideMats[j], frame);
				}
			}
		}

		private void BuildDust()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < 10; i++)
			{
				Material material;
				GameObject item = MakeQuad("Dust" + i, new Vector2(0.008f, 0.008f), HoloTheme.Shard, PlateStyle.Glow, 3611, out material);
				_dust.Add(item);
				_dustMats.Add(material);
			}
		}

		private void BuildSatellites()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_005f: 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_0089: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < 20; i++)
			{
				GameObject val = new GameObject("Sat" + i);
				val.transform.SetParent(_root.transform, false);
				GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)0);
				((Object)val2).name = "Body";
				val2.transform.SetParent(val.transform, false);
				val2.transform.localScale = Vector3.one * 0.06f;
				Collider component = val2.GetComponent<Collider>();
				if ((Object)(object)component != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)component);
				}
				Material val3 = HoloTheme.CreateMaterial(HoloTheme.Button, onTop: false, HoloTextures.Globe(8, 5));
				val3.renderQueue = 3605;
				Renderer component2 = val2.GetComponent<Renderer>();
				component2.material = val3;
				component2.shadowCastingMode = (ShadowCastingMode)0;
				component2.receiveShadows = false;
				GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)5);
				((Object)val4).name = "Icon";
				val4.transform.SetParent(val.transform, false);
				val4.transform.localScale = Vector3.one * 0.038999997f;
				Collider component3 = val4.GetComponent<Collider>();
				if ((Object)(object)component3 != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)component3);
				}
				Material val5 = HoloTheme.CreateMaterial(HoloTheme.TextBright, onTop: false, null);
				val5.renderQueue = 3607;
				Renderer component4 = val4.GetComponent<Renderer>();
				component4.material = val5;
				component4.shadowCastingMode = (ShadowCastingMode)0;
				component4.receiveShadows = false;
				Material material;
				GameObject panel = MakeChild(val, "Panel", (PrimitiveType)5, HoloTextures.Window(new Vector2(0.235f, 0.15f)), 3603, out material);
				Material material2;
				GameObject header = MakeChild(val, "Header", (PrimitiveType)5, HoloTextures.Plate(new Vector2(0.235f, 0.006f), PlateStyle.Solid), 3604, out material2);
				GameObject val6 = new GameObject("Label");
				val6.transform.SetParent(val.transform, false);
				TextMeshPro val7 = val6.AddComponent<TextMeshPro>();
				((TMP_Text)val7).font = HoloTheme.Font;
				HoloTheme.Calibrate((TMP_Text)(object)val7);
				((TMP_Text)val7).rectTransform.sizeDelta = new Vector2(0.16f, 0.02f);
				((TMP_Text)val7).fontSize = HoloTheme.FontSizeFor(0.008f);
				((Graphic)val7).color = HoloTheme.TextDim;
				((TMP_Text)val7).alignment = (TextAlignmentOptions)514;
				((TMP_Text)val7).enableWordWrapping = false;
				((TMP_Text)val7).overflowMode = (TextOverflowModes)1;
				((TMP_Text)val7).richText = false;
				((TMP_Text)val7).text = string.Empty;
				_satellites.Add(new Satellite
				{
					Root = val,
					Body = val2,
					BodyMat = val3,
					Icon = val4,
					IconMat = val5,
					Panel = panel,
					PanelMat = material,
					Header = header,
					HeaderMat = material2,
					Label = val7,
					Facing = Quaternion.identity,
					Angle = (float)i / 20f * (float)Math.PI * 2f
				});
			}
		}

		private GameObject MakeChild(GameObject parent, string name, PrimitiveType type, Texture2D texture, int queue, out Material material)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive(type);
			((Object)obj).name = name;
			obj.transform.SetParent(parent.transform, false);
			Collider component = obj.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			material = HoloTheme.CreateMaterial(HoloTheme.Button, onTop: false, texture);
			material.renderQueue = queue;
			Renderer component2 = obj.GetComponent<Renderer>();
			component2.material = material;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			component2.receiveShadows = false;
			obj.SetActive(false);
			return obj;
		}

		private void BuildTitle()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Title");
			val.transform.SetParent(_root.transform, false);
			_title = val.AddComponent<TextMeshPro>();
			((TMP_Text)_title).font = HoloTheme.Font;
			HoloTheme.Calibrate((TMP_Text)(object)_title);
			RectTransform rectTransform = ((TMP_Text)_title).rectTransform;
			((Transform)rectTransform).localPosition = new Vector3(0f, -0.235f, 0f);
			rectTransform.sizeDelta = new Vector2(0.3f, 0.03f);
			((TMP_Text)_title).fontSize = HoloTheme.FontSizeFor(0.011f);
			((Graphic)_title).color = HoloTheme.TextDim;
			((TMP_Text)_title).alignment = (TextAlignmentOptions)514;
			((TMP_Text)_title).enableWordWrapping = false;
			((TMP_Text)_title).overflowMode = (TextOverflowModes)1;
			((TMP_Text)_title).richText = false;
			((TMP_Text)_title).text = "ORB";
		}

		public void Refresh()
		{
			if (!Exists)
			{
				return;
			}
			List<CatalogEntry> list = SpawnCatalog.Get(Category.Favorites);
			bool flag = list.Count > 0;
			if (!flag)
			{
				list = SpawnCatalog.Get(Category.All);
			}
			int num = Mathf.Clamp(Prefs.OrbSlots, 1, _satellites.Count);
			for (int i = 0; i < _satellites.Count; i++)
			{
				Satellite satellite = _satellites[i];
				satellite.Entry = ((i < num && i < list.Count) ? list[i] : null);
				bool flag2 = satellite.Entry != null;
				if (satellite.Root.activeSelf != flag2)
				{
					satellite.Root.SetActive(flag2);
				}
				if (!flag2)
				{
					satellite.Held = false;
					continue;
				}
				((TMP_Text)satellite.Label).text = satellite.Entry.Title;
				HoloTheme.SetTexture(satellite.IconMat, HoloTextures.Icon(IconFor(satellite.Entry.Category)));
			}
			((TMP_Text)_title).text = (flag ? "FAVORITES" : "SPAWNABLES");
		}

		private static IconKind IconFor(Category category)
		{
			return category switch
			{
				Category.Guns => IconKind.Crosshair, 
				Category.Melee => IconKind.Blade, 
				Category.NPCs => IconKind.Figure, 
				Category.Props => IconKind.Cube, 
				_ => IconKind.Grid, 
			};
		}

		public void PlaceInFront()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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)
			if (Exists)
			{
				Transform head = Player.Head;
				if (!((Object)(object)head == (Object)null))
				{
					Vector3 forward = head.forward;
					forward.y *= 0.35f;
					_root.transform.position = head.position + ((Vector3)(ref forward)).normalized * 0.75f;
					_appear = 0f;
				}
			}
		}

		public void Tick(float dt)
		{
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			if (Exists)
			{
				_clock += dt;
				_appear = Mathf.MoveTowards(_appear, 1f, dt * 2.2f);
				_corePulse = Mathf.MoveTowards(_corePulse, 0f, dt * 2.4f);
				if (_deployed)
				{
					_openTarget = true;
				}
				_open = Mathf.MoveTowards(_open, _openTarget ? 1f : 0f, dt * 3.4f);
				_deployBlend = Mathf.MoveTowards(_deployBlend, _deployed ? 1f : 0f, dt * 1.5f);
				_blend = Ease.InOutSine(_deployBlend);
				if (!Suspended)
				{
					UpdateGrab(dt);
					UpdatePoke();
					UpdateDoubleTap();
				}
				FollowPlayerWhenDeployed(dt);
				TickFreePanels(dt);
				TickGuides();
				float num = Mathf.Max(0.2f, Prefs.OrbScale) * Ease.OutBack(_appear);
				_root.transform.localScale = Vector3.one * num;
				_root.transform.rotation = Quaternion.identity;
				TickCore();
				TickDust();
				TickSatellites(dt);
				TickRing(dt);
				TickTitle();
			}
		}

		private void FollowPlayerWhenDeployed(float dt)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0046: 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)
			//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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			if (_deployed && !_held && !Suspended && PlayerBody.TryResolve(out var feet, out var height, out var _))
			{
				Vector3 val = PlayerBody.Center(feet, height) + _deployForward * (0.34f * (height / 1.78f)) - Vector3.up * (0.12f * (height / 1.78f));
				_root.transform.position = Vector3.Lerp(_root.transform.position, val, 1f - Mathf.Exp(-1.6f * dt));
			}
		}

		private void TickCore()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: 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_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			float num = 1f + Mathf.Sin(_clock * 2.4f) * 0.06f + _corePulse * 0.45f + _deployGlow * 0.35f;
			_core.transform.localScale = Vector3.one * (0.0682f * num);
			_shell.transform.localScale = Vector3.one * (0.11f * (1f + _corePulse * 0.25f + _deployGlow * 0.3f));
			_halo.transform.localScale = Vector3.one * (0.1705f * (1f + _corePulse * 0.35f + _deployGlow * 0.9f));
			_core.transform.localRotation = Quaternion.Euler(_clock * 12f, _clock * 20f, 0f);
			_shell.transform.localRotation = Quaternion.Euler(18f, _clock * 26f, 6f);
			_halo.transform.localRotation = Quaternion.Euler(0f, (0f - _clock) * 9f, 0f);
			Color color = Color.Lerp(HoloTheme.ButtonActive, Color.white, Mathf.Max(_corePulse, _deployGlow));
			color.a = 0.92f * _appear;
			HoloTheme.Tint(_coreMat, color);
			Color frame = HoloTheme.Frame;
			frame.a = (0.42f + 0.14f * Mathf.Sin(_clock * 3.1f) + _corePulse * 0.3f + _deployGlow * 0.45f) * _appear;
			HoloTheme.Tint(_shellMat, frame);
			Color color2 = default(Color);
			((Color)(ref color2))..ctor(1f, 0.55f, 0.1f, (0.1f + _corePulse * 0.22f + _deployGlow * 0.35f) * _appear);
			HoloTheme.Tint(_haloMat, color2);
		}

		private void TickDust()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			Vector3 viewer = Viewer();
			for (int i = 0; i < _dust.Count; i++)
			{
				float num = _clock * (0.6f + (float)i * 0.07f) + (float)i * 1.37f;
				float num2 = 0.055f * (1.9f + 0.5f * Mathf.Sin(num * 0.7f + (float)i));
				float num3 = (float)i * 0.62f;
				_dust[i].transform.localPosition = new Vector3(Mathf.Cos(num) * num2, Mathf.Sin(num * 1.3f + num3) * num2 * 0.55f, Mathf.Sin(num) * num2);
				_dust[i].transform.rotation = Billboard(_dust[i].transform.position, viewer);
				Color shard = HoloTheme.Shard;
				shard.a = (0.3f + 0.3f * Mathf.Sin(num * 2f)) * _appear;
				HoloTheme.Tint(_dustMats[i], shard);
			}
		}

		private Quaternion OrbitBasis(int ring)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (ring != 0)
			{
				return Quaternion.Euler(-58f, _clock * -11f, 24f);
			}
			return Quaternion.Euler(22f, _clock * 15f, 8f);
		}

		private void TickSatellites(float dt)
		{
			//IL_0019: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//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_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_0060: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: 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_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: 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_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: 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_04ad: Unknown result type (might be due to invalid IL or missing references)
			float num = _clock * 0.42f;
			float num2 = Ease.OutBack(_open);
			Vector3 val = Viewer();
			float x = _root.transform.localScale.x;
			Vector3 position = _root.transform.position;
			float num3 = 0.17f * num2 * x;
			Vector3 feet = Vector3.zero;
			float height = 1.78f;
			Vector3 forward = Vector3.forward;
			bool flag = false;
			if (_blend > 0.001f)
			{
				flag = PlayerBody.TryResolve(out feet, out height, out forward);
			}
			Vector3 val2 = Vector3.zero;
			Vector3 val3 = Vector3.right;
			Vector3 val4 = Vector3.forward;
			float num4 = 0.72f;
			float num5 = 1f;
			float num6 = 0f;
			if (flag)
			{
				num5 = height / 1.78f;
				val2 = PlayerBody.Center(feet, height);
				val4 = _deployForward;
				val3 = Vector3.Cross(Vector3.up, _deployForward);
				num4 = Mathf.Max(0.25f, Prefs.DeployOrbitRadius) * num5;
				num6 = feet.y + height * 0.78f;
			}
			float num7 = Mathf.Lerp(1f, Mathf.Max(0.3f, Prefs.DeployedScale), _blend);
			float num8 = _clock * Prefs.DeployOrbitSpin * ((float)Math.PI / 180f);
			int num9 = 0;
			for (int i = 0; i < _satellites.Count; i++)
			{
				if (_satellites[i].Entry != null)
				{
					num9++;
				}
			}
			if (num9 <= 0)
			{
				num9 = 1;
			}
			num3 *= Mathf.Clamp(Mathf.Sqrt((float)num9 / 8f), 1f, 1.8f);
			int num10 = 0;
			for (int j = 0; j < _satellites.Count; j++)
			{
				Satellite satellite = _satellites[j];
				if (satellite.Entry != null)
				{
					satellite.Hover = Mathf.MoveTowards(satellite.Hover, satellite.Held ? 1f : 0f, dt * 6f);
					satellite.Press = Mathf.MoveTowards(satellite.Press, 0f, dt * 3f);
					satellite.Detach = Mathf.MoveTowards(satellite.Detach, (satellite.Held || satellite.Free) ? 1f : 0f, dt * 5f);
					int num11 = num10 % 2;
					int num12 = num10 / 2;
					int num13 = Mathf.Max(1, (num9 + ((num11 == 0) ? 1 : 0)) / 2);
					float num14 = num * ((num11 == 0) ? 1f : (-0.82f)) + (float)num12 / (float)num13 * (float)Math.PI * 2f + (float)num11 * 0.7f;
					Vector3 val5 = OrbitBasis(num11) * new Vector3(Mathf.Cos(num14), 0f, Mathf.Sin(num14));
					Vector3 val6 = position + val5 * num3;
					Vector3 val7 = val6;
					Quaternion val8 = Billboard(val6, val);
					Vector3 normalized = ((Vector3)(ref val5)).normalized;
					Vector3 val9 = val - position;
					float num15 = Mathf.Clamp01(0f - Vector3.Dot(normalized, ((Vector3)(ref val9)).normalized));
					if (flag)
					{
						bool flag2 = num10 % 2 == 0;
						float num16 = (float)num10 / (float)num9 * (float)Math.PI * 2f + num8 + (flag2 ? 0f : 0.18f);
						Vector3 val10 = val3 * Mathf.Cos(num16) + val4 * Mathf.Sin(num16);
						float num17 = (flag2 ? 0.085f : (-0.085f)) * height;
						float num18 = Mathf.Sin(_clock * 0.8f + (float)num10 * 1.1f) * 0.016f * num5;
						float num19 = num4 * (flag2 ? 1f : 0.93f);
						Vector3 val11 = new Vector3(val2.x, num6, val2.z) + val10 * num19 + Vector3.up * (num17 + num18);
						Vector3 val12 = val11 - new Vector3(val2.x, val11.y, val2.z);
						Quaternion val13 = ((((Vector3)(ref val12)).sqrMagnitude > 0.0001f) ? Quaternion.LookRotation(((Vector3)(ref val12)).normalized, Vector3.up) : val8);
						float num20 = Mathf.Clamp((num6 - val11.y) * 55f, -22f, 22f);
						float num21 = Mathf.Sin(_clock * 0.55f + (float)num10 * 1.7f) * 3.5f;
						val13 *= Quaternion.Euler(num20, num21, 0f);
						val7 = Vector3.Lerp(val6, val11, _blend);
						val8 = Quaternion.Slerp(val8, val13, _blend);
						num15 *= 1f - _blend;
					}
					float num22 = Ease.OutCubic(satellite.Detach);
					val7 = Vector3.Lerp(val7, satellite.FreePosition, num22);
					satellite.Root.transform.position = val7;
					satellite.Root.transform.rotation = val8;
					float num23 = Mathf.Lerp(1f, 0.34f, num15 * (1f - num22));
					float num24 = Mathf.Lerp(1f, 0.72f, num15 * (1f - num22));
					float num25 = 0.32f * satellite.Press * Mathf.Cos(satellite.Press * 7f);
					float grow = (0.25f + 0.75f * num2) * num24 * num7 * (1f + satellite.Hover * 0.18f + num25 + num22 * 0.12f);
					float alpha = Mathf.Max(num2, num22) * _appear * num23;
					LayoutSatellite(satellite, val7, val8, grow, alpha, num5);
					num10++;
				}
			}
		}

		private void LayoutSatellite(Satellite satellite, Vector3 world, Quaternion facing, float grow, float alpha, float bodyScaleRef)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0008: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00e9: 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_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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: 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_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			satellite.Facing = facing;
			_ = facing * Vector3.right;
			Vector3 val = facing * Vector3.up;
			Vector3 val2 = facing * Vector3.back;
			float num = grow * bodyScaleRef;
			float num2 = Mathf.Lerp(1f, 0f, Mathf.Clamp01(_blend * 1.6f)) * grow;
			bool flag = _blend > 0.01f;
			if (satellite.Panel.activeSelf != flag)
			{
				satellite.Panel.SetActive(flag);
				satellite.Header.SetActive(flag);
			}
			if (flag)
			{
				satellite.Panel.transform.position = world;
				satellite.Panel.transform.rotation = facing;
				satellite.Panel.transform.localScale = new Vector3(0.235f * num, 0.15f * num, 1f);
				satellite.Header.transform.position = world + val * (0.066f * num) + val2 * 0.002f;
				satellite.Header.transform.rotation = facing;
				satellite.Header.transform.localScale = new Vector3(0.21620001f * num, 0.006f * num, 1f);
				Color val3 = Color.Lerp(HoloTheme.Button, HoloTheme.ButtonHover, satellite.Hover);
				val3 = Color.Lerp(val3, HoloTheme.ButtonActive, satellite.Press);
				val3.a *= alpha * _blend;
				HoloTheme.Tint(satellite.PanelMat, val3);
				Color color = Color.Lerp(HoloTheme.Frame, HoloTheme.ButtonActive, Mathf.Max(satellite.Hover, satellite.Press));
				color.a *= alpha * _blend;
				HoloTheme.Tint(satellite.HeaderMat, color);
			}
			bool flag2 = num2 > 0.0005f;
			if (satellite.Body.activeSelf != flag2)
			{
				satellite.Body.SetActive(flag2);
			}
			satellite.Body.transform.position = world;
			satellite.Body.transform.localScale = Vector3.one * (0.06f * num2);
			satellite.Body.transform.localRotation = Quaternion.Euler(14f, _clock * 42f, 0f);
			Color val4 = Color.Lerp(HoloTheme.Button, HoloTheme.ButtonHover, satellite.Hover);
			val4 = Color.Lerp(val4, HoloTheme.ButtonActive, satellite.Press);
			val4.a *= alpha;
			HoloTheme.Tint(satellite.BodyMat, val4);
			float num3 = Mathf.Lerp(0.037499998f * grow, 0.066f * num, _blend);
			Vector3 position = Vector3.Lerp(world + val2 * (0.03f * grow * 1.05f), world + val * (0.006f * num) + val2 *