Decompiled source of BodyLog Customizer v1.1.0

Mods/BodyLogCustomizer.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Timers;
using System.Windows.Forms;
using BodyLogCustomizer;
using BodyLogCustomizer.Data;
using BodyLogCustomizer.Data.Messages;
using BodyLogCustomizer.Patches;
using BodyLogCustomizer.UI;
using BodyLogCustomizer.Utilities;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.BoneMenu.Elements;
using HarmonyLib;
using LabFusion.Data;
using LabFusion.Extensions;
using LabFusion.Network;
using LabFusion.Representation;
using LabFusion.SDK.Modules;
using LabFusion.Utilities;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SLZ.Props;
using SLZ.Rig;
using UnhollowerBaseLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BodyLogCustomizer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("BodyLogCustomizer")]
[assembly: AssemblyCopyright("Created by BuggedChecker")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(global::BodyLogCustomizer.BodyLogCustomizer), "BodyLogCustomizer", "1.1.0", "BuggedChecker", null)]
[assembly: ModuleInfo(typeof(FusionModule), "BodyLogCustomizer", "1.1.0", "BuggedChecker", null, true, ConsoleColor.Cyan)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.1.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public static class FusionUserCacheManager
{
	private static string cacheDirectoryPath = "UserData/BodyLogCustomizer/FusionUserCache/";

	public static void AddOrUpdate(string steamId, BodyLogColorData bodyLogColorData)
	{
		string contents = JsonConvert.SerializeObject((object)new FusionUserBodyLogColorData(steamId, bodyLogColorData), (Formatting)1);
		File.WriteAllText(Path.Combine(cacheDirectoryPath, steamId + ".json"), contents);
	}

	public static BodyLogColorData GetBodyLogColorData(string steamId)
	{
		string path = Path.Combine(cacheDirectoryPath, steamId + ".json");
		if (File.Exists(path))
		{
			return JsonConvert.DeserializeObject<FusionUserBodyLogColorData>(File.ReadAllText(path)).DecodeBodyLogColorData();
		}
		return null;
	}

	public static void ApplyCacheToDevice(PullCordDevice device)
	{
		foreach (PlayerRep playerRep in PlayerRepManager.PlayerReps)
		{
			BodyLogColorData bodyLogColorData = GetBodyLogColorData(playerRep.PlayerId.LongId.ToString());
			if (bodyLogColorData != null)
			{
				device.ApplyColorsFromData(bodyLogColorData);
			}
		}
	}

	public static void LoadCache()
	{
		if (!Directory.Exists(cacheDirectoryPath))
		{
			Directory.CreateDirectory(cacheDirectoryPath);
		}
		string text = MelonUtils.ComputeSimpleSHA256Hash(Assembly.GetExecutingAssembly().Location);
		string[] files;
		if (MelonPreferences.GetEntryValue<string>("BodyLogCustomizer", "AssemblyHash") != text)
		{
			files = Directory.GetFiles(cacheDirectoryPath);
			for (int i = 0; i < files.Length; i++)
			{
				File.Delete(files[i]);
			}
			MelonPreferences.SetEntryValue<string>("BodyLogCustomizer", "AssemblyHash", text);
		}
		files = Directory.GetFiles(cacheDirectoryPath);
		foreach (string path in files)
		{
			AddOrUpdate(bodyLogColorData: JsonConvert.DeserializeObject<FusionUserBodyLogColorData>(File.ReadAllText(path)).DecodeBodyLogColorData(), steamId: Path.GetFileNameWithoutExtension(path));
		}
	}
}
namespace BodyLogCustomizer
{
	public static class ModuleInfo
	{
		public const string Name = "BodyLogCustomizer";

		public const string Version = "1.1.0";

		public const string Author = "BuggedChecker";

		public const string Abbreviation = null;

		public const bool AutoRegister = true;

		public const ConsoleColor Color = ConsoleColor.Cyan;
	}
	public class FusionModule : Module
	{
		public static FusionModule Instance { get; private set; }

		public override void OnModuleLoaded()
		{
			Instance = this;
		}

		public void SendBodyLogColorData(BodyLogColorData bodyLogColorData)
		{
			//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_0032: 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_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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			if (!BodyLogCustomizer.ReplicateOnServer.Value || !NetworkInfo.HasServer)
			{
				return;
			}
			Color lineColor = bodyLogColorData.lineColor;
			BodyLogColorData.DialColor[] dialColor = bodyLogColorData.dialColor;
			Color[] tickColor = bodyLogColorData.tickColor;
			BodyLogColorData.GizmoColor gizmoBallColor = bodyLogColorData.gizmoBallColor;
			Color ringColor = bodyLogColorData.ringColor;
			Color coreParticleColor = bodyLogColorData.coreParticleColor;
			Color baseLogColor = bodyLogColorData.baseLogColor;
			BodyLogColorData.PreviewMeshColor previewMeshColor = bodyLogColorData.previewMeshColor;
			int baseSkinType = (int)bodyLogColorData.baseSkinType;
			FusionWriter val = FusionWriter.Create();
			try
			{
				using ColorDataFusion.ColorData colorData = ColorDataFusion.ColorData.Create(lineColor, dialColor, tickColor, gizmoBallColor, ringColor, coreParticleColor, baseLogColor, previewMeshColor, baseSkinType);
				val.Write<ColorDataFusion.ColorData>(colorData);
				FusionMessage val2 = FusionMessage.ModuleCreate<ColorDataFusion.ColorHandler>(val);
				try
				{
					MessageSender.SendToServer((NetworkChannel)0, val2);
				}
				finally
				{
					((IDisposable)val2)?.Dispose();
				}
			}
			finally
			{
				((IDisposable)val)?.Dispose();
			}
		}
	}
	public static class BuildInfo
	{
		public const string Name = "BodyLogCustomizer";

		public const string Author = "BuggedChecker";

		public const string Company = null;

		public const string Version = "1.1.0";

		public const string DownloadLink = null;
	}
	public class BodyLogCustomizer : MelonMod
	{
		public static MelonPreferences_Category BodyLogPrefs;

		public static MelonPreferences_Entry<string> AssemblyHash;

		public static MelonPreferences_Entry<bool> isEnabled;

		public static MelonPreferences_Entry<bool> ReplicateOnServer;

		public static MelonPreferences_Entry<bool> ReplicateOnClient;

		public static bool HasFusion;

		public override void OnInitializeMelon()
		{
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			HasFusion = HelperMethods.CheckIfAssemblyLoaded("labfusion");
			BodyLogPrefs = MelonPreferences.CreateCategory("BodyLogCustomizer", "BodyLog Customizer");
			AssemblyHash = BodyLogPrefs.CreateEntry<string>("AssemblyHash", "", "Assembly Hash (DO NOT CHANGE)", (string)null, false, false, (ValueValidator)null, (string)null);
			isEnabled = BodyLogPrefs.CreateEntry<bool>("isEnabled", false, "Enable BodyLog Customizer", (string)null, false, false, (ValueValidator)null, (string)null);
			ReplicateOnServer = BodyLogPrefs.CreateEntry<bool>("ReplicateOnServer", true, "Replicate BodyLog Customizer on Server", (string)null, false, false, (ValueValidator)null, (string)null);
			ReplicateOnClient = BodyLogPrefs.CreateEntry<bool>("ReplicateOnClient", true, "Replicate BodyLog Customizer on Client", (string)null, false, false, (ValueValidator)null, (string)null);
			BodyLogPrefs.SetFilePath(MelonUtils.UserDataDirectory + "/BodyLogCustomizer.cfg");
			BodyLogPrefs.SaveToFile(true);
			LogPrefInitializer.Initialize();
			FusionUserCacheManager.LoadCache();
			BoneMenuCreator.CreateMenu();
			if (HasFusion)
			{
				ModuleHandler.LoadModule(Assembly.GetExecutingAssembly());
				MultiplayerHooking.OnPlayerRepCreated += new RigManagerEvent(OnPlayerRepCreated);
			}
			AssetBundleLoader.LoadAssets();
		}

		private void OnPlayerRepCreated(RigManager rm)
		{
			Timer timer = new Timer(1000.0);
			timer.AutoReset = false;
			timer.Start();
			timer.Elapsed += delegate
			{
				PlayerRep val = default(PlayerRep);
				PlayerRepManager.TryGetPlayerRep(rm, ref val);
				FusionUserCacheManager.LoadCache();
				FusionUserCacheManager.ApplyCacheToDevice(val.pullCord);
				FusionModule.Instance.SendBodyLogColorData(LogPrefInitializer.bodyLogColorData);
			};
		}
	}
}
namespace BodyLogCustomizer.Utilities
{
	public static class BodyLogExtentions
	{
		public static void ApplyColorsFromData(this PullCordDevice device, BodyLogColorData bodyLogColorData)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			if (ComponentExtensions.IsPartOfSelf(((Component)device).gameObject) && !BodyLogCustomizer.ReplicateOnClient.Value)
			{
				return;
			}
			((Renderer)device.lineRenderer).material.SetColor("_ColorTint", bodyLogColorData.lineColor);
			device.lineRenderer.startColor = bodyLogColorData.lineColor;
			device.lineRenderer.endColor = bodyLogColorData.lineColor;
			for (int i = 0; i < ((Il2CppArrayBase<GameObject>)(object)device.tickLines).Length; i++)
			{
				((Il2CppArrayBase<GameObject>)(object)device.tickLines)[i].GetComponent<Renderer>().material.SetColor("_ColorTint", bodyLogColorData.tickColor[i]);
			}
			for (int j = 0; j < ((Il2CppArrayBase<GameObject>)(object)device.dialGlyphs).Length; j++)
			{
				Renderer component = ((Il2CppArrayBase<GameObject>)(object)device.dialGlyphs)[j].GetComponent<Renderer>();
				component.material.SetColor("_EmissionBase", bodyLogColorData.dialColor[j].emissionBase);
				component.material.SetColor("_EmissionColor", bodyLogColorData.dialColor[j].emissionColor);
			}
			foreach (ParticleSystemRenderer componentsInChild in ((Component)device).GetComponentsInChildren<ParticleSystemRenderer>())
			{
				((Renderer)componentsInChild).material.SetColor("_BaseColor", bodyLogColorData.coreParticleColor);
			}
			Transform val = ((Component)device).transform.Find("BodyLog/BodyLog");
			if ((Object)(object)val != (Object)null)
			{
				Renderer component2 = ((Component)val).GetComponent<Renderer>();
				if ((Object)(object)component2 != (Object)null)
				{
					switch (bodyLogColorData.baseSkinType)
					{
					case BodyLogColorData.BaseSkinType.Default:
						component2.material = AssetBundleLoader.DefaultMat;
						component2.material.SetColor("_EmissionColor", bodyLogColorData.ringColor);
						component2.material.SetColor("_BaseColor", bodyLogColorData.baseLogColor);
						break;
					case BodyLogColorData.BaseSkinType.AnimatedFire:
						component2.material = AssetBundleLoader.AnimatedFireMat;
						break;
					case BodyLogColorData.BaseSkinType.GlintSparkle:
						component2.material = AssetBundleLoader.GlintSparkleMat;
						break;
					case BodyLogColorData.BaseSkinType.Burnt:
						component2.material = AssetBundleLoader.BurntMat;
						break;
					case BodyLogColorData.BaseSkinType.ForceShield:
						component2.material = AssetBundleLoader.ForceShieldMat;
						break;
					case BodyLogColorData.BaseSkinType.AnimatedUVDistortion:
						component2.material = AssetBundleLoader.AnimatedUVDistortionMat;
						break;
					case BodyLogColorData.BaseSkinType.DissolveBurn:
						component2.material = AssetBundleLoader.DissolveBurnMat;
						break;
					case BodyLogColorData.BaseSkinType.XRay:
						component2.material = AssetBundleLoader.XRayMat;
						break;
					case BodyLogColorData.BaseSkinType.GradientGreen:
						component2.material = AssetBundleLoader.GradOneMat;
						component2.material.SetColor("_EmissionColor", bodyLogColorData.ringColor);
						component2.material.SetColor("_BaseColor", bodyLogColorData.baseLogColor);
						break;
					case BodyLogColorData.BaseSkinType.GradientTropical:
						component2.material = AssetBundleLoader.GradTwoMat;
						component2.material.SetColor("_EmissionColor", bodyLogColorData.ringColor);
						component2.material.SetColor("_BaseColor", bodyLogColorData.baseLogColor);
						break;
					case BodyLogColorData.BaseSkinType.GradientRedAndPurple:
						component2.material = AssetBundleLoader.GradThreeMat;
						component2.material.SetColor("_EmissionColor", bodyLogColorData.ringColor);
						component2.material.SetColor("_BaseColor", bodyLogColorData.baseLogColor);
						break;
					case BodyLogColorData.BaseSkinType.GradientGreenAndBlue:
						component2.material = AssetBundleLoader.GradFourMat;
						component2.material.SetColor("_EmissionColor", bodyLogColorData.ringColor);
						component2.material.SetColor("_BaseColor", bodyLogColorData.baseLogColor);
						break;
					case BodyLogColorData.BaseSkinType.GradientPinkAndBlue:
						component2.material = AssetBundleLoader.GradFiveMat;
						component2.material.SetColor("_EmissionColor", bodyLogColorData.ringColor);
						component2.material.SetColor("_BaseColor", bodyLogColorData.baseLogColor);
						break;
					case BodyLogColorData.BaseSkinType.GradientPurple:
						component2.material = AssetBundleLoader.GradSixMat;
						component2.material.SetColor("_EmissionColor", bodyLogColorData.ringColor);
						component2.material.SetColor("_BaseColor", bodyLogColorData.baseLogColor);
						break;
					}
				}
			}
			Renderer componentInChildren = device.ballArt.GetComponentInChildren<Renderer>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.material.SetColor("_Color", bodyLogColorData.gizmoBallColor.gizmoBallColor);
				componentInChildren.material.SetColor("_Emission", bodyLogColorData.gizmoBallColor.gizmoBallEmission);
			}
			MeshRenderer previewMeshRenderer = device.previewMeshRenderer;
			if ((Object)(object)previewMeshRenderer != (Object)null)
			{
				((Renderer)previewMeshRenderer).material.SetColor("_HologramEdgeColor", bodyLogColorData.previewMeshColor.hologramEdgeColor);
				((Renderer)previewMeshRenderer).material.SetColor("_EmissionColor", bodyLogColorData.previewMeshColor.hologramEmissionColor);
				((Renderer)previewMeshRenderer).material.SetColor("_Color", bodyLogColorData.baseLogColor);
			}
		}
	}
	public class ColorJsonConverter : JsonConverter
	{
		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			Color val = (Color)value;
			writer.WriteStartObject();
			writer.WritePropertyName("r");
			writer.WriteValue(val.r);
			writer.WritePropertyName("g");
			writer.WriteValue(val.g);
			writer.WritePropertyName("b");
			writer.WriteValue(val.b);
			writer.WritePropertyName("a");
			writer.WriteValue(val.a);
			writer.WriteEndObject();
		}

		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			JObject val = JObject.Load(reader);
			return (object)new Color((float)val["r"], (float)val["g"], (float)val["b"], (float)val["a"]);
		}

		public override bool CanConvert(Type objectType)
		{
			return objectType == typeof(Color);
		}
	}
}
namespace BodyLogCustomizer.Patches
{
	[HarmonyPatch(typeof(PullCordDevice), "Awake")]
	internal static class PullCordPatch
	{
		public static PullCordDevice localDevice;

