using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[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("ToggleMute")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ToggleMute")]
[assembly: AssemblyTitle("ToggleMute")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 PRZ_FishMic
{
[BepInPlugin("com.prz.fishmic", "PRZ - FishMic", "1.1.3")]
[BepInProcess("How to Fish.exe")]
public class Plugin : BaseUnityPlugin
{
private Texture2D micDisabledTex;
private ConfigEntry<KeyboardShortcut> toggleKey;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
Harmony val = new Harmony("com.prz.fishmic");
val.PatchAll();
toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "ToggleKey", new KeyboardShortcut((KeyCode)118, Array.Empty<KeyCode>()), "开关麦克风的按键 / Key to toggle microphone");
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
string text = Path.Combine(directoryName, "mic_disabled.png");
((BaseUnityPlugin)this).Logger.LogInfo((object)("找图片: " + text));
if (File.Exists(text))
{
byte[] array = File.ReadAllBytes(text);
micDisabledTex = new Texture2D(2, 2);
ImageConversion.LoadImage(micDisabledTex, array);
((Texture)micDisabledTex).filterMode = (FilterMode)1;
((BaseUnityPlugin)this).Logger.LogInfo((object)"图标加载成功");
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)("图标不存在: " + text));
}
}
private void Update()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = toggleKey.Value;
if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
{
ToggleMic();
}
}
private void ToggleMic()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected I4, but got Unknown
VoiceInputType voiceInputType = AudioManager.VoiceInputType;
VoiceInputType val = (VoiceInputType)(((int)voiceInputType == 0) ? 2 : 0);
AudioManager.SetAudioInputType(val);
PlayerPrefs.SetInt("AudioInputType", (int)val);
PlayerPrefs.Save();
}
private void OnGUI()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
bool flag = (int)AudioManager.VoiceInputType == 0;
bool flag2 = (int)Cursor.lockState == 1;
if (flag && flag2 && (Object)(object)micDisabledTex != (Object)null)
{
float num = (float)Screen.height / 1080f;
float num2 = 190f * num;
float num3 = 990f * num;
float num4 = 60f * num;
GUI.DrawTexture(new Rect(num2, num3, num4, num4), (Texture)(object)micDisabledTex);
}
}
}
}