Decompiled source of LobbyName v1.0.7

BepInEx\plugins\LobbyName\LobbyName.dll

Decompiled 8 hours ago
using System;
using System.Collections.Generic;
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 ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
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("Zenoyui")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright (c) 2026 Zenoyui")]
[assembly: AssemblyDescription("Shows the current REPO lobby name on the lobby UI.")]
[assembly: AssemblyFileVersion("1.0.7.0")]
[assembly: AssemblyInformationalVersion("1.0.7")]
[assembly: AssemblyProduct("LobbyName")]
[assembly: AssemblyTitle("LobbyName")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.7.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.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 LobbyName
{
	[BepInPlugin("ru.zenoyui.LobbyName", "Lobby Name", "1.0.7")]
	public sealed class LobbyNamePlugin : BaseUnityPlugin
	{
		private sealed class LobbyNameLoop : MonoBehaviour
		{
			private float _nextRefresh;

			private void Update()
			{
				if (!(Time.unscaledTime < _nextRefresh))
				{
					_nextRefresh = Time.unscaledTime + 0.5f;
					RefreshAll("scanner");
				}
			}
		}

		private static class MenuPageLobbyAwakePatch
		{
			public static void Postfix(object __instance)
			{
				ApplyToLobbyPage(__instance, "Awake");
			}
		}

		private static class MenuPageLobbyStartPatch
		{
			public static void Postfix(object __instance)
			{
				ApplyToLobbyPage(__instance, "Start");
			}
		}

		private static class MenuPageLobbyChatPromptPatch
		{
			public static void Postfix(object __instance)
			{
				ApplyToLobbyPage(__instance, "UpdateChatPrompt");
			}
		}

		private const string HarmonyId = "ru.zenoyui.LobbyName";

		private const string ServerNameProperty = "server_name";

		private const string HudTextObjectName = "LobbyName.RoomNameText";

		private static ManualLogSource Log = null;

		private static Harmony _harmony = null;

		private static Type? _menuPageLobbyType;

		private static FieldInfo? _roomNameTextField;

		private static FieldInfo? _chatPromptTextField;

		private static FieldInfo? _menuPageField;

		private static FieldInfo? _menuHeaderField;

		private static string _lastLoggedText = "";

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			_harmony = new Harmony("ru.zenoyui.LobbyName");
			CacheGameTypes();
			PatchMenuPageLobby();
			GameObject val = new GameObject("LobbyName.Loop");
			Object.DontDestroyOnLoad((Object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<LobbyNameLoop>();
			Log.LogInfo((object)"mod: init (id=ru.zenoyui.LobbyName, ver=1.0.7)");
		}

		private static void CacheGameTypes()
		{
			_menuPageLobbyType = AccessTools.TypeByName("MenuPageLobby");
			_roomNameTextField = Field(_menuPageLobbyType, "roomNameText");
			_chatPromptTextField = Field(_menuPageLobbyType, "chatPromptText");
			_menuPageField = Field(_menuPageLobbyType, "menuPage");
			_menuHeaderField = Field(AccessTools.TypeByName("MenuPage"), "menuHeader");
		}

		private static FieldInfo? Field(Type? type, string name)
		{
			if (!(type == null))
			{
				return AccessTools.Field(type, name);
			}
			return null;
		}

		private static void PatchMenuPageLobby()
		{
			if (_menuPageLobbyType == null)
			{
				Log.LogWarning((object)"type: missing (name=MenuPageLobby, scan=on)");
				return;
			}
			PatchPostfix("MenuPageLobby.Awake", "Awake", "Postfix", typeof(MenuPageLobbyAwakePatch));
			PatchPostfix("MenuPageLobby.Start", "Start", "Postfix", typeof(MenuPageLobbyStartPatch));
			PatchPostfix("MenuPageLobby.UpdateChatPrompt", "UpdateChatPrompt", "Postfix", typeof(MenuPageLobbyChatPromptPatch));
		}

		private static void PatchPostfix(string label, string originalName, string postfixName, Type patchType)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			try
			{
				MethodInfo methodInfo = AccessTools.Method(_menuPageLobbyType, originalName, Array.Empty<Type>(), (Type[])null);
				MethodInfo methodInfo2 = AccessTools.Method(patchType, postfixName, (Type[])null, (Type[])null);
				if (methodInfo == null || methodInfo2 == null)
				{
					Log.LogWarning((object)("patch: missing (target=" + label + ")"));
					return;
				}
				_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				Log.LogInfo((object)("patch: ok (target=" + label + ")"));
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("patch: fail (target=" + label + ", err=" + ex.GetType().Name + ", msg=" + ex.Message + ")"));
			}
		}

		internal static void RefreshAll(string source)
		{
			if (_menuPageLobbyType == null)
			{
				CacheGameTypes();
			}
			if (_menuPageLobbyType == null)
			{
				return;
			}
			Object[] array;
			try
			{
				array = Resources.FindObjectsOfTypeAll(_menuPageLobbyType);
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("scan: fail (type=MenuPageLobby, err=" + ex.GetType().Name + ", msg=" + ex.Message + ")"));
				return;
			}
			Object[] array2 = array;
			foreach (Object obj in array2)
			{
				MonoBehaviour val = (MonoBehaviour)(object)((obj is MonoBehaviour) ? obj : null);
				if (val != null && IsSceneObject(val))
				{
					ApplyToLobbyPage(val, source);
				}
			}
		}

		internal static void ApplyToLobbyPage(object? instance, string source)
		{
			if (instance == null)
			{
				return;
			}
			try
			{
				string lobbyDisplayName = GetLobbyDisplayName();
				if (string.IsNullOrWhiteSpace(lobbyDisplayName))
				{
					return;
				}
				TextMeshProUGUI hudRoomNameText = GetHudRoomNameText(instance);
				if (!((Object)(object)hudRoomNameText == (Object)null))
				{
					object? obj = _roomNameTextField?.GetValue(instance);
					TextMeshProUGUI val = (TextMeshProUGUI)((obj is TextMeshProUGUI) ? obj : null);
					if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)hudRoomNameText)
					{
						((TMP_Text)val).text = lobbyDisplayName;
					}
					PrepareText(hudRoomNameText);
					PositionHudText(instance, hudRoomNameText);
					if (!string.Equals(((TMP_Text)hudRoomNameText).text, lobbyDisplayName, StringComparison.Ordinal))
					{
						((TMP_Text)hudRoomNameText).text = lobbyDisplayName;
					}
					if (!string.Equals(_lastLoggedText, lobbyDisplayName, StringComparison.Ordinal))
					{
						_lastLoggedText = lobbyDisplayName;
						Log.LogInfo((object)("text: set (src=" + source + ", value=" + lobbyDisplayName + ")"));
					}
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("text: fail (src=" + source + ", err=" + ex.GetType().Name + ", msg=" + ex.Message + ")"));
			}
		}

		private static TextMeshProUGUI? GetHudRoomNameText(object instance)
		{
			Component val = (Component)((instance is Component) ? instance : null);
			if (val != null)
			{
				TextMeshProUGUI val2 = FindHudText(val.transform);
				if ((Object)(object)val2 != (Object)null)
				{
					return val2;
				}
			}
			TextMeshProUGUI val3 = AddHudRoomNameText(instance);
			if ((Object)(object)val3 != (Object)null)
			{
				return val3;
			}
			object? obj = _roomNameTextField?.GetValue(instance);
			return (TextMeshProUGUI?)((obj is TextMeshProUGUI) ? obj : null);
		}

		private static TextMeshProUGUI? FindHudText(Transform root)
		{
			TextMeshProUGUI[] componentsInChildren = ((Component)root).GetComponentsInChildren<TextMeshProUGUI>(true);
			foreach (TextMeshProUGUI val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null && ((Object)((Component)val).gameObject).name == "LobbyName.RoomNameText")
				{
					return val;
				}
			}
			return null;
		}

		private static TextMeshProUGUI? AddHudRoomNameText(object instance)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			object? obj = _chatPromptTextField?.GetValue(instance);
			TextMeshProUGUI val = (TextMeshProUGUI)((obj is TextMeshProUGUI) ? obj : null);
			TextMeshProUGUI menuHeader = GetMenuHeader(instance);
			object? obj2 = _roomNameTextField?.GetValue(instance);
			TextMeshProUGUI val2 = (TextMeshProUGUI)((obj2 is TextMeshProUGUI) ? obj2 : null);
			TextMeshProUGUI val3 = (((Object)(object)val != (Object)null) ? val : (((Object)(object)val2 != (Object)null) ? val2 : menuHeader));
			if ((Object)(object)val3 == (Object)null)
			{
				return null;
			}
			Transform obj3 = (((Object)(object)val != (Object)null) ? ((TMP_Text)val).transform.parent : ((TMP_Text)val3).transform.parent);
			RectTransform val4 = (RectTransform)(object)((obj3 is RectTransform) ? obj3 : null);
			if ((Object)(object)val4 == (Object)null)
			{
				return null;
			}
			GameObject val5 = new GameObject("LobbyName.RoomNameText", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(TextMeshProUGUI)
			});
			val5.transform.SetParent((Transform)(object)val4, false);
			TextMeshProUGUI component = val5.GetComponent<TextMeshProUGUI>();
			CopyTextStyle(val3, component);
			PositionBetween(((TMP_Text)component).rectTransform, menuHeader, val, val3);
			((TMP_Text)component).transform.SetAsLastSibling();
			Log.LogInfo((object)"text: add (mode=header-bounds)");
			return component;
		}

		private static TextMeshProUGUI? GetMenuHeader(object instance)
		{
			object obj = _menuPageField?.GetValue(instance);
			object? obj2 = _menuHeaderField?.GetValue(obj);
			return (TextMeshProUGUI?)((obj2 is TextMeshProUGUI) ? obj2 : null);
		}

		private static void CopyTextStyle(TextMeshProUGUI source, TextMeshProUGUI target)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)target).font = ((TMP_Text)source).font;
			((TMP_Text)target).fontSharedMaterial = ((TMP_Text)source).fontSharedMaterial;
			((Graphic)target).color = ((Graphic)source).color;
			((TMP_Text)target).fontSize = ((TMP_Text)source).fontSize;
			((TMP_Text)target).fontSizeMin = Mathf.Min((((TMP_Text)source).fontSizeMin > 0f) ? ((TMP_Text)source).fontSizeMin : 10f, 14f);
			((TMP_Text)target).fontSizeMax = ((TMP_Text)source).fontSize;
			((TMP_Text)target).enableAutoSizing = true;
			((TMP_Text)target).fontStyle = ((TMP_Text)source).fontStyle;
			((TMP_Text)target).alignment = (TextAlignmentOptions)513;
			((TMP_Text)target).characterSpacing = ((TMP_Text)source).characterSpacing;
			((TMP_Text)target).wordSpacing = ((TMP_Text)source).wordSpacing;
			((TMP_Text)target).lineSpacing = ((TMP_Text)source).lineSpacing;
			((TMP_Text)target).paragraphSpacing = ((TMP_Text)source).paragraphSpacing;
			((TMP_Text)target).richText = false;
			((Graphic)target).raycastTarget = false;
			((TMP_Text)target).enableWordWrapping = false;
			((TMP_Text)target).overflowMode = (TextOverflowModes)1;
			((TMP_Text)target).maxVisibleLines = 1;
		}

		private static void PositionBetween(RectTransform target, TextMeshProUGUI? header, TextMeshProUGUI? chatPrompt, TextMeshProUGUI template)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			RectTransform rectTransform = ((TMP_Text)template).rectTransform;
			target.anchorMin = rectTransform.anchorMin;
			target.anchorMax = rectTransform.anchorMax;
			target.pivot = rectTransform.pivot;
			target.sizeDelta = new Vector2(Mathf.Max(rectTransform.sizeDelta.x, 520f), Mathf.Max(new float[3]
			{
				rectTransform.sizeDelta.y,
				((TMP_Text)template).fontSize * 1.7f,
				30f
			}));
			((Transform)target).localScale = ((Transform)rectTransform).localScale;
			((Transform)target).localRotation = ((Transform)rectTransform).localRotation;
			target.anchoredPosition = rectTransform.anchoredPosition;
			PositionFromRenderedHeaderBounds(target, header, chatPrompt);
		}

		private static void PrepareText(TextMeshProUGUI text)
		{
			if (!((Component)text).gameObject.activeSelf)
			{
				((Component)text).gameObject.SetActive(true);
			}
			((Behaviour)text).enabled = true;
			((TMP_Text)text).richText = false;
			((Graphic)text).raycastTarget = false;
			((TMP_Text)text).enableWordWrapping = false;
			((TMP_Text)text).overflowMode = (TextOverflowModes)1;
			((TMP_Text)text).maxVisibleLines = 1;
		}

		private static void PositionHudText(object instance, TextMeshProUGUI text)
		{
			if (!(((Object)((Component)text).gameObject).name != "LobbyName.RoomNameText"))
			{
				RectTransform rectTransform = ((TMP_Text)text).rectTransform;
				TextMeshProUGUI? menuHeader = GetMenuHeader(instance);
				object? obj = _chatPromptTextField?.GetValue(instance);
				PositionFromRenderedHeaderBounds(rectTransform, menuHeader, (TextMeshProUGUI?)((obj is TextMeshProUGUI) ? obj : null));
			}
		}

		private static void PositionFromRenderedHeaderBounds(RectTransform target, TextMeshProUGUI? header, TextMeshProUGUI? chatPrompt)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)header == (Object)null)
			{
				return;
			}
			if (!TryGetRenderedTextWorldBounds(header, out var min, out var max))
			{
				RectTransform rectTransform = ((TMP_Text)header).rectTransform;
				Vector3[] array = (Vector3[])(object)new Vector3[4];
				rectTransform.GetWorldCorners(array);
				min = array[0];
				max = array[2];
			}
			float num = Mathf.Max(1f, max.y - min.y);
			float num2 = (((Object)(object)chatPrompt != (Object)null) ? ((TMP_Text)chatPrompt).fontSize : (((TMP_Text)header).fontSize * 0.22f));
			float num3 = Mathf.Max(num * 0.07f, num2 * 0.45f);
			float num4 = Mathf.Lerp(min.y, max.y, 0.42f);
			if (TryGetRenderedTextWorldBounds(chatPrompt, out var min2, out var max2))
			{
				float num5 = (min.y + max2.y) * 0.5f;
				if (num5 < max.y && num5 > min2.y)
				{
					num4 = num5;
				}
			}
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(max.x + num3, num4, max.z);
			Transform parent = ((Transform)target).parent;
			RectTransform val2 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
			float num6 = Mathf.Max(num2 * 8f, num * 1.6f);
			if ((Object)(object)val2 != (Object)null)
			{
				Vector3 val3 = ((Transform)val2).InverseTransformPoint(val);
				num6 = Mathf.Clamp(Mathf.Abs(((Transform)val2).InverseTransformPoint(new Vector3(GetWorldRight(val2), val.y, val.z)).x - val3.x) - num3, num2 * 8f, num * 3.2f);
				target.anchorMin = new Vector2(0.5f, 0.5f);
				target.anchorMax = new Vector2(0.5f, 0.5f);
				((Transform)target).localPosition = new Vector3(val3.x, val3.y, ((Transform)target).localPosition.z);
			}
			else
			{
				((Transform)target).position = val;
			}
			target.pivot = new Vector2(0f, 0.5f);
			float num7 = Mathf.Max(num2 * 1.7f, num * 0.18f);
			target.sizeDelta = new Vector2(num6, num7);
			TextMeshProUGUI component = ((Component)target).GetComponent<TextMeshProUGUI>();
			if ((Object)(object)component != (Object)null)
			{
				((TMP_Text)component).alignment = (TextAlignmentOptions)513;
				((TMP_Text)component).enableAutoSizing = true;
				((TMP_Text)component).fontSizeMax = num2;
				((TMP_Text)component).fontSizeMin = Mathf.Min(14f, num2 * 0.55f);
			}
		}

		private static bool TryGetRenderedTextWorldBounds(TextMeshProUGUI? text, out Vector3 min, out Vector3 max)
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			min = Vector3.zero;
			max = Vector3.zero;
			if ((Object)(object)text == (Object)null)
			{
				return false;
			}
			try
			{
				((TMP_Text)text).ForceMeshUpdate(true, false);
				Bounds textBounds = ((TMP_Text)text).textBounds;
				if (((Bounds)(ref textBounds)).size.x <= 0f || ((Bounds)(ref textBounds)).size.y <= 0f)
				{
					return false;
				}
				Vector3 val = ((TMP_Text)text).transform.TransformPoint(((Bounds)(ref textBounds)).min);
				Vector3 val2 = ((TMP_Text)text).transform.TransformPoint(((Bounds)(ref textBounds)).max);
				min = Vector3.Min(val, val2);
				max = Vector3.Max(val, val2);
				return true;
			}
			catch
			{
				return false;
			}
		}

		private static float GetWorldRight(RectTransform rectTransform)
		{
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			rectTransform.GetWorldCorners(array);
			float num = array[0].x;
			for (int i = 1; i < array.Length; i++)
			{
				num = Mathf.Max(num, array[i].x);
			}
			return num;
		}

		private static string GetLobbyDisplayName()
		{
			if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null)
			{
				return "";
			}
			string photonRoomProperty = GetPhotonRoomProperty("server_name");
			if (!string.IsNullOrWhiteSpace(photonRoomProperty))
			{
				return CleanLobbyName(photonRoomProperty);
			}
			string dataDirectorString = GetDataDirectorString("networkServerName");
			if (!string.IsNullOrWhiteSpace(dataDirectorString))
			{
				return CleanLobbyName(dataDirectorString);
			}
			return CleanLobbyName(PhotonNetwork.CurrentRoom.Name ?? "");
		}

		private static string GetPhotonRoomProperty(string key)
		{
			try
			{
				Room currentRoom = PhotonNetwork.CurrentRoom;
				Hashtable val = ((currentRoom != null) ? ((RoomInfo)currentRoom).CustomProperties : null);
				if (val != null && ((Dictionary<object, object>)(object)val).ContainsKey((object)key))
				{
					return val[(object)key]?.ToString() ?? "";
				}
			}
			catch
			{
			}
			return "";
		}

		private static string GetDataDirectorString(string fieldName)
		{
			try
			{
				Type type = AccessTools.TypeByName("DataDirector");
				object obj = AccessTools.Field(type, "instance")?.GetValue(null);
				return AccessTools.Field(type, fieldName)?.GetValue(obj)?.ToString() ?? "";
			}
			catch
			{
				return "";
			}
		}

		private static string CleanLobbyName(string value)
		{
			return (value ?? "").Replace('\r', ' ').Replace('\n', ' ').Trim();
		}

		private static bool IsSceneObject(MonoBehaviour behaviour)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)behaviour).gameObject;
			Scene scene = gameObject.scene;
			if (((Scene)(ref scene)).IsValid())
			{
				return gameObject.activeInHierarchy;
			}
			return false;
		}
	}
}