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 PauseMenuImages v2.1.5
plugins/PauseMenuImages/PauseMenuImages.dll
Decompiled 4 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; 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("PauseMenuImages")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PauseMenuImages")] [assembly: AssemblyTitle("PauseMenuImages")] [assembly: AssemblyVersion("1.0.0.0")] namespace PauseMenuImages; [BepInPlugin("com.yourname.pausemenuimages", "Pause Menu Images", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PauseMenuImagesMod : BaseUnityPlugin { [CompilerGenerated] private sealed class <AnimateImageSlideUp>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RectTransform rectTransform; public Vector2 targetPosition; public float duration; public PauseMenuImagesMod <>4__this; private float <elapsedTime>5__1; private Vector2 <startPosition>5__2; private float <t>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimateImageSlideUp>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //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) //IL_0096: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <elapsedTime>5__1 = 0f; <startPosition>5__2 = rectTransform.anchoredPosition; break; case 1: <>1__state = -1; break; } if (<elapsedTime>5__1 < duration) { <elapsedTime>5__1 += Time.deltaTime; <t>5__3 = <elapsedTime>5__1 / duration; <t>5__3 = 1f - (1f - <t>5__3) * (1f - <t>5__3); rectTransform.anchoredPosition = Vector2.Lerp(<startPosition>5__2, targetPosition, <t>5__3); <>2__current = null; <>1__state = 1; return true; } rectTransform.anchoredPosition = targetPosition; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Texture2D leftImageTexture; private Texture2D rightImageTexture; private bool imagesLoaded = false; public static ConfigEntry<bool> enableAnimation; public static ConfigEntry<float> configPosXLeft; public static ConfigEntry<float> configPosYLeft; public static ConfigEntry<float> configWidthLeft; public static ConfigEntry<float> configHeightLeft; public static ConfigEntry<float> configPosXRight; public static ConfigEntry<float> configPosYRight; public static ConfigEntry<float> configWidthRight; public static ConfigEntry<float> configHeightRight; public void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Pause Menu Images Mod loaded!"); InitializeConfig(); LoadImages(); } private void InitializeConfig() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0218: 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_0234: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Expected O, but got Unknown //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Expected O, but got Unknown //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Expected O, but got Unknown //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Expected O, but got Unknown //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Expected O, but got Unknown //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Expected O, but got Unknown //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Expected O, but got Unknown //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Expected O, but got Unknown //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Expected O, but got Unknown //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Expected O, but got Unknown //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown enableAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Slide up with Pause", true, "Enable the slide-up animation when pause menu appears"); configPosXLeft = ((BaseUnityPlugin)this).Config.Bind<float>("Left Image", "Position X", -400f, "Horizontal position of left image (negative = more left, positive = more right)"); configPosYLeft = ((BaseUnityPlugin)this).Config.Bind<float>("Left Image", "Position Y", 0f, "Vertical position of left image (negative = more down, positive = more up)"); configWidthLeft = ((BaseUnityPlugin)this).Config.Bind<float>("Left Image", "Width", 800f, new ConfigDescription("Width of left image in pixels", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 2000f), Array.Empty<object>())); configHeightLeft = ((BaseUnityPlugin)this).Config.Bind<float>("Left Image", "Height", 1080f, new ConfigDescription("Height of left image in pixels", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 2000f), Array.Empty<object>())); configPosXRight = ((BaseUnityPlugin)this).Config.Bind<float>("Right Image", "Position X", 400f, "Horizontal position of right image (negative = more left, positive = more right)"); configPosYRight = ((BaseUnityPlugin)this).Config.Bind<float>("Right Image", "Position Y", 0f, "Vertical position of right image (negative = more down, positive = more up)"); configWidthRight = ((BaseUnityPlugin)this).Config.Bind<float>("Right Image", "Width", 800f, new ConfigDescription("Width of right image in pixels", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 2000f), Array.Empty<object>())); configHeightRight = ((BaseUnityPlugin)this).Config.Bind<float>("Right Image", "Height", 1080f, new ConfigDescription("Height of right image in pixels", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 2000f), Array.Empty<object>())); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableAnimation)); ModSettingsManager.AddOption((BaseOption)new SliderOption(configPosXLeft, new SliderConfig { min = -960f, max = 960f, FormatString = "{0:0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(configPosYLeft, new SliderConfig { min = -540f, max = 540f, FormatString = "{0:0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(configWidthLeft, new SliderConfig { min = 10f, max = 2000f, FormatString = "{0:0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(configHeightLeft, new SliderConfig { min = 10f, max = 2000f, FormatString = "{0:0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(configPosXRight, new SliderConfig { min = -960f, max = 960f, FormatString = "{0:0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(configPosYRight, new SliderConfig { min = -540f, max = 540f, FormatString = "{0:0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(configWidthRight, new SliderConfig { min = 10f, max = 2000f, FormatString = "{0:0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(configHeightRight, new SliderConfig { min = 10f, max = 2000f, FormatString = "{0:0}" })); } } public void Update() { if (imagesLoaded && PauseManager.isPaused) { CheckForPauseMenu(); } } private void CheckForPauseMenu() { bool flag = false; bool flag2 = false; GameObject[] array = Object.FindObjectsOfType<GameObject>(); GameObject[] array2 = array; foreach (GameObject val in array2) { if (((Object)val).name.Contains("SettingsPanel") && val.activeInHierarchy) { flag = true; } if (((Object)val).name.Contains("LogbookMenu") && val.activeInHierarchy) { flag2 = true; } } GameObject[] array3 = array; foreach (GameObject val2 in array3) { if (!(((Object)val2).name == "PauseScreen(Clone)") || !val2.activeInHierarchy) { continue; } Canvas component = val2.GetComponent<Canvas>(); if (!((Object)(object)component != (Object)null)) { continue; } Transform val3 = val2.transform.Find("LeftCustomImage"); Transform val4 = val2.transform.Find("RightCustomImage"); if (flag || flag2) { if ((Object)(object)val3 != (Object)null) { Object.Destroy((Object)(object)((Component)val3).gameObject); } if ((Object)(object)val4 != (Object)null) { Object.Destroy((Object)(object)((Component)val4).gameObject); } } else if ((Object)(object)val3 == (Object)null && (Object)(object)val4 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Adding images to main pause menu"); AddImagesToPauseMenu(val2.transform); } break; } } private void LoadImages() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string filePath = Path.Combine(directoryName, "left_image.png"); leftImageTexture = LoadTexture(filePath); string filePath2 = Path.Combine(directoryName, "right_image.png"); rightImageTexture = LoadTexture(filePath2); if ((Object)(object)leftImageTexture != (Object)null && (Object)(object)rightImageTexture != (Object)null) { imagesLoaded = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Images loaded successfully!"); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load one or both images!"); } } private Texture2D LoadTexture(string filePath) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if (!File.Exists(filePath)) { ((BaseUnityPlugin)this).Logger.LogError((object)("Image not found at: " + filePath)); return null; } byte[] array = File.ReadAllBytes(filePath); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); return val; } private void AddImagesToPauseMenu(Transform parent) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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) ((BaseUnityPlugin)this).Logger.LogInfo((object)"Adding images to pause menu!"); if ((Object)(object)leftImageTexture != (Object)null) { CreateImageObject(parent, leftImageTexture, new Vector2(configPosXLeft.Value, configPosYLeft.Value), new Vector2(configWidthLeft.Value, configHeightLeft.Value), "LeftCustomImage"); } if ((Object)(object)rightImageTexture != (Object)null) { CreateImageObject(parent, rightImageTexture, new Vector2(configPosXRight.Value, configPosYRight.Value), new Vector2(configWidthRight.Value, configHeightRight.Value), "RightCustomImage"); } } private void CreateImageObject(Transform parent, Texture2D texture, Vector2 position, Vector2 size, string name) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_003f: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0090: 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_00a7: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).raycastTarget = false; Sprite sprite = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f)); val2.sprite = sprite; RectTransform component = val.GetComponent<RectTransform>(); if (enableAnimation.Value) { float num = position.y - 50f; component.anchoredPosition = new Vector2(position.x, num); component.sizeDelta = size; ((MonoBehaviour)this).StartCoroutine(AnimateImageSlideUp(component, position, 0.3f)); } else { component.anchoredPosition = position; component.sizeDelta = size; } } [IteratorStateMachine(typeof(<AnimateImageSlideUp>d__20))] private IEnumerator AnimateImageSlideUp(RectTransform rectTransform, Vector2 targetPosition, float duration) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimateImageSlideUp>d__20(0) { <>4__this = this, rectTransform = rectTransform, targetPosition = targetPosition, duration = duration }; } }