Decompiled source of CustomGrabColor v2.2.0

CustomGrabColour.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CustomGrabColour.Config;
using CustomGrabColour.PlayerGrabBeam;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("Enchanted_Games")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.2.0.0")]
[assembly: AssemblyInformationalVersion("2.2.0+fbbbd91b05114a40601b8f1c56741df7998c23bd")]
[assembly: AssemblyProduct("CustomGrabColour")]
[assembly: AssemblyTitle("CustomGrabColour")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 CustomGrabColour
{
	public static class PluginInfo
	{
		public const string PluginID = "CustomGrabColour";

		public const string PluginName = "CustomGrabColour";

		public const string PluginVersion = "2.2.0";

		public const string PluginGuid = "games.enchanted.CustomGrabColour";
	}
	[BepInPlugin("games.enchanted.CustomGrabColour", "CustomGrabColour", "2.2.0")]
	public class Plugin : BaseUnityPlugin
	{
		private ManualLogSource _pluginLogger;

		public static Plugin Instance { get; private set; }

		public static void LogMessageIfDebug(object message)
		{
			if (CustomGrabColourConfig.EnableDebugLogs.Value)
			{
				Instance._pluginLogger.LogMessage((object)("CustomGrabColour Debug: " + message));
			}
		}

		public static void LogMessage(object message)
		{
			Instance._pluginLogger.LogMessage((object)("CustomGrabColour: " + message));
		}

		public static void LogError(object message)
		{
			Instance._pluginLogger.LogError((object)("CustomGrabColour Debug: " + message));
		}

		public static void LogErrorIfDebug(object message)
		{
			if (CustomGrabColourConfig.EnableDebugLogs.Value)
			{
				Instance._pluginLogger.LogError((object)("CustomGrabColour: " + message));
			}
		}

		public static void LogWarning(object message)
		{
			Instance._pluginLogger.LogWarning((object)("CustomGrabColour: " + message));
		}

		private void Awake()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			Instance = this;
			_pluginLogger = ((BaseUnityPlugin)this).Logger;
			_pluginLogger.LogInfo((object)"Loading plugin CustomGrabColour! (games.enchanted.CustomGrabColour)");
			CustomGrabColourConfig.Init(((BaseUnityPlugin)this).Config);
			Harmony val = new Harmony("games.enchanted.CustomGrabColour");
			val.PatchAll();
			ConfigMenu.Init();
			_pluginLogger.LogInfo((object)"Loading finished for CustomGrabColour! (games.enchanted.CustomGrabColour)");
		}
	}
}
namespace CustomGrabColour.PlayerGrabBeam
{
	public class CustomGrabBeamColour : MonoBehaviour, IPunObservable
	{
		internal static GrabBeamColourSettings LocalNeutralColour;

		internal static GrabBeamColourSettings LocalHealingColour;

		internal static GrabBeamColourSettings LocalRotatingColour;

		internal GrabBeamColourSettings CurrentNeutralColour;

		internal GrabBeamColourSettings CurrentHealingColour;

		internal GrabBeamColourSettings CurrentRotatingColour;

		internal bool SentInitialColourUpdate = false;

		public PlayerAvatar player;

		private Material _bodyMaterialInternal;

		public Material BodyMaterial
		{
			get
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Expected O, but got Unknown
				if ((Object)(object)_bodyMaterialInternal == (Object)null)
				{
					try
					{
						FieldInfo field = ((object)player.playerHealth).GetType().GetField("bodyMaterial", BindingFlags.Instance | BindingFlags.NonPublic);
						_bodyMaterialInternal = (Material)field.GetValue(player.playerHealth);
					}
					catch (Exception)
					{
						Plugin.LogMessageIfDebug("Failed to get value of PlayerHealth bodyMaterial field");
						return null;
					}
				}
				return _bodyMaterialInternal;
			}
			set
			{
				_bodyMaterialInternal = value;
			}
		}

		public static GrabBeamColourSettings LocalBeamColour
		{
			get
			{
				throw new NotImplementedException("Tried to get field LocalBeamColour, call GetLocalSettingsForBeamType instead");
			}
			set
			{
				switch (value.CurrentBeamType)
				{
				case GrabBeamColourSettings.BeamType.Neutral:
					LocalNeutralColour = value;
					break;
				case GrabBeamColourSettings.BeamType.Heal:
					LocalHealingColour = value;
					break;
				case GrabBeamColourSettings.BeamType.Rotate:
					LocalRotatingColour = value;
					break;
				}
			}
		}

		public GrabBeamColourSettings CurrentBeamColour
		{
			get
			{
				throw new NotImplementedException("Tried to get field CurrentBeamColour, call GetSettingsForBeamType instead");
			}
			set
			{
				switch (value.CurrentBeamType)
				{
				case GrabBeamColourSettings.BeamType.Neutral:
					CurrentNeutralColour = value;
					break;
				case GrabBeamColourSettings.BeamType.Heal:
					CurrentHealingColour = value;
					break;
				case GrabBeamColourSettings.BeamType.Rotate:
					CurrentRotatingColour = value;
					break;
				}
			}
		}

		public static GrabBeamColourSettings GetLocalSettingsForBeamType(GrabBeamColourSettings.BeamType beamType)
		{
			return beamType switch
			{
				GrabBeamColourSettings.BeamType.Heal => LocalHealingColour, 
				GrabBeamColourSettings.BeamType.Rotate => LocalRotatingColour, 
				_ => LocalNeutralColour, 
			};
		}

		public GrabBeamColourSettings GetSettingsForBeamType(GrabBeamColourSettings.BeamType beamType)
		{
			return beamType switch
			{
				GrabBeamColourSettings.BeamType.Heal => CurrentNeutralColour, 
				GrabBeamColourSettings.BeamType.Rotate => CurrentHealingColour, 
				_ => CurrentRotatingColour, 
			};
		}

		private void Awake()
		{
			player = ((Component)this).gameObject.GetComponent<PlayerAvatar>();
		}

		public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
		{
			throw new NotImplementedException();
		}

		public static void SaveLocalColoursToConfig()
		{
			CustomGrabColourConfig.SaveColour(LocalNeutralColour);
			CustomGrabColourConfig.SaveColour(LocalHealingColour);
			CustomGrabColourConfig.SaveColour(LocalRotatingColour);
		}

		public static void ResetBeamColours()
		{
			//IL_0001: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			LocalNeutralColour = new GrabBeamColourSettings(CustomGrabColourConfig.NeutralDefaultColour, (bool)((ConfigEntryBase)CustomGrabColourConfig.NeutralGrabBeam.MatchSkin).DefaultValue, GrabBeamColourSettings.BeamType.Neutral);
			LocalHealingColour = new GrabBeamColourSettings(CustomGrabColourConfig.HealingDefaultColour, (bool)((ConfigEntryBase)CustomGrabColourConfig.HealingGrabBeam.MatchSkin).DefaultValue, GrabBeamColourSettings.BeamType.Heal);
			LocalRotatingColour = new GrabBeamColourSettings(CustomGrabColourConfig.RotatingDefaultColour, (bool)((ConfigEntryBase)CustomGrabColourConfig.RotatingGrabBeam.MatchSkin).DefaultValue, GrabBeamColourSettings.BeamType.Rotate);
			UpdateBeamColourForAllBeams();
		}

		public static void UpdateBeamColour(GrabBeamColourSettings newColour)
		{
			newColour.a = Mathf.Clamp(newColour.a, 0f, 0.5f);
			LocalBeamColour = newColour;
			UpdateBeamColour(newColour.CurrentBeamType);
		}

		public static void UpdateBeamColourForAllBeams()
		{
			foreach (GrabBeamColourSettings.BeamType value in Enum.GetValues(typeof(GrabBeamColourSettings.BeamType)))
			{
				UpdateBeamColour(value);
			}
		}

		public static void UpdateBeamColour(GrabBeamColourSettings.BeamType beamType)
		{
			GrabBeamColourSettings localSettingsForBeamType = GetLocalSettingsForBeamType(beamType);
			if (GameManager.Multiplayer())
			{
				PlayerAvatar.instance.photonView.RPC("SetBeamColourRPC", (RpcTarget)3, GrabBeamColourSettings.ToRPCBuffer(localSettingsForBeamType));
			}
			else
			{
				((Component)PlayerAvatar.instance).GetComponent<CustomGrabBeamColour>().SetBeamColourRPC(GrabBeamColourSettings.ToRPCBuffer(localSettingsForBeamType));
			}
		}

