Decompiled source of CSCrosshairMod v1.0.0

CrosshairMod.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ComputerysModdingUtilities;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: StraftatMod(true)]
[assembly: AssemblyCompany("CrosshairMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CS Crosshair Mod")]
[assembly: AssemblyTitle("CrosshairMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CrosshairMod
{
	public static class CrosshairConfig
	{
		public static ConfigEntry<float> crosshairSize;

		public static ConfigEntry<float> crosshairGap;

		public static ConfigEntry<float> crosshairThickness;

		public static ConfigEntry<bool> crosshairDot;

		public static ConfigEntry<bool> crosshairOutline;

		public static ConfigEntry<float> crosshairOutlineThickness;

		public static ConfigEntry<bool> crosshairTStyle;

		public static ConfigEntry<byte> crosshairColorR;

		public static ConfigEntry<byte> crosshairColorG;

		public static ConfigEntry<byte> crosshairColorB;

		public static ConfigEntry<byte> crosshairColorA;

		public static ConfigEntry<string> crosshairFromCS;

		public static ConfigEntry<bool> crosshairPreview;

		public static void BindTo(ConfigFile config)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Expected O, but got Unknown
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Expected O, but got Unknown
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Expected O, but got Unknown
			crosshairPreview = config.Bind<bool>("Preview", "Preview", false, new ConfigDescription("Draw crosshair in menu", (AcceptableValueBase)null, Array.Empty<object>()));
			crosshairSize = config.Bind<float>("Style.Sizing", "Size/Length", 2f, new ConfigDescription("Crosshair Size", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 256f), Array.Empty<object>()));
			crosshairGap = config.Bind<float>("Style.Sizing", "Gap", -3f, new ConfigDescription("Crosshair Gap", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-12.7f, 12.7f), Array.Empty<object>()));
			crosshairThickness = config.Bind<float>("Style.Sizing", "Thickness", 1f, new ConfigDescription("Crosshair Thickness", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 6.3f), Array.Empty<object>()));
			crosshairDot = config.Bind<bool>("Style.Features", "Draw Dot", false, new ConfigDescription("Show center dot", (AcceptableValueBase)null, Array.Empty<object>()));
			crosshairOutline = config.Bind<bool>("Style.Features", "Draw Outline", false, new ConfigDescription("Show crosshair outline", (AcceptableValueBase)null, Array.Empty<object>()));
			crosshairOutlineThickness = config.Bind<float>("Style.Features", "Outline Thickness", 1f, new ConfigDescription("Crosshair outline thickness", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>()));
			crosshairTStyle = config.Bind<bool>("Style.Features", "T-Style", false, new ConfigDescription("Use T-style crosshair", (AcceptableValueBase)null, Array.Empty<object>()));
			crosshairColorR = config.Bind<byte>("Style.Color", "Red", byte.MaxValue, new ConfigDescription("Red value of crosshair color", (AcceptableValueBase)(object)new AcceptableValueRange<byte>((byte)0, byte.MaxValue), Array.Empty<object>()));
			crosshairColorG = config.Bind<byte>("Style.Color", "Green", byte.MaxValue, new ConfigDescription("Green value of crosshair color", (AcceptableValueBase)(object)new AcceptableValueRange<byte>((byte)0, byte.MaxValue), Array.Empty<object>()));
			crosshairColorB = config.Bind<byte>("Style.Color", "Blue", byte.MaxValue, new ConfigDescription("Blue value of crosshair color", (AcceptableValueBase)(object)new AcceptableValueRange<byte>((byte)0, byte.MaxValue), Array.Empty<object>()));
			crosshairColorA = config.Bind<byte>("Style.Color", "Alpha", byte.MaxValue, new ConfigDescription("Alpha value of crosshair color", (AcceptableValueBase)(object)new AcceptableValueRange<byte>((byte)0, byte.MaxValue), Array.Empty<object>()));
			crosshairFromCS = config.Bind<string>("Style.Import", "CS Share Code", "CSGO-nCfX7-54ue9-aC5eV-6Womf-Q6izO", new ConfigDescription("CSGO share code", (AcceptableValueBase)null, Array.Empty<object>()));
		}
	}
	public class CrosshairInfo
	{
		public int Style;

		public bool HasCenterDot;

		public float Length;

		public float Thickness;

		public float Gap;

		public bool HasOutline;

		public float Outline;

		public int Red;

		public int Green;

		public int Blue;

		public bool HasAlpha;

		public int Alpha;

		public int SplitDistance;

		public float FixedCrosshairGap;

		public int Color;

		public float InnerSplitAlpha;

		public float OuterSplitAlpha;

		public float SplitSizeRatio;

		public bool IsTStyle;

		public bool DeployedWeaponGapEnabled;

		public bool FollowRecoil;
	}
	public static class CSGOShareCode
	{
		private const string DICTIONARY = "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789";

		private static readonly Regex SHARECODE_PATTERN = new Regex("^CSGO(-?[\\w]{5}){5}$", RegexOptions.Compiled);

		private static readonly int[][] predefinedColors = new int[5][]
		{
			new int[3] { 255, 0, 0 },
			new int[3] { 0, 255, 0 },
			new int[3] { 255, 255, 0 },
			new int[3] { 0, 0, 255 },
			new int[3] { 0, 255, 255 }
		};

		private static int EncodeSignedByte(int value)
		{
			if (value >= 0)
			{
				return value;
			}
			return value + 256;
		}

		private static int CalculateChecksum(List<int> bytes)
		{
			int num = 0;
			for (int i = 1; i < bytes.Count; i++)
			{
				num += bytes[i];
			}
			return num % 256;
		}

		public static string Encode(CrosshairInfo c)
		{
			List<int> list = new List<int>
			{
				0,
				1,
				EncodeSignedByte((int)Math.Round(10f * c.Gap)),
				(int)Math.Floor(2f * c.Outline),
				c.Red,
				c.Green,
				c.Blue,
				c.Alpha,
				(c.SplitDistance & 0x7F) | (c.FollowRecoil ? 128 : 0),
				EncodeSignedByte((int)Math.Round(10f * c.FixedCrosshairGap)),
				(c.Color & 7) | (c.HasOutline ? 8 : 0) | ((int)Math.Round(10f * c.InnerSplitAlpha) << 4),
				((int)Math.Round(10f * c.OuterSplitAlpha) & 0xF) | ((int)Math.Round(10f * c.SplitSizeRatio) << 4),
				(int)Math.Round(10f * c.Thickness),
				((c.Style & 7) << 1) | (c.HasCenterDot ? 16 : 0) | (c.DeployedWeaponGapEnabled ? 32 : 0) | (c.HasAlpha ? 64 : 0) | (c.IsTStyle ? 128 : 0)
			};
			int num = (int)Math.Round(10f * c.Length);
			list.Add(num % 256);
			list.Add((int)Math.Floor((float)num / 256f) & 0x1F);
			list.Add(0);
			list.Add(0);
			list[0] = CalculateChecksum(list);
			BigInteger bigInteger = 0;
			BigInteger bigInteger2 = 1;
			for (int num2 = list.Count - 1; num2 >= 0; num2--)
			{
				bigInteger += list[num2] * bigInteger2;
				bigInteger2 *= (BigInteger)256;
			}
			int length = "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789".Length;
			string text = "";
			for (int i = 0; i < 25; i++)
			{
				BigInteger bigInteger3 = bigInteger % length;
				bigInteger /= (BigInteger)length;
				text += "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789"[(int)bigInteger3];
			}
			return "CSGO-" + text.Substring(0, 5) + "-" + text.Substring(5, 5) + "-" + text.Substring(10, 5) + "-" + text.Substring(15, 5) + "-" + text.Substring(20, 5);
		}

		private static int DecodeSignedByte(int val)
		{
			if (val <= 127)
			{
				return val;
			}
			return val - 256;
		}

		public static CrosshairInfo Decode(string shareCode)
		{
			if (!SHARECODE_PATTERN.IsMatch(shareCode))
			{
				throw new Exception("Invalid share code format");
			}
			char[] array = shareCode.Replace("CSGO-", "").Replace("-", "").Reverse()
				.ToArray();
			BigInteger bigInteger = 0;
			BigInteger bigInteger2 = "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789".Length;
			char[] array2 = array;
			foreach (char c in array2)
			{
				int num = "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789".IndexOf(c);
				if (num == -1)
				{
					throw new Exception($"Invalid character '{c}' in share code");
				}
				bigInteger *= bigInteger2;
				bigInteger += (BigInteger)num;
			}
			int[] array3 = new int[18];
			for (int num2 = 17; num2 >= 0; num2--)
			{
				array3[num2] = (int)(bigInteger % 256);
				bigInteger /= (BigInteger)256;
			}
			int num3 = 0;
			for (int j = 1; j < 18; j++)
			{
				num3 += array3[j];
			}
			if (array3[0] != num3 % 256)
			{
				Debug.LogWarning((object)"Checksum mismatch in share code");
			}
			int num4 = array3[10] & 7;
			int red = array3[4];
			int green = array3[5];
			int blue = array3[6];
			if (num4 != 5)
			{
				if (num4 >= 0 && num4 < predefinedColors.Length)
				{
					red = predefinedColors[num4][0];
					green = predefinedColors[num4][1];
					blue = predefinedColors[num4][2];
				}
				else
				{
					red = 0;
					green = 255;
					blue = 0;
				}
			}
			bool flag = (array3[13] & 0x40) == 64;
			int alpha = (flag ? array3[7] : 200);
			return new CrosshairInfo
			{
				Style = (array3[13] & 0xE) >> 1,
				HasCenterDot = ((array3[13] & 0x10) == 16),
				Length = (float)(((array3[15] & 0x1F) << 8) + array3[14]) / 10f,
				Thickness = (float)(array3[12] & 0x3F) / 10f,
				Gap = (float)DecodeSignedByte(array3[2]) / 10f,
				HasOutline = ((array3[10] & 8) == 8),
				Outline = (float)array3[3] / 2f,
				Red = red,
				Green = green,
				Blue = blue,
				HasAlpha = flag,
				Alpha = alpha,
				SplitDistance = (array3[8] & 0x7F),
				FixedCrosshairGap = (float)DecodeSignedByte(array3[9]) / 10f,
				Color = num4,
				InnerSplitAlpha = (float)((array3[10] >> 4) & 0xF) / 10f,
				OuterSplitAlpha = (float)(array3[11] & 0xF) / 10f,
				SplitSizeRatio = (float)((array3[11] >> 4) & 0xF) / 10f,
				IsTStyle = ((array3[13] & 0x80) == 128),
				DeployedWeaponGapEnabled = ((array3[13] & 0x20) == 32),
				FollowRecoil = ((array3[8] & 0x80) != 0)
			};
		}
	}
	[HarmonyPatch(typeof(Crosshair))]
	public static class CrosshairPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void SetupCrosshair(Crosshair __instance)
		{
			Plugin.CreateCrosshairUI(((Component)__instance).transform.parent);
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		public static void UpdateCrosshair(ref Crosshair __instance)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.queueReload)
			{
				Plugin.UpdateCrosshair();
				Plugin.queueReload = false;
			}
			if ((Object)(object)__instance.player != (Object)null && __instance.canScopeAim && __instance.player.isAiming)
			{
				Plugin.root.SetActive(false);
				return;
			}
			if (!CrosshairConfig.crosshairPreview.Value)
			{
				Scene activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name == "MainMenu")
				{
					Plugin.root.SetActive(false);
					return;
				}
			}
			Plugin.root.SetActive(true);
		}
	}
	[BepInPlugin("CrosshairMod", "CS Crosshair Mod", "1.0.0")]
	[BepInProcess("STRAFTAT.exe")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private static readonly Harmony HarmonyInstance = new Harmony("CrosshairMod");

		public static GameObject root;

		private static Image[] lines;

		private static Image[] outlines;

		private static Image dot;

		private static Image dotOutline;

		public static bool queueReload = true;

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			CrosshairConfig.BindTo(((BaseUnityPlugin)this).Config);
			((BaseUnityPlugin)this).Config.SettingChanged += OnConfigChanged;
			HarmonyInstance.PatchAll();
			Logger.LogInfo((object)"Crosshair Mod Loaded");
		}

		private void OnConfigChanged(object sender, SettingChangedEventArgs e)
		{
			if (e.ChangedSetting == CrosshairConfig.crosshairFromCS)
			{
				CrosshairInfo crosshairInfo = CSGOShareCode.Decode(CrosshairConfig.crosshairFromCS.Value);
				CrosshairConfig.crosshairSize.Value = crosshairInfo.Length;
				CrosshairConfig.crosshairGap.Value = crosshairInfo.Gap;
				CrosshairConfig.crosshairThickness.Value = crosshairInfo.Thickness;
				CrosshairConfig.crosshairDot.Value = crosshairInfo.HasCenterDot;
				CrosshairConfig.crosshairOutline.Value = crosshairInfo.HasOutline;
				CrosshairConfig.crosshairOutlineThickness.Value = crosshairInfo.Outline;
				CrosshairConfig.crosshairTStyle.Value = crosshairInfo.IsTStyle;
				CrosshairConfig.crosshairColorR.Value = Convert.ToByte(crosshairInfo.Red);
				CrosshairConfig.crosshairColorG.Value = Convert.ToByte(crosshairInfo.Green);
				CrosshairConfig.crosshairColorB.Value = Convert.ToByte(crosshairInfo.Blue);
				CrosshairConfig.crosshairColorA.Value = Convert.ToByte(crosshairInfo.Alpha);
			}
			else
			{
				CrosshairInfo c = new CrosshairInfo
				{
					Gap = CrosshairConfig.crosshairGap.Value,
					Length = CrosshairConfig.crosshairSize.Value,
					Thickness = CrosshairConfig.crosshairThickness.Value,
					HasCenterDot = CrosshairConfig.crosshairDot.Value,
					HasOutline = CrosshairConfig.crosshairOutline.Value,
					Outline = CrosshairConfig.crosshairOutlineThickness.Value,
					IsTStyle = CrosshairConfig.crosshairTStyle.Value,
					Red = Convert.ToInt32(CrosshairConfig.crosshairColorR.Value),
					Green = Convert.ToInt32(CrosshairConfig.crosshairColorG.Value),
					Blue = Convert.ToInt32(CrosshairConfig.crosshairColorB.Value),
					Alpha = Convert.ToInt32(CrosshairConfig.crosshairColorA.Value),
					Color = 5,
					HasAlpha = true
				};
				CrosshairConfig.crosshairFromCS.Value = CSGOShareCode.Encode(c);
			}
			UpdateCrosshair();
		}

		public static void UpdateCrosshair()
		{
			//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)
			//IL_0091: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: 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_01ea: 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_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			if (lines == null || outlines == null)
			{
				return;
			}
			float value = CrosshairConfig.crosshairGap.Value;
			float value2 = CrosshairConfig.crosshairSize.Value;
			float value3 = CrosshairConfig.crosshairThickness.Value;
			bool value4 = CrosshairConfig.crosshairDot.Value;
			bool value5 = CrosshairConfig.crosshairOutline.Value;
			float value6 = CrosshairConfig.crosshairOutlineThickness.Value;
			bool value7 = CrosshairConfig.crosshairTStyle.Value;
			Color color = Color32.op_Implicit(new Color32(CrosshairConfig.crosshairColorR.Value, CrosshairConfig.crosshairColorG.Value, CrosshairConfig.crosshairColorB.Value, CrosshairConfig.crosshairColorA.Value));
			RectTransform rectTransform = ((Graphic)lines[0]).rectTransform;
			RectTransform rectTransform2 = ((Graphic)outlines[0]).rectTransform;
			Vector2 anchoredPosition = default(Vector2);
			((Vector2)(ref anchoredPosition))..ctor(0f, value3 / 2f + 5f + value + value2 / 2f);
			rectTransform2.anchoredPosition = anchoredPosition;
			rectTransform.anchoredPosition = anchoredPosition;
			RectTransform rectTransform3 = ((Graphic)lines[1]).rectTransform;
			RectTransform rectTransform4 = ((Graphic)outlines[1]).rectTransform;
			((Vector2)(ref anchoredPosition))..ctor(0f, (0f - value3) / 2f - 5f - value - value2 / 2f);
			rectTransform4.anchoredPosition = anchoredPosition;
			rectTransform3.anchoredPosition = anchoredPosition;
			RectTransform rectTransform5 = ((Graphic)lines[2]).rectTransform;
			RectTransform rectTransform6 = ((Graphic)outlines[2]).rectTransform;
			((Vector2)(ref anchoredPosition))..ctor((0f - value3) / 2f - 5f - value - value2 / 2f, 0f);
			rectTransform6.anchoredPosition = anchoredPosition;
			rectTransform5.anchoredPosition = anchoredPosition;
			RectTransform rectTransform7 = ((Graphic)lines[3]).rectTransform;
			RectTransform rectTransform8 = ((Graphic)outlines[3]).rectTransform;
			((Vector2)(ref anchoredPosition))..ctor(value3 / 2f + 5f + value + value2 / 2f, 0f);
			rectTransform8.anchoredPosition = anchoredPosition;
			rectTransform7.anchoredPosition = anchoredPosition;
			for (int i = 0; i < 4; i++)
			{
				Image obj = lines[i];
				((Graphic)obj).color = color;
				RectTransform rectTransform9 = ((Graphic)obj).rectTransform;
				rectTransform9.sizeDelta = ((i >= 2) ? new Vector2(value2, value3) : new Vector2(value3, value2));
				((Component)outlines[i]).gameObject.SetActive(value5);
				if (value5 && value2 > 0.1f)
				{
					Image obj2 = outlines[i];
					((Graphic)obj2).color = Color.black;
					((Graphic)obj2).rectTransform.sizeDelta = rectTransform9.sizeDelta + new Vector2(value6, value6);
				}
			}
			((Component)lines[0]).gameObject.SetActive(!value7);
			((Component)outlines[0]).gameObject.SetActive(!value7 && value5);
			((Component)dot).gameObject.SetActive(value4);
			((Component)dotOutline).gameObject.SetActive(value5 && value4);
			if (value4)
			{
				((Graphic)dot).color = color;
				((Graphic)dot).rectTransform.sizeDelta = Vector2.one * value3;
				if (value5)
				{
					((Graphic)dotOutline).color = Color.black;
					((Graphic)dotOutline).rectTransform.sizeDelta = ((Graphic)dot).rectTransform.sizeDelta + Vector2.one * value6;
				}
			}
		}

		public static void CreateCrosshairUI(Transform uiRoot = null)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0062: 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_006e: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			root = new GameObject("Crosshair Canvas");
			Canvas val = root.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			val.sortingOrder = 999;
			GameObject val2 = new GameObject("CrosshairGroup");
			val2.transform.SetParent(((Component)val).transform, false);
			RectTransform obj = val2.AddComponent<RectTransform>();
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0.5f, 0.5f);
			obj.anchorMax = val3;
			obj.anchorMin = val3;
			obj.anchoredPosition = Vector2.zero;
			dotOutline = new GameObject("DotOutline").AddComponent<Image>();
			((Component)dotOutline).transform.SetParent(val2.transform, false);
			lines = (Image[])(object)new Image[4];
			outlines = (Image[])(object)new Image[4];
			for (int i = 0; i < 4; i++)
			{
				GameObject val4 = new GameObject("Outline" + i);
				val4.transform.SetParent(val2.transform, false);
				Image val5 = val4.AddComponent<Image>();
				outlines[i] = val5;
				GameObject val6 = new GameObject("Line" + i);
				val6.transform.SetParent(val2.transform, false);
				Image val7 = val6.AddComponent<Image>();
				lines[i] = val7;
			}
			dot = new GameObject("Dot").AddComponent<Image>();
			((Component)dot).transform.SetParent(val2.transform, false);
			UpdateCrosshair();
			if (Object.op_Implicit((Object)(object)uiRoot))
			{
				root.transform.SetParent(uiRoot, false);
			}
			root.transform.localPosition = Vector3.zero;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CrosshairMod";

		public const string PLUGIN_NAME = "CS Crosshair Mod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}