		internal static void Postfix(PullCordDevice __instance)
		{
			if (BodyLogCustomizer.HasFusion && NetworkInfo.HasServer && !ComponentExtensions.IsPartOfSelf(((Component)__instance).gameObject))
			{
				return;
			}
			localDevice = __instance;
			if (BodyLogCustomizer.isEnabled.Value && BodyLogCustomizer.ReplicateOnClient.Value)
			{
				__instance.ApplyColorsFromData(LogPrefInitializer.bodyLogColorData);
				if (BodyLogCustomizer.HasFusion && NetworkInfo.HasServer && BodyLogCustomizer.ReplicateOnServer.Value)
				{
					FusionModule.Instance.SendBodyLogColorData(LogPrefInitializer.bodyLogColorData);
				}
			}
		}
	}
}
namespace BodyLogCustomizer.Data
{
	internal static class AssetBundleLoader
	{
		internal static Material DefaultMat { get; private set; }

		internal static Material AnimatedFireMat { get; private set; }

		internal static Material GlintSparkleMat { get; private set; }

		internal static Material BurntMat { get; private set; }

		internal static Material ForceShieldMat { get; private set; }

		internal static Material AnimatedUVDistortionMat { get; private set; }

		internal static Material DissolveBurnMat { get; private set; }

		internal static Material XRayMat { get; private set; }