		[PunRPC]
		public void SetBeamColourRPC(object[] beamColourParts)
		{
			GrabBeamColourSettings currentBeamColour = GrabBeamColourSettings.FromRPCBuffer(beamColourParts);
			Plugin.LogMessageIfDebug("SetBeamColourRPC called with values: r:" + currentBeamColour.r + ", g:" + currentBeamColour.g + ", b:" + currentBeamColour.b + ", a:" + currentBeamColour.a + ", matchSkin:" + currentBeamColour.MatchSkin + ", beamType:" + currentBeamColour.CurrentBeamType);
			currentBeamColour.a = Mathf.Clamp(currentBeamColour.a, 0f, 0.5f);
			CurrentBeamColour = currentBeamColour;
			if (currentBeamColour.CurrentBeamType != 0)
			{
				return;
			}
			Type type = ((object)player.physGrabber).GetType();
			try
			{
				FieldInfo field = type.GetField("prevColorState", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					field.SetValue(player.physGrabber, -1);
				}
			}
			catch (Exception ex)
			{
				Plugin.LogErrorIfDebug("Error while setting field 'prevColorState', this is probably harmless.\n" + ex);
			}
			try
			{
				MethodInfo method = type.GetMethod("ColorStates", BindingFlags.Instance | BindingFlags.NonPublic);
				if (method != null)
				{
					method.Invoke(player.physGrabber, null);
				}
			}
			catch (Exception ex2)
			{
				Plugin.LogErrorIfDebug("Error while calling method 'ColorStates', this is probably harmless.\n" + ex2);
			}
		}

		public Color GetBodyColour(Color fallbackColour)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001f: Unknown result type (might be due to invalid IL or missing references)
			Color color = BodyMaterial.GetColor(Shader.PropertyToID("_AlbedoColor"));
			bool flag = false;
			return color;
		}

		public static Color GetLocalBodyColour(Color fallbackColour)
		{
			//IL_0055: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_003f: 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_0062: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			Color color;
			try
			{
				FieldInfo field = ((object)PlayerAvatar.instance.playerHealth).GetType().GetField("bodyMaterial", BindingFlags.Instance | BindingFlags.NonPublic);
				Material val = (Material)field.GetValue(PlayerAvatar.instance.playerHealth);
				color = val.GetColor(Shader.PropertyToID("_AlbedoColor"));
			}
			catch (Exception)
			{
				Plugin.LogMessageIfDebug("Failed to get value of PlayerHealth bodyMaterial field in GetLocalBodyColour");
				return fallbackColour;
			}
			bool flag = false;
			return color;
		}
	}
	public struct GrabBeamColourSettings
	{
		public enum BeamType : byte
		{
			Neutral,
			Heal,
			Rotate
		}

		public Color Colour;

		public bool MatchSkin;

		public readonly BeamType CurrentBeamType;

		public float r
		{
			get
			{
				return Colour.r;
			}
			set
			{
				Colour.r = value;
			}
		}

		public float g
		{
			get
			{
				return Colour.g;
			}
			set
			{
				Colour.g = value;
			}
		}

		public float b
		{
			get
			{
				return Colour.b;
			}
			set
			{
				Colour.b = value;
			}
		}

		public float a
		{
			get
			{
				return Colour.a;
			}
			set
			{
				Colour.a = value;
			}
		}

		public GrabBeamColourSettings(Color colour, bool matchSkin, BeamType currentBeamType)
		{
			//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)
			Colour = colour;
			MatchSkin = matchSkin;
			CurrentBeamType = currentBeamType;
		}

		public static object[] ToRPCBuffer(GrabBeamColourSettings beamColour)
		{
			//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_0010: 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_002c: 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)
			Color colour = beamColour.Colour;
			return new object[6]
			{
				colour.r,
				colour.g,
				colour.b,
				colour.a,
				beamColour.MatchSkin,
				(byte)beamColour.CurrentBeamType
			};
		}

		public static GrabBeamColourSettings FromRPCBuffer(object[] rpcBuffer)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if (!(rpcBuffer[0] is float) || !(rpcBuffer[1] is float) || !(rpcBuffer[2] is float) || !(rpcBuffer[3] is float) || !(rpcBuffer[4] is bool) || !(rpcBuffer[5] is byte))
			{
				throw new ArgumentException("FromRPCBuffer recieved incorrect parameters");
			}
			Color colour = default(Color);
			((Color)(ref colour))..ctor((float)rpcBuffer[0], (float)rpcBuffer[1], (float)rpcBuffer[2], (float)rpcBuffer[3]);
			return new GrabBeamColourSettings(colour, (bool)rpcBuffer[4], (BeamType)rpcBuffer[5]);
		}
	}
	public static class GrabBeamUtil
	{
		private static void TrySendBeamColourUpdate(PlayerAvatar player, GrabBeamColourSettings.BeamType beamType)
		{
			CustomGrabBeamColour component = ((Component)player).GetComponent<CustomGrabBeamColour>();
			if ((Object)(object)component != (Object)null)
			{
				CustomGrabBeamColour.UpdateBeamColour(beamType);
			}
		}

		public static void TrySendBeamColourUpdateForAllBeams(PlayerAvatar player)
		{
			foreach (GrabBeamColourSettings.BeamType value in Enum.GetValues(typeof(GrabBeamColourSettings.BeamType)))
			{
				TrySendBeamColourUpdate(player, value);
			}
		}
	}
}
namespace CustomGrabColour.Patch
{
	internal abstract class PhysGrabberPatches
	{
		[HarmonyPatch(typeof(PhysGrabber))]
		[HarmonyPatch("ColorStateSetColor")]
		private class PhysGrabber_ColorState_Patch
		{
			private static readonly FieldRef<PhysGrabber, int> PrevColorStateRef = AccessTools.FieldRefAccess<PhysGrabber, int>("prevColorState");

			private static void Prefix(PhysGrabber __instance, ref Color mainColor, ref Color emissionColor)
			{
				//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_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: 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_00fc: 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_011a: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
				int num = PrevColorStateRef.Invoke(__instance);
				bool flag = false;
				CustomGrabBeamColour currentGrabBeamColour = GetCurrentGrabBeamColour(__instance);
				if (!Object.op_Implicit((Object)(object)currentGrabBeamColour))
				{
					Plugin.LogMessageIfDebug("Player has no custom beam colour");
					ResetRotateBeamGridsColour(__instance);
					return;
				}
				GrabBeamColourSettings grabBeamColourSettings;
				switch (num)
				{
				case 0:
					grabBeamColourSettings = currentGrabBeamColour.CurrentNeutralColour;
					break;
				case 1:
					grabBeamColourSettings = currentGrabBeamColour.CurrentHealingColour;
					break;
				case 2:
					grabBeamColourSettings = currentGrabBeamColour.CurrentRotatingColour;
					break;
				default:
					ResetRotateBeamGridsColour(__instance);
					return;
				}
				Color val;
				if (grabBeamColourSettings.MatchSkin)
				{
					val = currentGrabBeamColour.GetBodyColour(grabBeamColourSettings.Colour);
					val.a = grabBeamColourSettings.Colour.a;
				}
				else
				{
					val = grabBeamColourSettings.Colour;
				}
				mainColor.r = val.r / 3.5f;
				mainColor.g = val.g / 4f;
				mainColor.b = val.b / 3.5f;
				mainColor.a = val.a;
				emissionColor.r = val.r / 3.5f;
				emissionColor.g = val.g / 4f;
				emissionColor.b = val.b / 3.5f;
				emissionColor.a = 0.3f;
				Plugin.LogMessageIfDebug("Set player beam to: (" + mainColor.r + ", " + mainColor.g + ", " + mainColor.b + ", " + mainColor.a + "). colour state is " + num);
				SetRotateBeamGridsColour(__instance, val);
			}
		}

		[HarmonyPatch(typeof(PhysGrabber))]
		[HarmonyPatch("ChangeBeamAlpha")]
		private class PhysGrabber_ChangeBeamAlpha_Patch
		{
			private static bool Prefix()
			{
				return false;
			}
		}

