Decompiled source of InGameChat v1.0.0

InGameChat/MageArena_InGameChat.dll

Decompiled 2 weeks 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 BepInEx.Logging;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MageArena_InGameChat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MageArena_InGameChat")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ef69ad45-8535-4acc-acd1-961032af1c7d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 MageArena_InGameChat
{
	[BepInPlugin("com.rezarg.magearena.ingamechat", "In-Game Chat", "1.0.0")]
	[BepInProcess("MageArena.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class InGameChat : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <CoMain>d__6 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Expected O, but got Unknown
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: Expected O, but got Unknown
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				case 2:
					<>1__state = -1;
					break;
				case 3:
					<>1__state = -1;
					break;
				}
				GameObject obj = GameObject.Find("Canvas (1)");
				object obj2;
				if (obj == null)
				{
					obj2 = null;
				}
				else
				{
					Transform obj3 = obj.transform.Find("Main");
					obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null);
				}
				GameObject val = (GameObject)obj2;
				object obj4;
				if (obj == null)
				{
					obj4 = null;
				}
				else
				{
					Transform obj5 = obj.transform.Find("TextChat");
					obj4 = ((obj5 != null) ? ((Component)obj5).gameObject : null);
				}
				GameObject val2 = (GameObject)obj4;
				if ((Object)(object)val2 == (Object)null)
				{
					ManualLogSource? logger = Logger;
					if (logger != null)
					{
						logger.LogInfo((object)"TextChatUI not found, retrying...");
					}
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				}
				if ((Object)(object)val == (Object)null)
				{
					ManualLogSource? logger2 = Logger;
					if (logger2 != null)
					{
						logger2.LogInfo((object)"Main UI not found, retrying...");
					}
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 2;
					return true;
				}
				if (val2.activeSelf != !val.activeSelf)
				{
					val2.SetActive(!val.activeSelf);
				}
				if (Input.GetKeyDown((KeyCode)47))
				{
					val2.GetComponentInChildren<TMP_InputField>().ActivateInputField();
				}
				<>2__current = (object)new WaitForEndOfFrame();
				<>1__state = 3;
				return true;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public const string NAME = "In-Game Chat";

		public const string GUID = "com.rezarg.magearena.ingamechat";

		public const string VERSION = "1.0.0";

		public static readonly string modsync = "all";

		public static ManualLogSource? Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			((MonoBehaviour)this).StartCoroutine(CoMain());
			Logger.LogInfo((object)"Plugin In-Game Chat (com.rezarg.magearena.ingamechat) v1.0.0 initialized!");
		}

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