		internal static Material GradOneMat { get; private set; }

		internal static Material GradTwoMat { get; private set; }

		internal static Material GradThreeMat { get; private set; }

		internal static Material GradFourMat { get; private set; }

		internal static Material GradFiveMat { get; private set; }

		internal static Material GradSixMat { get; private set; }

		internal static void LoadAssets()
		{
			AssetBundle val = HelperMethods.LoadEmbeddedAssetBundle(Assembly.GetExecutingAssembly(), HelperMethods.IsAndroid() ? "$safeprojectname$.Resources.Android.bodylogskins.bundle" : "$safeprojectname$.Resources.Windows.bodylogskins.bundle");
			if ((Object)(object)val == (Object)null)
			{
				MelonLogger.Error("Failed to load AssetBundle!");
				return;
			}
			DefaultMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/Base/BodyLog/BaseBodyLog.mat");
			AnimatedFireMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/AmplifyShaderPack/Samples URP/Samples/Animated Fire/Animated Fire.mat");
			GlintSparkleMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/AmplifyShaderPack/Samples URP/Samples/Glint Sparkle/Glint Sparkle.mat");
			BurntMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/AmplifyShaderPack/Samples URP/Samples/Burn/Burn Effect.mat");
			ForceShieldMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/AmplifyShaderPack/Samples URP/Samples/Community Force Shield/Force Shield.mat");
			AnimatedUVDistortionMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/AmplifyShaderPack/Samples URP/Samples/Animated UV Distortion/Animated UV Distortion.mat");
			DissolveBurnMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/AmplifyShaderPack/Samples URP/Samples/Community Dissolve Burn/Dissolve Burn.mat");
			XRayMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/AmplifyShaderPack/Samples URP/Samples/Xray/XRay.mat");
			GradOneMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/Base/BodyLog/BaseBodyLog Grad One.mat");
			GradTwoMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/Base/BodyLog/BaseBodyLog Grad Two.mat");
			GradThreeMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/Base/BodyLog/BaseBodyLog Grad Three.mat");
			GradFourMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/Base/BodyLog/BaseBodyLog Grad Four.mat");
			GradFiveMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/Base/BodyLog/BaseBodyLog Grad Five.mat");
			GradSixMat = HelperMethods.LoadPersistentAsset<Material>(val, "Assets/Base/BodyLog/BaseBodyLog Grad Six.mat");
			if ((Object)(object)AnimatedFireMat == (Object)null)
			{
				MelonLogger.Error("Failed to load AnimatedFireMat!");
			}
			if ((Object)(object)GlintSparkleMat == (Object)null)
			{
				MelonLogger.Error("Failed to load GlintSparkleMat!");
			}
			if ((Object)(object)BurntMat == (Object)null)
			{
				MelonLogger.Error("Failed to load BurntMat!");
			}
			if ((Object)(object)ForceShieldMat == (Object)null)
			{
				MelonLogger.Error("Failed to load ForceShieldMat!");
			}
			if ((Object)(object)AnimatedUVDistortionMat == (Object)null)
			{
				MelonLogger.Error("Failed to load AnimatedUVDistortionMat!");
			}
			if ((Object)(object)DissolveBurnMat == (Object)null)
			{
				MelonLogger.Error("Failed to load DissolveBurnMat!");
			}
			if ((Object)(object)XRayMat == (Object)null)
			{
				MelonLogger.Error("Failed to load XRayMat!");
			}
			if ((Object)(object)GradOneMat == (Object)null)
			{
				MelonLogger.Error("Failed to load GradOneMat!");
			}
			if ((Object)(object)GradTwoMat == (Object)null)
			{
				MelonLogger.Error("Failed to load GradTwoMat!");
			}
			if ((Object)(object)GradThreeMat == (Object)null)
			{
				MelonLogger.Error("Failed to load GradThreeMat!");
			}
			if ((Object)(object)GradFourMat == (Object)null)
			{
				MelonLogger.Error("Failed to load GradFourMat!");
			}
			if ((Object)(object)GradFiveMat == (Object)null)
			{
				MelonLogger.Error("Failed to load GradFiveMat!");
			}
			if ((Object)(object)GradSixMat == (Object)null)
			{
				MelonLogger.Error("Failed to load GradSixMat!");
			}
		}
	}
	[Serializable]
	public class BodyLogColorData
	{
		public struct DialColor
		{
			public Color emissionBase;

