using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using RoR2.HudOverlay;
using TMPro;
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("CustomizableCorruptionMeter")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0ae4fd1b5f8ab4d25d5d8231b07167d49bf78683")]
[assembly: AssemblyProduct("CustomizableCorruptionMeter")]
[assembly: AssemblyTitle("CustomizableCorruptionMeter")]
[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 CustomizableCorruptionMeter
{
[BepInPlugin("InvisibleMan.CustomizableCorruptionMeter", "CustomizableCorruptionMeter", "1.0.3")]
public class CustomizableCorruptionMeter : BaseUnityPlugin
{
public const string PluginGUID = "InvisibleMan.CustomizableCorruptionMeter";
public const string PluginAuthor = "InvisibleMan";
public const string PluginName = "CustomizableCorruptionMeter";
public const string PluginVersion = "1.0.3";
private static ConfigFile conf;
private GameObject overlayPrefab;
private GameObject fillRoot;
public static ConfigEntry<Vector3> Position { get; set; }
public static ConfigEntry<bool> DisableCorruptionText { get; set; }
public static ConfigEntry<float> MeterOpacity { get; set; }
public void Awake()
{
conf = ((BaseUnityPlugin)this).Config;
initializeConfigEntries();
addHooks();
}
private void initializeConfigEntries()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
Position = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Options", "Position", new Vector3(147.3702f, -59.2215f, 1f), "The global position, default value is the center of the screen");
DisableCorruptionText = ((BaseUnityPlugin)this).Config.Bind<bool>("Options", "DisableCorruptionText", true, "Disables the text with corruption percentage");
MeterOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("Options", "MeterOpacity", 0.3f, "Transparency value of the meter: 0 is transparent, 1 is full opacity");
Position.SettingChanged += delegate
{
setOverlayPosition();
};
DisableCorruptionText.SettingChanged += delegate
{
hideCorruptionText();
};
MeterOpacity.SettingChanged += delegate
{
setMeterOpacity();
};
}
private void addHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
VoidSurvivorController.OnEnable += (hook_OnEnable)delegate(orig_OnEnable orig, VoidSurvivorController self)
{
overlayPrefab = self.overlayPrefab;
setOverlayPosition();
orig.Invoke(self);
};
VoidSurvivorController.OnOverlayInstanceAdded += (hook_OnOverlayInstanceAdded)delegate(orig_OnOverlayInstanceAdded orig, VoidSurvivorController self, OverlayController controller, GameObject instance)
{
fillRoot = ((Component)instance.transform.GetChild(0)).gameObject;
hideCorruptionText();
setMeterOpacity();
orig.Invoke(self, controller, instance);
};
}
private void setOverlayPosition()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
overlayPrefab.transform.position = Position.Value;
}
private void hideCorruptionText()
{
((Component)((TMP_Text)fillRoot.GetComponentInChildren<TextMeshProUGUI>()).transform.parent).gameObject.SetActive(!DisableCorruptionText.Value);
}
private void setMeterOpacity()
{
//IL_001b: 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)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
Image[] componentsInChildren = fillRoot.GetComponentsInChildren<Image>();
Image[] array = componentsInChildren;
foreach (Image val in array)
{
((Graphic)val).color = new Color(((Graphic)val).color.r, ((Graphic)val).color.g, ((Graphic)val).color.b, Mathf.Clamp(MeterOpacity.Value, 0f, 1f));
}
}
}
}