using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Gunfiguration;
using HarmonyLib;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using Newtonsoft.Json;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CustomCursor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomCursor")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("825bc8e2-2faf-496c-803c-3f3e31eba1a0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CustomCursor;
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("kleirof.etg.customcursor", "Custom Cursor", "1.0.1")]
public class CustomCursorModule : BaseUnityPlugin
{
public const string GUID = "kleirof.etg.customcursor";
public const string NAME = "Custom Cursor";
public const string VERSION = "1.0.1";
public const string TEXT_COLOR = "#857DF1";
public static CustomCursorModule instance;
public CursorManager cursorManager;
public void Start()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
instance = this;
ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
cursorManager = new CursorManager();
Harmony val = new Harmony("kleirof.etg.customcursor");
val.PatchAll();
}
internal static void Log(string text, string color = "FFFFFF")
{
ETGModConsole.Log((object)("<color=" + color + ">" + text + "</color>"), false);
}
internal void GMStart(GameManager g)
{
Log("Custom Cursor v1.0.1 started successfully.", "#857DF1");
cursorManager.Initialize();
}
}
public static class CustomCursorPatches
{
[HarmonyPatch(typeof(GameCursorController), "DrawCursor")]
public class GameCursorControllerGetShowMouseCursorPatchClass
{
[HarmonyILManipulator]
public static void GameCursorControllerGetShowMouseCursorPatch(ILContext ctx)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_046d: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(ctx);
ILLabel val2 = ctx.DefineLabel();
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall<GameCursorController>(x, "get_showPlayerTwoControllerCursor")
}))
{
val.MarkLabel(val2);
}
val.Index = 0;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Texture>(x, "get_width")
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_1");
}
int index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Texture>(x, "get_height")
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_1");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 3)
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_2");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GameManager>(x, "get_CurrentGameType")
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_3");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall<BraveInput>(x, "GetInstanceForPlayer")
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_4");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<BraveInput>(x, "IsKeyboardAndMouse")
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_5");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f)
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_1");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchNewobj<Color>(x)
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_6");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Texture>(x, "get_width")
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_7");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Texture>(x, "get_height")
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_7");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 12)
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_8");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall<Rect>(x, ".ctor")
}))
{
val.Emit(OpCodes.Ldloc_S, (byte)13);
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_9");
val.Emit(OpCodes.Br, (object)val2);
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Texture>(x, "get_width")
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_10");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Texture>(x, "get_height")
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_10");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 20)
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_11");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f)
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_10");
}
index = val.Index;
val.Index = index + 1;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchNewobj<Color>(x)
}))
{
val.EmitCall<GameCursorControllerGetShowMouseCursorPatchClass>("GameCursorControllerGetShowMouseCursorPatchCall_12");
}
}
private static Texture2D GameCursorControllerGetShowMouseCursorPatchCall_1(Texture2D orig)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Invalid comparison between Unknown and I4
if (CursorManager.instance.customCursorIsOn)
{
if ((int)GameManager.Instance.CurrentGameType == 1 && BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false))
{
return CursorManager.instance.playerTwoCursor;
}
return CursorManager.instance.playerOneCursor;
}
return orig;
}
private static Vector2 GameCursorControllerGetShowMouseCursorPatchCall_2(Vector2 orig)
{
//IL_0056: 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)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Invalid comparison between Unknown and I4
//IL_005a: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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_0040: Unknown result type (might be due to invalid IL or missing references)
if (CursorManager.instance.customCursorIsOn)
{
if ((int)GameManager.Instance.CurrentGameType == 1 && BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false))
{
return CursorManager.instance.playerTwoCursorScale * orig;
}
return CursorManager.instance.playerOneCursorScale * orig;
}
return orig;
}
private static int GameCursorControllerGetShowMouseCursorPatchCall_3(int orig)
{
if (CursorManager.instance.customCursorIsOn)
{
return 1;
}
return orig;
}
private static int GameCursorControllerGetShowMouseCursorPatchCall_4(int orig)
{
if (CursorManager.instance.customCursorIsOn)
{
return 0;
}
return orig;
}
private static bool GameCursorControllerGetShowMouseCursorPatchCall_5(bool orig)
{
if (CursorManager.instance.customCursorIsOn)
{
return true;
}
return orig;
}
private static Color GameCursorControllerGetShowMouseCursorPatchCall_6(Color orig)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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: Invalid comparison between Unknown and I4
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
if (CursorManager.instance.customCursorIsOn)
{
if ((int)GameManager.Instance.CurrentGameType == 1 && BraveInput.GetInstanceForPlayer(1).IsKeyboardAndMouse(false))
{
return CursorManager.instance.playerTwoCursorModulation;
}
return CursorManager.instance.playerOneCursorModulation;
}
return orig;
}
private static Texture2D GameCursorControllerGetShowMouseCursorPatchCall_7(Texture2D orig)
{
if (CursorManager.instance.customCursorIsOn)
{
return CursorManager.instance.playerOneCursor;
}
return orig;
}
private static Vector2 GameCursorControllerGetShowMouseCursorPatchCall_8(Vector2 orig)
{
//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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if (CursorManager.instance.customCursorIsOn)
{
return CursorManager.instance.playerOneCursorScale * orig;
}
return orig;
}
private static void GameCursorControllerGetShowMouseCursorPatchCall_9(Rect screenRect2)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if (CursorManager.instance.customCursorIsOn)
{
Graphics.DrawTexture(screenRect2, (Texture)(object)CursorManager.instance.playerOneCursor, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, CursorManager.instance.playerOneCursorModulation);
}
}
private static Texture2D GameCursorControllerGetShowMouseCursorPatchCall_10(Texture2D orig)
{
if (CursorManager.instance.customCursorIsOn)
{
return CursorManager.instance.playerTwoCursor;
}
return orig;
}
private static Vector2 GameCursorControllerGetShowMouseCursorPatchCall_11(Vector2 orig)
{
//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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if (CursorManager.instance.customCursorIsOn)
{
return CursorManager.instance.playerTwoCursorScale * orig;
}
return orig;
}
private static Color GameCursorControllerGetShowMouseCursorPatchCall_12(Color orig)
{
//IL_001c: 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_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)
if (CursorManager.instance.customCursorIsOn)
{
return CursorManager.instance.playerTwoCursorModulation;
}
return orig;
}
}
public static void EmitCall<T>(this ILCursor iLCursor, string methodName, Type[] parameters = null, Type[] generics = null)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
MethodInfo methodInfo = AccessTools.Method(typeof(T), methodName, parameters, generics);
iLCursor.Emit(OpCodes.Call, (MethodBase)methodInfo);
}
public static T GetFieldInEnumerator<T>(object instance, string fieldNamePattern)
{
return (T)instance.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((FieldInfo f) => f.Name.Contains("$" + fieldNamePattern) || f.Name.Contains("<" + fieldNamePattern + ">") || f.Name == fieldNamePattern)
.GetValue(instance);
}
public static bool TheNthTime(this Func<bool> predict, int n = 1)
{
for (int i = 0; i < n; i++)
{
if (!predict())
{
return false;
}
}
return true;
}
}
public class CursorManager
{
private class CursorDataFile
{
[Serializable]
public class CursorEntry
{
public string name = "";
public string image = "";
}
[Serializable]
public class RGBAModulationEntry
{
public string name = "";
public float[] rgba_modulation = new float[0];
}
public List<CursorEntry> cursors = new List<CursorEntry>();
public List<RGBAModulationEntry> rgba_modulations = new List<RGBAModulationEntry>();
public List<float> scales = new List<float>();
}
private class CursorItem
{
public string name;
public Texture2D texture;
}
private class RGBAModulationItem
{
public string name;
public Color modulation;
}
internal static CursorManager instance;
private Gunfig gunfig;
private const string CustomCursorOnStr = "Custom Cursor On";
private const string PlayerOneCursorStr = "1P Cursor";
private const string PlayerOneCursorModulationStr = "1P Cursor Modulation";
private const string PlayerOneCursorScaleStr = "1P Cursor Scale";
private const string PlayerTwoCursorStr = "2P Cursor";
private const string PlayerTwoCursorModulationStr = "2P Cursor Modulation";
private const string PlayerTwoCursorScaleStr = "2P Cursor Scale";
public bool customCursorIsOn;
public Texture2D playerOneCursor;
public Color playerOneCursorModulation;
public float playerOneCursorScale;
public Texture2D playerTwoCursor;
public Color playerTwoCursorModulation;
public float playerTwoCursorScale;
private List<string> cursorNameList = new List<string>();
private Dictionary<string, CursorItem> registeredCursors = new Dictionary<string, CursorItem>();
private List<string> modulationNameList = new List<string>();
private Dictionary<string, RGBAModulationItem> registeredModulations = new Dictionary<string, RGBAModulationItem>();
private Dictionary<string, float> registeredScales = new Dictionary<string, float>();
private readonly Color defaultModulation = new Color(0.5f, 0.5f, 0.5f, 0.5f);
private Texture2D[] defaultCursors;
private dfGUIManager uiManager;
public CursorManager()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
instance = this;
}
private void SetCustomCursorIsOn(bool value)
{
customCursorIsOn = value;
}
private void SetPlayerOneCursor(Texture2D value)
{
playerOneCursor = value;
}
private void SetPlayerOneCursorModulation(Color value)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
playerOneCursorModulation = value;
}
private void SetPlayerOneCursorScale(float value)
{
playerOneCursorScale = value;
}
private void SetPlayerTwoCursor(Texture2D value)
{
playerTwoCursor = value;
}
private void SetPlayerTwoCursorModulation(Color value)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
playerTwoCursorModulation = value;
}
private void SetPlayerTwoCursorScale(float value)
{
playerTwoCursorScale = value;
}
private string GetUniqueName<T>(Dictionary<string, T> dict, string baseName)
{
if (!dict.ContainsKey(baseName))
{
return baseName;
}
int num = 0;
string text = baseName + "_";
bool flag = false;
foreach (string key in dict.Keys)
{
if (key == baseName || !key.StartsWith(text))
{
continue;
}
string s = key.Substring(text.Length);
if (int.TryParse(s, out var result))
{
flag = true;
if (result > num)
{
num = result;
}
}
}
return flag ? $"{baseName}_{num + 1}" : (baseName + "_1");
}
internal void LoadAllCursorData()
{
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Expected O, but got Unknown
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_0370: Unknown result type (might be due to invalid IL or missing references)
cursorNameList.Clear();
registeredCursors.Clear();
modulationNameList.Clear();
registeredModulations.Clear();
registeredScales.Clear();
defaultCursors = ((Component)GameUIRoot.Instance).GetComponent<GameCursorController>()?.cursors;
if (defaultCursors != null)
{
for (int i = 0; i < defaultCursors.Length; i++)
{
string text = "default" + i;
registeredCursors[text] = new CursorItem
{
name = text,
texture = defaultCursors[i]
};
cursorNameList.Add(text);
}
}
string text2 = "default";
registeredModulations[text2] = new RGBAModulationItem
{
name = text2,
modulation = defaultModulation
};
modulationNameList.Add(text2);
string key = "1";
registeredScales[key] = 1f;
string[] files = Directory.GetFiles(Paths.PluginPath, "*.customcursor", SearchOption.AllDirectories);
string[] array = files;
Color modulation = default(Color);
foreach (string text3 in array)
{
string text4 = File.ReadAllText(text3);
CursorDataFile cursorDataFile = JsonConvert.DeserializeObject<CursorDataFile>(text4);
if (cursorDataFile == null)
{
Debug.LogWarning((object)("Failed to deserialize JSON in file: " + text3));
continue;
}
if (cursorDataFile.cursors != null)
{
foreach (CursorDataFile.CursorEntry cursor in cursorDataFile.cursors)
{
if (!string.IsNullOrEmpty(cursor.name))
{
string text5 = Path.Combine(Path.GetDirectoryName(text3), cursor.image);
if (!File.Exists(text5))
{
Debug.LogWarning((object)("Cursor image not found: " + text5));
continue;
}
byte[] array2 = File.ReadAllBytes(text5);
Texture2D val = new Texture2D(0, 0, (TextureFormat)4, false);
((Texture)val).filterMode = (FilterMode)0;
ImageConversion.LoadImage(val, array2);
string uniqueName = GetUniqueName(registeredCursors, cursor.name);
registeredCursors[uniqueName] = new CursorItem
{
name = uniqueName,
texture = val
};
cursorNameList.Add(uniqueName);
}
}
}
if (cursorDataFile.rgba_modulations != null)
{
foreach (CursorDataFile.RGBAModulationEntry rgba_modulation in cursorDataFile.rgba_modulations)
{
if (rgba_modulation.rgba_modulation != null && rgba_modulation.rgba_modulation.Length >= 3)
{
string baseName = rgba_modulation.name ?? "UnnamedModulation";
string uniqueName2 = GetUniqueName(registeredModulations, baseName);
((Color)(ref modulation))..ctor(rgba_modulation.rgba_modulation[0] / 2f, rgba_modulation.rgba_modulation[1] / 2f, rgba_modulation.rgba_modulation[2] / 2f, (rgba_modulation.rgba_modulation.Length >= 4) ? (rgba_modulation.rgba_modulation[3] / 2f) : 0.5f);
registeredModulations[uniqueName2] = new RGBAModulationItem
{
name = uniqueName2,
modulation = modulation
};
modulationNameList.Add(uniqueName2);
}
}
}
if (cursorDataFile.scales == null)
{
continue;
}
foreach (float scale in cursorDataFile.scales)
{
string key2 = scale.ToString();
if (!registeredScales.ContainsKey(key2))
{
registeredScales[key2] = scale;
}
}
}
Debug.Log((object)$"Loaded cursors: {cursorNameList.Count}, modulations: {modulationNameList.Count}, sizes: {registeredScales.Keys.Count}");
}
private void UpdateCustomCursor(string value = null)
{
if (value == null)
{
value = gunfig.Value("Custom Cursor On");
}
SetCustomCursorIsOn(value == "1");
if (customCursorIsOn)
{
UpdatePlayerOneCursor();
UpdatePlayerOneCursorModulation();
UpdatePlayerOneCursorScale();
UpdatePlayerTwoCursor();
UpdatePlayerTwoCursorModulation();
UpdatePlayerTwoCursorScale();
}
}
private void UpdatePlayerOneCursor(string value = null)
{
if (value == null)
{
value = gunfig.Value("1P Cursor");
}
if (registeredCursors.TryGetValue(value, out var value2))
{
SetPlayerOneCursor(value2.texture);
return;
}
Texture2D[] array = defaultCursors;
SetPlayerOneCursor(((array != null) ? array[0] : null) ?? ((Component)GameUIRoot.Instance).GetComponent<GameCursorController>()?.normalCursor);
}
private void UpdatePlayerOneCursorModulation(string value = null)
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (value == null)
{
value = gunfig.Value("1P Cursor Modulation");
}
if (registeredModulations.TryGetValue(value, out var value2))
{
SetPlayerOneCursorModulation(value2.modulation);
}
else
{
SetPlayerOneCursorModulation(defaultModulation);
}
}
private void UpdatePlayerOneCursorScale(string value = null)
{
if (value == null)
{
value = gunfig.Value("1P Cursor Scale");
}
if (registeredScales.TryGetValue(value, out var value2))
{
SetPlayerOneCursorScale(value2);
}
else
{
SetPlayerOneCursorScale(1f);
}
}
private void UpdatePlayerTwoCursor(string value = null)
{
if (value == null)
{
value = gunfig.Value("2P Cursor");
}
if (registeredCursors.TryGetValue(value, out var value2))
{
SetPlayerTwoCursor(value2.texture);
return;
}
Texture2D[] array = defaultCursors;
SetPlayerTwoCursor(((array != null) ? array[0] : null) ?? ((Component)GameUIRoot.Instance).GetComponent<GameCursorController>()?.normalCursor);
}
private void UpdatePlayerTwoCursorModulation(string value = null)
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (value == null)
{
value = gunfig.Value("2P Cursor Modulation");
}
if (registeredModulations.TryGetValue(value, out var value2))
{
SetPlayerTwoCursorModulation(value2.modulation);
}
else
{
SetPlayerTwoCursorModulation(defaultModulation);
}
}
private void UpdatePlayerTwoCursorScale(string value = null)
{
if (value == null)
{
value = gunfig.Value("2P Cursor Scale");
}
if (registeredScales.TryGetValue(value, out var value2))
{
SetPlayerTwoCursorScale(value2);
}
else
{
SetPlayerTwoCursorScale(1f);
}
}
internal void InitializeGunfig()
{
//IL_0007: 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_0068: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Invalid comparison between Unknown and I4
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Invalid comparison between Unknown and I4
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Invalid comparison between Unknown and I4
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Invalid comparison between Unknown and I4
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Invalid comparison between Unknown and I4
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Invalid comparison between Unknown and I4
gunfig = Gunfig.Get(GunfigHelpers.WithColor("Custom Cursor", Color.white));
float result;
List<string> list = registeredScales.Keys.OrderBy((string key) => float.TryParse(key, out result) ? result : float.MaxValue).ToList();
gunfig.AddToggle("Custom Cursor On", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "开启Custom Cursor" : "Custom Cursor On", (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdateCustomCursor(optionValue);
}, (Update)0);
Gunfig obj = gunfig;
string text = (((int)GameManager.Options.CurrentLanguage == 11) ? "1P光标" : "1P Cursor");
obj.AddScrollBox("1P Cursor", cursorNameList, text, (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdatePlayerOneCursor(optionValue);
}, (List<string>)null, (Update)0);
Gunfig obj2 = gunfig;
text = (((int)GameManager.Options.CurrentLanguage == 11) ? "1P光标颜色" : "1P Cursor Modulation");
obj2.AddScrollBox("1P Cursor Modulation", modulationNameList, text, (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdatePlayerOneCursorModulation(optionValue);
}, (List<string>)null, (Update)0);
Gunfig obj3 = gunfig;
text = (((int)GameManager.Options.CurrentLanguage == 11) ? "1P光标缩放" : "1P Cursor Scale");
obj3.AddScrollBox("1P Cursor Scale", list, text, (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdatePlayerOneCursorScale(optionValue);
}, (List<string>)null, (Update)0);
Gunfig obj4 = gunfig;
text = (((int)GameManager.Options.CurrentLanguage == 11) ? "2P光标" : "2P Cursor");
obj4.AddScrollBox("2P Cursor", cursorNameList, text, (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdatePlayerTwoCursor(optionValue);
}, (List<string>)null, (Update)0);
Gunfig obj5 = gunfig;
text = (((int)GameManager.Options.CurrentLanguage == 11) ? "2P光标颜色" : "2P Cursor Modulation");
obj5.AddScrollBox("2P Cursor Modulation", modulationNameList, text, (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdatePlayerTwoCursorModulation(optionValue);
}, (List<string>)null, (Update)0);
Gunfig obj6 = gunfig;
text = (((int)GameManager.Options.CurrentLanguage == 11) ? "2P光标缩放" : "2P Cursor Scale");
obj6.AddScrollBox("2P Cursor Scale", list, text, (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdatePlayerTwoCursorScale(optionValue);
}, (List<string>)null, (Update)0);
UpdateCustomCursor();
}
internal void Initialize()
{
GameObject obj = GameObject.Find("UI Root");
uiManager = ((obj != null) ? obj.GetComponent<dfGUIManager>() : null);
if ((Object)(object)uiManager == (Object)null)
{
Debug.LogError((object)"DfGUIManager not found.");
}
LoadAllCursorData();
InitializeGunfig();
}
}