Decompiled source of FixDeathFade v1.0.1

FixDeathFade.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
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: AssemblyTitle("FixDontBlinkDeathFade")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FixDontBlinkDeathFade")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("90172d8d-1292-4bbd-9583-f86c334beeff")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FixDeathFade;

[BepInPlugin("fix.deathfade", "Fix Death Fade", "1.0.1")]
public class FixDeathFadePlugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("fix.dontblink.deathfade");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"FixDeathFade loaded!");
	}
}
[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
internal class KillPlayerPatch
{
	[CompilerGenerated]
	private sealed class <FixScreenNextFrame>d__1 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		private float <timeout>5__1;

		private float <elapsedTime>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <FixScreenNextFrame>d__1(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = null;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<timeout>5__1 = 5f;
				<elapsedTime>5__2 = 0f;
				break;
			case 2:
				<>1__state = -1;
				break;
			}
			if (((Object)(object)HUDManager.Instance == (Object)null || (Object)(object)HUDManager.Instance.playerScreenTexture == (Object)null) && <elapsedTime>5__2 < <timeout>5__1)
			{
				<elapsedTime>5__2 += Time.deltaTime;
				<>2__current = null;
				<>1__state = 2;
				return true;
			}
			if ((Object)(object)HUDManager.Instance != (Object)null && (Object)(object)HUDManager.Instance.playerScreenTexture != (Object)null)
			{
				((Graphic)HUDManager.Instance.playerScreenTexture).canvasRenderer.SetAlpha(0f);
				Debug.Log((object)"[FixDeathFade] Successfully set playerScreenTexture alpha to 0.");
			}
			else
			{
				Debug.LogWarning((object)"[FixDeathFade] Timeout: playerScreenTexture was still null after waiting.");
			}
			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();
		}
	}

	[HarmonyPostfix]
	private static void Postfix(PlayerControllerB __instance)
	{
		if (!((Object)(object)__instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController) && __instance.isPlayerDead && (Object)(object)HUDManager.Instance != (Object)null)
		{
			((MonoBehaviour)__instance).StartCoroutine(FixScreenNextFrame());
		}
	}

	[IteratorStateMachine(typeof(<FixScreenNextFrame>d__1))]
	private static IEnumerator FixScreenNextFrame()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <FixScreenNextFrame>d__1(0);
	}
}