			public Color emissionColor;
		}

		public struct GizmoColor
		{
			public Color gizmoBallColor;

			public Color gizmoBallEmission;
		}

		public struct PreviewMeshColor
		{
			public Color hologramEdgeColor;

			public Color hologramEmissionColor;
		}

		public enum BaseSkinType
		{
			Default,
			AnimatedFire,
			GlintSparkle,
			Burnt,
			ForceShield,
			AnimatedUVDistortion,
			DissolveBurn,
			XRay,
			GradientGreen,
			GradientTropical,
			GradientRedAndPurple,
			GradientGreenAndBlue,
			GradientPinkAndBlue,
			GradientPurple
		}

		public Color ringColor;

		public Color coreParticleColor;

		public Color baseLogColor;

		public Color lineColor;

		public Color[] tickColor;

		public PreviewMeshColor previewMeshColor;

		public GizmoColor gizmoBallColor;

		public DialColor[] dialColor;

		public BaseSkinType baseSkinType;

		public BodyLogColorData(Color lineColor, DialColor[] dialColor, Color[] tickColor, GizmoColor gizmoBallColor, Color ringColor, Color coreParticleColor, Color baseLogColor, PreviewMeshColor previewMeshColor, int baseSkinTypeId)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			this.lineColor = lineColor;
			this.tickColor = (Color[])(object)new Color[7];
			this.gizmoBallColor = gizmoBallColor;
			this.ringColor = ringColor;
			this.coreParticleColor = coreParticleColor;
			this.dialColor = new DialColor[6];
			for (int i = 0; i < 6; i++)
			{
				this.dialColor[i] = dialColor[i];
			}
			for (int j = 0; j < 7; j++)
			{
				this.tickColor[j] = tickColor[j];
			}
			this.baseLogColor = baseLogColor;
			this.previewMeshColor = previewMeshColor;
			baseSkinType = (BaseSkinType)baseSkinTypeId;
		}
	}
	public class DefaultValues
	{
		public static readonly BodyLogColorData.GizmoColor gizmoBallColor = new BodyLogColorData.GizmoColor
		{
			gizmoBallColor = Color.white,
			gizmoBallEmission = Color.white
		};

		public static readonly BodyLogColorData.PreviewMeshColor previewMeshColor = new BodyLogColorData.PreviewMeshColor
		{
			hologramEdgeColor = Color.white,
			hologramEmissionColor = Color.white
		};

		public static readonly Color ringColor = Color.white;

		public static readonly Color coreParticleColor = Color.white;

		public static readonly Color baseLogColor = Color.white;

		public static readonly Color lineColor = Color.white;

		public static readonly Color[] tickColor = (Color[])(object)new Color[8]
		{
			Color.white,
			Color.white,
			Color.white,
			Color.white,
			Color.white,
			Color.white,
			Color.white,
			Color.white
		};

		public static readonly BodyLogColorData.DialColor[] dialColor = new BodyLogColorData.DialColor[6]
		{
			new BodyLogColorData.DialColor
			{
				emissionBase = Color.white,
				emissionColor = Color.white
			},
			new BodyLogColorData.DialColor
			{
				emissionBase = Color.white,
				emissionColor = Color.white
			},
			new BodyLogColorData.DialColor
			{
				emissionBase = Color.white,
				emissionColor = Color.white
			},
			new BodyLogColorData.DialColor
			{
				emissionBase = Color.white,
				emissionColor = Color.white
			},
			new BodyLogColorData.DialColor
			{
				emissionBase = Color.white,
				emissionColor = Color.white
			},
			new BodyLogColorData.DialColor
			{
				emissionBase = Color.white,
				emissionColor = Color.white
			}
		};

		public static readonly BodyLogColorData.BaseSkinType baseSkinType = BodyLogColorData.BaseSkinType.Default;
	}
	public class FusionUserBodyLogColorData
	{
		public string SteamId { get; set; }

		public string BodyLogColorDataBase64 { get; set; }

		public FusionUserBodyLogColorData(string steamId, BodyLogColorData bodyLogColorData)
		{
			SteamId = steamId;
			BodyLogColorDataBase64 = ConvertToBase64(bodyLogColorData);
		}

		private string ConvertToBase64(BodyLogColorData bodyLogColorData)
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			string s = JsonConvert.SerializeObject((object)bodyLogColorData, (Formatting)1, new JsonSerializerSettings
			{
				ReferenceLoopHandling = (ReferenceLoopHandling)1,
				Converters = new List<JsonConverter> { (JsonConverter)(object)new ColorJsonConverter() }
			});
			return Convert.ToBase64String(Encoding.UTF8.GetBytes(s));
		}

		public BodyLogColorData DecodeBodyLogColorData()
		{
			byte[] bytes = Convert.FromBase64String(BodyLogColorDataBase64);
			return JsonConvert.DeserializeObject<BodyLogColorData>(Encoding.UTF8.GetString(bytes));
		}
	}
	public static class LogPrefInitializer
	{
		public const string dataFolder = "UserData/BodyLogCustomizer";

		public const string logPrefsFile = "LocalBodyLogPref.json";

		public const string combinedPrefsFile = "UserData/BodyLogCustomizer/LocalBodyLogPref.json";

		public static BodyLogColorData bodyLogColorData { get; set; }

		public static void Initialize()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_00c1: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			Directory.CreateDirectory("UserData/BodyLogCustomizer");
			string location = Assembly.GetExecutingAssembly().Location;
			if (File.Exists("UserData/BodyLogCustomizer/LocalBodyLogPref.json"))
			{
				string text = MelonUtils.ComputeSimpleSHA256Hash(location);
				MelonLogger.Msg("Hash: " + text);
				if (MelonPreferences.GetEntryValue<string>("BodyLogCustomizer", "AssemblyHash") == text)
				{
					bodyLogColorData = SerializeConfig();
					return;
				}
				File.Move("UserData/BodyLogCustomizer/LocalBodyLogPref.json", "UserData/BodyLogCustomizer/LocalBodyLogPref.json_" + text);
				BodyLogCustomizer.AssemblyHash.Value = text;
			}
			Color lineColor = DefaultValues.lineColor;
			BodyLogColorData.GizmoColor gizmoBallColor = DefaultValues.gizmoBallColor;
			BodyLogColorData.DialColor[] dialColor = DefaultValues.dialColor;
			Color[] tickColor = DefaultValues.tickColor;
			Color ringColor = DefaultValues.ringColor;
			Color coreParticleColor = DefaultValues.coreParticleColor;
			Color baseLogColor = DefaultValues.baseLogColor;
			BodyLogColorData.PreviewMeshColor previewMeshColor = DefaultValues.previewMeshColor;
			BodyLogColorData.BaseSkinType baseSkinType = DefaultValues.baseSkinType;
			BodyLogColorData obj = new BodyLogColorData(lineColor, dialColor, tickColor, gizmoBallColor, ringColor, coreParticleColor, baseLogColor, previewMeshColor, (int)baseSkinType);
			string contents = JsonConvert.SerializeObject((object)obj, (Formatting)1, new JsonSerializerSettings
			{
				ReferenceLoopHandling = (ReferenceLoopHandling)1,
				Converters = new List<JsonConverter> { (JsonConverter)(object)new ColorJsonConverter() }
			});
			File.WriteAllText("UserData/BodyLogCustomizer/LocalBodyLogPref.json", contents);
			bodyLogColorData = obj;
		}

		public static BodyLogColorData SerializeConfig()
		{
			if (!File.Exists("UserData/BodyLogCustomizer/LocalBodyLogPref.json"))
			{
				MelonLogger.Error("Failed to find BodyLog preferences file!");
				return null;
			}
			return JsonConvert.DeserializeObject<BodyLogColorData>(File.ReadAllText("UserData/BodyLogCustomizer/LocalBodyLogPref.json"));
		}

		public static void DeserializeConfig()
		{
			//IL_0018: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			if (bodyLogColorData == null)
			{
				MelonLogger.Error("Failed to deserialize BodyLog preferences file!");
				return;
			}
			string contents = JsonConvert.SerializeObject((object)bodyLogColorData, (Formatting)1, new JsonSerializerSettings
			{
				ReferenceLoopHandling = (ReferenceLoopHandling)1,
				Converters = new List<JsonConverter> { (JsonConverter)(object)new ColorJsonConverter() }
			});
			File.WriteAllText("UserData/BodyLogCustomizer/LocalBodyLogPref.json", contents);
		}
	}
}
namespace BodyLogCustomizer.Data.Messages
{
	public class ColorDataFusion
	{
		public class ColorData : IFusionSerializable, IDisposable
		{
			public BodyLogColorData.GizmoColor GizmoColor { get; set; }

