Decompiled source of NametagColour v1.0.9

dev.bw.nametag_colour.dll

Decompiled a week ago
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("dev.bw.nametag_colour")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.9.0")]
[assembly: AssemblyInformationalVersion("1.0.9+82260e9d0a36ac47a26cbda02f447736e2934fef")]
[assembly: AssemblyProduct("NametagColour")]
[assembly: AssemblyTitle("dev.bw.nametag_colour")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.9.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 NametagColour
{
	[BepInPlugin("dev.bw.nametag_colour", "NametagColour", "1.0.9")]
	[BepInProcess("REPO.exe")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private static Harmony _hi;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin dev.bw.nametag_colour is loaded!");
			_hi = new Harmony("dev.bw.nametag_colour");
			_hi.PatchAll();
		}

		private void OnDestroy()
		{
			_hi.UnpatchSelf();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "dev.bw.nametag_colour";

		public const string PLUGIN_NAME = "NametagColour";

		public const string PLUGIN_VERSION = "1.0.9";
	}
}
namespace NametagColour.Patches
{
	[HarmonyPatch(typeof(MenuPlayerListed), "Update")]
	public class MenuPlayerPatch
	{
		private static void Postfix(MenuPlayerListed __instance)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			PlayerAvatar playerAvatar = __instance.playerAvatar;
			((Graphic)__instance.playerName).color = playerAvatar.playerAvatarVisuals.color;
			((TMP_Text)__instance.playerName).alpha = (playerAvatar.voiceChat.isTalking ? 1f : 0.5f);
		}
	}
	[HarmonyPatch(typeof(SpectateNameUI), "SetName")]
	public class SpectatePatch
	{
		private static void Postfix(SpectateNameUI __instance, string name)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			PlayerAvatar val = GameDirector.instance.PlayerList.Find((PlayerAvatar x) => x.playerName == name);
			((Graphic)__instance.Text).color = val.playerAvatarVisuals.color;
			((TMP_Text)__instance.Text).alpha = (val.voiceChat.isTalking ? 1f : 0.5f);
		}
	}
	[HarmonyPatch(typeof(WorldSpaceUIPlayerName), "Update")]
	public class WorldUIPatch
	{
		private static void Postfix(WorldSpaceUIPlayerName __instance)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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)
			TextMeshProUGUI text = __instance.text;
			PlayerAvatar playerAvatar = __instance.playerAvatar;
			if (!((Object)(object)text == (Object)null) && !((Object)(object)playerAvatar?.playerAvatarVisuals == (Object)null))
			{
				Color color = ((Graphic)text).color;
				Color color2 = playerAvatar.playerAvatarVisuals.color;
				((Graphic)text).color = new Color(color2.r, color2.g, color2.b, color.a);
			}
		}
	}
}