		[HarmonyPatch(typeof(PhysGrabber))]
		[HarmonyPatch("PhysGrabBeamActivate")]
		private class PhysGrabber_PhysGrabBeamActivate_Patch
		{
			private static async void Prefix(PhysGrabber __instance)
			{
				CustomGrabBeamColour grabBeamColour = GetCurrentGrabBeamColour(__instance);
				if (!grabBeamColour.SentInitialColourUpdate)
				{
					bool grabBeamActive = true;
					try
					{
						FieldInfo grabBeamActiveField = ((object)__instance).GetType().GetField("physGrabBeamActive", BindingFlags.Instance | BindingFlags.NonPublic);
						grabBeamActive = (bool)grabBeamActiveField.GetValue(__instance);
					}
					catch (Exception)
					{
						Plugin.LogMessageIfDebug("Failed to get value of PhysGrabber physGrabBeamActive field");
					}
					if (!grabBeamActive)
					{
						await Task.Delay(100);
						Plugin.LogMessageIfDebug("PhysGrabBeamActivate called");
						GrabBeamUtil.TrySendBeamColourUpdateForAllBeams(__instance.playerAvatar);
						grabBeamColour.SentInitialColourUpdate = true;
					}
				}
			}
		}

		private static readonly FieldRef<PhysGrabber, List<GameObject>> PhysGrabPointVisualGridObjectsRef = AccessTools.FieldRefAccess<PhysGrabber, List<GameObject>>("physGrabPointVisualGridObjects");

		private static readonly int EmissionColor = Shader.PropertyToID("_EmissionColor");

		private static CustomGrabBeamColour GetCurrentGrabBeamColour(PhysGrabber grabber)
		{
			return ((Component)grabber.playerAvatar).gameObject.GetComponent<CustomGrabBeamColour>();
		}

		private static void ResetRotateBeamGridsColour(PhysGrabber __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			SetRotateBeamGridsColour(__instance, CustomGrabColourConfig.RotatingDefaultColour);
		}

		private static void SetRotateBeamGridsColour(PhysGrabber __instance, Color gridColour)
		{
			//IL_0046: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_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)
			List<GameObject> list = PhysGrabPointVisualGridObjectsRef.Invoke(__instance);
			Color color = default(Color);
			Color val = default(Color);
			foreach (GameObject item in list)
			{
				Material material = ((Renderer)item.GetComponent<MeshRenderer>()).material;
				if (Object.op_Implicit((Object)(object)material))
				{
					((Color)(ref color))..ctor(gridColour.r / 3.5f, gridColour.g / 4f, gridColour.b / 3.5f, gridColour.a);
					material.color = color;
					((Color)(ref val))..ctor(gridColour.r / 3.5f, gridColour.g / 4f, gridColour.b / 3.5f, 0.3f);
					material.SetColor(EmissionColor, val);
					Plugin.LogMessageIfDebug("Set grid mesh to: (" + material.color.r + ", " + material.color.g + ", " + material.color.b + ", " + material.color.a + ")");
				}
			}
		}
	}
	internal abstract class PlayerAvatarPatches
	{
		[HarmonyPatch(typeof(PlayerAvatar))]
		[HarmonyPatch("Awake")]
		private class PlayerAvatar_Awake_Patch
		{
			public static void Postfix(PlayerAvatar __instance)
			{
				((Component)__instance).gameObject.AddComponent<CustomGrabBeamColour>();
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar))]
		[HarmonyPatch("PlayerAvatarSetColor")]
		private class PlayerAvatar_PlayerAvatarSetColor_Patch
		{
			public static void Postfix(PlayerAvatar __instance, int colorIndex)
			{
				GrabBeamUtil.TrySendBeamColourUpdateForAllBeams(__instance);
			}
		}
	}
}
namespace CustomGrabColour.Config
{
	internal static class ConfigMenu
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static BuilderDelegate <>9__7_0;

			public static BuilderDelegate <>9__7_1;

			public static BuilderDelegate <>9__7_2;

			public static BuilderDelegate <>9__8_0;

			public static ScrollViewBuilderDelegate <>9__8_1;

			public static Action<float> <>9__8_20;

			public static ScrollViewBuilderDelegate <>9__8_2;

			public static Action<float> <>9__8_21;

			public static ScrollViewBuilderDelegate <>9__8_3;

			public static Action<float> <>9__8_22;

			public static ScrollViewBuilderDelegate <>9__8_4;

			public static Action<float> <>9__8_23;

			public static ScrollViewBuilderDelegate <>9__8_5;

			public static Action<bool> <>9__8_24;

			public static ScrollViewBuilderDelegate <>9__8_6;

			public static ScrollViewBuilderDelegate <>9__8_7;

			public static Action<float> <>9__8_25;

			public static ScrollViewBuilderDelegate <>9__8_8;

			public static Action<float> <>9__8_26;

			public static ScrollViewBuilderDelegate <>9__8_9;

			public static Action<float> <>9__8_27;

			public static ScrollViewBuilderDelegate <>9__8_10;

			public static Action<float> <>9__8_28;

			public static ScrollViewBuilderDelegate <>9__8_11;

			public static Action<bool> <>9__8_29;

			public static ScrollViewBuilderDelegate <>9__8_12;

			public static ScrollViewBuilderDelegate <>9__8_13;

			public static Action<float> <>9__8_30;

			public static ScrollViewBuilderDelegate <>9__8_14;

			public static Action<float> <>9__8_31;

			public static ScrollViewBuilderDelegate <>9__8_15;

			public static Action<float> <>9__8_32;

			public static ScrollViewBuilderDelegate <>9__8_16;

			public static Action<float> <>9__8_33;

			public static ScrollViewBuilderDelegate <>9__8_17;

			public static Action<bool> <>9__8_34;

			public static ScrollViewBuilderDelegate <>9__8_18;

