using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CustomCrosshairs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CustomCrosshairs")]
[assembly: AssemblyTitle("CustomCrosshairs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 CustomCrosshairs
{
[BepInPlugin("com.cheekyentity.customcrosshairs", "Custom Crosshairs", "1.0.0")]
[BepInProcess("MageArena.exe")]
public class EnhancedPlugin : BaseUnityPlugin
{
public enum CrosshairShape
{
Dot,
Cross,
Circle,
Square,
Diamond,
Plus,
X
}
private static ManualLogSource Logger;
private bool ShowCrosshair = true;
private CrosshairShape CurrentShape = CrosshairShape.Cross;
private Color CrosshairColor = Color.white;
private float CrosshairSize = 20f;
private float CrosshairOpacity = 0.8f;
private bool ShowSettingsPanel;
private Rect PanelRect = new Rect(50f, 50f, 400f, 500f);
private string ConfigPath;
private void Awake()
{
try
{
Logger = ((BaseUnityPlugin)this).Logger;
ConfigPath = Path.Combine(Paths.ConfigPath, "CustomCrosshairs.cfg");
Logger.LogInfo((object)"Custom Crosshairs v1.0.0 loaded successfully!");
Logger.LogInfo((object)"Plugin initialized with the following controls:");
Logger.LogInfo((object)" F1 - Toggle crosshair visibility");
Logger.LogInfo((object)" F2 - Cycle colors");
Logger.LogInfo((object)" F3 - Cycle sizes");
Logger.LogInfo((object)" F4 - Cycle shapes");
Logger.LogInfo((object)" F5 - Open settings panel");
Logger.LogInfo((object)" F6 - Save settings");
Logger.LogInfo((object)" F7 - Reset to defaults");
}
catch (Exception ex)
{
ManualLogSource logger = Logger;
if (logger != null)
{
logger.LogError((object)("Failed to initialize plugin: " + ex.Message));
}
ManualLogSource logger2 = Logger;
if (logger2 != null)
{
logger2.LogError((object)("Stack trace: " + ex.StackTrace));
}
}
}
private void Start()
{
try
{
LoadSettings();
Logger.LogInfo((object)"Plugin startup completed successfully");
}
catch (Exception ex)
{
Logger.LogError((object)("Error during plugin startup: " + ex.Message));
}
}
private void Update()
{
try
{
HandleInput();
}
catch (Exception ex)
{
Logger.LogError((object)("Error handling input: " + ex.Message));
}
}
private void OnGUI()
{
try
{
if (ShowCrosshair)
{
RenderCrosshair();
}
if (ShowSettingsPanel)
{
RenderSettingsPanel();
}
}
catch (Exception ex)
{
Logger.LogError((object)("Error during GUI rendering: " + ex.Message));
}
}
private void OnDestroy()
{
try
{
Logger.LogInfo((object)"Plugin shutting down, saving current settings...");
SaveSettings();
Logger.LogInfo((object)"Custom Crosshairs v1.0.0 shutdown complete");
}
catch (Exception ex)
{
ManualLogSource logger = Logger;
if (logger != null)
{
logger.LogError((object)("Error during plugin shutdown: " + ex.Message));
}
}
}
private void HandleInput()
{
if (Input.GetKeyDown((KeyCode)282))
{
ShowCrosshair = !ShowCrosshair;
Logger.LogInfo((object)("Crosshair visibility " + (ShowCrosshair ? "enabled" : "disabled")));
}
if (Input.GetKeyDown((KeyCode)283))
{
CycleColor();
}
if (Input.GetKeyDown((KeyCode)284))
{
CycleSize();
}
if (Input.GetKeyDown((KeyCode)285))
{
CycleShape();
}
if (Input.GetKeyDown((KeyCode)286))
{
ShowSettingsPanel = !ShowSettingsPanel;
Logger.LogInfo((object)("Settings panel " + (ShowSettingsPanel ? "opened" : "closed")));
}
if (Input.GetKeyDown((KeyCode)287))
{
SaveSettings();
}
if (Input.GetKeyDown((KeyCode)288))
{
ResetToDefaults();
}
if (ShowSettingsPanel && Input.GetKeyDown((KeyCode)27))
{
ShowSettingsPanel = false;
Logger.LogInfo((object)"Settings panel closed via ESC key");
}
}
private void RenderCrosshair()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
try
{
float centerX = (float)Screen.width / 2f;
float centerY = (float)Screen.height / 2f;
float crosshairSize = CrosshairSize;
Color crosshairColor = CrosshairColor;
crosshairColor.a = CrosshairOpacity;
GUI.color = crosshairColor;
switch (CurrentShape)
{
case CrosshairShape.Dot:
RenderDot(centerX, centerY, crosshairSize);
break;
case CrosshairShape.Cross:
RenderCross(centerX, centerY, crosshairSize);
break;
case CrosshairShape.Circle:
RenderCircle(centerX, centerY, crosshairSize);
break;
case CrosshairShape.Square:
RenderSquare(centerX, centerY, crosshairSize);
break;
case CrosshairShape.Diamond:
RenderDiamond(centerX, centerY, crosshairSize);
break;
case CrosshairShape.Plus:
RenderPlus(centerX, centerY, crosshairSize);
break;
case CrosshairShape.X:
RenderX(centerX, centerY, crosshairSize);
break;
default:
Logger.LogWarning((object)$"Unknown crosshair shape: {CurrentShape}");
break;
}
GUI.color = Color.white;
}
catch (Exception ex)
{
Logger.LogError((object)("Error rendering crosshair: " + ex.Message));
}
}
private void RenderDot(float centerX, float centerY, float size)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
float num = size / 4f;
GUI.DrawTexture(new Rect(centerX - num, centerY - num, num * 2f, num * 2f), (Texture)(object)Texture2D.whiteTexture);
}
private void RenderCross(float centerX, float centerY, float size)
{
//IL_0028: 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)
float num = size / 2f;
float num2 = Mathf.Max(2f, size / 10f);
GUI.DrawTexture(new Rect(centerX - num, centerY - num2 / 2f, size, num2), (Texture)(object)Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(centerX - num2 / 2f, centerY - num, num2, size), (Texture)(object)Texture2D.whiteTexture);
}
private void RenderCircle(float centerX, float centerY, float size)
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
float num = size / 2f;
float num2 = Mathf.Max(1f, size / 15f);
int num3 = 32;
for (int i = 0; i < num3; i++)
{
float num4 = (float)i / (float)num3 * 2f * MathF.PI;
float num5 = centerX + Mathf.Cos(num4) * num;
float num6 = centerY + Mathf.Sin(num4) * num;
GUI.DrawTexture(new Rect(num5 - num2 / 2f, num6 - num2 / 2f, num2, num2), (Texture)(object)Texture2D.whiteTexture);
}
}
private void RenderSquare(float centerX, float centerY, float size)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
float num = size / 2f;
float num2 = Mathf.Max(1f, size / 15f);
GUI.DrawTexture(new Rect(centerX - num, centerY - num, size, num2), (Texture)(object)Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(centerX - num, centerY + num - num2, size, num2), (Texture)(object)Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(centerX - num, centerY - num, num2, size), (Texture)(object)Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(centerX + num - num2, centerY - num, num2, size), (Texture)(object)Texture2D.whiteTexture);
}
private void RenderDiamond(float centerX, float centerY, float size)
{
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
float num = size / 2f;
float num2 = Mathf.Max(1f, size / 15f);
int num3 = 16;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < num3; j++)
{
float num4 = (float)j / (float)num3;
float num5;
float num6;
switch (i)
{
case 0:
num5 = centerX + num4 * num;
num6 = centerY - (1f - num4) * num;
break;
case 1:
num5 = centerX + (1f - num4) * num;
num6 = centerY + num4 * num;
break;
case 2:
num5 = centerX - num4 * num;
num6 = centerY + (1f - num4) * num;
break;
default:
num5 = centerX - (1f - num4) * num;
num6 = centerY - num4 * num;
break;
}
GUI.DrawTexture(new Rect(num5 - num2 / 2f, num6 - num2 / 2f, num2, num2), (Texture)(object)Texture2D.whiteTexture);
}
}
}
private void RenderPlus(float centerX, float centerY, float size)
{
//IL_0028: 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)
float num = size / 2f;
float num2 = Mathf.Max(3f, size / 8f);
GUI.DrawTexture(new Rect(centerX - num, centerY - num2 / 2f, size, num2), (Texture)(object)Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(centerX - num2 / 2f, centerY - num, num2, size), (Texture)(object)Texture2D.whiteTexture);
}
private void RenderX(float centerX, float centerY, float size)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
_ = size / 2f;
float num = Mathf.Max(2f, size / 12f);
int num2 = 16;
for (int i = 0; i < num2; i++)
{
float num3 = (float)i / (float)(num2 - 1);
float num4 = centerX + (num3 - 0.5f) * size;
float num5 = centerY + (num3 - 0.5f) * size;
GUI.DrawTexture(new Rect(num4 - num / 2f, num5 - num / 2f, num, num), (Texture)(object)Texture2D.whiteTexture);
}
for (int j = 0; j < num2; j++)
{
float num6 = (float)j / (float)(num2 - 1);
float num7 = centerX + (num6 - 0.5f) * size;
float num8 = centerY - (num6 - 0.5f) * size;
GUI.DrawTexture(new Rect(num7 - num / 2f, num8 - num / 2f, num, num), (Texture)(object)Texture2D.whiteTexture);
}
}
private void RenderSettingsPanel()
{
//IL_0003: 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_001e: Expected O, but got Unknown
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
try
{
PanelRect = GUI.Window(0, PanelRect, new WindowFunction(DrawSettingsWindow), "Custom Crosshairs Settings");
}
catch (Exception ex)
{
Logger.LogError((object)("Error rendering settings panel: " + ex.Message));
}
}
private void DrawSettingsWindow(int windowID)
{
try
{
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
bool flag = GUILayout.Toggle(ShowCrosshair, "Enable Crosshair", Array.Empty<GUILayoutOption>());
if (flag != ShowCrosshair)
{
ShowCrosshair = flag;
Logger.LogInfo((object)("Crosshair " + (ShowCrosshair ? "enabled" : "disabled") + " via settings panel"));
}
GUILayout.Space(10f);
GUILayout.Label($"Shape: {CurrentShape}", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Next Shape (F4)", Array.Empty<GUILayoutOption>()))
{
CycleShape();
}
GUILayout.Space(10f);
GUILayout.Label($"Color: R:{CrosshairColor.r:F2} G:{CrosshairColor.g:F2} B:{CrosshairColor.b:F2}", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Next Color (F2)", Array.Empty<GUILayoutOption>()))
{
CycleColor();
}
GUILayout.Space(10f);
GUILayout.Label($"Size: {CrosshairSize:F0} pixels", Array.Empty<GUILayoutOption>());
float num = GUILayout.HorizontalSlider(CrosshairSize, 10f, 50f, Array.Empty<GUILayoutOption>());
if (!Mathf.Approximately(num, CrosshairSize))
{
CrosshairSize = num;
Logger.LogInfo((object)$"Crosshair size adjusted to {CrosshairSize:F0} pixels");
}
GUILayout.Space(10f);
GUILayout.Label($"Opacity: {CrosshairOpacity * 100f:F0}%", Array.Empty<GUILayoutOption>());
float num2 = GUILayout.HorizontalSlider(CrosshairOpacity, 0.1f, 1f, Array.Empty<GUILayoutOption>());
if (!Mathf.Approximately(num2, CrosshairOpacity))
{
CrosshairOpacity = num2;
Logger.LogInfo((object)$"Crosshair opacity adjusted to {CrosshairOpacity * 100f:F0}%");
}
GUILayout.Space(20f);
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Save (F6)", Array.Empty<GUILayoutOption>()))
{
SaveSettings();
}
if (GUILayout.Button("Reset (F7)", Array.Empty<GUILayoutOption>()))
{
ResetToDefaults();
}
if (GUILayout.Button("Close", Array.Empty<GUILayoutOption>()))
{
ShowSettingsPanel = false;
Logger.LogInfo((object)"Settings panel closed via button");
}
GUILayout.EndHorizontal();
GUILayout.Space(20f);
GUILayout.Label("Keyboard Shortcuts:", GUI.skin.label, Array.Empty<GUILayoutOption>());
GUILayout.Label("F1 - Toggle visibility", Array.Empty<GUILayoutOption>());
GUILayout.Label("F2 - Cycle colors", Array.Empty<GUILayoutOption>());
GUILayout.Label("F3 - Cycle sizes", Array.Empty<GUILayoutOption>());
GUILayout.Label("F4 - Cycle shapes", Array.Empty<GUILayoutOption>());
GUILayout.Label("F5 - Toggle this panel", Array.Empty<GUILayoutOption>());
GUILayout.Label("F6 - Save settings", Array.Empty<GUILayoutOption>());
GUILayout.Label("F7 - Reset to defaults", Array.Empty<GUILayoutOption>());
GUILayout.EndVertical();
GUI.DragWindow();
}
catch (Exception ex)
{
Logger.LogError((object)("Error in settings window: " + ex.Message));
}
}
private void CycleColor()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0063: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
try
{
Color[] array = (Color[])(object)new Color[7]
{
Color.white,
Color.red,
Color.green,
Color.blue,
Color.yellow,
Color.cyan,
Color.magenta
};
int num = 0;
for (int i = 0; i < array.Length; i++)
{
if (Vector4.Distance(Color.op_Implicit(CrosshairColor), Color.op_Implicit(array[i])) < 0.1f)
{
num = i;
break;
}
}
int num2 = (num + 1) % array.Length;
CrosshairColor = array[num2];
string colorName = GetColorName(CrosshairColor);
Logger.LogInfo((object)("Crosshair color changed to: " + colorName));
}
catch (Exception ex)
{
Logger.LogError((object)("Error cycling color: " + ex.Message));
}
}
private string GetColorName(Color color)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//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_000b: 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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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_0067: 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_0071: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_00ab: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00d7: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
if (Vector4.Distance(Color.op_Implicit(color), Color.op_Implicit(Color.white)) < 0.1f)
{
return "White";
}
if (Vector4.Distance(Color.op_Implicit(color), Color.op_Implicit(Color.red)) < 0.1f)
{
return "Red";
}
if (Vector4.Distance(Color.op_Implicit(color), Color.op_Implicit(Color.green)) < 0.1f)
{
return "Green";
}
if (Vector4.Distance(Color.op_Implicit(color), Color.op_Implicit(Color.blue)) < 0.1f)
{
return "Blue";
}
if (Vector4.Distance(Color.op_Implicit(color), Color.op_Implicit(Color.yellow)) < 0.1f)
{
return "Yellow";
}
if (Vector4.Distance(Color.op_Implicit(color), Color.op_Implicit(Color.cyan)) < 0.1f)
{
return "Cyan";
}
if (Vector4.Distance(Color.op_Implicit(color), Color.op_Implicit(Color.magenta)) < 0.1f)
{
return "Magenta";
}
return $"RGB({color.r:F2}, {color.g:F2}, {color.b:F2})";
}
private void CycleSize()
{
try
{
float[] array = new float[9] { 10f, 15f, 20f, 25f, 30f, 35f, 40f, 45f, 50f };
int num = 0;
for (int i = 0; i < array.Length; i++)
{
if (Mathf.Abs(CrosshairSize - array[i]) < 1f)
{
num = i;
break;
}
}
int num2 = (num + 1) % array.Length;
CrosshairSize = array[num2];
Logger.LogInfo((object)$"Crosshair size changed to: {CrosshairSize:F0} pixels");
}
catch (Exception ex)
{
Logger.LogError((object)("Error cycling size: " + ex.Message));
}
}
private void CycleShape()
{
try
{
Array values = Enum.GetValues(typeof(CrosshairShape));
int index = (Array.IndexOf(values, CurrentShape) + 1) % values.Length;
CurrentShape = (CrosshairShape)values.GetValue(index);
Logger.LogInfo((object)$"Crosshair shape changed to: {CurrentShape}");
}
catch (Exception ex)
{
Logger.LogError((object)("Error cycling shape: " + ex.Message));
}
}
private void SaveSettings()
{
try
{
Logger.LogInfo((object)"Saving crosshair settings...");
string contents = $"Shape={CurrentShape}\n" + $"ColorR={CrosshairColor.r}\n" + $"ColorG={CrosshairColor.g}\n" + $"ColorB={CrosshairColor.b}\n" + $"Size={CrosshairSize}\n" + $"Opacity={CrosshairOpacity}\n" + $"Enabled={ShowCrosshair}";
string directoryName = Path.GetDirectoryName(ConfigPath);
if (!Directory.Exists(directoryName))
{
Directory.CreateDirectory(directoryName);
Logger.LogInfo((object)("Created configuration directory: " + directoryName));
}
File.WriteAllText(ConfigPath, contents);
Logger.LogInfo((object)("Settings saved successfully to: " + ConfigPath));
}
catch (Exception ex)
{
Logger.LogError((object)("Failed to save settings: " + ex.Message));
Logger.LogError((object)("Config path: " + ConfigPath));
}
}
private void LoadSettings()
{
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: 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_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!File.Exists(ConfigPath))
{
Logger.LogInfo((object)"No configuration file found, using default settings");
return;
}
Logger.LogInfo((object)("Loading settings from: " + ConfigPath));
string[] array = File.ReadAllLines(ConfigPath);
int num = 0;
string[] array2 = array;
foreach (string text in array2)
{
if (string.IsNullOrWhiteSpace(text))
{
continue;
}
string[] array3 = text.Split('=');
if (array3.Length != 2)
{
Logger.LogWarning((object)("Invalid config line format: " + text));
continue;
}
string text2 = array3[0].Trim();
string text3 = array3[1].Trim();
switch (text2)
{
case "Shape":
{
if (Enum.TryParse<CrosshairShape>(text3, out var result3))
{
CurrentShape = result3;
num++;
}
else
{
Logger.LogWarning((object)("Invalid shape value: " + text3));
}
break;
}
case "ColorR":
{
if (float.TryParse(text3, out var result6))
{
Color crosshairColor3 = CrosshairColor;
crosshairColor3.r = Mathf.Clamp01(result6);
CrosshairColor = crosshairColor3;
num++;
}
break;
}
case "ColorG":
{
if (float.TryParse(text3, out var result2))
{
Color crosshairColor = CrosshairColor;
crosshairColor.g = Mathf.Clamp01(result2);
CrosshairColor = crosshairColor;
num++;
}
break;
}
case "ColorB":
{
if (float.TryParse(text3, out var result5))
{
Color crosshairColor2 = CrosshairColor;
crosshairColor2.b = Mathf.Clamp01(result5);
CrosshairColor = crosshairColor2;
num++;
}
break;
}
case "Size":
{
if (float.TryParse(text3, out var result7))
{
CrosshairSize = Mathf.Clamp(result7, 10f, 50f);
num++;
}
else
{
Logger.LogWarning((object)("Invalid size value: " + text3));
}
break;
}
case "Opacity":
{
if (float.TryParse(text3, out var result4))
{
CrosshairOpacity = Mathf.Clamp(result4, 0.1f, 1f);
num++;
}
else
{
Logger.LogWarning((object)("Invalid opacity value: " + text3));
}
break;
}
case "Enabled":
{
if (bool.TryParse(text3, out var result))
{
ShowCrosshair = result;
num++;
}
else
{
Logger.LogWarning((object)("Invalid enabled value: " + text3));
}
break;
}
default:
Logger.LogWarning((object)("Unknown config key: " + text2));
break;
}
}
Logger.LogInfo((object)$"Successfully loaded {num} settings from configuration file");
}
catch (Exception ex)
{
Logger.LogError((object)("Failed to load settings: " + ex.Message));
Logger.LogWarning((object)"Using default settings instead");
}
}
private void ResetToDefaults()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
try
{
Logger.LogInfo((object)"Resetting crosshair settings to defaults...");
CurrentShape = CrosshairShape.Cross;
CrosshairColor = Color.white;
CrosshairSize = 20f;
CrosshairOpacity = 0.8f;
ShowCrosshair = true;
SaveSettings();
Logger.LogInfo((object)"All settings have been reset to defaults successfully!");
}
catch (Exception ex)
{
Logger.LogError((object)("Failed to reset settings to defaults: " + ex.Message));
}
}
}
internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.cheekyentity.customcrosshairs";
public const string PLUGIN_NAME = "Custom Crosshairs";
public const string PLUGIN_VERSION = "1.0.0";
}
}