Decompiled source of HandPaint v1.0.1

plugins/HandPaint/HandPaint.dll

Decompiled a week ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using HandPaint.Components;
using HandPaint.Scripts;
using HarmonyLib;
using PluginConfig.API;
using PluginConfig.API.Fields;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("HandPaint")]
[assembly: AssemblyDescription("ULTRAKILL plugin enabling custom arms colors")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HandPaint")]
[assembly: AssemblyCopyright("Copyright © 2024 Flazhik")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("D79551C3-9E3E-46FF-95A5-029A9093600A")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace HandPaint
{
	public class AssetsManager : MonoSingleton<AssetsManager>
	{
		private const BindingFlags Flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private static readonly Dictionary<string, Object> Prefabs = new Dictionary<string, Object>();

		private AssetBundle _bundle;

		public void LoadAssets()
		{
			_bundle = AssetBundle.LoadFromMemory(Resources.HandPaint);
		}

		public void RegisterPrefabs()
		{
			string[] allAssetNames = _bundle.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				Prefabs.Add(text, _bundle.LoadAsset<Object>(text));
			}
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				CheckType(types[i]);
			}
		}

		private static void CheckType(IReflect type)
		{
			type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).ToList().ForEach(ProcessField);
		}

		private static void ProcessField(FieldInfo field)
		{
			if (!field.FieldType.IsArray && field.IsStatic)
			{
				PrefabAsset customAttribute = field.GetCustomAttribute<PrefabAsset>();
				if (customAttribute != null)
				{
					field.SetValue(null, Prefabs[customAttribute.Path]);
				}
			}
		}

		public static Object GetAsset(string assetName)
		{
			return Prefabs[assetName];
		}
	}
	public static class HandPaintConfig
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static BoolValueChangeEventDelegate <>9__19_0;

			public static BoolValueChangeEventDelegate <>9__19_1;

			internal void <Init>b__19_0(BoolValueChangeEvent v)
			{
				bool flag = !v.value || SkittlePoxIsActive();
				((ConfigField)EnableRepaint).hidden = SkittlePoxIsActive();
				((ConfigField)EasterEggConfig.Panel).hidden = !SkittlePoxIsActive();
				((ConfigField)PaintFeedbackerSeparately).hidden = flag;
				((ConfigField)FeedbackerPanel).hidden = flag;
				((ConfigField)RightFeedbackerPanel).hidden = flag || !PaintFeedbackerSeparately.value;
				((ConfigField)KnuckleblasterPanel).hidden = flag;
				((ConfigField)WhiplashPanel).hidden = flag;
			}

			internal void <Init>b__19_1(BoolValueChangeEvent v)
			{
				((ConfigField)RightFeedbackerPanel).hidden = !v.value || !EnableRepaint.value;
			}
		}

		public static readonly BoolField EnableRepaint;

		public static readonly BoolField PaintFeedbackerSeparately;

		public static readonly ColorAlphaField[] WhiplashColors;

		public static ColorAlphaField WhiplashRopeColorField;

		public static readonly ColorAlphaField[] KnuckleblasterColors;

		public static ColorAlphaField KnuckleblasterShellColorField;

		public static readonly ColorAlphaField[] FeedbackerColors;

		public static readonly ColorAlphaField[] RightFeedbackerColors;

		public static readonly EasterEggConfig EasterEggConfig;

		private static readonly ConfigPanel FeedbackerPanel;

		private static readonly ConfigPanel RightFeedbackerPanel;

		private static readonly ConfigPanel KnuckleblasterPanel;

		private static readonly ConfigPanel WhiplashPanel;

		private static readonly Color[] BaseFeedbackerColors;

		private static readonly Color[] BaseKnuckleblasterColors;

		private static readonly Color[] BaseWhiplashColors;

		private static readonly Color BaseWhiplashRopeColor;

		private static readonly Color BaseKnuckleblasterShellColor;

		static HandPaintConfig()
		{
			//IL_0048: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Expected O, but got Unknown
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Expected O, but got Unknown
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Expected O, but got Unknown
			WhiplashColors = new ColorAlphaField[3];
			KnuckleblasterColors = new ColorAlphaField[3];
			FeedbackerColors = new ColorAlphaField[3];
			RightFeedbackerColors = new ColorAlphaField[3];
			BaseFeedbackerColors = (Color[])(object)new Color[3]
			{
				new Color(0.251f, 0.439f, 0.933f, 1f),
				new Color(0.392f, 0.392f, 0.392f, 1f),
				new Color(0.251f, 0.439f, 0.933f, 1f)
			};
			BaseKnuckleblasterColors = (Color[])(object)new Color[3]
			{
				new Color(0.859f, 0.09f, 0.09f, 1f),
				new Color(0.498f, 0.314f, 0.251f, 1f),
				new Color(0.878f, 0.686f, 0.514f, 1f)
			};
			BaseWhiplashColors = (Color[])(object)new Color[3]
			{
				new Color(0.486f, 0.612f, 0.153f, 1f),
				new Color(0.843f, 0.686f, 0.498f, 1f),
				new Color(0.409f, 0.345f, 0.282f, 1f)
			};
			BaseWhiplashRopeColor = new Color(0.25f, 0.25f, 0.25f);
			BaseKnuckleblasterShellColor = new Color(1f, 0f, 0f, 1f);
			PluginConfigurator obj = PluginConfigurator.Create("HandPaint", "dev.flazhik.handpaint");
			EnableRepaint = new BoolField(obj.rootPanel, "Repaint arms", "handpaint.enabled", true);
			PaintFeedbackerSeparately = new BoolField(obj.rootPanel, "Paint feedbacker arms separately", "handpaint.paint-feedbacker-separately", false);
			FeedbackerPanel = new ConfigPanel(obj.rootPanel, "Feedbacker colors", "handpaint.feedbacker-colors");
			RightFeedbackerPanel = new ConfigPanel(obj.rootPanel, "Feedbacker right arm colors", "handpaint.feedbacker-r-colors");
			KnuckleblasterPanel = new ConfigPanel(obj.rootPanel, "Knuckleblaster colors", "handpaint.knuckleblaster-colors");
			WhiplashPanel = new ConfigPanel(obj.rootPanel, "Whiplash colors", "handpaint.whiplash-colors");
			EasterEggConfig = new EasterEggConfig(obj);
			obj.SetIconWithURL("file://" + Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, "icon.png"));
		}

		public static void Init()
		{
			//IL_003c: 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_00bc: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			for (int i = 0; i < 3; i++)
			{
				WhiplashColors[i] = new ColorAlphaField(WhiplashPanel, $"Whiplash color {i + 1}", $"handpaint.whiplash-color-{i + 1}", BaseWhiplashColors[i]);
				KnuckleblasterColors[i] = new ColorAlphaField(KnuckleblasterPanel, $"Knuckleblaster color {i + 1}", $"handpaint.knuckleblaster-color-{i + 1}", BaseKnuckleblasterColors[i]);
				FeedbackerColors[i] = new ColorAlphaField(FeedbackerPanel, $"Feedbacker color {i + 1}", $"handpaint.feedbacker-l-color-{i + 1}", BaseFeedbackerColors[i]);
				RightFeedbackerColors[i] = new ColorAlphaField(RightFeedbackerPanel, $"Feedbacker right arm color {i + 1}", $"handpaint.feedbacker-r-color-{i + 1}", BaseFeedbackerColors[i]);
			}
			WhiplashRopeColorField = new ColorAlphaField(WhiplashPanel, "Whiplash rope color", "handpaint.whiplash-rope-color", BaseWhiplashRopeColor);
			KnuckleblasterShellColorField = new ColorAlphaField(KnuckleblasterPanel, "Knuckleblaster shell color", "handpaint.knuckleblaster-shell-color", BaseKnuckleblasterShellColor);
			BoolField enableRepaint = EnableRepaint;
			object obj = <>c.<>9__19_0;
			if (obj == null)
			{
				BoolValueChangeEventDelegate val = delegate(BoolValueChangeEvent v)
				{
					bool flag = !v.value || SkittlePoxIsActive();
					((ConfigField)EnableRepaint).hidden = SkittlePoxIsActive();
					((ConfigField)EasterEggConfig.Panel).hidden = !SkittlePoxIsActive();
					((ConfigField)PaintFeedbackerSeparately).hidden = flag;
					((ConfigField)FeedbackerPanel).hidden = flag;
					((ConfigField)RightFeedbackerPanel).hidden = flag || !PaintFeedbackerSeparately.value;
					((ConfigField)KnuckleblasterPanel).hidden = flag;
					((ConfigField)WhiplashPanel).hidden = flag;
				};
				<>c.<>9__19_0 = val;
				obj = (object)val;
			}
			enableRepaint.onValueChange += (BoolValueChangeEventDelegate)obj;
			BoolField paintFeedbackerSeparately = PaintFeedbackerSeparately;
			object obj2 = <>c.<>9__19_1;
			if (obj2 == null)
			{
				BoolValueChangeEventDelegate val2 = delegate(BoolValueChangeEvent v)
				{
					((ConfigField)RightFeedbackerPanel).hidden = !v.value || !EnableRepaint.value;
				};
				<>c.<>9__19_1 = val2;
				obj2 = (object)val2;
			}
			paintFeedbackerSeparately.onValueChange += (BoolValueChangeEventDelegate)obj2;
			EnableRepaint.TriggerValueChangeEvent();
		}

		private static bool SkittlePoxIsActive()
		{
			return MonoSingleton<SkittlesPox>.Instance.activated;
		}
	}
	[BepInProcess("ULTRAKILL.exe")]
	[BepInPlugin("dev.flazhik.handpaint", "HandPaint", "1.0.1")]
	public class HandPaint : BaseUnityPlugin
	{
		private Harmony _harmony;

		private SkittlesPox _easterEgg;

		private void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			MonoSingleton<AssetsManager>.Instance.LoadAssets();
			MonoSingleton<AssetsManager>.Instance.RegisterPrefabs();
			_easterEgg = MonoSingleton<SkittlesPox>.Instance;
			_harmony = new Harmony("dev.flazhik.handpaint");
			HandPaintConfig.Init();
			_harmony.PatchAll();
		}
	}
	internal static class PluginInfo
	{
		public const string GUID = "dev.flazhik.handpaint";

		public const string NAME = "HandPaint";

		public const string VERSION = "1.0.1";
	}
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("HandPaint.Resources", typeof(Resources).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] HandPaint => (byte[])ResourceManager.GetObject("HandPaint", resourceCulture);

		internal Resources()
		{
		}
	}
	public class EasterEggConfig
	{
		public readonly FloatSliderField Frequency;

		public readonly FloatSliderField[] Phases = (FloatSliderField[])(object)new FloatSliderField[3];

		public readonly ConfigPanel Panel;

		private static readonly float[] PhasesDefaultValues = new float[3] { 0.41f, 0.6f, 0.79f };

		public EasterEggConfig(PluginConfigurator config)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			Panel = new ConfigPanel(config.rootPanel, "SKITTLES POX", "handpaint.easter");
			Frequency = new FloatSliderField(Panel, "Hue shift frequency (cycles per minute)", "handpaint.easter.frequency", new Tuple<float, float>(0f, 120f), 30f, 0);
			for (int i = 0; i < Phases.Length; i++)
			{
				Phases[i] = new FloatSliderField(Panel, $"Phase of color {i + 1}", $"handpaint.easter.frequency.color-{i + 1}-phase", new Tuple<float, float>(0f, 1f), PhasesDefaultValues[i], 2);
			}
			((ConfigField)Panel).hidden = true;
		}
	}
}
namespace HandPaint.Scripts
{
	public class ColorAlphaField : CustomConfigValueField
	{
		[PrefabAsset("assets/ui/coloralphafield.prefab")]
		private static GameObject fieldPrefab;

