Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Better CrossHair v1.0.0
CrosshairReplacement.dll
Decompiled 4 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Microsoft.CodeAnalysis; using On.RoR2.UI; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CrosshairReplacement")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CrosshairReplacement")] [assembly: AssemblyTitle("CrosshairReplacement")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CrosshairReplacement { [BepInPlugin("com.tonpseudo.crosshairreplacement", "CrosshairReplacement", "1.0.0")] public class CrosshairReplacementPlugin : BaseUnityPlugin { private static AssetBundle bundle; private static Sprite customCrosshair; public void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"CrosshairReplacement loaded!"); LoadAssets(); CrosshairManager.UpdateCrosshair += new hook_UpdateCrosshair(ReplaceCrosshair); } private void LoadAssets() { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "crosshairbundle"); bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)bundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load AssetBundle!"); return; } customCrosshair = bundle.LoadAsset<Sprite>("MyCrosshair.png"); if ((Object)(object)customCrosshair == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load MyCrosshair.png!"); } } private void ReplaceCrosshair(orig_UpdateCrosshair orig, CrosshairManager self, CharacterBody targetBody, Vector3 crosshairWorldPosition, Camera uiCamera) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) orig.Invoke(self, targetBody, crosshairWorldPosition, uiCamera); Image[] array = Object.FindObjectsOfType<Image>(true); Image[] array2 = array; foreach (Image val in array2) { if (!((Object)(object)val == (Object)null) && ((Object)val).name.ToLower().Contains("crosshair")) { val.sprite = customCrosshair; ((Graphic)val).color = Color.white; ((Graphic)val).rectTransform.sizeDelta = new Vector2(64f, 64f); } } } } }