Decompiled source of Ash ChatTweaks v1.0.0

plugin/Ash_ChatTweaks.dll

Decompiled 3 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 RoR2;
using RoR2.UI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Ash_ChatTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ash_ChatTweaks")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fddc0f3c-f6ee-48c6-bb66-4c95e5a66a43")]
[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 Ash_ChatTweaks;

[BepInPlugin("Ashen_O.Ash_ChatTweaks", "Ash_ChatTweaks", "1.0.0")]
public class Ash_ChatTweaks : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <SetChatHeightLoop>d__3 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public float height;

		public Ash_ChatTweaks <>4__this;

		private ChatBox <chatBox>5__1;

		private RectTransform <rect>5__2;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<chatBox>5__1 = null;
			<rect>5__2 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<chatBox>5__1 = null;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if ((Object)(object)<chatBox>5__1 == (Object)null)
			{
				<chatBox>5__1 = Object.FindObjectOfType<ChatBox>();
				if ((Object)(object)<chatBox>5__1 != (Object)null)
				{
					<rect>5__2 = ((Component)<chatBox>5__1).GetComponent<RectTransform>();
					if ((Object)(object)<rect>5__2 != (Object)null)
					{
						<rect>5__2.sizeDelta = new Vector2(<rect>5__2.sizeDelta.x, height);
						Debug.Log((object)$"[Ash][ChatTweaks] Chat resized to {height}");
						SceneDirector.onPostPopulateSceneServer += <>4__this.OnScenePopulated;
					}
					return false;
				}
				Debug.Log((object)"[Ash][ChatTweaks] ChatBox not found yet, retrying in 1 second...");
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			}
			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();
		}
	}

	private void Awake()
	{
		Run.onRunStartGlobal += OnRunStart;
	}

	private void OnRunStart(Run run)
	{
		Debug.Log((object)"[Ash][ChatTweaks] New run started, ready to resize chat.");
		SceneDirector.onPostPopulateSceneServer += OnScenePopulated;
	}

	private void OnScenePopulated(SceneDirector director)
	{
		((MonoBehaviour)this).StartCoroutine(SetChatHeightLoop(200f));
	}

	[IteratorStateMachine(typeof(<SetChatHeightLoop>d__3))]
	private IEnumerator SetChatHeightLoop(float height)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <SetChatHeightLoop>d__3(0)
		{
			<>4__this = this,
			height = height
		};
	}
}