			public BodyLogColorData.PreviewMeshColor PreviewMeshColor { get; set; }

			public byte PlayerId { get; set; }

			public Color RingColor { get; set; }

			public Color CoreParticleColor { get; set; }

			public Color BaseLogColor { get; set; }

			public Color LineColor { get; set; }

			public Color[] TickColor { get; set; }

			public BodyLogColorData.DialColor[] DialColor { get; set; }

			public int BaseSkinTypeId { get; set; }

			public void Dispose()
			{
				GC.SuppressFinalize(this);
			}

			public void Serialize(FusionWriter writer)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: 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_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_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_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				writer.Write(PlayerId);
				writer.Write(GizmoColor.gizmoBallColor);
				writer.Write(GizmoColor.gizmoBallEmission);
				writer.Write(PreviewMeshColor.hologramEdgeColor);
				writer.Write(PreviewMeshColor.hologramEmissionColor);
				writer.Write(RingColor);
				writer.Write(CoreParticleColor);
				writer.Write(BaseLogColor);
				writer.Write(LineColor);
				writer.Write(BaseSkinTypeId);
				Color[] tickColor = TickColor;
				foreach (Color val in tickColor)
				{
					writer.Write(val);
				}
				BodyLogColorData.DialColor[] dialColor = DialColor;
				for (int i = 0; i < dialColor.Length; i++)
				{
					BodyLogColorData.DialColor dialColor2 = dialColor[i];
					writer.Write(dialColor2.emissionBase);
					writer.Write(dialColor2.emissionColor);
				}
			}