		private readonly Color _defaultValue;

		private ConfigColorAlphaField _currentUi;

		private Color _value;

		private string _lastRed = "0";

		private string _lastGreen = "0";

		private string _lastBlue = "0";

		private string _lastAlpha = "0";

		[CompilerGenerated]
		private ColorValueChangeEventDelegate m_onValueChange;

		[CompilerGenerated]
		private PostColorValueChangeEvent m_postValueChangeEvent;

		public Color Value
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return _value;
			}
			private set
			{
				//IL_0016: 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_001d: 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)
				if ((Object)(object)_currentUi != (Object)null)
				{
					SetSliders(value);
				}
				_value = value;
				((CustomConfigValueField)this).fieldValue = StringifyColor(value);
			}
		}

		public event ColorValueChangeEventDelegate onValueChange
		{
			[CompilerGenerated]
			add
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				ColorValueChangeEventDelegate val = this.m_onValueChange;
				ColorValueChangeEventDelegate val2;
				do
				{
					val2 = val;
					ColorValueChangeEventDelegate value2 = (ColorValueChangeEventDelegate)Delegate.Combine((Delegate?)(object)val2, (Delegate?)(object)value);
					val = Interlocked.CompareExchange(ref this.m_onValueChange, value2, val2);
				}
				while (val != val2);
			}
			[CompilerGenerated]
			remove
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				ColorValueChangeEventDelegate val = this.m_onValueChange;
				ColorValueChangeEventDelegate val2;
				do
				{
					val2 = val;
					ColorValueChangeEventDelegate value2 = (ColorValueChangeEventDelegate)Delegate.Remove((Delegate?)(object)val2, (Delegate?)(object)value);
					val = Interlocked.CompareExchange(ref this.m_onValueChange, value2, val2);
				}
				while (val != val2);
			}
		}

		public event PostColorValueChangeEvent postValueChangeEvent
		{
			[CompilerGenerated]
			add
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				PostColorValueChangeEvent val = this.m_postValueChangeEvent;
				PostColorValueChangeEvent val2;
				do
				{
					val2 = val;
					PostColorValueChangeEvent value2 = (PostColorValueChangeEvent)Delegate.Combine((Delegate?)(object)val2, (Delegate?)(object)value);
					val = Interlocked.CompareExchange(ref this.m_postValueChangeEvent, value2, val2);
				}
				while (val != val2);
			}
			[CompilerGenerated]
			remove
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				PostColorValueChangeEvent val = this.m_postValueChangeEvent;
				PostColorValueChangeEvent val2;
				do
				{
					val2 = val;
					PostColorValueChangeEvent value2 = (PostColorValueChangeEvent)Delegate.Remove((Delegate?)(object)val2, (Delegate?)(object)value);
					val = Interlocked.CompareExchange(ref this.m_postValueChangeEvent, value2, val2);
				}
				while (val != val2);
			}
		}

		public void TriggerValueChangeEvent()
		{
			//IL_0009: 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_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_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (this.onValueChange != null)
			{
				ColorValueChangeEvent val = new ColorValueChangeEvent
				{
					value = _value
				};
				this.onValueChange.Invoke(val);
				if (!val.canceled && val.value != _value)
				{
					Value = val.value;
				}
			}
		}

		public override void OnDisplayNameChange(string newName)
		{
			if ((Object)(object)_currentUi != (Object)null)
			{
				((TMP_Text)_currentUi.nameText).text = ((ConfigField)this).displayName;
			}
		}

		private void SetSliders(Color c)
		{
			//IL_001a: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_currentUi == (Object)null))
			{
				_currentUi.red.SetValueWithoutNotify(c.r);
				_currentUi.green.SetValueWithoutNotify(c.g);
				_currentUi.blue.SetValueWithoutNotify(c.b);
				_currentUi.alpha.SetValueWithoutNotify(c.a);
				_currentUi.redInput.SetTextWithoutNotify(((int)((double)c.r * 255.0)).ToString());
				_currentUi.greenInput.SetTextWithoutNotify(((int)((double)c.g * 255.0)).ToString());
				_currentUi.blueInput.SetTextWithoutNotify(((int)((double)c.b * 255.0)).ToString());
				_currentUi.alphaInput.SetTextWithoutNotify(((int)((double)c.a * 255.0)).ToString());
				_currentUi.SetColor(c.r, c.g, c.b, c.a);
			}
		}

		internal Color GetColorFromSliders()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			return new Color(_currentUi.red.normalizedValue, _currentUi.green.normalizedValue, _currentUi.blue.normalizedValue, _currentUi.alpha.normalizedValue);
		}

		protected override GameObject CreateUI(Transform content)
		{
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Expected O, but got Unknown
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Expected O, but got Unknown
			GameObject val2 = Object.Instantiate<GameObject>(fieldPrefab, content);
			_currentUi = val2.GetComponent<ConfigColorAlphaField>();
			((TMP_Text)_currentUi.nameText).text = ((ConfigField)this).displayName;
			((Selectable)_currentUi.red).interactable = ((ConfigField)this).interactable;
			((Component)_currentUi.red).gameObject.AddComponent<ColorFieldSliderComponent>().callback = this;
			((Selectable)_currentUi.green).interactable = ((ConfigField)this).interactable;
			((Component)_currentUi.green).gameObject.AddComponent<ColorFieldSliderComponent>().callback = this;
			((Selectable)_currentUi.blue).interactable = ((ConfigField)this).interactable;
			((Component)_currentUi.blue).gameObject.AddComponent<ColorFieldSliderComponent>().callback = this;
			((Selectable)_currentUi.alpha).interactable = ((ConfigField)this).interactable;
			((Component)_currentUi.alpha).gameObject.AddComponent<ColorFieldSliderComponent>().callback = this;
			((Selectable)_currentUi.redInput).interactable = ((ConfigField)this).interactable;
			((UnityEvent<string>)(object)_currentUi.redInput.onValueChanged).AddListener((UnityAction<string>)delegate(string val)
			{
				if (!_currentUi.redInput.wasCanceled)
				{
					_lastRed = val;
				}
			});
			((UnityEvent<string>)(object)_currentUi.redInput.onEndEdit).AddListener((UnityAction<string>)delegate
			{
				OnInputFieldChange(_currentUi.redInput, _currentUi.red, ref _lastRed);
			});
			((Selectable)_currentUi.greenInput).interactable = ((ConfigField)this).interactable;
			((UnityEvent<string>)(object)_currentUi.greenInput.onValueChanged).AddListener((UnityAction<string>)delegate(string val)
			{
				if (!_currentUi.greenInput.wasCanceled)
				{
					_lastGreen = val;
				}
			});
			((UnityEvent<string>)(object)_currentUi.greenInput.onEndEdit).AddListener((UnityAction<string>)delegate
			{
				OnInputFieldChange(_currentUi.greenInput, _currentUi.green, ref _lastGreen);
			});
			((Selectable)_currentUi.blueInput).interactable = ((ConfigField)this).interactable;
			((UnityEvent<string>)(object)_currentUi.blueInput.onValueChanged).AddListener((UnityAction<string>)delegate(string val)
			{
				if (!_currentUi.blueInput.wasCanceled)
				{
					_lastBlue = val;
				}
			});
			((UnityEvent<string>)(object)_currentUi.blueInput.onEndEdit).AddListener((UnityAction<string>)delegate
			{
				OnInputFieldChange(_currentUi.blueInput, _currentUi.blue, ref _lastBlue);
			});
			((Selectable)_currentUi.alphaInput).interactable = ((ConfigField)this).interactable;
			((UnityEvent<string>)(object)_currentUi.alphaInput.onValueChanged).AddListener((UnityAction<string>)delegate(string val)
			{
				if (!_currentUi.alphaInput.wasCanceled)
				{
					_lastAlpha = val;
				}
			});
			((UnityEvent<string>)(object)_currentUi.alphaInput.onEndEdit).AddListener((UnityAction<string>)delegate
			{
				OnInputFieldChange(_currentUi.alphaInput, _currentUi.alpha, ref _lastAlpha);
			});
			SetSliders(_value);
			_currentUi.resetButton.onClick = new ButtonClickedEvent();
			((UnityEvent)_currentUi.resetButton.onClick).AddListener(new UnityAction(OnReset));
			((Component)_currentUi.resetButton).gameObject.SetActive(false);
			ScrollRect componentInParent = ((Component)content).gameObject.GetComponentInParent<ScrollRect>();
			Utils.SetupResetButton(val2, componentInParent, (UnityAction<BaseEventData>)delegate
			{
				if (((ConfigField)this).interactable)
				{
					((Component)_currentUi.resetButton).gameObject.SetActive(true);
				}
			}, (UnityAction<BaseEventData>)delegate
			{
				((Component)_currentUi.resetButton).gameObject.SetActive(false);
			});
			Utils.AddScrollEvents(((Component)_currentUi.redInput).gameObject.AddComponent<EventTrigger>(), componentInParent);
			Utils.AddScrollEvents(((Component)_currentUi.greenInput).gameObject.AddComponent<EventTrigger>(), componentInParent);
			Utils.AddScrollEvents(((Component)_currentUi.blueInput).gameObject.AddComponent<EventTrigger>(), componentInParent);
			Utils.AddScrollEvents(((Component)_currentUi.alphaInput).gameObject.AddComponent<EventTrigger>(), componentInParent);
			val2.SetActive(!((ConfigField)this).hidden);
			SetInteractableColor(((ConfigField)this).interactable);
			return val2;
		}

		internal void OnValueChange(Color newColor)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0028: Expected O, but got Unknown
			//IL_0010: 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_0061: 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)
			if (newColor == _value)
			{
				Value = _value;
				return;
			}
			ColorValueChangeEvent val = new ColorValueChangeEvent
			{
				value = newColor
			};
			if (this.onValueChange != null)
			{
				try
				{
					this.onValueChange.Invoke(val);
				}
				catch (Exception arg)
				{
					Debug.LogError((object)$"Value change event for {((ConfigField)this).guid} threw an error: {arg}");
				}
			}
			Value = (val.canceled ? _value : val.value);
			if (this.postValueChangeEvent == null)
			{
				return;
			}
			try
			{
				this.postValueChangeEvent.Invoke(_value);
			}
			catch (Exception arg2)
			{
				Debug.LogError((object)$"Post value change event for {((ConfigField)this).guid} threw an error: {arg2}");
			}
		}

		private void OnInputFieldChange(TMP_InputField field, Slider targetSlider, ref string lastValue)
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			if (field.wasCanceled)
			{
				return;
			}
			int num = (int)((double)targetSlider.normalizedValue * 255.0);
			if (!int.TryParse(field.text, out var result))
			{
				field.SetTextWithoutNotify(num.ToString());
				return;
			}
			int num2 = Mathf.Clamp(result, 0, 255);
			field.SetTextWithoutNotify(num2.ToString());
			if (num != num2)
			{
				targetSlider.SetNormalizedValueWithoutNotify((float)num2 / 255f);
				OnValueChange(new Color(_currentUi.red.normalizedValue, _currentUi.green.normalizedValue, _currentUi.blue.normalizedValue, _currentUi.alpha.normalizedValue));
			}
		}

		private void OnReset()
		{
			//IL_0002: 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)
			SetSliders(_defaultValue);
			OnValueChange(_defaultValue);
		}

		protected override void LoadDefaultValue()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Value = _defaultValue;
		}

		protected sealed override void LoadFromString(string data)
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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)
			string[] array = data.Split(new char[1] { ',' });
			bool flag = array.Length == 4;
			if (flag)
			{
				if (!float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
				{
					flag = false;
				}
				if (!float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2))
				{
					flag = false;
				}
				if (!float.TryParse(array[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3))
				{
					flag = false;
				}
				if (!float.TryParse(array[3], NumberStyles.Float, CultureInfo.InvariantCulture, out var result4))
				{
					flag = false;
				}
				if (flag)
				{
					_value = new Color(result, result2, result3, result4);
				}
				else
				{
					OnValueChange(new Color(_defaultValue.r, _defaultValue.g, _defaultValue.b, _defaultValue.a));
				}
			}
		}

		private static string StringifyColor(Color c)
		{
			return c.r.ToString(CultureInfo.InvariantCulture) + "," + c.g.ToString(CultureInfo.InvariantCulture) + "," + c.b.ToString(CultureInfo.InvariantCulture) + "," + c.a.ToString(CultureInfo.InvariantCulture);
		}

		private void SetInteractableColor(bool interactable)
		{
			//IL_0024: 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)
			if (!((Object)(object)_currentUi == (Object)null))
			{
				((Graphic)_currentUi.nameText).color = (interactable ? Color.white : Color.gray);
			}
		}

		public ColorAlphaField(ConfigPanel parentPanel, string displayName, string guid, Color defaultValue)
			: base(parentPanel, guid, displayName)
		{
			//IL_0036: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			_defaultValue = defaultValue;
			if (((CustomConfigValueField)this).fieldValue == null)
			{
				Value = defaultValue;
			}
			else
			{
				((CustomConfigValueField)this).LoadFromString(((CustomConfigValueField)this).fieldValue);
			}
		}
	}
	internal class ColorFieldSliderComponent : MonoBehaviour, IPointerUpHandler, IEventSystemHandler
	{
		public ColorAlphaField callback;

		public void OnPointerUp(PointerEventData data)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			callback?.OnValueChange(callback.GetColorFromSliders());
		}
	}
	public class ConfigColorAlphaField : MonoBehaviour
	{
		[SerializeField]
		public TextMeshProUGUI nameText;

		public Image image;

		public Image metallicPreview;

		public Slider red;

		public Slider green;

		public Slider blue;

		public Slider alpha;

		public TMP_InputField redInput;

		public TMP_InputField greenInput;

		public TMP_InputField blueInput;

		public TMP_InputField alphaInput;

		public Button resetButton;

		public void SliderSetR(float newR)
		{
			redInput.SetTextWithoutNotify(((int)((double)red.normalizedValue * 255.0)).ToString());
			SetColor();
		}

		public void SliderSetG(float newG)
		{
			greenInput.SetTextWithoutNotify(((int)((double)green.normalizedValue * 255.0)).ToString());
			SetColor();
		}

		public void SliderSetB(float newB)
		{
			blueInput.SetTextWithoutNotify(((int)((double)blue.normalizedValue * 255.0)).ToString());
			SetColor();
		}

		public void SliderSetA(float newA)
		{
			alphaInput.SetTextWithoutNotify(((int)((double)alpha.normalizedValue * 255.0)).ToString());
			SetColor();
		}

		public void SetColor()
		{
			SetColor(red.value, green.value, blue.value, alpha.value);
		}

		public void SetColor(float newR, float newG, float newB, float newA)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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)
			((Graphic)image).color = new Color(newR, newG, newB);
			float num = (((double)Vector3.Dot(Vector3.one, new Vector3(newR, newG, newB)) / 3.0 < 0.9) ? 1f : 0.7f);
			((Graphic)metallicPreview).color = new Color(num, num, num, newA);
		}
	}
	[AttributeUsage(AttributeTargets.Field)]
	public class PrefabAsset : Attribute
	{
		public string Path { get; }

		public PrefabAsset(string path = "")
		{
			Path = path;
		}
	}
	public static class SliderExtensions
	{
		public static void SetNormalizedValueWithoutNotify(this Slider slider, float normalized)
		{
			slider.SetValueWithoutNotify(slider.minValue + normalized * (slider.maxValue - slider.minValue));
		}
	}
}
namespace HandPaint.Patches
{
	[HarmonyPatch(typeof(RevolverAnimationReceiver))]
	public class RevolverAnimationReceiverPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(RevolverAnimationReceiver), "Start")]
		public static bool RevolverAnimationReceiver_Start_Prefix(RevolverAnimationReceiver __instance)
		{
			((Component)((Component)__instance).transform.Find("RightArm")).gameObject.AddComponent<ColoredFeedbackerR>();
			return true;
		}
	}
	[HarmonyPatch(typeof(HookArm))]
	public class HookArmPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(HookArm), "Start")]
		public static void HookArm_Start_Postfix(HookArm __instance)
		{
			((Component)__instance).gameObject.AddComponent<ColoredWhiplash>();
		}
	}
	[HarmonyPatch(typeof(Punch))]
	public class PunchPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Punch), "Awake")]
		public static void Punch_Awake_Postfix(Punch __instance, SkinnedMeshRenderer ___smr)
		{
			if (((Object)__instance).name.StartsWith("Arm Red"))
			{
				((Component)__instance).gameObject.AddComponent<ColoredKnuckleblaster>().shell = __instance.shell;
			}
			else if (((Object)__instance).name.StartsWith("Arm Blue"))
			{
				((Component)__instance).gameObject.AddComponent<ColoredFeedbacker>();
			}
			else
			{
				Debug.LogWarning((object)"GameObject has a Punch component but it's neither blue nor red hand");
			}
		}
	}
}
namespace HandPaint.Components
{
	public abstract class AbstractColoredArm : MonoBehaviour
	{
		protected static readonly int IdTex = Shader.PropertyToID("_IDTex");