			internal void <Init>b__7_0(Transform parent)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f));
			}

			internal void <Init>b__7_1(Transform parent)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f));
			}

			internal void <Init>b__7_2(Transform parent)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f));
			}

			internal void <OpenPopup>b__8_0(Transform parent)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: 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_00af: 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_0106: 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_00d5: 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)
				float verticalPos = GetVerticalPos(0);
				REPOLabel val = MenuAPI.CreateREPOLabel("Neutral Colour Preview", parent, new Vector2(452f, verticalPos - 60f));
				((Component)val).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
				if (!Object.op_Implicit((Object)(object)_neutralGrabColourPreviewParent))
				{
					CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos), out _neutralGrabColourPreviewParent, out _neutralGrabColourPreviewImage);
				}
				float verticalPos2 = GetVerticalPos(1);
				REPOLabel val2 = MenuAPI.CreateREPOLabel("Rotating Colour Preview", parent, new Vector2(452f, verticalPos2 - 60f));
				((Component)val2).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
				if (!Object.op_Implicit((Object)(object)_rotatingGrabColourPreviewParent))
				{
					CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos2), out _rotatingGrabColourPreviewParent, out _rotatingGrabColourPreviewImage);
				}
				float verticalPos3 = GetVerticalPos(2);
				REPOLabel val3 = MenuAPI.CreateREPOLabel("Healing Colour Preview", parent, new Vector2(452f, verticalPos3 - 60f));
				((Component)val3).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
				if (!Object.op_Implicit((Object)(object)_healingGrabColourPreviewParent))
				{
					CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos3), out _healingGrabColourPreviewParent, out _healingGrabColourPreviewImage);
				}
			}

			internal RectTransform <OpenPopup>b__8_1(Transform parent)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				REPOLabel val = MenuAPI.CreateREPOLabel("Neutral Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(0)));
				((Component)val).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
				return ((REPOElement)val).rectTransform;
			}

			internal RectTransform <OpenPopup>b__8_2(Transform parent)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Red", "", delegate(float f)
				{
					//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalNeutralColour.r = f;
					if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin)
					{
						Color color = ((Graphic)_neutralGrabColourPreviewImage).color;
						color.r = f;
						((Graphic)_neutralGrabColourPreviewImage).color = color;
					}
				}, CustomGrabBeamColour.LocalNeutralColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(1)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_20(float f)
			{
				//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalNeutralColour.r = f;
				if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin)
				{
					Color color = ((Graphic)_neutralGrabColourPreviewImage).color;
					color.r = f;
					((Graphic)_neutralGrabColourPreviewImage).color = color;
				}
			}

			internal RectTransform <OpenPopup>b__8_3(Transform parent)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Green", "", delegate(float f)
				{
					//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalNeutralColour.g = f;
					if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin)
					{
						Color color = ((Graphic)_neutralGrabColourPreviewImage).color;
						color.g = f;
						((Graphic)_neutralGrabColourPreviewImage).color = color;
					}
				}, CustomGrabBeamColour.LocalNeutralColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(2)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_21(float f)
			{
				//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalNeutralColour.g = f;
				if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin)
				{
					Color color = ((Graphic)_neutralGrabColourPreviewImage).color;
					color.g = f;
					((Graphic)_neutralGrabColourPreviewImage).color = color;
				}
			}

			internal RectTransform <OpenPopup>b__8_4(Transform parent)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Blue", "", delegate(float f)
				{
					//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalNeutralColour.b = f;
					if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin)
					{
						Color color = ((Graphic)_neutralGrabColourPreviewImage).color;
						color.b = f;
						((Graphic)_neutralGrabColourPreviewImage).color = color;
					}
				}, CustomGrabBeamColour.LocalNeutralColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(3)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_22(float f)
			{
				//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalNeutralColour.b = f;
				if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin)
				{
					Color color = ((Graphic)_neutralGrabColourPreviewImage).color;
					color.b = f;
					((Graphic)_neutralGrabColourPreviewImage).color = color;
				}
			}

			internal RectTransform <OpenPopup>b__8_5(Transform parent)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Opacity", "", delegate(float f)
				{
					//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalNeutralColour.a = f;
					Color color = ((Graphic)_neutralGrabColourPreviewImage).color;
					color.a = f;
					((Graphic)_neutralGrabColourPreviewImage).color = color;
				}, CustomGrabBeamColour.LocalNeutralColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(4)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_23(float f)
			{
				//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalNeutralColour.a = f;
				Color color = ((Graphic)_neutralGrabColourPreviewImage).color;
				color.a = f;
				((Graphic)_neutralGrabColourPreviewImage).color = color;
			}

			internal RectTransform <OpenPopup>b__8_6(Transform parent)
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				REPOToggle val2 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val)
				{
					CustomGrabBeamColour.LocalNeutralColour.MatchSkin = val;
					HandleNeutralSkinMatchChange();
				}, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(5)), "Yes", "No", CustomGrabBeamColour.LocalNeutralColour.MatchSkin);
				return ((REPOElement)val2).rectTransform;
			}

			internal void <OpenPopup>b__8_24(bool val)
			{
				CustomGrabBeamColour.LocalNeutralColour.MatchSkin = val;
				HandleNeutralSkinMatchChange();
			}

			internal RectTransform <OpenPopup>b__8_7(Transform parent)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				REPOLabel val = MenuAPI.CreateREPOLabel("Rotating Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(6)));
				((Component)val).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
				return ((REPOElement)val).rectTransform;
			}

			internal RectTransform <OpenPopup>b__8_8(Transform parent)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Red", "", delegate(float f)
				{
					//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalRotatingColour.r = f;
					if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin)
					{
						Color color = ((Graphic)_rotatingGrabColourPreviewImage).color;
						color.r = f;
						((Graphic)_rotatingGrabColourPreviewImage).color = color;
						HandleRotatingSkinMatchChange();
					}
				}, CustomGrabBeamColour.LocalRotatingColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(7)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_25(float f)
			{
				//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalRotatingColour.r = f;
				if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin)
				{
					Color color = ((Graphic)_rotatingGrabColourPreviewImage).color;
					color.r = f;
					((Graphic)_rotatingGrabColourPreviewImage).color = color;
					HandleRotatingSkinMatchChange();
				}
			}

			internal RectTransform <OpenPopup>b__8_9(Transform parent)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Green", "", delegate(float f)
				{
					//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalRotatingColour.g = f;
					if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin)
					{
						Color color = ((Graphic)_rotatingGrabColourPreviewImage).color;
						color.g = f;
						((Graphic)_rotatingGrabColourPreviewImage).color = color;
						HandleRotatingSkinMatchChange();
					}
				}, CustomGrabBeamColour.LocalRotatingColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(8)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_26(float f)
			{
				//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalRotatingColour.g = f;
				if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin)
				{
					Color color = ((Graphic)_rotatingGrabColourPreviewImage).color;
					color.g = f;
					((Graphic)_rotatingGrabColourPreviewImage).color = color;
					HandleRotatingSkinMatchChange();
				}
			}

			internal RectTransform <OpenPopup>b__8_10(Transform parent)
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Blue", "", delegate(float f)
				{
					//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalRotatingColour.b = f;
					if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin)
					{
						Color color = ((Graphic)_rotatingGrabColourPreviewImage).color;
						color.b = f;
						((Graphic)_rotatingGrabColourPreviewImage).color = color;
						HandleRotatingSkinMatchChange();
					}
				}, CustomGrabBeamColour.LocalRotatingColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(9)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_27(float f)
			{
				//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalRotatingColour.b = f;
				if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin)
				{
					Color color = ((Graphic)_rotatingGrabColourPreviewImage).color;
					color.b = f;
					((Graphic)_rotatingGrabColourPreviewImage).color = color;
					HandleRotatingSkinMatchChange();
				}
			}

			internal RectTransform <OpenPopup>b__8_11(Transform parent)
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Opacity", "", delegate(float f)
				{
					//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalRotatingColour.a = f;
					Color color = ((Graphic)_rotatingGrabColourPreviewImage).color;
					color.a = f;
					((Graphic)_rotatingGrabColourPreviewImage).color = color;
					HandleRotatingSkinMatchChange();
				}, CustomGrabBeamColour.LocalRotatingColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(10)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_28(float f)
			{
				//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalRotatingColour.a = f;
				Color color = ((Graphic)_rotatingGrabColourPreviewImage).color;
				color.a = f;
				((Graphic)_rotatingGrabColourPreviewImage).color = color;
				HandleRotatingSkinMatchChange();
			}

			internal RectTransform <OpenPopup>b__8_12(Transform parent)
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				REPOToggle val2 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val)
				{
					CustomGrabBeamColour.LocalRotatingColour.MatchSkin = val;
					HandleRotatingSkinMatchChange();
				}, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(11)), "Yes", "No", CustomGrabBeamColour.LocalRotatingColour.MatchSkin);
				return ((REPOElement)val2).rectTransform;
			}

			internal void <OpenPopup>b__8_29(bool val)
			{
				CustomGrabBeamColour.LocalRotatingColour.MatchSkin = val;
				HandleRotatingSkinMatchChange();
			}

			internal RectTransform <OpenPopup>b__8_13(Transform parent)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				REPOLabel val = MenuAPI.CreateREPOLabel("Healing Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(6)));
				((Component)val).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
				return ((REPOElement)val).rectTransform;
			}

			internal RectTransform <OpenPopup>b__8_14(Transform parent)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Red", "", delegate(float f)
				{
					//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalHealingColour.r = f;
					if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin)
					{
						Color color = ((Graphic)_healingGrabColourPreviewImage).color;
						color.r = f;
						((Graphic)_healingGrabColourPreviewImage).color = color;
						HandleHealingSkinMatchChange();
					}
				}, CustomGrabBeamColour.LocalHealingColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(7)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_30(float f)
			{
				//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalHealingColour.r = f;
				if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin)
				{
					Color color = ((Graphic)_healingGrabColourPreviewImage).color;
					color.r = f;
					((Graphic)_healingGrabColourPreviewImage).color = color;
					HandleHealingSkinMatchChange();
				}
			}

			internal RectTransform <OpenPopup>b__8_15(Transform parent)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Green", "", delegate(float f)
				{
					//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalHealingColour.g = f;
					if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin)
					{
						Color color = ((Graphic)_healingGrabColourPreviewImage).color;
						color.g = f;
						((Graphic)_healingGrabColourPreviewImage).color = color;
						HandleHealingSkinMatchChange();
					}
				}, CustomGrabBeamColour.LocalHealingColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(8)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_31(float f)
			{
				//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalHealingColour.g = f;
				if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin)
				{
					Color color = ((Graphic)_healingGrabColourPreviewImage).color;
					color.g = f;
					((Graphic)_healingGrabColourPreviewImage).color = color;
					HandleHealingSkinMatchChange();
				}
			}

			internal RectTransform <OpenPopup>b__8_16(Transform parent)
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Blue", "", delegate(float f)
				{
					//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalHealingColour.b = f;
					if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin)
					{
						Color color = ((Graphic)_healingGrabColourPreviewImage).color;
						color.b = f;
						((Graphic)_healingGrabColourPreviewImage).color = color;
						HandleHealingSkinMatchChange();
					}
				}, CustomGrabBeamColour.LocalHealingColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(9)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_32(float f)
			{
				//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalHealingColour.b = f;
				if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin)
				{
					Color color = ((Graphic)_healingGrabColourPreviewImage).color;
					color.b = f;
					((Graphic)_healingGrabColourPreviewImage).color = color;
					HandleHealingSkinMatchChange();
				}
			}

			internal RectTransform <OpenPopup>b__8_17(Transform parent)
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				REPOSlider val = CreateColourSlider("Opacity", "", delegate(float f)
				{
					//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
					CustomGrabBeamColour.LocalHealingColour.a = f;
					Color color = ((Graphic)_healingGrabColourPreviewImage).color;
					color.a = f;
					((Graphic)_healingGrabColourPreviewImage).color = color;
					HandleHealingSkinMatchChange();
				}, CustomGrabBeamColour.LocalHealingColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(10)));
				return ((REPOElement)val).rectTransform;
			}

			internal void <OpenPopup>b__8_33(float f)
			{
				//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
				CustomGrabBeamColour.LocalHealingColour.a = f;
				Color color = ((Graphic)_healingGrabColourPreviewImage).color;
				color.a = f;
				((Graphic)_healingGrabColourPreviewImage).color = color;
				HandleHealingSkinMatchChange();
			}

			internal RectTransform <OpenPopup>b__8_18(Transform parent)
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				REPOToggle val2 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val)
				{
					CustomGrabBeamColour.LocalHealingColour.MatchSkin = val;
					HandleHealingSkinMatchChange();
				}, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(11)), "Yes", "No", CustomGrabBeamColour.LocalHealingColour.MatchSkin);
				return ((REPOElement)val2).rectTransform;
			}

			internal void <OpenPopup>b__8_34(bool val)
			{
				CustomGrabBeamColour.LocalHealingColour.MatchSkin = val;
				HandleHealingSkinMatchChange();
			}
		}

		private static Image _neutralGrabColourPreviewImage;

		private static GameObject _neutralGrabColourPreviewParent;

		private static Image _rotatingGrabColourPreviewImage;

		private static GameObject _rotatingGrabColourPreviewParent;

		private static Image _healingGrabColourPreviewImage;

		private static GameObject _healingGrabColourPreviewParent;

		private const float HorizontalPos = 70f;

		public static void Init()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//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: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			object obj = <>c.<>9__7_0;
			if (obj == null)
			{
				BuilderDelegate val = delegate(Transform parent)
				{
					//IL_002c: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f));
				};
				<>c.<>9__7_0 = val;
				obj = (object)val;
			}
			MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj);
			object obj2 = <>c.<>9__7_1;
			if (obj2 == null)
			{
				BuilderDelegate val2 = delegate(Transform parent)
				{
					//IL_002c: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f));
				};
				<>c.<>9__7_1 = val2;
				obj2 = (object)val2;
			}
			MenuAPI.AddElementToColorMenu((BuilderDelegate)obj2);
			if (!CustomGrabColourConfig.DebugAddButtonToMainMenu.Value)
			{
				return;
			}
			object obj3 = <>c.<>9__7_2;
			if (obj3 == null)
			{
				BuilderDelegate val3 = delegate(Transform parent)
				{
					//IL_002c: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f));
				};
				<>c.<>9__7_2 = val3;
				obj3 = (object)val3;
			}
			MenuAPI.AddElementToMainMenu((BuilderDelegate)obj3);
		}

		private static void OpenPopup()
		{
			//IL_0039: 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_0044: Expected O, but got Unknown
			//IL_0064: 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_006f: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_0103: 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_010e: Expected O, but got Unknown
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected O, but got Unknown
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Expected O, but got Unknown
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Expected O, but got Unknown
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Expected O, but got Unknown
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Expected O, but got Unknown
			//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_02eb: Expected O, but got Unknown
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Expected O, but got Unknown
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Expected O, but got Unknown
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Expected O, but got Unknown
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Expected O, but got Unknown
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Expected O, but got Unknown
			//IL_0421: 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_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Expected O, but got Unknown
			REPOPopupPage changeGrabColourPage = MenuAPI.CreateREPOPopupPage("Change Grab Beam Colour", (PresetSide)0, false, true, 1.5f);
			REPOPopupPage obj = changeGrabColourPage;
			object obj2 = <>c.<>9__8_0;
			if (obj2 == null)
			{
				BuilderDelegate val2 = delegate(Transform parent)
				{
					//IL_001a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0035: Unknown result type (might be due to invalid IL or missing references)
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					//IL_008f: 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_00af: 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_0106: 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_00d5: 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)
					float verticalPos = GetVerticalPos(0);
					REPOLabel val41 = MenuAPI.CreateREPOLabel("Neutral Colour Preview", parent, new Vector2(452f, verticalPos - 60f));
					((Component)val41).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
					if (!Object.op_Implicit((Object)(object)_neutralGrabColourPreviewParent))
					{
						CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos), out _neutralGrabColourPreviewParent, out _neutralGrabColourPreviewImage);
					}
					float verticalPos2 = GetVerticalPos(1);
					REPOLabel val42 = MenuAPI.CreateREPOLabel("Rotating Colour Preview", parent, new Vector2(452f, verticalPos2 - 60f));
					((Component)val42).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
					if (!Object.op_Implicit((Object)(object)_rotatingGrabColourPreviewParent))
					{
						CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos2), out _rotatingGrabColourPreviewParent, out _rotatingGrabColourPreviewImage);
					}
					float verticalPos3 = GetVerticalPos(2);
					REPOLabel val43 = MenuAPI.CreateREPOLabel("Healing Colour Preview", parent, new Vector2(452f, verticalPos3 - 60f));
					((Component)val43).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
					if (!Object.op_Implicit((Object)(object)_healingGrabColourPreviewParent))
					{
						CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos3), out _healingGrabColourPreviewParent, out _healingGrabColourPreviewImage);
					}
				};
				<>c.<>9__8_0 = val2;
				obj2 = (object)val2;
			}
			obj.AddElement((BuilderDelegate)obj2);
			REPOPopupPage obj3 = changeGrabColourPage;
			object obj4 = <>c.<>9__8_1;
			if (obj4 == null)
			{
				ScrollViewBuilderDelegate val3 = delegate(Transform parent)
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					REPOLabel val40 = MenuAPI.CreateREPOLabel("Neutral Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(0)));
					((Component)val40).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
					return ((REPOElement)val40).rectTransform;
				};
				<>c.<>9__8_1 = val3;
				obj4 = (object)val3;
			}
			obj3.AddElementToScrollView((ScrollViewBuilderDelegate)obj4, 0f, 0f);
			REPOPopupPage obj5 = changeGrabColourPage;
			object obj6 = <>c.<>9__8_2;
			if (obj6 == null)
			{
				ScrollViewBuilderDelegate val4 = delegate(Transform parent)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val39 = CreateColourSlider("Red", "", delegate(float f)
					{
						//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalNeutralColour.r = f;
						if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin)
						{
							Color color12 = ((Graphic)_neutralGrabColourPreviewImage).color;
							color12.r = f;
							((Graphic)_neutralGrabColourPreviewImage).color = color12;
						}
					}, CustomGrabBeamColour.LocalNeutralColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(1)));
					return ((REPOElement)val39).rectTransform;
				};
				<>c.<>9__8_2 = val4;
				obj6 = (object)val4;
			}
			obj5.AddElementToScrollView((ScrollViewBuilderDelegate)obj6, 0f, 0f);
			REPOPopupPage obj7 = changeGrabColourPage;
			object obj8 = <>c.<>9__8_3;
			if (obj8 == null)
			{
				ScrollViewBuilderDelegate val5 = delegate(Transform parent)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val38 = CreateColourSlider("Green", "", delegate(float f)
					{
						//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalNeutralColour.g = f;
						if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin)
						{
							Color color11 = ((Graphic)_neutralGrabColourPreviewImage).color;
							color11.g = f;
							((Graphic)_neutralGrabColourPreviewImage).color = color11;
						}
					}, CustomGrabBeamColour.LocalNeutralColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(2)));
					return ((REPOElement)val38).rectTransform;
				};
				<>c.<>9__8_3 = val5;
				obj8 = (object)val5;
			}
			obj7.AddElementToScrollView((ScrollViewBuilderDelegate)obj8, 0f, 0f);
			REPOPopupPage obj9 = changeGrabColourPage;
			object obj10 = <>c.<>9__8_4;
			if (obj10 == null)
			{
				ScrollViewBuilderDelegate val6 = delegate(Transform parent)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val37 = CreateColourSlider("Blue", "", delegate(float f)
					{
						//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalNeutralColour.b = f;
						if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin)
						{
							Color color10 = ((Graphic)_neutralGrabColourPreviewImage).color;
							color10.b = f;
							((Graphic)_neutralGrabColourPreviewImage).color = color10;
						}
					}, CustomGrabBeamColour.LocalNeutralColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(3)));
					return ((REPOElement)val37).rectTransform;
				};
				<>c.<>9__8_4 = val6;
				obj10 = (object)val6;
			}
			obj9.AddElementToScrollView((ScrollViewBuilderDelegate)obj10, 0f, 0f);
			REPOPopupPage obj11 = changeGrabColourPage;
			object obj12 = <>c.<>9__8_5;
			if (obj12 == null)
			{
				ScrollViewBuilderDelegate val7 = delegate(Transform parent)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val36 = CreateColourSlider("Opacity", "", delegate(float f)
					{
						//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalNeutralColour.a = f;
						Color color9 = ((Graphic)_neutralGrabColourPreviewImage).color;
						color9.a = f;
						((Graphic)_neutralGrabColourPreviewImage).color = color9;
					}, CustomGrabBeamColour.LocalNeutralColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(4)));
					return ((REPOElement)val36).rectTransform;
				};
				<>c.<>9__8_5 = val7;
				obj12 = (object)val7;
			}
			obj11.AddElementToScrollView((ScrollViewBuilderDelegate)obj12, 0f, 0f);
			REPOPopupPage obj13 = changeGrabColourPage;
			object obj14 = <>c.<>9__8_6;
			if (obj14 == null)
			{
				ScrollViewBuilderDelegate val8 = delegate(Transform parent)
				{
					//IL_0031: Unknown result type (might be due to invalid IL or missing references)
					REPOToggle val35 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val)
					{
						CustomGrabBeamColour.LocalNeutralColour.MatchSkin = val;
						HandleNeutralSkinMatchChange();
					}, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(5)), "Yes", "No", CustomGrabBeamColour.LocalNeutralColour.MatchSkin);
					return ((REPOElement)val35).rectTransform;
				};
				<>c.<>9__8_6 = val8;
				obj14 = (object)val8;
			}
			obj13.AddElementToScrollView((ScrollViewBuilderDelegate)obj14, 0f, 0f);
			REPOPopupPage obj15 = changeGrabColourPage;
			object obj16 = <>c.<>9__8_7;
			if (obj16 == null)
			{
				ScrollViewBuilderDelegate val9 = delegate(Transform parent)
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					REPOLabel val34 = MenuAPI.CreateREPOLabel("Rotating Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(6)));
					((Component)val34).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
					return ((REPOElement)val34).rectTransform;
				};
				<>c.<>9__8_7 = val9;
				obj16 = (object)val9;
			}
			obj15.AddElementToScrollView((ScrollViewBuilderDelegate)obj16, 0f, 0f);
			REPOPopupPage obj17 = changeGrabColourPage;
			object obj18 = <>c.<>9__8_8;
			if (obj18 == null)
			{
				ScrollViewBuilderDelegate val10 = delegate(Transform parent)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val33 = CreateColourSlider("Red", "", delegate(float f)
					{
						//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalRotatingColour.r = f;
						if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin)
						{
							Color color8 = ((Graphic)_rotatingGrabColourPreviewImage).color;
							color8.r = f;
							((Graphic)_rotatingGrabColourPreviewImage).color = color8;
							HandleRotatingSkinMatchChange();
						}
					}, CustomGrabBeamColour.LocalRotatingColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(7)));
					return ((REPOElement)val33).rectTransform;
				};
				<>c.<>9__8_8 = val10;
				obj18 = (object)val10;
			}
			obj17.AddElementToScrollView((ScrollViewBuilderDelegate)obj18, 0f, 0f);
			REPOPopupPage obj19 = changeGrabColourPage;
			object obj20 = <>c.<>9__8_9;
			if (obj20 == null)
			{
				ScrollViewBuilderDelegate val11 = delegate(Transform parent)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val32 = CreateColourSlider("Green", "", delegate(float f)
					{
						//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalRotatingColour.g = f;
						if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin)
						{
							Color color7 = ((Graphic)_rotatingGrabColourPreviewImage).color;
							color7.g = f;
							((Graphic)_rotatingGrabColourPreviewImage).color = color7;
							HandleRotatingSkinMatchChange();
						}
					}, CustomGrabBeamColour.LocalRotatingColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(8)));
					return ((REPOElement)val32).rectTransform;
				};
				<>c.<>9__8_9 = val11;
				obj20 = (object)val11;
			}
			obj19.AddElementToScrollView((ScrollViewBuilderDelegate)obj20, 0f, 0f);
			REPOPopupPage obj21 = changeGrabColourPage;
			object obj22 = <>c.<>9__8_10;
			if (obj22 == null)
			{
				ScrollViewBuilderDelegate val12 = delegate(Transform parent)
				{
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val31 = CreateColourSlider("Blue", "", delegate(float f)
					{
						//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalRotatingColour.b = f;
						if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin)
						{
							Color color6 = ((Graphic)_rotatingGrabColourPreviewImage).color;
							color6.b = f;
							((Graphic)_rotatingGrabColourPreviewImage).color = color6;
							HandleRotatingSkinMatchChange();
						}
					}, CustomGrabBeamColour.LocalRotatingColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(9)));
					return ((REPOElement)val31).rectTransform;
				};
				<>c.<>9__8_10 = val12;
				obj22 = (object)val12;
			}
			obj21.AddElementToScrollView((ScrollViewBuilderDelegate)obj22, 0f, 0f);
			REPOPopupPage obj23 = changeGrabColourPage;
			object obj24 = <>c.<>9__8_11;
			if (obj24 == null)
			{
				ScrollViewBuilderDelegate val13 = delegate(Transform parent)
				{
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val30 = CreateColourSlider("Opacity", "", delegate(float f)
					{
						//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalRotatingColour.a = f;
						Color color5 = ((Graphic)_rotatingGrabColourPreviewImage).color;
						color5.a = f;
						((Graphic)_rotatingGrabColourPreviewImage).color = color5;
						HandleRotatingSkinMatchChange();
					}, CustomGrabBeamColour.LocalRotatingColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(10)));
					return ((REPOElement)val30).rectTransform;
				};
				<>c.<>9__8_11 = val13;
				obj24 = (object)val13;
			}
			obj23.AddElementToScrollView((ScrollViewBuilderDelegate)obj24, 0f, 0f);
			REPOPopupPage obj25 = changeGrabColourPage;
			object obj26 = <>c.<>9__8_12;
			if (obj26 == null)
			{
				ScrollViewBuilderDelegate val14 = delegate(Transform parent)
				{
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					REPOToggle val29 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val)
					{
						CustomGrabBeamColour.LocalRotatingColour.MatchSkin = val;
						HandleRotatingSkinMatchChange();
					}, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(11)), "Yes", "No", CustomGrabBeamColour.LocalRotatingColour.MatchSkin);
					return ((REPOElement)val29).rectTransform;
				};
				<>c.<>9__8_12 = val14;
				obj26 = (object)val14;
			}
			obj25.AddElementToScrollView((ScrollViewBuilderDelegate)obj26, 0f, 0f);
			REPOPopupPage obj27 = changeGrabColourPage;
			object obj28 = <>c.<>9__8_13;
			if (obj28 == null)
			{
				ScrollViewBuilderDelegate val15 = delegate(Transform parent)
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					REPOLabel val28 = MenuAPI.CreateREPOLabel("Healing Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(6)));
					((Component)val28).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
					return ((REPOElement)val28).rectTransform;
				};
				<>c.<>9__8_13 = val15;
				obj28 = (object)val15;
			}
			obj27.AddElementToScrollView((ScrollViewBuilderDelegate)obj28, 0f, 0f);
			REPOPopupPage obj29 = changeGrabColourPage;
			object obj30 = <>c.<>9__8_14;
			if (obj30 == null)
			{
				ScrollViewBuilderDelegate val16 = delegate(Transform parent)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val27 = CreateColourSlider("Red", "", delegate(float f)
					{
						//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalHealingColour.r = f;
						if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin)
						{
							Color color4 = ((Graphic)_healingGrabColourPreviewImage).color;
							color4.r = f;
							((Graphic)_healingGrabColourPreviewImage).color = color4;
							HandleHealingSkinMatchChange();
						}
					}, CustomGrabBeamColour.LocalHealingColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(7)));
					return ((REPOElement)val27).rectTransform;
				};
				<>c.<>9__8_14 = val16;
				obj30 = (object)val16;
			}
			obj29.AddElementToScrollView((ScrollViewBuilderDelegate)obj30, 0f, 0f);
			REPOPopupPage obj31 = changeGrabColourPage;
			object obj32 = <>c.<>9__8_15;
			if (obj32 == null)
			{
				ScrollViewBuilderDelegate val17 = delegate(Transform parent)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val26 = CreateColourSlider("Green", "", delegate(float f)
					{
						//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalHealingColour.g = f;
						if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin)
						{
							Color color3 = ((Graphic)_healingGrabColourPreviewImage).color;
							color3.g = f;
							((Graphic)_healingGrabColourPreviewImage).color = color3;
							HandleHealingSkinMatchChange();
						}
					}, CustomGrabBeamColour.LocalHealingColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(8)));
					return ((REPOElement)val26).rectTransform;
				};
				<>c.<>9__8_15 = val17;
				obj32 = (object)val17;
			}
			obj31.AddElementToScrollView((ScrollViewBuilderDelegate)obj32, 0f, 0f);
			REPOPopupPage obj33 = changeGrabColourPage;
			object obj34 = <>c.<>9__8_16;
			if (obj34 == null)
			{
				ScrollViewBuilderDelegate val18 = delegate(Transform parent)
				{
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val25 = CreateColourSlider("Blue", "", delegate(float f)
					{
						//IL_0022: 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_0035: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalHealingColour.b = f;
						if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin)
						{
							Color color2 = ((Graphic)_healingGrabColourPreviewImage).color;
							color2.b = f;
							((Graphic)_healingGrabColourPreviewImage).color = color2;
							HandleHealingSkinMatchChange();
						}
					}, CustomGrabBeamColour.LocalHealingColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(9)));
					return ((REPOElement)val25).rectTransform;
				};
				<>c.<>9__8_16 = val18;
				obj34 = (object)val18;
			}
			obj33.AddElementToScrollView((ScrollViewBuilderDelegate)obj34, 0f, 0f);
			REPOPopupPage obj35 = changeGrabColourPage;
			object obj36 = <>c.<>9__8_17;
			if (obj36 == null)
			{
				ScrollViewBuilderDelegate val19 = delegate(Transform parent)
				{
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					REPOSlider val24 = CreateColourSlider("Opacity", "", delegate(float f)
					{
						//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
						CustomGrabBeamColour.LocalHealingColour.a = f;
						Color color = ((Graphic)_healingGrabColourPreviewImage).color;
						color.a = f;
						((Graphic)_healingGrabColourPreviewImage).color = color;
						HandleHealingSkinMatchChange();
					}, CustomGrabBeamColour.LocalHealingColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(10)));
					return ((REPOElement)val24).rectTransform;
				};
				<>c.<>9__8_17 = val19;
				obj36 = (object)val19;
			}
			obj35.AddElementToScrollView((ScrollViewBuilderDelegate)obj36, 0f, 0f);
			REPOPopupPage obj37 = changeGrabColourPage;
			object obj38 = <>c.<>9__8_18;
			if (obj38 == null)
			{
				ScrollViewBuilderDelegate val20 = delegate(Transform parent)
				{
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					REPOToggle val23 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val)
					{
						CustomGrabBeamColour.LocalHealingColour.MatchSkin = val;
						HandleHealingSkinMatchChange();
					}, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(11)), "Yes", "No", CustomGrabBeamColour.LocalHealingColour.MatchSkin);
					return ((REPOElement)val23).rectTransform;
				};
				<>c.<>9__8_18 = val20;
				obj38 = (object)val20;
			}
			obj37.AddElementToScrollView((ScrollViewBuilderDelegate)obj38, 0f, 0f);
			changeGrabColourPage.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: 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_00a0: 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)
				REPOButton val21 = MenuAPI.CreateREPOButton("Done", (Action)delegate
				{
					changeGrabColourPage.ClosePage(true);
					CustomGrabBeamColour.UpdateBeamColourForAllBeams();
					CustomGrabBeamColour.SaveLocalColoursToConfig();
				}, parent, new Vector2(70f, 30f));
				REPOButton val22 = MenuAPI.CreateREPOButton("Reset", (Action)delegate
				{
					changeGrabColourPage.ClosePage(true);
					CustomGrabBeamColour.ResetBeamColours();
					CustomGrabBeamColour.UpdateBeamColourForAllBeams();
					CustomGrabBeamColour.SaveLocalColoursToConfig();
				}, parent, new Vector2(590f, 30f));
				val22.overrideButtonSize = val22.GetLabelSize() / 2f;
				((Component)val22).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f));
			});
			SetupPreviewRectangleColours(CustomGrabBeamColour.LocalNeutralColour.Colour, CustomGrabBeamColour.LocalHealingColour.Colour, CustomGrabBeamColour.LocalRotatingColour.Colour);
			changeGrabColourPage.OpenPage(false);
		}

		private static void SetupPreviewRectangleColours(Color neutralColour, Color healingColour, Color rotatingColour)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)_neutralGrabColourPreviewImage).color = neutralColour;
			((Graphic)_healingGrabColourPreviewImage).color = healingColour;
			((Graphic)_rotatingGrabColourPreviewImage).color = rotatingColour;
			HandleNeutralSkinMatchChange();
			HandleRotatingSkinMatchChange();
			HandleHealingSkinMatchChange();
		}

		private static void HandleNeutralSkinMatchChange()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)_neutralGrabColourPreviewImage).color = (CustomGrabBeamColour.LocalNeutralColour.MatchSkin ? CustomGrabBeamColour.GetLocalBodyColour(Color.black) : CustomGrabBeamColour.LocalNeutralColour.Colour);
			Color color = ((Graphic)_neutralGrabColourPreviewImage).color;
			color.a = CustomGrabBeamColour.LocalNeutralColour.Colour.a;
			((Graphic)_neutralGrabColourPreviewImage).color = color;
		}

		private static void HandleRotatingSkinMatchChange()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)_rotatingGrabColourPreviewImage).color = (CustomGrabBeamColour.LocalRotatingColour.MatchSkin ? CustomGrabBeamColour.GetLocalBodyColour(Color.black) : CustomGrabBeamColour.LocalRotatingColour.Colour);
			Color color = ((Graphic)_rotatingGrabColourPreviewImage).color;
			color.a = CustomGrabBeamColour.LocalRotatingColour.Colour.a;
			((Graphic)_rotatingGrabColourPreviewImage).color = color;
		}

		private static void HandleHealingSkinMatchChange()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)_healingGrabColourPreviewImage).color = (CustomGrabBeamColour.LocalHealingColour.MatchSkin ? CustomGrabBeamColour.GetLocalBodyColour(Color.black) : CustomGrabBeamColour.LocalHealingColour.Colour);
			Color color = ((Graphic)_healingGrabColourPreviewImage).color;
			color.a = CustomGrabBeamColour.LocalHealingColour.Colour.a;
			((Graphic)_healingGrabColourPreviewImage).color = color;
		}

		private static void CreateBeamPreviewColourRectangle(Transform parent, Vector2 position, out GameObject colourPreviewParent, out Image colourPreviewImage)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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)
			colourPreviewParent = new GameObject();
			((Object)colourPreviewParent).name = "Grab Beam Colour Preview Rectangle Parent";
			colourPreviewParent.transform.SetParent(parent);
			Canvas val = colourPreviewParent.AddComponent<Canvas>();
			((Component)val).transform.SetParent(colourPreviewParent.gameObject.transform.parent);
			GameObject val2 = new GameObject();
			val2.transform.SetParent(((Component)val).gameObject.transform.parent);
			colourPreviewImage = val2.AddComponent<Image>();
			((Object)colourPreviewImage).name = "Grab Beam Colour Preview Rectangle Image";
			((Component)colourPreviewImage).transform.SetParent(val2.gameObject.transform.parent);
			((Graphic)colourPreviewImage).color = new Color(1f, 0f, 0f);
			((Component)colourPreviewImage).gameObject.transform.position = Vector2.op_Implicit(position);
			((Component)colourPreviewImage).gameObject.transform.localScale = new Vector3(0.85f, 0.85f, 1f);
		}

		private static REPOSlider CreateColourSlider(string name, string desc, Action<float> onChange, float initial, float max, Transform parent, Vector2 localPosition)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return MenuAPI.CreateREPOSlider(name, desc, onChange, parent, localPosition, 0f, max, 2, initial, "", "", (BarBehavior)0);
		}

		private static float GetVerticalOffsetForScrollChildren(int index)
		{
			return 40 * index;
		}

		private static float GetVerticalPos(int offset)
		{
			int num = -Math.Abs(-offset);
			num += 3;
			return -12f + (float)(110 * num);
		}
	}
	public static class ConfigUtil
	{
		public static string ColorToString(Color color)
		{
			return color.r + ", " + color.g + ", " + color.b + ", " + color.a;
		}

		public static Color StringToColor(string color, Color defaultColour)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00de: 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)
			string[] array = color.Split(',');
			switch (array.Length)
			{
			case 3:
			{
				float[] array3 = new float[3];
				for (int j = 0; j < array.Length; j++)
				{
					try
					{
						array3.SetValue(float.Parse(array[j].Trim()), j);
					}
					catch
					{
						return defaultColour;
					}
				}
				return new Color(array3[0], array3[1], array3[2], 0.2f);
			}
			case 4:
			{
				float[] array2 = new float[4];
				for (int i = 0; i < array.Length; i++)
				{
					try
					{
						array2.SetValue(float.Parse(array[i].Trim()), i);
					}
					catch
					{
						return defaultColour;
					}
				}
				return new Color(array2[0], array2[1], array2[2], array2[3]);
			}
			default:
				return defaultColour;
			}
		}
	}
	public static class CustomGrabColourConfig
	{
		public struct BeamConfigEntries
		{
			public readonly ConfigEntry<string> BeamColour;

			public readonly ConfigEntry<bool> MatchSkin;

			public BeamConfigEntries(ConfigEntry<string> beamColour, ConfigEntry<bool> matchSkin)
			{
				BeamColour = beamColour;
				MatchSkin = matchSkin;
			}
		}

		private static readonly Dictionary<GrabBeamColourSettings.BeamType, BeamConfigEntries> BeamTypeToConfigEntries = new Dictionary<GrabBeamColourSettings.BeamType, BeamConfigEntries>();

		public const float DefaultOpacity = 0.2f;

		public const float MaxOpacity = 0.5f;

		public static readonly Color NeutralDefaultColour = new Color(1f, 0.58f, 0.19f, 0.35f);

		public static readonly Color HealingDefaultColour = new Color(0.17f, 1f, 0.17f, 0.2f);

		public static readonly Color RotatingDefaultColour = new Color(0.65f, 0.06f, 0.8f, 0.2f);

		public static BeamConfigEntries NeutralGrabBeam;

		public static BeamConfigEntries HealingGrabBeam;

		public static BeamConfigEntries RotatingGrabBeam;

		public static ConfigEntry<bool> EnableDebugLogs;

		public static ConfigEntry<bool> DebugAddButtonToMainMenu;

		private const string ColourNotes = "\nStored as R,G,B,A values in 0-1 range";

		public static void Init(ConfigFile config)
		{
			//IL_000c: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			ConfigEntry<string> beamColour = config.Bind<string>("General", "NeutralGrabBeamColour", ConfigUtil.ColorToString(NeutralDefaultColour), "The default colour of the grab beam when holding an item.\nStored as R,G,B,A values in 0-1 range");
			ConfigEntry<bool> matchSkin = config.Bind<bool>("General", "NeutralGrabBeamMatchSkin", true, "Should the neutral grab beam match the colour of your skin?");
			NeutralGrabBeam = new BeamConfigEntries(beamColour, matchSkin);
			BeamTypeToConfigEntries.Add(GrabBeamColourSettings.BeamType.Neutral, NeutralGrabBeam);
			ConfigEntry<string> beamColour2 = config.Bind<string>("General", "RotatingGrabBeamColour", ConfigUtil.ColorToString(RotatingDefaultColour), "The colour of the grab beam when rotating an item or monster.\nStored as R,G,B,A values in 0-1 range");
			ConfigEntry<bool> matchSkin2 = config.Bind<bool>("General", "RotatingGrabBeamMatchSkin", false, "Should the rotating grab beam match the colour of your skin?");
			RotatingGrabBeam = new BeamConfigEntries(beamColour2, matchSkin2);
			BeamTypeToConfigEntries.Add(GrabBeamColourSettings.BeamType.Rotate, RotatingGrabBeam);
			ConfigEntry<string> beamColour3 = config.Bind<string>("General", "HealingGrabBeamColour", ConfigUtil.ColorToString(HealingDefaultColour), "The colour of the grab beam when healing another player.\nStored as R,G,B,A values in 0-1 range");
			ConfigEntry<bool> matchSkin3 = config.Bind<bool>("General", "HealingGrabBeamMatchSkin", false, "Should the healing grab beam match the colour of your skin?");
			HealingGrabBeam = new BeamConfigEntries(beamColour3, matchSkin3);
			BeamTypeToConfigEntries.Add(GrabBeamColourSettings.BeamType.Heal, HealingGrabBeam);
			EnableDebugLogs = config.Bind<bool>("Debug", "EnableDebugLogs", false, "Outputs additional debugging information to the log");
			DebugAddButtonToMainMenu = config.Bind<bool>("Debug", "AddConfigToMainMenu", false, "Adds the config menu button to the main menu");
			LoadValuesFromConfig();
		}

		private static void LoadValuesFromConfig()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			Color val = ConfigUtil.StringToColor(NeutralGrabBeam.BeamColour.Value, NeutralDefaultColour);
			val.a = Mathf.Clamp(val.a, 0f, 0.5f);
			CustomGrabBeamColour.LocalNeutralColour = new GrabBeamColourSettings(val, NeutralGrabBeam.MatchSkin.Value, GrabBeamColourSettings.BeamType.Neutral);
			Color val2 = ConfigUtil.StringToColor(RotatingGrabBeam.BeamColour.Value, RotatingDefaultColour);
			val2.a = Mathf.Clamp(val2.a, 0f, 0.5f);
			CustomGrabBeamColour.LocalRotatingColour = new GrabBeamColourSettings(val2, RotatingGrabBeam.MatchSkin.Value, GrabBeamColourSettings.BeamType.Rotate);
			Color val3 = ConfigUtil.StringToColor(HealingGrabBeam.BeamColour.Value, HealingDefaultColour);
			val3.a = Mathf.Clamp(val3.a, 0f, 0.5f);
			CustomGrabBeamColour.LocalHealingColour = new GrabBeamColourSettings(val3, HealingGrabBeam.MatchSkin.Value, GrabBeamColourSettings.BeamType.Heal);
		}

		public static void SaveColour(GrabBeamColourSettings beamColourSettings)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			Plugin.LogMessageIfDebug("Saving colour to config file: " + beamColourSettings);
			beamColourSettings.a = Mathf.Clamp(beamColourSettings.a, 0f, 0.5f);
			if (!BeamTypeToConfigEntries.TryGetValue(beamColourSettings.CurrentBeamType, out var value))
			{
				Plugin.LogWarning("Unable to save colour value for beam type: " + beamColourSettings.CurrentBeamType);
			}
			value.BeamColour.Value = ConfigUtil.ColorToString(beamColourSettings.Colour);
			value.MatchSkin.Value = beamColourSettings.MatchSkin;
		}
	}
}