			public void Deserialize(FusionReader reader)
			{
				//IL_0018: 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_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_00e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				PlayerId = reader.ReadByte();
				GizmoColor = new BodyLogColorData.GizmoColor
				{
					gizmoBallColor = reader.ReadColor(),
					gizmoBallEmission = reader.ReadColor()
				};
				PreviewMeshColor = new BodyLogColorData.PreviewMeshColor
				{
					hologramEdgeColor = reader.ReadColor(),
					hologramEmissionColor = reader.ReadColor()
				};
				RingColor = reader.ReadColor();
				CoreParticleColor = reader.ReadColor();
				BaseLogColor = reader.ReadColor();
				LineColor = reader.ReadColor();
				TickColor = (Color[])(object)new Color[7];
				DialColor = new BodyLogColorData.DialColor[6];
				BaseSkinTypeId = reader.ReadInt32();
				for (int i = 0; i < 7; i++)
				{
					TickColor[i] = reader.ReadColor();
				}
				for (int j = 0; j < 6; j++)
				{
					DialColor[j].emissionBase = reader.ReadColor();
					DialColor[j].emissionColor = reader.ReadColor();
				}
			}

			public static ColorData Create(Color lineColor, BodyLogColorData.DialColor[] dialColor, Color[] tickColor, BodyLogColorData.GizmoColor gizmoColor, Color ringColor, Color coreParticleColor, Color baseLogColor, BodyLogColorData.PreviewMeshColor previewMeshColor, int baseSkinTypeId)
			{
				//IL_0011: 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_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				return new ColorData
				{
					PlayerId = PlayerIdManager.LocalSmallId,
					LineColor = lineColor,
					TickColor = tickColor,
					GizmoColor = gizmoColor,
					DialColor = dialColor,
					RingColor = ringColor,
					CoreParticleColor = coreParticleColor,
					BaseLogColor = baseLogColor,
					PreviewMeshColor = previewMeshColor,
					BaseSkinTypeId = baseSkinTypeId
				};
			}
		}