		protected static readonly int Cube = Shader.PropertyToID("_Cube");

		protected static readonly int[] ColorProperties = new int[3]
		{
			Shader.PropertyToID("_CustomColor1"),
			Shader.PropertyToID("_CustomColor2"),
			Shader.PropertyToID("_CustomColor3")
		};

		protected Shader CustomColorsShader;

		protected MaterialPropertyBlock MaterialBlock;

		private readonly ColorValueChangeEventDelegate[] _colorHandlers = (ColorValueChangeEventDelegate[])(object)new ColorValueChangeEventDelegate[3];

		private bool _skittlesPoxActive;

		private Color _skittlesPoxValue = new Color(1f, 0f, 0f, 1f);

		private SkittlesPox _skittlesPox;

		protected void Start()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			_skittlesPox = MonoSingleton<SkittlesPox>.Instance;
			MaterialBlock = new MaterialPropertyBlock();
			CustomColorsShader = Addressables.LoadAssetAsync<Shader>((object)"Assets/Shaders/Special/ULTRAKILL-vertexlit-customcolors-emissive.shader").WaitForCompletion();
			BindHandlers();
			HandPaintConfig.EnableRepaint.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent v)
			{
				if (v.value)
				{
					Repaint();
				}
				else
				{
					RestoreVanillaMaterials();
				}
			};
		}

		private void FixedUpdate()
		{
			//IL_008a: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			if (!_skittlesPox.activated)
			{
				if (_skittlesPoxActive)
				{
					_skittlesPoxActive = false;
					BindHandlers();
				}
				return;
			}
			if (!_skittlesPoxActive)
			{
				UnbindHandlers();
				_skittlesPoxActive = true;
				return;
			}
			for (int i = 0; i < 3; i++)
			{
				float num = (_skittlesPox.hue + Time.fixedDeltaTime * HandPaintConfig.EasterEggConfig.Frequency.value / 60f + HandPaintConfig.EasterEggConfig.Phases[i].value) % 1f;
				_skittlesPoxValue = Color.HSVToRGB(num, 1f, 1f);
				MaterialBlock.SetColor(ColorProperties[i], _skittlesPoxValue);
				SetPropertyBlock();
			}
			DateTimeOffset.Now.ToUnixTimeMilliseconds();
		}

		protected void BindHandlers()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			ColorAlphaField[] array = ColorFields();
			for (int i = 0; i < 3; i++)
			{
				int num = i;
				_colorHandlers[i] = (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent v)
				{
					//IL_0018: Unknown result type (might be due to invalid IL or missing references)
					MaterialBlock.SetColor(ColorProperties[num], v.value);
					SetPropertyBlock();
				};
				array[i].onValueChange += _colorHandlers[i];
				array[i].TriggerValueChangeEvent();
			}
		}

		protected void UnbindHandlers()
		{
			ColorAlphaField[] array = ColorFields();
			for (int i = 0; i < array.Length; i++)
			{
				array[i].onValueChange -= _colorHandlers[i];
			}
		}

		protected abstract void RestoreVanillaMaterials();

		protected abstract void Repaint();

		protected abstract ColorAlphaField[] ColorFields();

		protected abstract void SetPropertyBlock();

		protected virtual void OnDestroy()
		{
			UnbindHandlers();
		}
	}
	public class ColoredFeedbacker : AbstractColoredArm
	{
		[PrefabAsset("assets/textures/feedbacker_mask.png")]
		private static Texture _mask;

		[PrefabAsset("assets/textures/cube.png")]
		private static Texture _cube;

		private Material _coloredMaterial;

		private Material _originalMaterial;

		private SkinnedMeshRenderer _armRenderer;

		private new void Start()
		{
			_armRenderer = ((Component)((Component)this).transform.GetChild(0).GetChild(1)).GetComponent<SkinnedMeshRenderer>();
			base.Start();
			_originalMaterial = Object.Instantiate<Material>(((Renderer)_armRenderer).material);
			_coloredMaterial = ((Renderer)_armRenderer).material;
			_coloredMaterial.shader = CustomColorsShader;
			MaterialBlock.SetTexture(AbstractColoredArm.IdTex, _mask);
			MaterialBlock.SetTexture(AbstractColoredArm.Cube, _cube);
			SetPropertyBlock();
			HandPaintConfig.EnableRepaint.TriggerValueChangeEvent();
		}

		protected override void RestoreVanillaMaterials()
		{
			if (!((Object)(object)_armRenderer == (Object)null))
			{
				((Renderer)_armRenderer).material = _originalMaterial;
			}
		}

		protected override void Repaint()
		{
			if (!((Object)(object)_armRenderer == (Object)null))
			{
				((Renderer)_armRenderer).material = _coloredMaterial;
			}
		}

		protected override void SetPropertyBlock()
		{
			((Renderer)_armRenderer).SetPropertyBlock(MaterialBlock);
		}

		protected override ColorAlphaField[] ColorFields()
		{
			return HandPaintConfig.FeedbackerColors;
		}
	}
	public class ColoredFeedbackerR : AbstractColoredArm
	{
		[PrefabAsset("assets/textures/feedbacker_mask.png")]
		private static Texture _mask;

		[PrefabAsset("assets/textures/cube.png")]
		private static Texture _cube;

		private Material _coloredMaterial;

		private Material _originalMaterial;

		private SkinnedMeshRenderer _armRenderer;

		private ColorAlphaField[] _colorFields;

		private new void Start()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			_armRenderer = ((Component)((Component)this).transform).GetComponent<SkinnedMeshRenderer>();
			_colorFields = HandPaintConfig.FeedbackerColors;
			base.Start();
			_originalMaterial = Object.Instantiate<Material>(((Renderer)_armRenderer).material);
			_coloredMaterial = ((Renderer)_armRenderer).material;
			_coloredMaterial.shader = CustomColorsShader;
			MaterialBlock.SetTexture(AbstractColoredArm.IdTex, _mask);
			MaterialBlock.SetTexture(AbstractColoredArm.Cube, _cube);
			SetPropertyBlock();
			HandPaintConfig.PaintFeedbackerSeparately.onValueChange += new BoolValueChangeEventDelegate(OnSeparatePaint);
			HandPaintConfig.PaintFeedbackerSeparately.TriggerValueChangeEvent();
			HandPaintConfig.EnableRepaint.TriggerValueChangeEvent();
		}

		public void OnSeparatePaint(BoolValueChangeEvent v)
		{
			UnbindHandlers();
			_colorFields = (v.value ? HandPaintConfig.RightFeedbackerColors : HandPaintConfig.FeedbackerColors);
			BindHandlers();
		}

		protected override void RestoreVanillaMaterials()
		{
			if (!((Object)(object)_armRenderer == (Object)null))
			{
				((Renderer)_armRenderer).material = _originalMaterial;
			}
		}

		protected override void Repaint()
		{
			if (!((Object)(object)_armRenderer == (Object)null))
			{
				((Renderer)_armRenderer).material = _coloredMaterial;
			}
		}

		protected override void SetPropertyBlock()
		{
			((Renderer)_armRenderer).SetPropertyBlock(MaterialBlock);
		}

		protected override ColorAlphaField[] ColorFields()
		{
			return _colorFields;
		}

		protected override void OnDestroy()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			base.OnDestroy();
			HandPaintConfig.PaintFeedbackerSeparately.onValueChange -= new BoolValueChangeEventDelegate(OnSeparatePaint);
		}
	}
	public class ColoredKnuckleblaster : AbstractColoredArm
	{
		[PrefabAsset("assets/textures/knuckleblaster_mask.png")]
		private static Texture _mask;

		[PrefabAsset("assets/textures/shell_mask.png")]
		private static Texture _shellMask;

		[PrefabAsset("assets/textures/cube.png")]
		private static Texture _cube;

		public GameObject shell;

		private Material _coloredArmMaterial;

		private Material _coloredShellMaterial;

		private Material _originalArmMaterial;

		private Material _originalShellMaterial;

		private SkinnedMeshRenderer _armRenderer;

		private MeshRenderer _shellRenderer;

		private new void Start()
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			_armRenderer = ((Component)((Component)this).transform.GetChild(0)).GetComponent<SkinnedMeshRenderer>();
			_shellRenderer = ((Component)shell.transform.GetChild(0)).GetComponent<MeshRenderer>();
			base.Start();
			_originalArmMaterial = Object.Instantiate<Material>(((Renderer)_armRenderer).material);
			_originalShellMaterial = Object.Instantiate<Material>(((Renderer)_shellRenderer).material);
			_coloredArmMaterial = ((Renderer)_armRenderer).material;
			_coloredArmMaterial.shader = CustomColorsShader;
			_coloredShellMaterial = ((Renderer)_shellRenderer).material;
			_coloredShellMaterial.shader = CustomColorsShader;
			((Renderer)_armRenderer).material = _coloredArmMaterial;
			((Renderer)_shellRenderer).material = _coloredShellMaterial;
			MaterialBlock.SetTexture(AbstractColoredArm.IdTex, _mask);
			MaterialBlock.SetTexture(AbstractColoredArm.Cube, _cube);
			((Renderer)_shellRenderer).material.SetTexture(AbstractColoredArm.IdTex, _shellMask);
			SetPropertyBlock();
			HandPaintConfig.KnuckleblasterShellColorField.onValueChange += new ColorValueChangeEventDelegate(OnShellColor);
			HandPaintConfig.KnuckleblasterShellColorField.TriggerValueChangeEvent();
			HandPaintConfig.EnableRepaint.TriggerValueChangeEvent();
		}

		protected override void RestoreVanillaMaterials()
		{
			if (!((Object)(object)_armRenderer == (Object)null) && !((Object)(object)_shellRenderer == (Object)null))
			{
				((Renderer)_armRenderer).material = _originalArmMaterial;
				((Renderer)_shellRenderer).material = _originalShellMaterial;
			}
		}

		protected override void Repaint()
		{
			if (!((Object)(object)_armRenderer == (Object)null) && !((Object)(object)_shellRenderer == (Object)null))
			{
				((Renderer)_armRenderer).material = _coloredArmMaterial;
				((Renderer)_shellRenderer).material = _coloredShellMaterial;
			}
		}

		public void OnShellColor(ColorValueChangeEvent e)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)_shellRenderer).material.SetColor(AbstractColoredArm.ColorProperties[0], e.value);
		}

		protected override void SetPropertyBlock()
		{
			((Renderer)_armRenderer).SetPropertyBlock(MaterialBlock);
		}

		protected override ColorAlphaField[] ColorFields()
		{
			return HandPaintConfig.KnuckleblasterColors;
		}

		protected override void OnDestroy()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			base.OnDestroy();
			HandPaintConfig.KnuckleblasterShellColorField.onValueChange -= new ColorValueChangeEventDelegate(OnShellColor);
		}
	}
	public class ColoredWhiplash : AbstractColoredArm
	{
		[PrefabAsset("assets/textures/whiplash_mask.png")]
		private static Texture _mask;

		[PrefabAsset("assets/textures/cube.png")]
		private static Texture _cube;

		private Material _coloredMaterial;

		private Material _originalMaterial;

		private Color _originalRopeColor;

		private SkinnedMeshRenderer _armRenderer;

		private SkinnedMeshRenderer _hookRenderer;

		private LineRenderer _ropeRenderer;

		private new void Start()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Expected O, but got Unknown
			_armRenderer = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).GetComponent<SkinnedMeshRenderer>();
			_hookRenderer = ((Component)((Component)this).transform.GetChild(0).GetChild(2)).GetComponent<SkinnedMeshRenderer>();
			_ropeRenderer = ((Component)((Component)this).transform).GetComponent<LineRenderer>();
			base.Start();
			Color startColor = _ropeRenderer.startColor;
			_originalMaterial = Object.Instantiate<Material>(((Renderer)_armRenderer).material);
			_originalRopeColor = new Color(startColor.r, startColor.g, startColor.b);
			_coloredMaterial = ((Renderer)_armRenderer).material;
			_coloredMaterial.shader = CustomColorsShader;
			((Renderer)_hookRenderer).material = _coloredMaterial;
			MaterialBlock.SetTexture(AbstractColoredArm.IdTex, _mask);
			MaterialBlock.SetTexture(AbstractColoredArm.Cube, _cube);
			SetPropertyBlock();
			HandPaintConfig.WhiplashRopeColorField.onValueChange += new ColorValueChangeEventDelegate(OnRopeColor);
			HandPaintConfig.WhiplashRopeColorField.TriggerValueChangeEvent();
			HandPaintConfig.EnableRepaint.TriggerValueChangeEvent();
		}

		protected override void RestoreVanillaMaterials()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_armRenderer == (Object)null) && !((Object)(object)_hookRenderer == (Object)null))
			{
				((Renderer)_armRenderer).material = _originalMaterial;
				((Renderer)_hookRenderer).material = _originalMaterial;
				_ropeRenderer.startColor = _originalRopeColor;
				_ropeRenderer.endColor = _originalRopeColor;
			}
		}

		protected override void Repaint()
		{
			//IL_004a: 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)
			if (!((Object)(object)_armRenderer == (Object)null) && !((Object)(object)_hookRenderer == (Object)null))
			{
				((Renderer)_armRenderer).material = _coloredMaterial;
				((Renderer)_hookRenderer).material = _coloredMaterial;
				_ropeRenderer.startColor = HandPaintConfig.WhiplashRopeColorField.Value;
				_ropeRenderer.endColor = HandPaintConfig.WhiplashRopeColorField.Value;
			}
		}

		public void OnRopeColor(ColorValueChangeEvent e)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			_ropeRenderer.startColor = e.value;
			_ropeRenderer.endColor = e.value;
		}

		protected override void SetPropertyBlock()
		{
			((Renderer)_armRenderer).SetPropertyBlock(MaterialBlock);
			((Renderer)_hookRenderer).SetPropertyBlock(MaterialBlock);
		}

		protected override void OnDestroy()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			base.OnDestroy();
			HandPaintConfig.WhiplashRopeColorField.onValueChange -= new ColorValueChangeEventDelegate(OnRopeColor);
		}

		protected override ColorAlphaField[] ColorFields()
		{
			return HandPaintConfig.WhiplashColors;
		}
	}
	public class SkittlesPox : MonoSingleton<SkittlesPox>
	{
		private static readonly List<string> Tantrums = new List<string>
		{
			"<color=red>YOU SHOULDN'T HAVE TASTED THE RAINBOW FROM AN UNRELIABLE DEALER</color>\nYou are now infected with <color=red>S</color><color=orange>K</color><color=yellow>I</color><color=green>T</color><color=#00ffff>T</color><color=blue>L</color><color=purple>E</color><color=red>S</color> POX", "<color=red>HA-HA, YOU WISH!</color>\nYOU CAN ONLY CURE <color=red>S</color><color=orange>K</color><color=yellow>I</color><color=green>T</color><color=#00ffff>T</color><color=blue>L</color><color=purple>E</color><color=red>S</color> POX BY RESTARTING!", "Maybe I didn't make myself clear.\nYou can only cure <color=red>S</color><color=orange>K</color><color=yellow>I</color><color=green>T</color><color=#00ffff>T</color><color=blue>L</color><color=purple>E</color><color=red>S</color> pox by restarting the scene.", "Hello? Nothing happens until you restart the scene!", "You know what? You're right, I shouldn't have used such a demanding tone with you. It's just...", "...it would be really cool if you just restarted the scene instead. How does that sound?", "...okay, let's take another approach.\n¡Solo puedes curar la viruela de Skittles reiniciando la escena!", "¿No hablas español? All right, let's see...", "Вылечить скитлстрянку можно только перезагрузив сцену!", "Skittles poxu se můžeš zbavit pouze restartováním scény!",
			"Okay, you're either really dumb or really curious", "And I'm, like, 95% positive you're just dumb", "Maybe 85%, but the point stands", "All I know you're 100% getting on my nerves!", "Look, I'm not even telling you to accept the consequences of your actions. I've literally just told you how to fix this! RESTART THE SCENE!", "<color=red>TYPE IT IN ONE MORE TIME, I DARE YOU! THEN WE WILL SEE HOW MUCH BLOOD THIS LITTLE BLUE BODY OF YOURS CAN FIT!</color>", "..."
		};

		private const string Skittles = "<color=red>S</color><color=orange>K</color><color=yellow>I</color><color=green>T</color><color=#00ffff>T</color><color=blue>L</color><color=purple>E</color><color=red>S</color>";

		private List<KeyControl> _easterSequence;

		public bool activated;

		public float hue;

		private int _sequenceIndex;

		private int _tantrumIndex;

		protected IEnumerator Start()
		{
			SceneManager.sceneLoaded += delegate
			{
				activated = false;
				HandPaintConfig.EnableRepaint.TriggerValueChangeEvent();
			};
			yield return ((MonoBehaviour)this).StartCoroutine(WaitForTheKeyboard());
			_easterSequence = new List<KeyControl>
			{
				Keyboard.current.digit0Key,
				Keyboard.current.digit4Key,
				Keyboard.current.digit5Key,
				Keyboard.current.digit1Key
			};
		}

		private void Update()
		{
			if (!HandPaintConfig.EnableRepaint.value || Keyboard.current == null || !((ButtonControl)Keyboard.current.anyKey).wasPressedThisFrame)
			{
				return;
			}
			if (_easterSequence != null && ((ButtonControl)_easterSequence[_sequenceIndex]).wasPressedThisFrame)
			{
				_sequenceIndex++;
				if (_sequenceIndex != _easterSequence.Count)
				{
					return;
				}
				_sequenceIndex = 0;
				if (_tantrumIndex < Tantrums.Count)
				{
					if (_tantrumIndex == 0)
					{
						activated = true;
						HandPaintConfig.EnableRepaint.TriggerValueChangeEvent();
					}
					DisplayMessage(Tantrums[_tantrumIndex]);
					_tantrumIndex++;
				}
				else
				{
					activated = false;
					HandPaintConfig.EnableRepaint.TriggerValueChangeEvent();
					DisplayMessage("Fine, FINE! IT'S OFF! HAPPY NOW?!\nGET LOST!!!");
					_tantrumIndex = 0;
				}
			}
			else
			{
				_sequenceIndex = 0;
			}
		}

		private void FixedUpdate()
		{
			hue = (hue + Time.fixedDeltaTime * HandPaintConfig.EasterEggConfig.Frequency.value / 60f) % 1f;
		}

		private static IEnumerator WaitForTheKeyboard()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => Keyboard.current != null));
		}

		private static void DisplayMessage(string msg)
		{
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage(msg, "", "", 0, false);
		}
	}
}