using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CustomPostProcessingAPI;
using EchoProject.Properties;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Rendering.HighDefinition;
[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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("EchoSense")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+cae25b75a8eb7a927d45b3f3931b09e54afde749")]
[assembly: AssemblyProduct("EchoSense")]
[assembly: AssemblyTitle("EchoSense")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 EchoProject
{
[BepInPlugin("grug.lethalcompany.EchoSense", "EchoSense", "1.0.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class EchoPlugin : BaseUnityPlugin
{
public const string modGuid = "grug.lethalcompany.EchoSense";
public const string modName = "EchoSense";
public static ManualLogSource mls;
public static AssetBundle assetBundle = AssetBundle.LoadFromMemory(Resources.sonarbundle);
public static Material assetMat = assetBundle.LoadAsset<Material>("Assets/fulscreen stuff/FS_Material.mat");
public static FullScreenCustomPass? sonarPass;
public static ConfigEntry<float>? sonarSpeed;
public static ConfigEntry<string>? sonarColor;
public static ConfigEntry<float>? sonarRange;
public static ConfigEntry<bool>? nightmareMode;
public static Hook? hudManagerHook;
public static Hook? startOfRoundHook;
public static Hook? hudManagerUpdateHook;
public void Awake()
{
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Expected O, but got Unknown
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Expected O, but got Unknown
mls = ((BaseUnityPlugin)this).Logger;
assetMat.SetFloat("_Distance", 100f);
sonarSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Sonar settings", "Sonar speed", 15f, "How fast the sonar expands");
sonarColor = ((BaseUnityPlugin)this).Config.Bind<string>("Sonar settings", "Sonar Color", "0,9,255", "255,0,0 for red, 0,255,0 for green, 0,0,255 for blue");
sonarRange = ((BaseUnityPlugin)this).Config.Bind<float>("Sonar settings", "Sonar Range", 50f, "How far the sonar goes");
nightmareMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Sonar settings", "Nightmare mode", false, "Only for the brave hearted");
string[] array = sonarColor.Value.Split(',');
int[] array2 = new int[3];
int.TryParse(array[0], out array2[0]);
int.TryParse(array[1], out array2[1]);
int.TryParse(array[2], out array2[2]);
if (nightmareMode.Value)
{
assetMat.SetInt("_Fade", 1);
assetMat.SetFloat("_FadeOffset", -1f);
}
assetMat.SetFloat("_FadeAfter", sonarRange.Value);
assetMat.SetColor("_BorderColor", new Color((float)array2[0] / 255f, (float)array2[1] / 255f, (float)array2[2] / 255f));
hudManagerHook = new Hook((MethodBase)typeof(HUDManager).GetMethod("PingScan_performed", (BindingFlags)2147483647), (Delegate)(Action<Action<HUDManager, CallbackContext>, HUDManager, CallbackContext>)delegate(Action<HUDManager, CallbackContext> original, HUDManager self, CallbackContext context)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
assetMat.SetFloat("_Distance", 0f);
assetMat.SetVector("_Position", Vector4.op_Implicit(((Component)StartOfRound.Instance.localPlayerController).transform.position));
original(self, context);
});
hudManagerUpdateHook = new Hook((MethodBase)typeof(HUDManager).GetMethod("Update", (BindingFlags)2147483647), (Delegate)(Action<Action<HUDManager>, HUDManager>)delegate(Action<HUDManager> original, HUDManager self)
{
if (!StartOfRound.Instance.inShipPhase)
{
assetMat.SetFloat("_Distance", assetMat.GetFloat("_Distance") + Time.deltaTime * sonarSpeed.Value);
}
if (sonarPass != null)
{
((CustomPass)sonarPass).enabled = !StartOfRound.Instance.inShipPhase;
}
original(self);
});
}
private void Start()
{
if (CustomPostProcessingManager.Initialized)
{
DoStuff();
}
else
{
CustomPostProcessingManager.OnLoad += CustomPostProcessingManager_OnLoad;
}
}
private void CustomPostProcessingManager_OnLoad(object sender, EventArgs e)
{
DoStuff();
}
private void DoStuff()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
PostProcess val = new PostProcess("Sonar", assetMat)
{
InjectionType = (InjectionType)6
};
sonarPass = CustomPostProcessingManager.Instance.AddPostProcess(val);
}
}
}
namespace EchoProject.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("EchoProject.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static byte[] sonarbundle
{
get
{
object @object = ResourceManager.GetObject("sonarbundle", resourceCulture);
return (byte[])@object;
}
}
internal Resources()
{
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}