		public class ColorHandler : ModuleMessageHandler
		{
			public override void HandleMessage(byte[] bytes, bool isServerHandled = false)
			{
				//IL_003c: 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)
				//IL_005a: 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)
				FusionReader val = FusionReader.Create(bytes);
				try
				{
					using ColorData colorData = val.ReadFusionSerializable<ColorData>();
					if (NetworkInfo.IsServer && isServerHandled)
					{
						FusionMessage val2 = FusionMessage.ModuleCreate<ColorHandler>(bytes);
						try
						{
							MessageSender.BroadcastMessage((NetworkChannel)0, val2);
							return;
						}
						finally
						{
							((IDisposable)val2)?.Dispose();
						}
					}
					BodyLogColorData bodyLogColorData = new BodyLogColorData(colorData.LineColor, colorData.DialColor, colorData.TickColor, colorData.GizmoColor, colorData.RingColor, colorData.CoreParticleColor, colorData.BaseLogColor, colorData.PreviewMeshColor, colorData.BaseSkinTypeId);
					foreach (PlayerRep playerRep in PlayerRepManager.PlayerReps)
					{
						if (playerRep.PlayerId.SmallId == colorData.PlayerId)
						{
							Timer timer = new Timer(1000.0);
							timer.AutoReset = false;
							timer.Start();
							timer.Elapsed += delegate
							{
								playerRep.pullCord.ApplyColorsFromData(bodyLogColorData);
								FusionUserCacheManager.AddOrUpdate(playerRep.PlayerId.LongId.ToString(), bodyLogColorData);
							};
						}
					}
				}
				finally
				{
					((IDisposable)val)?.Dispose();
				}
			}
		}
	}
}
namespace BodyLogCustomizer.UI
{
	public static class BoneMenuCreator
	{
		private static Color mixedColor = Color.white;

		public static MenuCategory mainCategory { get; private set; }

		public static MenuCategory gizmoBallCategory { get; private set; }

		public static MenuCategory dialColorCategory { get; private set; }

		public static MenuCategory previewMeshCategory { get; private set; }

		public static SubPanelElement colorSelectorSubCategory { get; private set; }

		public static MenuElement rElement { get; private set; }

		public static MenuElement gElement { get; private set; }

		public static MenuElement bElement { get; private set; }

		public static MenuElement hologramEdgeColorElement { get; private set; }

		public static MenuElement hologramEmissionColorElement { get; private set; }

		public static MenuElement lineColorElement { get; private set; }

		public static MenuElement dialEmissionBaseElement { get; private set; }

		public static MenuElement dialEmissionColorElement { get; private set; }

		public static MenuElement ringColorElement { get; private set; }

		public static MenuElement coreParticleColorElement { get; private set; }

		public static MenuElement baseLogColorElement { get; private set; }

		public static MenuElement gizmoBallColorElement { get; private set; }

		public static MenuElement gizmoBallEmissionElement { get; private set; }

		public static MenuElement tickColorElement { get; private set; }

		public static EnumElement<BodyLogColorData.BaseSkinType> baseSkinElement { get; private set; }

		public static void CreateMenu()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			mainCategory = MenuManager.CreateCategory("BodyLog Customizer", Color.yellow);
			mainCategory.CreateBoolElement("Auto-apply Enabled", Color.cyan, BodyLogCustomizer.isEnabled.Value, (Action<bool>)delegate(bool value)
			{
				BodyLogCustomizer.isEnabled.Value = value;
			});
			mainCategory.CreateFunctionElement("Apply Colors", Color.cyan, (Action)delegate
			{
				PullCordPatch.localDevice.ApplyColorsFromData(LogPrefInitializer.bodyLogColorData);
				LogPrefInitializer.DeserializeConfig();
				if (BodyLogCustomizer.HasFusion && NetworkInfo.HasServer && BodyLogCustomizer.ReplicateOnServer.Value)
				{
					FusionModule.Instance.SendBodyLogColorData(LogPrefInitializer.bodyLogColorData);
				}
			});
			colorSelectorSubCategory = mainCategory.CreateSubPanel("Color Selector", Color.cyan);
			FunctionElement currColor = colorSelectorSubCategory.CreateFunctionElement("Current Color", Color.white, (Action)delegate
			{
			});
			rElement = (MenuElement)(object)colorSelectorSubCategory.CreateFloatElement("R", Color.red, mixedColor.r, 0.1f, 0f, 1f, (Action<float>)delegate(float value)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				mixedColor.r = value;
				rElement.SetColor(new Color(value, 0f, 0f));
				((MenuElement)currColor).SetColor(mixedColor);
			});
			gElement = (MenuElement)(object)colorSelectorSubCategory.CreateFloatElement("G", Color.green, mixedColor.g, 0.1f, 0f, 1f, (Action<float>)delegate(float value)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				mixedColor.g = value;
				gElement.SetColor(new Color(0f, value, 0f));
				((MenuElement)currColor).SetColor(mixedColor);
			});
			bElement = (MenuElement)(object)colorSelectorSubCategory.CreateFloatElement("B", Color.blue, mixedColor.b, 0.1f, 0f, 1f, (Action<float>)delegate(float value)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				mixedColor.b = value;
				bElement.SetColor(new Color(0f, 0f, value));
				((MenuElement)currColor).SetColor(mixedColor);
			});
			if (!HelperMethods.IsAndroid())
			{
				colorSelectorSubCategory.CreateFunctionElement("Paste from Clipboard", Color.white, (Action)delegate
				{
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					//IL_001a: Unknown result type (might be due to invalid IL or missing references)
					Color val2 = default(Color);
					if (ColorUtility.TryParseHtmlString(Clipboard.GetText(), ref val2))
					{
						mixedColor = val2;
						((MenuElement)currColor).SetColor(mixedColor);
					}
				});
			}
			baseSkinElement = mainCategory.CreateEnumElement<BodyLogColorData.BaseSkinType>("Body Log Skin", Color.yellow, (Action<BodyLogColorData.BaseSkinType>)delegate(BodyLogColorData.BaseSkinType value)
			{
				LogPrefInitializer.bodyLogColorData.baseSkinType = value;
			});
			((GenericElement<BodyLogColorData.BaseSkinType>)(object)baseSkinElement).SetValue(LogPrefInitializer.bodyLogColorData.baseSkinType);
			previewMeshCategory = mainCategory.CreateCategory("Preview Mesh", Color.cyan);
			hologramEdgeColorElement = (MenuElement)(object)previewMeshCategory.CreateFunctionElement("Set Hologram Edge Color", LogPrefInitializer.bodyLogColorData.previewMeshColor.hologramEdgeColor, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				Color hologramEdgeColor = MenuColorButton(hologramEdgeColorElement);
				LogPrefInitializer.bodyLogColorData.previewMeshColor.hologramEdgeColor = hologramEdgeColor;
			});
			hologramEmissionColorElement = (MenuElement)(object)previewMeshCategory.CreateFunctionElement("Set Hologram Emission Color", LogPrefInitializer.bodyLogColorData.previewMeshColor.hologramEmissionColor, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				Color hologramEmissionColor = MenuColorButton(hologramEmissionColorElement);
				LogPrefInitializer.bodyLogColorData.previewMeshColor.hologramEmissionColor = hologramEmissionColor;
			});
			dialColorCategory = mainCategory.CreateCategory("Dial Color", Color.cyan);
			dialEmissionBaseElement = (MenuElement)(object)dialColorCategory.CreateFunctionElement("Set Emission Base", LogPrefInitializer.bodyLogColorData.dialColor[0].emissionBase, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				Color emissionBase = MenuColorButton(dialEmissionBaseElement);
				for (int k = 0; k < LogPrefInitializer.bodyLogColorData.dialColor.Length; k++)
				{
					LogPrefInitializer.bodyLogColorData.dialColor[k].emissionBase = emissionBase;
				}
			});
			dialEmissionColorElement = (MenuElement)(object)dialColorCategory.CreateFunctionElement("Set Emission Color", LogPrefInitializer.bodyLogColorData.dialColor[0].emissionColor, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				Color emissionColor = MenuColorButton(dialEmissionColorElement);
				for (int j = 0; j < LogPrefInitializer.bodyLogColorData.dialColor.Length; j++)
				{
					LogPrefInitializer.bodyLogColorData.dialColor[j].emissionColor = emissionColor;
				}
			});
			gizmoBallCategory = mainCategory.CreateCategory("Gizmo Ball", Color.cyan);
			gizmoBallColorElement = (MenuElement)(object)gizmoBallCategory.CreateFunctionElement("Set Gizmo Ball Color", LogPrefInitializer.bodyLogColorData.gizmoBallColor.gizmoBallColor, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				Color gizmoBallColor = MenuColorButton(gizmoBallColorElement);
				LogPrefInitializer.bodyLogColorData.gizmoBallColor.gizmoBallColor = gizmoBallColor;
			});
			gizmoBallEmissionElement = (MenuElement)(object)gizmoBallCategory.CreateFunctionElement("Set Gizmo Ball Emission", LogPrefInitializer.bodyLogColorData.gizmoBallColor.gizmoBallEmission, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				Color gizmoBallEmission = MenuColorButton(gizmoBallEmissionElement);
				LogPrefInitializer.bodyLogColorData.gizmoBallColor.gizmoBallEmission = gizmoBallEmission;
			});
			baseLogColorElement = (MenuElement)(object)mainCategory.CreateFunctionElement("Set Base Log Color", LogPrefInitializer.bodyLogColorData.baseLogColor, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: 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_0011: Unknown result type (might be due to invalid IL or missing references)
				Color baseLogColor = MenuColorButton(baseLogColorElement);
				LogPrefInitializer.bodyLogColorData.baseLogColor = baseLogColor;
			});
			ringColorElement = (MenuElement)(object)mainCategory.CreateFunctionElement("Set Ring Color", LogPrefInitializer.bodyLogColorData.ringColor, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: 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_0011: Unknown result type (might be due to invalid IL or missing references)
				Color ringColor = MenuColorButton(ringColorElement);
				LogPrefInitializer.bodyLogColorData.ringColor = ringColor;
			});
			coreParticleColorElement = (MenuElement)(object)mainCategory.CreateFunctionElement("Set Core Particle Color", LogPrefInitializer.bodyLogColorData.coreParticleColor, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: 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_0011: Unknown result type (might be due to invalid IL or missing references)
				Color coreParticleColor = MenuColorButton(coreParticleColorElement);
				LogPrefInitializer.bodyLogColorData.coreParticleColor = coreParticleColor;
			});
			lineColorElement = (MenuElement)(object)mainCategory.CreateFunctionElement("Set Line Color", LogPrefInitializer.bodyLogColorData.lineColor, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: 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_0011: Unknown result type (might be due to invalid IL or missing references)
				Color lineColor = MenuColorButton(lineColorElement);
				LogPrefInitializer.bodyLogColorData.lineColor = lineColor;
			});
			tickColorElement = (MenuElement)(object)mainCategory.CreateFunctionElement("Set Tick Color", LogPrefInitializer.bodyLogColorData.tickColor[0], (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: 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_001b: Unknown result type (might be due to invalid IL or missing references)
				Color val = MenuColorButton(tickColorElement);
				for (int i = 0; i < LogPrefInitializer.bodyLogColorData.tickColor.Length; i++)
				{
					LogPrefInitializer.bodyLogColorData.tickColor[i] = val;
				}
			});
		}

		public static Color MenuColorButton(MenuElement element)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Color val = mixedColor;
			element.SetColor(val);
			return val;
		}
	}
}