Decompiled source of Simple Teleport v1.2.1

plugins/SimpleTeleport.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.TextCore;
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("SimpleTeleport")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1+884b5d85ad6b7f2188baab0bb9de3a836ffa231e")]
[assembly: AssemblyProduct("SimpleTeleport")]
[assembly: AssemblyTitle("SimpleTeleport")]
[assembly: AssemblyVersion("1.2.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 SimpleTeleport
{
	[BepInPlugin("khalil.SimpleTeleport", "Simple Teleport", "1.2.1")]
	public sealed class SimpleTeleportPlugin : BaseUnityPlugin
	{
		internal const string PluginGuid = "khalil.SimpleTeleport";

		internal const string PluginName = "Simple Teleport";

		internal const string PluginVersion = "1.2.1";

		private void Awake()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			STLog.Init(((BaseUnityPlugin)this).Logger);
			STConfig.Bind(((BaseUnityPlugin)this).Config);
			GameObject val = new GameObject("SimpleTeleportHost");
			val.transform.SetParent(((Component)this).transform, false);
			val.AddComponent<STBootstrap>();
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			STLog.Info("Simple Teleport v1.2.1 loaded.");
		}
	}
	internal sealed class STBootstrap : MonoBehaviour
	{
		private const float PollSeconds = 0.5f;

		private STPanel _panel;

		private bool _priming;

		private bool _createFailed;

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(WatchGame());
		}

		private IEnumerator WatchGame()
		{
			while (true)
			{
				try
				{
					Tick();
				}
				catch (Exception ex)
				{
					STLog.Error("面板引导出错(继续重试): " + ex);
				}
				yield return (object)new WaitForSecondsRealtime(0.5f);
			}
		}

		private void Tick()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			GUIManager instance = GUIManager.instance;
			if ((Object)(object)instance == (Object)null)
			{
				_createFailed = false;
				if ((Object)(object)_panel != (Object)null)
				{
					Object.Destroy((Object)(object)_panel);
					_panel = null;
				}
			}
			else
			{
				if (_createFailed)
				{
					return;
				}
				if ((Object)(object)_panel == (Object)null)
				{
					if ((Object)(object)instance.interactNameText == (Object)null)
					{
						return;
					}
					try
					{
						_panel = ((Component)this).gameObject.AddComponent<STPanel>();
						STLog.Info("传送面板已创建,按 " + ((object)STConfig.ToggleKey.Value/*cast due to .constrained prefix*/).ToString() + " 打开。");
					}
					catch (Exception ex)
					{
						_createFailed = true;
						STLog.Error("创建传送面板失败,等待下次场景重试:" + ex);
						return;
					}
				}
				if (!_priming && !_panel.Primed && !_panel.IsOpen && CanPrime())
				{
					((MonoBehaviour)this).StartCoroutine(Prime());
				}
			}
		}

		private IEnumerator Prime()
		{
			_priming = true;
			try
			{
				yield return _panel.PrimeRendering();
			}
			finally
			{
				_priming = false;
			}
		}

		private static bool CanPrime()
		{
			if (LoadingScreenHandler.loading)
			{
				return true;
			}
			try
			{
				return GUIManager.InPauseMenu;
			}
			catch (Exception)
			{
				return false;
			}
		}
	}
	internal static class STConfig
	{
		internal static ConfigEntry<KeyCode> ToggleKey;

		internal static ConfigEntry<float> CooldownSeconds;

		internal static ConfigEntry<float> ArrivalOffset;

		internal static ConfigEntry<float> PanelScale;

		internal static ConfigEntry<bool> UseMetricDistance;

		internal static ConfigEntry<bool> CloseAfterTeleport;

		internal static void Bind(ConfigFile config)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			ToggleKey = config.Bind<KeyCode>("General", "ToggleKey", (KeyCode)116, "打开/关闭传送面板的按键。");
			CooldownSeconds = config.Bind<float>("General", "CooldownSeconds", 1.5f, new ConfigDescription("两次传送之间的最小间隔(秒),防止连点导致布娃娃物理异常。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>()));
			ArrivalOffset = config.Bind<float>("General", "ArrivalOffset", 1.6f, new ConfigDescription("落点与目标玩家的水平距离(米)。数值太小会与目标重叠并互相弹开。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 6f), Array.Empty<object>()));
			CloseAfterTeleport = config.Bind<bool>("General", "CloseAfterTeleport", true, "传送后自动关闭面板。");
			PanelScale = config.Bind<float>("UI", "PanelScale", 1f, new ConfigDescription("面板整体缩放。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.6f, 2f), Array.Empty<object>()));
			UseMetricDistance = config.Bind<bool>("UI", "UseMetricDistance", true, "true 在距离后面加 m,false 只显示裸数值。PEAK 中 1 单位约等于 1 米。");
		}
	}
	internal static class STInput
	{
		private static bool _legacyBroken;

		private static readonly Dictionary<KeyCode, Key> SpecialMap = new Dictionary<KeyCode, Key>
		{
			{
				(KeyCode)48,
				(Key)50
			},
			{
				(KeyCode)49,
				(Key)41
			},
			{
				(KeyCode)50,
				(Key)42
			},
			{
				(KeyCode)51,
				(Key)43
			},
			{
				(KeyCode)52,
				(Key)44
			},
			{
				(KeyCode)53,
				(Key)45
			},
			{
				(KeyCode)54,
				(Key)46
			},
			{
				(KeyCode)55,
				(Key)47
			},
			{
				(KeyCode)56,
				(Key)48
			},
			{
				(KeyCode)57,
				(Key)49
			},
			{
				(KeyCode)13,
				(Key)2
			},
			{
				(KeyCode)96,
				(Key)4
			},
			{
				(KeyCode)316,
				(Key)74
			},
			{
				(KeyCode)317,
				(Key)74
			},
			{
				(KeyCode)319,
				(Key)59
			},
			{
				(KeyCode)306,
				(Key)55
			},
			{
				(KeyCode)305,
				(Key)56
			},
			{
				(KeyCode)310,
				(Key)57
			},
			{
				(KeyCode)309,
				(Key)58
			},
			{
				(KeyCode)300,
				(Key)73
			},
			{
				(KeyCode)256,
				(Key)84
			},
			{
				(KeyCode)257,
				(Key)85
			},
			{
				(KeyCode)258,
				(Key)86
			},
			{
				(KeyCode)259,
				(Key)87
			},
			{
				(KeyCode)260,
				(Key)88
			},
			{
				(KeyCode)261,
				(Key)89
			},
			{
				(KeyCode)262,
				(Key)90
			},
			{
				(KeyCode)263,
				(Key)91
			},
			{
				(KeyCode)264,
				(Key)92
			},
			{
				(KeyCode)265,
				(Key)93
			},
			{
				(KeyCode)266,
				(Key)82
			},
			{
				(KeyCode)267,
				(Key)78
			},
			{
				(KeyCode)268,
				(Key)79
			},
			{
				(KeyCode)269,
				(Key)81
			},
			{
				(KeyCode)270,
				(Key)80
			},
			{
				(KeyCode)271,
				(Key)77
			},
			{
				(KeyCode)272,
				(Key)83
			}
		};

		private static readonly Dictionary<KeyCode, Key> ResolvedCache = new Dictionary<KeyCode, Key>();

		internal static float ScrollNotches
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				Mouse current = Mouse.current;
				float num = ((current != null) ? ((InputControl<Vector2>)(object)current.scroll).ReadValue().y : LegacyScroll());
				if (!(Mathf.Abs(num) >= 60f))
				{
					return num;
				}
				return num / 120f;
			}
		}

		internal static Vector2 MousePosition
		{
			get
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				Mouse current = Mouse.current;
				if (current != null)
				{
					return ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue();
				}
				return LegacyMousePosition();
			}
		}

		internal static bool LeftClickThisFrame
		{
			get
			{
				Mouse current = Mouse.current;
				if (current != null)
				{
					return current.leftButton.wasPressedThisFrame;
				}
				return LegacyKeyDown((KeyCode)323);
			}
		}

		internal static bool LeftButtonHeld
		{
			get
			{
				Mouse current = Mouse.current;
				if (current != null)
				{
					return current.leftButton.isPressed;
				}
				return LegacyKeyHeld((KeyCode)323);
			}
		}

		internal static bool WasPressedThisFrame(KeyCode code)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Key val = Resolve(code);
			if ((int)val != 0)
			{
				Keyboard current = Keyboard.current;
				if (current != null)
				{
					try
					{
						KeyControl val2 = current[val];
						if (val2 != null)
						{
							return ((ButtonControl)val2).wasPressedThisFrame;
						}
					}
					catch (ArgumentOutOfRangeException)
					{
						ResolvedCache[code] = (Key)0;
					}
				}
			}
			return LegacyKeyDown(code);
		}

		private unsafe static Key Resolve(KeyCode code)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			if (ResolvedCache.TryGetValue(code, out var value))
			{
				return value;
			}
			Key val = (Key)0;
			Key result;
			if (SpecialMap.TryGetValue(code, out var value2))
			{
				val = value2;
			}
			else if (Enum.TryParse<Key>(((object)(*(KeyCode*)(&code))/*cast due to .constrained prefix*/).ToString(), ignoreCase: false, out result) && Enum.IsDefined(typeof(Key), result))
			{
				val = result;
			}
			if ((int)val != 0 && char.IsDigit(((object)(*(KeyCode*)(&code))/*cast due to .constrained prefix*/).ToString()[0]))
			{
				val = (Key)0;
			}
			ResolvedCache[code] = val;
			return val;
		}

		private static bool LegacyKeyDown(KeyCode code)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (_legacyBroken)
			{
				return false;
			}
			try
			{
				return Input.GetKeyDown(code);
			}
			catch (Exception ex)
			{
				MarkLegacyBroken(ex);
				return false;
			}
		}

		private static bool LegacyKeyHeld(KeyCode code)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (_legacyBroken)
			{
				return false;
			}
			try
			{
				return Input.GetKey(code);
			}
			catch (Exception ex)
			{
				MarkLegacyBroken(ex);
				return false;
			}
		}

		private static float LegacyScroll()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (_legacyBroken)
			{
				return 0f;
			}
			try
			{
				return Input.mouseScrollDelta.y;
			}
			catch (Exception ex)
			{
				MarkLegacyBroken(ex);
				return 0f;
			}
		}

		private static Vector2 LegacyMousePosition()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (_legacyBroken)
			{
				return Vector2.zero;
			}
			try
			{
				return Vector2.op_Implicit(Input.mousePosition);
			}
			catch (Exception ex)
			{
				MarkLegacyBroken(ex);
				return Vector2.zero;
			}
		}

		private static void MarkLegacyBroken(Exception ex)
		{
			_legacyBroken = true;
			STLog.Warn("旧版 Input 不可用,已停用退回路径:" + ex.Message);
		}
	}
	internal sealed class STInputProxy
	{
		private readonly GameObject _holder;

		private readonly MenuWindow _window;

		internal bool IsRegistered
		{
			get
			{
				if ((Object)(object)_window != (Object)null)
				{
					return MenuWindow.AllActiveWindows.Contains(_window);
				}
				return false;
			}
		}

		internal STInputProxy(Transform parent)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			_holder = new GameObject("SimpleTeleportInputProxy");
			_holder.transform.SetParent(parent, false);
			_holder.SetActive(false);
			_window = _holder.AddComponent<MenuWindow>();
		}

		internal void Attach()
		{
			if ((Object)(object)_window != (Object)null && !MenuWindow.AllActiveWindows.Contains(_window))
			{
				MenuWindow.AllActiveWindows.Add(_window);
			}
		}

		internal void Detach()
		{
			List<MenuWindow> allActiveWindows = MenuWindow.AllActiveWindows;
			if ((Object)(object)_window != (Object)null)
			{
				allActiveWindows.Remove(_window);
			}
			for (int i = 0; i < allActiveWindows.Count; i++)
			{
				if ((Object)(object)allActiveWindows[i] == (Object)null)
				{
					STLog.Warn("MenuWindow.AllActiveWindows 里存在已销毁的窗口,游戏 HUD 更新可能会出错(不是本模组的占位)。");
					break;
				}
			}
		}

		internal void Destroy()
		{
			Detach();
			if ((Object)(object)_holder != (Object)null)
			{
				Object.Destroy((Object)(object)_holder);
			}
		}
	}
	internal static class STLog
	{
		private static ManualLogSource _log;

		internal static void Init(ManualLogSource log)
		{
			_log = log;
		}

		internal static void Info(string message)
		{
			ManualLogSource log = _log;
			if (log != null)
			{
				log.LogInfo((object)message);
			}
		}

		internal static void Warn(string message)
		{
			ManualLogSource log = _log;
			if (log != null)
			{
				log.LogWarning((object)message);
			}
		}

		internal static void Error(string message)
		{
			ManualLogSource log = _log;
			if (log != null)
			{
				log.LogError((object)message);
			}
		}
	}
	internal static class STMarkup
	{
		internal static string Clean(string value)
		{
			if (string.IsNullOrEmpty(value))
			{
				return string.Empty;
			}
			StringBuilder stringBuilder = null;
			int num = 0;
			int num2 = 0;
			while (num2 < value.Length)
			{
				char c = value[num2];
				if (IsInvisible(c))
				{
					if (stringBuilder == null)
					{
						stringBuilder = new StringBuilder(value.Length);
					}
					stringBuilder.Append(value, num, num2 - num);
					num2++;
					num = num2;
					continue;
				}
				if (c != '<')
				{
					num2++;
					continue;
				}
				int num3 = TagEnd(value, num2);
				if (num3 < 0)
				{
					num2++;
					continue;
				}
				if (stringBuilder == null)
				{
					stringBuilder = new StringBuilder(value.Length);
				}
				stringBuilder.Append(value, num, num2 - num);
				num2 = num3;
				num = num2;
			}
			if (stringBuilder == null)
			{
				return value;
			}
			stringBuilder.Append(value, num, value.Length - num);
			return stringBuilder.ToString();
		}

		private static int TagEnd(string value, int start)
		{
			int i = start + 1;
			if (i < value.Length && value[i] == '/')
			{
				i++;
			}
			if (i >= value.Length || (!char.IsLetter(value[i]) && value[i] != '#'))
			{
				return -1;
			}
			for (; i < value.Length && value[i] != '>' && value[i] != '<'; i++)
			{
			}
			if (i >= value.Length || value[i] != '>')
			{
				return -1;
			}
			return i + 1;
		}

		private static bool IsInvisible(char c)
		{
			if (c < ' ' || (c >= '\u007f' && c <= '\u009f'))
			{
				return true;
			}
			switch (c)
			{
			default:
				if (c >= '\u2066')
				{
					return c <= '\u2069';
				}
				return false;
			case '\u200b':
			case '\u200e':
			case '\u200f':
			case '\u202a':
			case '\u202b':
			case '\u202c':
			case '\u202d':
			case '\u202e':
			case '\ufeff':
				return true;
			}
		}
	}
	[DefaultExecutionOrder(-200)]
	internal sealed class STPanel : MonoBehaviour
	{
		private struct TargetEntry
		{
			internal Character Character;

			internal string Name;

			internal int Actor;
		}

		private struct NameCache
		{
			internal string Raw;

			internal string Cleaned;
		}

		private sealed class CardView
		{
			internal GameObject Root;

			internal RectTransform RootRect;

			internal Image Fill;

			internal Image Accent;

			internal TextMeshProUGUI NameText;

			internal TextMeshProUGUI InfoText;

			internal Image GoFill;

			internal TextMeshProUGUI GoLabel;

			internal RectTransform GoRect;

			internal Image BringFill;

			internal TextMeshProUGUI BringLabel;

			internal RectTransform BringRect;

			internal int BoundIndex;

			internal int BoundActor;

			internal string BoundName;

			internal float Hover;

			internal float InfoDueAt;
		}

		private const int VisibleRows = 6;

		private const int CardPoolSize = 12;

		private const int BufferAbove = 2;

		private const float PanelWidth = 528f;

		private const float PanelPadding = 18f;

		private const float PanelRadius = 16f;

		private const float CardHeight = 88f;

		private const float CardSpacing = 8f;

		private const float CardPitch = 96f;

		private const float CardRadius = 12f;

		private const float AccentWidth = 3.5f;

		private const float AccentInset = 10f;

		private const float AccentBarWidth = 52f;

		private const float AccentBarHeight = 3f;

		private const float TextLeft = 18f;

		private const float ButtonTop = 10f;

		private const float NameColumnGap = 10f;

		private const float NameColumnWidth = 336f;

		private const float ButtonWidth = 112f;

		private const float ButtonHeight = 30f;

		private const float ButtonGap = 8f;

		private const float ButtonRight = 16f;

		private const float ButtonRadius = 8f;

		private const float TrackWidth = 6f;

		private const float TrackRightInset = 9f;

		private const float ThumbWidth = 8f;

		private const float ThumbOverhang = -1f;

		private const float ThumbMinHeight = 34f;

		private const float ThumbMomentumSeconds = 0.12f;

		private const float HeaderTop = 10f;

		private const float TitleAccentGap = 6f;

		private const float AccentHintGap = 7f;

		private const float HeaderBottom = 10f;

		private const float FooterTopPlain = 12f;

		private const float FooterTopScrolling = 10f;

		private const float FooterGap = 4f;

		private const float FooterBottom = 8f;

		private const float TitleFontSize = 28f;

		private const float HintFontSize = 15f;

		private const float CountFontSize = 14f;

		private const float NameFontSize = 24f;

		private const float InfoFontSize = 16f;

		private const float ButtonFontSize = 16f;

		private const float StatusFontSize = 15f;

		private const float ScrollHintFontSize = 15f;

		private const float EmptyFontSize = 20f;

		private const float ScrollPixelsPerNotch = 96f;

		private const float ScrollNotchClamp = 384f;

		private const float HoverSmoothing = 24f;

		private const float HoverEpsilon = 0.004f;

		private const float OpenAnimSeconds = 0.15f;

		private const float OpenZoomFrom = 0.985f;

		private const float InfoRefreshSeconds = 0.15f;

		private const float StatusHoldSeconds = 2.2f;

		private const float StatusFadeSeconds = 0.45f;

		private const float HintPulseSpeed = 3.1f;

		private const float HintPulseMin = 0.72f;

		private const float HintPulseSteps = 8f;

		private const float HeightSmoothing = 26f;

		private const float HeightEpsilon = 0.5f;

		private const float DragIdleSeconds = 0.08f;

		private const float DragMomentumMinSpeed = 60f;

		private const float ShadowRoom = 24f;

		private const float PressedDarken = 0.24f;

		private const float CanvasFitMargin = 0.98f;

		private const float CountWidth = 190f;

		private const int CanvasSortingOrder = 520;

		private const float ViewportHeight = 568f;

		private static readonly Vector4 ThumbGrabPadding = new Vector4(-5f, -6f, -5f, -6f);

		private static readonly Color PanelFillColor = new Color(0.071f, 0.086f, 0.114f, 0.965f);

		private static readonly Color BorderColor = new Color(1f, 1f, 1f, 0.09f);

		private static readonly Color ShadowColor = new Color(0f, 0f, 0f, 0.55f);

		private static readonly Color DividerColor = new Color(1f, 1f, 1f, 0.055f);

		private static readonly Color TitleColor = new Color(0.949f, 0.961f, 0.98f, 1f);

		private static readonly Color SubtleColor = new Color(0.596f, 0.635f, 0.702f, 1f);

		private static readonly Color DimColor = new Color(0.5f, 0.54f, 0.6f, 1f);

		private static readonly Color AccentColor = new Color(0.298f, 0.553f, 1f, 0.86f);

		private static readonly Color CardColor = new Color(1f, 1f, 1f, 0.075f);

		private static readonly Color CardHoverColor = new Color(1f, 1f, 1f, 0.14f);

		private static readonly Color GoColor = new Color(0.165f, 0.373f, 0.78f, 1f);

		private static readonly Color GoHoverColor = new Color(0.212f, 0.439f, 0.871f, 1f);

		private static readonly Color BringColor = new Color(0.6f, 0.36f, 0.14f, 1f);

		private static readonly Color BringHoverColor = new Color(0.66f, 0.4f, 0.16f, 1f);

		private static readonly Color ButtonBlockedColor = new Color(0.165f, 0.184f, 0.22f, 1f);

		private static readonly Color ButtonBlockedTextColor = new Color(0.475f, 0.51f, 0.561f, 1f);

		private static readonly Color TrackColor = new Color(1f, 1f, 1f, 0.1f);

		private static readonly Color ThumbColor = new Color(0.765f, 0.816f, 0.894f, 0.55f);

		private static readonly Color ThumbHoverColor = new Color(0.88f, 0.92f, 1f, 0.75f);

		private static readonly Color ThumbDragColor = new Color(0.3f, 0.62f, 1f, 0.9f);

		private static readonly Color ScrollHintColor = new Color(0.91f, 0.627f, 0.353f, 1f);

		private float _titleRow;

		private float _hintRow;

		private float _countRow;

		private float _nameRow;

		private float _infoRow;

		private float _statusRow;

		private float _headerHeight;

		private float _footerHeight;

		private int _nameWidthUnits;

		private GameObject _canvasObject;

		private RectTransform _canvasRect;

		private RectTransform _panelRect;

		private CanvasGroup _group;

		private TextMeshProUGUI _titleText;

		private TextMeshProUGUI _hintText;

		private TextMeshProUGUI _countText;

		private TextMeshProUGUI _statusText;

		private TextMeshProUGUI _emptyText;

		private TextMeshProUGUI _scrollHintText;

		private Image _footerDivider;

		private RectTransform _viewportRect;

		private RectTransform _contentRect;

		private Image _scrollTrack;

		private RectTransform _trackRect;

		private Image _scrollThumb;

		private RectTransform _thumbRect;

		private readonly List<CardView> _cards = new List<CardView>();

		private readonly List<TargetEntry> _targets = new List<TargetEntry>();

		private readonly bool[] _slotUsed = new bool[12];

		private readonly Dictionary<int, NameCache> _nameCache = new Dictionary<int, NameCache>();

		private static readonly Comparison<TargetEntry> ByName = CompareByName;

		private int _countFrom;

		private int _countTo;

		private int _countTotal = -1;

		private int _cooldownTenths = -1;

		private string _cooldownText;

		private STScrollState _scroll;

		private bool _open;

		private bool _primed;

		private bool _priming;

		private bool _draggingThumb;

		private float _openTime;

		private float _dragGrabOffset;

		private float _dragVelocity;

		private float _lastDragMoveTime;

		private string _statusMessage;

		private float _statusUntil;

		private float _displayHeight = -1f;

		private float _appliedHeight = -1f;

		private float _appliedScale = -1f;

		private float _appliedAlpha = -1f;

		private float _appliedViewportHeight = -1f;

		private float _appliedContentHeight = -1f;

		private float _appliedContentOffset = float.NaN;

		private float _appliedThumbTop = float.NaN;

		private float _appliedThumbHeight = -1f;

		private STInputProxy _proxy;

		internal bool IsOpen => _open;

		internal bool Primed => _primed;

		private bool NeedsScrolling => _targets.Count > 6;

		private static bool AnimationsEnabled
		{
			get
			{
				GUIManager instance = GUIManager.instance;
				if (!((Object)(object)instance == (Object)null))
				{
					return !instance.photosensitivity;
				}
				return true;
			}
		}

		private int FirstVisibleIndex => Mathf.Clamp(Mathf.FloorToInt(_scroll.Offset / 96f), 0, Mathf.Max(0, _targets.Count - 1));

		private void Awake()
		{
			MeasureLayout();
			BuildHierarchy();
			_proxy = new STInputProxy(((Component)this).transform);
			_canvasObject.SetActive(false);
		}

		private void OnDisable()
		{
			Close();
		}

		private void OnDestroy()
		{
			if (_proxy != null)
			{
				_proxy.Destroy();
				_proxy = null;
			}
			if ((Object)(object)_canvasObject != (Object)null)
			{
				Object.Destroy((Object)(object)_canvasObject);
				_canvasObject = null;
			}
		}

		private void Update()
		{
			Character localCharacter = Character.localCharacter;
			if (_open && !StillValid(localCharacter))
			{
				Close();
				return;
			}
			try
			{
				if (_open)
				{
					SuppressStaleGameplayInput(localCharacter);
				}
				HandleToggleKey(localCharacter);
				if (_open)
				{
					RefreshTargets(localCharacter);
					HandlePointerInput();
					_scroll.Step(Time.unscaledDeltaTime);
					LayoutPanel(Time.unscaledDeltaTime);
					DrawCards(localCharacter);
					DrawChrome();
					HandleClicks(localCharacter);
				}
			}
			catch (Exception ex)
			{
				STLog.Error("面板更新出错,已关闭面板:" + ex);
				Close();
			}
		}

		private void LateUpdate()
		{
			if (!_open)
			{
				return;
			}
			try
			{
				SuppressStaleGameplayInput(Character.localCharacter);
			}
			catch (Exception ex)
			{
				STLog.Error("清理输入出错,已关闭面板:" + ex);
				Close();
			}
		}

		private void MeasureLayout()
		{
			_titleRow = STUI.RowHeightFor(28f);
			_hintRow = STUI.RowHeightFor(15f);
			_countRow = STUI.RowHeightFor(14f);
			_nameRow = STUI.RowHeightFor(24f);
			_infoRow = STUI.RowHeightFor(16f);
			_statusRow = STUI.RowHeightFor(15f);
			_headerHeight = 10f + _titleRow + 6f + 3f + 7f + _hintRow + 10f;
			_footerHeight = 10f + _hintRow + 4f + _statusRow + 8f;
			_nameWidthUnits = Mathf.FloorToInt(1400f);
		}

		private bool StillValid(Character local)
		{
			if ((Object)(object)local == (Object)null || (Object)(object)GUIManager.instance == (Object)null || LoadingScreenHandler.loading)
			{
				return false;
			}
			if (!TeleportService.IsPositionReady(local))
			{
				return false;
			}
			if (GUIManager.InPauseMenu)
			{
				return false;
			}
			if (_proxy != null)
			{
				return _proxy.IsRegistered;
			}
			return false;
		}

		private void HandleToggleKey(Character local)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (STInput.WasPressedThisFrame(STConfig.ToggleKey.Value))
			{
				if (_open)
				{
					Close();
				}
				else if (!((Object)(object)local == (Object)null) && !((Object)(object)GUIManager.instance == (Object)null) && !LoadingScreenHandler.loading && TeleportService.IsPositionReady(local) && !GUIManager.InPauseMenu && !GUIManager.instance.wheelActive && !GUIManager.instance.windowBlockingInput)
				{
					Open();
				}
			}
		}

		private void Open()
		{
			if (!_open)
			{
				_open = true;
				_openTime = Time.unscaledTime;
				if (_proxy != null)
				{
					_proxy.Attach();
				}
				GUIManager instance = GUIManager.instance;
				if ((Object)(object)instance != (Object)null)
				{
					instance.UpdateWindowStatus();
				}
				_scroll.Reset();
				_statusMessage = null;
				_statusUntil = 0f;
				_cooldownTenths = -1;
				_cooldownText = null;
				_countTotal = -1;
				for (int i = 0; i < _cards.Count; i++)
				{
					_cards[i].BoundIndex = -1;
					_cards[i].InfoDueAt = 0f;
					_cards[i].Hover = 0f;
				}
				_displayHeight = -1f;
				_appliedHeight = -1f;
				_appliedScale = -1f;
				_appliedAlpha = -1f;
				_appliedViewportHeight = -1f;
				_appliedContentHeight = -1f;
				_appliedContentOffset = float.NaN;
				_appliedThumbTop = 0f;
				_appliedThumbHeight = -1f;
				ApplyStaticText();
				_canvasObject.SetActive(true);
			}
		}

		private void Close()
		{
			if (_open)
			{
				_open = false;
				_draggingThumb = false;
				_nameCache.Clear();
				if (_proxy != null)
				{
					_proxy.Detach();
				}
				_targets.Clear();
				if ((Object)(object)_group != (Object)null)
				{
					_group.alpha = 1f;
					_appliedAlpha = 1f;
				}
				if ((Object)(object)_canvasObject != (Object)null)
				{
					_canvasObject.SetActive(false);
				}
			}
		}

		private static void SuppressStaleGameplayInput(Character local)
		{
			CharacterInput val = local?.input;
			if (!((Object)(object)val == (Object)null))
			{
				val.scrollInput = 0f;
				val.scrollForwardWasPressed = false;
				val.scrollBackwardWasPressed = false;
				val.scrollForwardIsPressed = false;
				val.scrollBackwardIsPressed = false;
				val.pingWasPressed = false;
				val.selectBackpackWasPressed = false;
				val.selectSlotForwardWasPressed = false;
				val.selectSlotBackwardWasPressed = false;
				val.unselectSlotWasPressed = false;
				val.spectateLeftWasPressed = false;
				val.spectateRightWasPressed = false;
				val.sprintToggleIsPressed = false;
				InputAction push_to_talk = CharacterInput.push_to_talk;
				if (push_to_talk != null)
				{
					val.pushToTalkPressed = push_to_talk.IsPressed();
				}
			}
		}

		private void RefreshTargets(Character local)
		{
			_targets.Clear();
			List<Character> allCharacters = Character.AllCharacters;
			for (int i = 0; i < allCharacters.Count; i++)
			{
				Character val = allCharacters[i];
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)local) && val.IsPlayerControlled && !((Object)(object)((MonoBehaviourPun)val).photonView == (Object)null) && ((MonoBehaviourPun)val).photonView.Owner != null && TeleportService.IsPositionReady(val))
				{
					int actorNumber = ((MonoBehaviourPun)val).photonView.Owner.ActorNumber;
					string text = STText.RawName(val);
					if (!_nameCache.TryGetValue(actorNumber, out var value) || !string.Equals(value.Raw, text))
					{
						value = new NameCache
						{
							Raw = text,
							Cleaned = STText.Display(text)
						};
						_nameCache[actorNumber] = value;
					}
					_targets.Add(new TargetEntry
					{
						Character = val,
						Name = value.Cleaned,
						Actor = actorNumber
					});
				}
			}
			_targets.Sort(ByName);
		}

		private static int CompareByName(TargetEntry a, TargetEntry b)
		{
			int num = string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase);
			if (num == 0)
			{
				return a.Actor.CompareTo(b.Actor);
			}
			return num;
		}

		private void HandlePointerInput()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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)
			Vector2 mousePosition = STInput.MousePosition;
			if (_draggingThumb)
			{
				float distanceFromTop;
				if (!STInput.LeftButtonHeld)
				{
					EndThumbDrag();
				}
				else if (TryTrackDistanceFromTop(mousePosition, out distanceFromTop))
				{
					float offset = _scroll.Offset;
					_scroll.Drag(OffsetForThumbTop(distanceFromTop - _dragGrabOffset));
					if (!Mathf.Approximately(_scroll.Offset, offset))
					{
						float num = Mathf.Max(Time.unscaledDeltaTime, 0.0001f);
						_dragVelocity = Mathf.Lerp(_dragVelocity, (_scroll.Offset - offset) / num, 0.35f);
						_lastDragMoveTime = Time.unscaledTime;
					}
				}
			}
			else
			{
				if (!NeedsScrolling)
				{
					return;
				}
				float num2 = STInput.ScrollNotches * 96f;
				if (Mathf.Abs(num2) > 0.01f && RectTransformUtility.RectangleContainsScreenPoint(_panelRect, mousePosition))
				{
					_scroll.ScrollBy(0f - Mathf.Clamp(num2, -384f, 384f));
				}
				if (!STInput.LeftClickThisFrame || !STInput.LeftButtonHeld)
				{
					return;
				}
				float distanceFromTop3;
				if (RectTransformUtility.RectangleContainsScreenPoint(_thumbRect, mousePosition, (Camera)null, ThumbGrabPadding))
				{
					if (TryTrackDistanceFromTop(mousePosition, out var distanceFromTop2))
					{
						_draggingThumb = true;
						_dragGrabOffset = distanceFromTop2 - _appliedThumbTop;
						_dragVelocity = 0f;
					}
				}
				else if (RectTransformUtility.RectangleContainsScreenPoint(_trackRect, mousePosition) && TryTrackDistanceFromTop(mousePosition, out distanceFromTop3))
				{
					_dragGrabOffset = _appliedThumbHeight * 0.5f;
					_scroll.Drag(OffsetForThumbTop(distanceFromTop3 - _dragGrabOffset));
					_draggingThumb = true;
					_dragVelocity = 0f;
				}
			}
		}

		private float OffsetForThumbTop(float thumbTop)
		{
			return STScrollState.OffsetForThumbTop(thumbTop, _appliedViewportHeight, _appliedThumbHeight, _scroll.Max);
		}

		private void EndThumbDrag()
		{
			_draggingThumb = false;
			if (Time.unscaledTime - _lastDragMoveTime < 0.08f && Mathf.Abs(_dragVelocity) > 60f)
			{
				_scroll.ScrollBy(_dragVelocity * 0.12f);
			}
			_dragVelocity = 0f;
		}

		private bool TryTrackDistanceFromTop(Vector2 screenPoint, out float distanceFromTop)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			distanceFromTop = 0f;
			Vector2 val = default(Vector2);
			if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(_trackRect, screenPoint, (Camera)null, ref val))
			{
				return false;
			}
			distanceFromTop = 0f - val.y;
			return true;
		}

		private void LayoutPanel(float deltaTime)
		{
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			int count = _targets.Count;
			int rows = Mathf.Clamp(count, 1, 6);
			float num = MeasureHeight(rows);
			if (_displayHeight <= 0f || !AnimationsEnabled || Mathf.Abs(num - _displayHeight) < 0.5f)
			{
				_displayHeight = num;
			}
			else
			{
				_displayHeight = Mathf.Lerp(_displayHeight, num, 1f - Mathf.Exp(-26f * Mathf.Max(0f, deltaTime)));
			}
			float num2 = Mathf.Max(88f, _displayHeight - _headerHeight - _footerHeight);
			ApplyPanelSize(_displayHeight);
			if (!Mathf.Approximately(num2, _appliedViewportHeight))
			{
				_appliedViewportHeight = num2;
				STUI.SetStretchRow(_viewportRect, 18f, 18f, _headerHeight, num2);
				STUI.SetTopRight(_trackRect, 9f, _headerHeight, 6f, num2);
			}
			float num3 = ContentHeight(count);
			_scroll.SetMax(num3 - num2);
			if (!Mathf.Approximately(num3, _appliedContentHeight))
			{
				_appliedContentHeight = num3;
				_contentRect.sizeDelta = new Vector2(0f, num3);
			}
			if (!Mathf.Approximately(_scroll.Offset, _appliedContentOffset))
			{
				_appliedContentOffset = _scroll.Offset;
				_contentRect.anchoredPosition = new Vector2(0f, _scroll.Offset);
			}
			RedrawScrollBar(num2, num3);
			SetActiveIfChanged(((Component)_scrollTrack).gameObject, NeedsScrolling);
			SetActiveIfChanged(((Component)_footerDivider).gameObject, NeedsScrolling);
			SetActiveIfChanged(((Component)_scrollHintText).gameObject, NeedsScrolling);
			SetActiveIfChanged(((Component)_emptyText).gameObject, count == 0);
		}

		private static float ContentHeight(int count)
		{
			if (count > 0)
			{
				return (float)count * 96f - 8f;
			}
			return 88f;
		}

		private float MeasureHeight(int rows)
		{
			return _headerHeight + ((float)rows * 96f - 8f) + _footerHeight;
		}

		private void ApplyPanelSize(float height)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			float num = (AnimationsEnabled ? Mathf.Clamp01((Time.unscaledTime - _openTime) / 0.15f) : 1f);
			float num2 = 1f - (1f - num) * (1f - num) * (1f - num);
			float num3 = Mathf.Clamp(STConfig.PanelScale.Value, 0.6f, 2f);
			float num4;
			if (!((Object)(object)_canvasRect != (Object)null))
			{
				num4 = 0f;
			}
			else
			{
				Rect rect = _canvasRect.rect;
				num4 = ((Rect)(ref rect)).height;
			}
			float num5 = num4;
			if (num5 > 1f && height > 1f)
			{
				float num6 = Mathf.Max(num5 * 0.98f - 48f, num5 * 0.5f);
				num3 = Mathf.Min(num3, num6 / height);
			}
			float num7 = num3 * (0.985f + 0.014999986f * num2);
			if (!Mathf.Approximately(height, _appliedHeight))
			{
				_appliedHeight = height;
				_panelRect.sizeDelta = new Vector2(528f, height);
			}
			if (!Mathf.Approximately(num7, _appliedScale))
			{
				_appliedScale = num7;
				((Transform)_panelRect).localScale = new Vector3(num7, num7, 1f);
			}
			if (!Mathf.Approximately(num2, _appliedAlpha))
			{
				_appliedAlpha = num2;
				_group.alpha = num2;
			}
		}

		private void RedrawScrollBar(float viewportHeight, float contentHeight)
		{
			//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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (NeedsScrolling)
			{
				float num = Mathf.Clamp(viewportHeight * viewportHeight / Mathf.Max(1f, contentHeight), 34f, viewportHeight);
				float num2 = (viewportHeight - num) * _scroll.Progress;
				bool flag = !_draggingThumb && RectTransformUtility.RectangleContainsScreenPoint(_thumbRect, STInput.MousePosition, (Camera)null, ThumbGrabPadding);
				((Graphic)_scrollThumb).color = (_draggingThumb ? ThumbDragColor : (flag ? ThumbHoverColor : ThumbColor));
				if (!Mathf.Approximately(num, _appliedThumbHeight) || !Mathf.Approximately(num2, _appliedThumbTop))
				{
					_appliedThumbHeight = num;
					_appliedThumbTop = num2;
					STUI.SetTopRight(_thumbRect, -1f, num2, 8f, num);
				}
			}
		}

		private void DrawCards(Character local)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0150: Unknown result type (might be due to invalid IL or missing references)
			int count = _targets.Count;
			if (count == 0)
			{
				for (int i = 0; i < _cards.Count; i++)
				{
					HideCard(_cards[i]);
				}
				return;
			}
			Vector2 mousePosition = STInput.MousePosition;
			bool insideViewport = RectTransformUtility.RectangleContainsScreenPoint(_viewportRect, mousePosition);
			bool value = STConfig.UseMetricDistance.Value;
			int num = Mathf.FloorToInt(_scroll.Offset / 96f);
			int num2 = Mathf.Max(0, num - 2);
			int num3 = Mathf.Min(count - 1, num2 + 12 - 1);
			for (int j = 0; j < _slotUsed.Length; j++)
			{
				_slotUsed[j] = false;
			}
			for (int k = num2; k <= num3; k++)
			{
				int num4 = k % 12;
				CardView cardView = _cards[num4];
				_slotUsed[num4] = true;
				if (!cardView.Root.activeSelf)
				{
					cardView.Root.SetActive(true);
				}
				TargetEntry entry = _targets[k];
				if (cardView.BoundIndex != k || cardView.BoundActor != entry.Actor || !string.Equals(cardView.BoundName, entry.Name))
				{
					PlaceCard(cardView, k);
					BindCard(cardView, k, entry, value);
				}
				DrawCardState(cardView, k, local, mousePosition, insideViewport, value);
			}
			for (int l = 0; l < _cards.Count; l++)
			{
				if (!_slotUsed[l])
				{
					HideCard(_cards[l]);
				}
			}
		}

		private void PlaceCard(CardView card, int index)
		{
			STUI.SetStretchRow(card.RootRect, 0f, 0f, (float)index * 96f, 88f);
			card.BoundIndex = index;
		}

		private static void HideCard(CardView card)
		{
			if (card.Root.activeSelf)
			{
				card.Root.SetActive(false);
			}
			card.BoundIndex = -1;
		}

		private void BindCard(CardView card, int index, TargetEntry entry, bool metric)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			SetText(card.NameText, STTextWidth.Truncate(entry.Name, _nameWidthUnits));
			SetText(card.GoLabel, STStrings.GoToLabel);
			SetText(card.BringLabel, STStrings.BringLabel);
			SetText(card.InfoText, BuildInfoLine(entry.Character, metric));
			((Graphic)card.Accent).color = AccentFor(entry.Character);
			card.Hover = -1f;
			card.BoundActor = entry.Actor;
			card.BoundName = entry.Name;
			card.InfoDueAt = Time.unscaledTime + 0.15f;
		}

		private void DrawCardState(CardView card, int index, Character local, Vector2 mouse, bool insideViewport, bool metric)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			Character character = _targets[index].Character;
			float num = ((insideViewport && RectTransformUtility.RectangleContainsScreenPoint(card.RootRect, mouse)) ? 1f : 0f);
			card.Hover = ((card.Hover < 0f || !AnimationsEnabled || Mathf.Abs(card.Hover - num) < 0.004f) ? num : Mathf.Lerp(card.Hover, num, 1f - Mathf.Exp(-24f * Mathf.Max(0f, Time.unscaledDeltaTime))));
			((Graphic)card.Fill).color = Color.Lerp(CardColor, CardHoverColor, card.Hover);
			bool flag = TeleportService.Validate(local, character) == TeleportFailure.None;
			bool flag2 = TeleportService.Validate(character, local) == TeleportFailure.None;
			bool leftButtonHeld = STInput.LeftButtonHeld;
			bool pressed = flag && leftButtonHeld && RectTransformUtility.RectangleContainsScreenPoint(card.GoRect, mouse);
			bool pressed2 = flag2 && leftButtonHeld && RectTransformUtility.RectangleContainsScreenPoint(card.BringRect, mouse);
			((Graphic)card.GoFill).color = ButtonColor(flag, card.Hover, GoColor, GoHoverColor, pressed);
			((Graphic)card.BringFill).color = ButtonColor(flag2, card.Hover, BringColor, BringHoverColor, pressed2);
			((Graphic)card.GoLabel).color = (flag ? Color.white : ButtonBlockedTextColor);
			((Graphic)card.BringLabel).color = (flag2 ? Color.white : ButtonBlockedTextColor);
			if (Time.unscaledTime >= card.InfoDueAt)
			{
				card.InfoDueAt = Time.unscaledTime + 0.15f;
				SetText(card.InfoText, BuildInfoLine(character, metric));
			}
		}

		private static Color ButtonColor(bool ready, float hover, Color idle, Color hoverColor, bool pressed)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (!ready)
			{
				return ButtonBlockedColor;
			}
			Color val = Color.Lerp(idle, hoverColor, hover);
			if (!pressed)
			{
				return val;
			}
			return Color.Lerp(val, Color.black, 0.24f);
		}

		private void DrawChrome()
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			int count = _targets.Count;
			if (count == 0)
			{
				SetText(_countText, string.Empty);
				_countTotal = -1;
			}
			else if (NeedsScrolling)
			{
				int firstVisibleIndex = FirstVisibleIndex;
				int num = firstVisibleIndex + 1;
				int num2 = Mathf.Min(count, firstVisibleIndex + 6);
				if (num != _countFrom || num2 != _countTo || count != _countTotal)
				{
					_countFrom = num;
					_countTo = num2;
					_countTotal = count;
					SetText(_countText, STStrings.Count(num, num2, count));
				}
			}
			else if (count != _countTotal)
			{
				_countTotal = count;
				SetText(_countText, STStrings.Total(count));
			}
			if (NeedsScrolling)
			{
				Color scrollHintColor = ScrollHintColor;
				if (AnimationsEnabled)
				{
					float num3 = Mathf.Round((0.5f + 0.5f * Mathf.Sin(Time.unscaledTime * 3.1f)) * 8f) / 8f;
					scrollHintColor.a *= 0.72f + 0.27999997f * num3;
				}
				((Graphic)_scrollHintText).color = scrollHintColor;
			}
			DrawStatus();
		}

		private void ApplyStaticText()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			SetText(_titleText, STStrings.Title);
			SetText(_hintText, STStrings.Hint(((object)STConfig.ToggleKey.Value/*cast due to .constrained prefix*/).ToString()));
			SetText(_scrollHintText, STStrings.ScrollHint);
			SetText(_emptyText, STStrings.Empty);
		}

		private void DrawStatus()
		{
			//IL_00a7: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			string text = null;
			float num = 1f;
			if (!string.IsNullOrEmpty(_statusMessage))
			{
				float num2 = _statusUntil - Time.unscaledTime;
				if (num2 > 0f)
				{
					text = _statusMessage;
					num = Mathf.Clamp01(num2 / 0.45f);
				}
			}
			if (text == null)
			{
				float cooldownRemaining = TeleportService.CooldownRemaining;
				int num3 = Mathf.CeilToInt(cooldownRemaining * 10f);
				if (num3 > 0)
				{
					if (num3 != _cooldownTenths)
					{
						_cooldownTenths = num3;
						_cooldownText = STStrings.Cooldown(cooldownRemaining);
					}
					text = _cooldownText;
				}
				else
				{
					_cooldownTenths = -1;
					_cooldownText = null;
				}
			}
			SetText(_statusText, text ?? string.Empty);
			Color subtleColor = SubtleColor;
			subtleColor.a *= num;
			((Graphic)_statusText).color = subtleColor;
		}

		private void HandleClicks(Character local)
		{
			//IL_0010: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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)
			if (!STInput.LeftClickThisFrame || _draggingThumb)
			{
				return;
			}
			Vector2 mousePosition = STInput.MousePosition;
			if (!RectTransformUtility.RectangleContainsScreenPoint(_viewportRect, mousePosition))
			{
				return;
			}
			for (int i = 0; i < _cards.Count; i++)
			{
				CardView cardView = _cards[i];
				if (cardView.Root.activeSelf && cardView.BoundIndex >= 0)
				{
					if (RectTransformUtility.RectangleContainsScreenPoint(cardView.GoRect, mousePosition))
					{
						Execute(local, _targets[cardView.BoundIndex].Character, bringThem: false);
						break;
					}
					if (RectTransformUtility.RectangleContainsScreenPoint(cardView.BringRect, mousePosition))
					{
						Execute(local, _targets[cardView.BoundIndex].Character, bringThem: true);
						break;
					}
				}
			}
		}

		private void Execute(Character local, Character target, bool bringThem)
		{
			Character mover = (bringThem ? target : local);
			Character anchor = (bringThem ? local : target);
			if (!TeleportService.Teleport(mover, anchor, out var message))
			{
				SetStatus(message);
				return;
			}
			if (STConfig.CloseAfterTeleport.Value)
			{
				Close();
				return;
			}
			string target2 = STText.PlayerName(target);
			SetStatus(bringThem ? STStrings.SentBring(target2) : STStrings.SentGoTo(target2));
		}

		private void SetStatus(string message)
		{
			_statusMessage = message;
			_statusUntil = Time.unscaledTime + 2.2f;
		}

		private string BuildInfoLine(Character target, bool metric)
		{
			//IL_0047: 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)
			string text = DescribeState(target);
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null || !TeleportService.TryGetAnchorPosition(target, out var position) || ((Object)(object)target.data != (Object)null && target.data.dead))
			{
				return text ?? STStrings.NoPosition;
			}
			string text2 = STStrings.Distance(Vector3.Distance(TeleportService.AnchorPosition(localCharacter), position), metric);
			if (!string.IsNullOrEmpty(text))
			{
				text2 = text2 + "   " + text;
			}
			return text2;
		}

		private static string DescribeState(Character target)
		{
			if ((Object)(object)target.data == (Object)null)
			{
				return null;
			}
			if (target.data.dead)
			{
				return STStrings.StateDead;
			}
			if (target.warping)
			{
				return STStrings.StateWarping;
			}
			if (target.data.fullyPassedOut)
			{
				return STStrings.StateDown;
			}
			return null;
		}

		private static Color AccentFor(Character target)
		{
			//IL_0044: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				CharacterCustomization val = ((target.refs != null) ? target.refs.customization : null);
				if ((Object)(object)val != (Object)null)
				{
					Color playerColor = val.PlayerColor;
					playerColor.a = AccentColor.a;
					return playerColor;
				}
			}
			catch (MissingReferenceException)
			{
			}
			catch (NullReferenceException)
			{
			}
			return AccentColor;
		}

		private static void SetText(TextMeshProUGUI target, string value)
		{
			if (!string.Equals(((TMP_Text)target).text, value))
			{
				((TMP_Text)target).text = value;
			}
		}

		private static void SetActiveIfChanged(GameObject target, bool active)
		{
			if (target.activeSelf != active)
			{
				target.SetActive(active);
			}
		}

		private void BuildHierarchy()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			_canvasObject = new GameObject("SimpleTeleportCanvas");
			_canvasObject.transform.SetParent(((Component)this).transform, false);
			Canvas obj = _canvasObject.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 520;
			_canvasRect = (RectTransform)_canvasObject.transform;
			CanvasScaler obj2 = _canvasObject.AddComponent<CanvasScaler>();
			obj2.uiScaleMode = (ScaleMode)1;
			obj2.referenceResolution = new Vector2(1920f, 1080f);
			obj2.screenMatchMode = (ScreenMatchMode)0;
			obj2.matchWidthOrHeight = 0.5f;
			RectTransform val = (_panelRect = STUI.CreateContainer("Panel", _canvasObject.transform));
			val.anchorMin = new Vector2(0.5f, 0.5f);
			val.anchorMax = new Vector2(0.5f, 0.5f);
			val.pivot = new Vector2(0.5f, 0.5f);
			val.anchoredPosition = Vector2.zero;
			val.sizeDelta = new Vector2(528f, MeasureHeight(6));
			_group = ((Component)val).gameObject.AddComponent<CanvasGroup>();
			_group.blocksRaycasts = false;
			_group.interactable = false;
			RectTransform obj3 = STUI.Rect(((Component)STUI.CreateImage("Shadow", (Transform)(object)val, STSprites.Shadow(18, 16), (Type)1, ShadowColor)).gameObject);
			obj3.anchorMin = Vector2.zero;
			obj3.anchorMax = Vector2.one;
			obj3.pivot = new Vector2(0.5f, 0.5f);
			obj3.offsetMin = new Vector2(-14f, -24f);
			obj3.offsetMax = new Vector2(14f, 6f);
			STUI.Stretch(STUI.Rect(((Component)STUI.CreateImage("Background", (Transform)(object)val, STSprites.Fill(16), (Type)1, PanelFillColor)).gameObject));
			STUI.Stretch(STUI.Rect(((Component)STUI.CreateImage("Border", (Transform)(object)val, STSprites.Ring(16, 1), (Type)1, BorderColor)).gameObject));
			BuildHeader(val);
			BuildViewport(val);
			BuildScrollBar(val);
			BuildFooter(val);
			ApplyStaticText();
		}

		private void BuildHeader(RectTransform root)
		{
			//IL_0011: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			_titleText = STUI.CreateText("Title", (Transform)(object)root, 28f, (TextAlignmentOptions)514, TitleColor);
			((TMP_Text)_titleText).fontStyle = (FontStyles)1;
			STUI.SetStretchRow(STUI.Rect(((Component)_titleText).gameObject), 18f, 18f, 10f, _titleRow);
			STUI.SetTopCenter(STUI.Rect(((Component)STUI.CreateImage("AccentBar", (Transform)(object)root, STSprites.Fill(2), (Type)1, AccentColor)).gameObject), 10f + _titleRow + 6f, 52f, 3f);
			_hintText = STUI.CreateText("Hint", (Transform)(object)root, 15f, (TextAlignmentOptions)514, SubtleColor);
			STUI.SetStretchRow(STUI.Rect(((Component)_hintText).gameObject), 18f, 18f, 10f + _titleRow + 6f + 3f + 7f, _hintRow);
			_countText = STUI.CreateText("Count", (Transform)(object)root, 14f, (TextAlignmentOptions)516, DimColor);
			STUI.SetTopRight(STUI.Rect(((Component)_countText).gameObject), 18f, 10f + (_titleRow - _countRow) * 0.5f, 190f, _countRow);
			STUI.SetStretchRow(STUI.Rect(((Component)STUI.CreateRect("Divider", (Transform)(object)root, DividerColor)).gameObject), 18f, 18f, _headerHeight - 4f, 1f);
		}

		private void BuildViewport(RectTransform root)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = (_viewportRect = STUI.CreateContainer("Viewport", (Transform)(object)root));
			STUI.SetStretchRow(val, 18f, 18f, _headerHeight, 568f);
			((Component)val).gameObject.AddComponent<RectMask2D>();
			_contentRect = STUI.CreateContainer("Content", (Transform)(object)val);
			_contentRect.anchorMin = new Vector2(0f, 1f);
			_contentRect.anchorMax = new Vector2(1f, 1f);
			_contentRect.pivot = new Vector2(0.5f, 1f);
			_contentRect.offsetMin = new Vector2(0f, -88f);
			_contentRect.offsetMax = new Vector2(0f, 0f);
			_emptyText = STUI.CreateText("Empty", (Transform)(object)val, 20f, (TextAlignmentOptions)514, DimColor);
			STUI.Stretch(STUI.Rect(((Component)_emptyText).gameObject));
			for (int i = 0; i < 12; i++)
			{
				_cards.Add(BuildCard(_contentRect, i));
			}
		}

		private void BuildScrollBar(RectTransform root)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			_scrollTrack = STUI.CreateImage("ScrollTrack", (Transform)(object)root, STSprites.Fill(3), (Type)1, TrackColor);
			_trackRect = STUI.Rect(((Component)_scrollTrack).gameObject);
			STUI.SetTopRight(_trackRect, 9f, _headerHeight, 6f, 568f);
			_scrollThumb = STUI.CreateImage("ScrollThumb", ((Component)_scrollTrack).transform, STSprites.Fill(4), (Type)1, ThumbColor);
			_thumbRect = STUI.Rect(((Component)_scrollThumb).gameObject);
			STUI.SetTopRight(_thumbRect, -1f, 0f, 8f, 568f);
			_appliedThumbHeight = 568f;
			_appliedThumbTop = 0f;
		}

		private void BuildFooter(RectTransform root)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			_footerDivider = STUI.CreateRect("FooterDivider", (Transform)(object)root, DividerColor);
			STUI.SetBottomRow(STUI.Rect(((Component)_footerDivider).gameObject), 18f, 18f, 10f + _hintRow + 4f + _statusRow + 4f, 1f);
			_scrollHintText = STUI.CreateText("ScrollHint", (Transform)(object)root, 15f, (TextAlignmentOptions)514, ScrollHintColor);
			STUI.SetBottomRow(STUI.Rect(((Component)_scrollHintText).gameObject), 18f, 18f, 10f + _statusRow + 4f, _hintRow);
			_statusText = STUI.CreateText("Status", (Transform)(object)root, 15f, (TextAlignmentOptions)513, SubtleColor);
			STUI.SetBottomRow(STUI.Rect(((Component)_statusText).gameObject), 18f, 18f, 12f, _statusRow);
		}

		private CardView BuildCard(RectTransform parent, int slot)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			Image val = STUI.CreateImage("Card" + slot, (Transform)(object)parent, STSprites.Fill(12), (Type)1, CardColor);
			RectTransform val2 = STUI.Rect(((Component)val).gameObject);
			STUI.SetStretchRow(val2, 0f, 0f, 0f, 88f);
			Image val3 = STUI.CreateImage("Accent", ((Component)val).transform, STSprites.Fill(2), (Type)1, AccentColor);
			RectTransform obj = STUI.Rect(((Component)val3).gameObject);
			obj.anchorMin = new Vector2(0f, 0f);
			obj.anchorMax = new Vector2(0f, 1f);
			obj.pivot = new Vector2(0f, 0.5f);
			obj.offsetMin = new Vector2(0f, 10f);
			obj.offsetMax = new Vector2(3.5f, -10f);
			float y = 10f + (30f - _nameRow) * 0.5f;
			float y2 = 48f + (30f - _infoRow) * 0.5f;
			TextMeshProUGUI val4 = STUI.CreateText("Name", ((Component)val).transform, 24f, (TextAlignmentOptions)513, TitleColor);
			STUI.SetTopLeft(STUI.Rect(((Component)val4).gameObject), 18f, y, 336f, _nameRow);
			TextMeshProUGUI val5 = STUI.CreateText("Info", ((Component)val).transform, 16f, (TextAlignmentOptions)513, SubtleColor);
			STUI.SetTopLeft(STUI.Rect(((Component)val5).gameObject), 18f, y2, 336f, _infoRow);
			Image val6 = STUI.CreateImage("Go", ((Component)val).transform, STSprites.Fill(8), (Type)1, GoColor);
			RectTransform val7 = STUI.Rect(((Component)val6).gameObject);
			STUI.SetTopRight(val7, 16f, 10f, 112f, 30f);
			TextMeshProUGUI val8 = STUI.CreateText("GoLabel", ((Component)val6).transform, 16f, (TextAlignmentOptions)514, Color.white);
			STUI.Stretch(STUI.Rect(((Component)val8).gameObject));
			Image val9 = STUI.CreateImage("Bring", ((Component)val).transform, STSprites.Fill(8), (Type)1, BringColor);
			RectTransform val10 = STUI.Rect(((Component)val9).gameObject);
			STUI.SetTopRight(val10, 16f, 48f, 112f, 30f);
			TextMeshProUGUI val11 = STUI.CreateText("BringLabel", ((Component)val9).transform, 16f, (TextAlignmentOptions)514, Color.white);
			STUI.Stretch(STUI.Rect(((Component)val11).gameObject));
			return new CardView
			{
				Root = ((Component)val).gameObject,
				RootRect = val2,
				Fill = val,
				Accent = val3,
				NameText = val4,
				InfoText = val5,
				GoFill = val6,
				GoLabel = val8,
				GoRect = val7,
				BringFill = val9,
				BringLabel = val11,
				BringRect = val10,
				BoundIndex = -1
			};
		}

		internal IEnumerator PrimeRendering()
		{
			if (_primed || _priming || _open || (Object)(object)_canvasObject == (Object)null)
			{
				yield break;
			}
			_priming = true;
			try
			{
				bool flag = false;
				Character localCharacter = Character.localCharacter;
				if ((Object)(object)localCharacter != (Object)null && TeleportService.IsPositionReady(localCharacter))
				{
					try
					{
						RefreshTargets(localCharacter);
						LayoutPanel(0f);
						DrawCards(localCharacter);
						DrawChrome();
						flag = _targets.Count > 0;
					}
					catch (Exception ex)
					{
						STLog.Warn("预热时绘制真实名单失败,改用占位文案:" + ex.Message);
					}
				}
				if (!flag)
				{
					FillSampleContent();
				}
				_group.alpha = 0f;
				_canvasObject.SetActive(true);
				Canvas.ForceUpdateCanvases();
				yield return null;
				if (!((Object)(object)_canvasObject == (Object)null))
				{
					Canvas.ForceUpdateCanvases();
					yield return null;
					_primed = true;
				}
			}
			finally
			{
				STPanel sTPanel = this;
				if ((Object)(object)sTPanel._canvasObject != (Object)null && !sTPanel._open)
				{
					sTPanel._canvasObject.SetActive(false);
				}
				if ((Object)(object)sTPanel._group != (Object)null && !sTPanel._open)
				{
					sTPanel._group.alpha = 1f;
					sTPanel._appliedAlpha = 1f;
				}
				sTPanel._priming = false;
			}
		}

		private void FillSampleContent()
		{
			ApplyStaticText();
			SetText(_countText, STStrings.Total(6));
			SetText(_statusText, STStrings.SentGoTo("Player"));
			for (int i = 0; i < _cards.Count; i++)
			{
				CardView cardView = _cards[i];
				if (!cardView.Root.activeSelf)
				{
					cardView.Root.SetActive(true);
				}
				STUI.SetStretchRow(cardView.RootRect, 0f, 0f, (float)i * 96f, 88f);
				SetText(cardView.NameText, "Player Name");
				SetText(cardView.InfoText, STStrings.Distance(12.3f, metric: true) + "   " + STStrings.StateDead);
				SetText(cardView.GoLabel, STStrings.GoToLabel);
				SetText(cardView.BringLabel, STStrings.BringLabel);
				cardView.BoundIndex = -1;
			}
		}
	}
	internal struct STScrollState
	{
		private const float Smoothing = 22f;

		private const float SnapDistance = 0.3f;

		internal float Offset;

		internal float Target;

		internal float Max;

		internal float Progress
		{
			get
			{
				if (!(Max > 0f))
				{
					return 0f;
				}
				return Clamp01(Offset / Max);
			}
		}

		internal void Reset()
		{
			Offset = 0f;
			Target = 0f;
		}

		internal void SetMax(float max)
		{
			Max = ((max > 0f) ? max : 0f);
			Offset = Clamp(Offset);
			Target = Clamp(Target);
		}

		internal void ScrollBy(float delta)
		{
			Target = Clamp(Target + delta);
		}

		internal void Drag(float offset)
		{
			if (!float.IsNaN(offset))
			{
				Offset = Clamp(offset);
				Target = Offset;
			}
		}

		internal void Step(float deltaTime)
		{
			if (Math.Abs(Target - Offset) <= 0.3f)
			{
				Offset = Target;
				return;
			}
			float num = 1f - (float)Math.Exp(-22f * ((deltaTime > 0f) ? deltaTime : 0f));
			Offset += (Target - Offset) * num;
		}

		internal static float OffsetForThumbTop(float thumbTop, float viewportHeight, float thumbHeight, float max)
		{
			float num = viewportHeight - thumbHeight;
			if (num <= 0.01f || max <= 0f || float.IsNaN(thumbTop))
			{
				return 0f;
			}
			return Clamp01(thumbTop / num) * max;
		}

		private float Clamp(float value)
		{
			if (Max <= 0f || value < 0f)
			{
				return 0f;
			}
			if (!(value > Max))
			{
				return value;
			}
			return Max;
		}

		private static float Clamp01(float value)
		{
			if (value < 0f)
			{
				return 0f;
			}
			if (!(value > 1f))
			{
				return value;
			}
			return 1f;
		}
	}
	internal static class STSprites
	{
		private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>();

		internal static Sprite Fill(int radius)
		{
			return Get("fill" + radius, radius, 0, 0);
		}

		internal static Sprite Ring(int radius, int width)
		{
			return Get("ring" + radius + "x" + width, radius, width, 0);
		}

		internal static Sprite Shadow(int radius, int blur)
		{
			return Get("shadow" + radius + "x" + blur, radius, 0, blur);
		}

		private static Sprite Get(string key, int radius, int ringWidth, int blur)
		{
			if (Cache.TryGetValue(key, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			Sprite val = Build(radius, ringWidth, blur);
			Cache[key] = val;
			return val;
		}

		private static Sprite Build(int radius, int ringWidth, int blur)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			int num = 2 + blur;
			int num2 = radius + ringWidth + num;
			int num3 = num2 * 2 + 2;
			float num4 = (float)num3 * 0.5f;
			float num5 = num4 - (float)num;
			float corner = Mathf.Clamp((float)radius, 1f, num5);
			Texture2D val = new Texture2D(num3, num3, (TextureFormat)4, false)
			{
				name = "SimpleTeleportRounded",
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1,
				hideFlags = (HideFlags)61
			};
			Color32[] array = (Color32[])(object)new Color32[num3 * num3];
			for (int i = 0; i < num3; i++)
			{
				for (int j = 0; j < num3; j++)
				{
					byte b = (byte)Mathf.RoundToInt(Coverage(RoundedDistance((float)j + 0.5f - num4, (float)i + 0.5f - num4, num5, corner), ringWidth, blur) * 255f);
					array[i * num3 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b);
				}
			}
			val.SetPixels32(array);
			val.Apply(false, false);
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)num3, (float)num3), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)num2, (float)num2, (float)num2, (float)num2));
			((Object)obj).name = "SimpleTeleportRounded";
			((Object)obj).hideFlags = (HideFlags)61;
			return obj;
		}

		private static float RoundedDistance(float x, float y, float extent, float corner)
		{
			float num = Mathf.Abs(x) - (extent - corner);
			float num2 = Mathf.Abs(y) - (extent - corner);
			float num3 = Mathf.Max(num, 0f);
			float num4 = Mathf.Max(num2, 0f);
			return Mathf.Sqrt(num3 * num3 + num4 * num4) + Mathf.Min(Mathf.Max(num, num2), 0f) - corner;
		}

		private static float Coverage(float distance, int ringWidth, int blur)
		{
			if (blur > 0)
			{
				return Mathf.Clamp01(1f - distance / (float)blur);
			}
			if (ringWidth > 0)
			{
				float num = 0f - distance;
				return Mathf.Clamp01(Mathf.Min(num, (float)ringWidth - num) + 0.5f);
			}
			return Mathf.Clamp01(0.5f - distance);
		}
	}
	internal static class STStrings
	{
		private static bool IsChinese
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: 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_0009: Invalid comparison between Unknown and I4
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Invalid comparison between Unknown and I4
				Language cURRENT_LANGUAGE = LocalizedText.CURRENT_LANGUAGE;
				if ((int)cURRENT_LANGUAGE != 9)
				{
					return (int)cURRENT_LANGUAGE == 10;
				}
				return true;
			}
		}

		private static bool IsTraditional => (int)LocalizedText.CURRENT_LANGUAGE == 10;

		internal static string Title => Pick("传送面板", "傳送面板", "Teleport");

		internal static string ScrollHint => Pick("滚动鼠标滚轮或拖动右侧滑块查看更多玩家", "滾動滑鼠滾輪或拖動右側滑塊查看更多玩家", "Scroll or drag the bar to see more players");

		internal static string GoToLabel => Pick("我过去", "我過去", "Go To");

		internal static string BringLabel => Pick("拉过来", "拉過來", "Bring");

		internal static string Empty => Pick("房间里没有其他玩家", "房間裡沒有其他玩家", "No other players in the room");

		internal static string StateDead => Pick("[已死亡]", "[已死亡]", "[Dead]");

		internal static string StateDown => Pick("[昏迷]", "[昏迷]", "[Down]");

		internal static string StateWarping => Pick("[传送中]", "[傳送中]", "[Warping]");

		internal static string Busy => Pick("上一次传送还没结束", "上一次傳送還沒結束", "Previous warp still running");

		internal static string SelfDead => Pick("你已死亡,无法移动", "你已死亡,無法移動", "You are dead");

		internal static string MoverDead => Pick("对方已死亡,无法移动", "對方已死亡,無法移動", "Target is dead");

		internal static string AnchorUnknown => Pick("找不到对方的有效位置", "找不到對方的有效位置", "No valid position for target");

		internal static string Unavailable => Pick("当前无法传送", "當前無法傳送", "Teleport unavailable right now");

		internal static string NoPosition => Pick("位置未知", "位置未知", "Position unknown");

		private static string Pick(string simplified, string traditional, string english)
		{
			if (!IsChinese)
			{
				return english;
			}
			if (!IsTraditional)
			{
				return simplified;
			}
			return traditional;
		}

		internal static string Hint(string key)
		{
			return Pick("按 " + key + " 关闭", "按 " + key + " 關閉", "Press " + key + " to close");
		}

		internal static string Count(int shownFrom, int shownTo, int total)
		{
			if (total <= 0)
			{
				return string.Empty;
			}
			string text = string.Format(CultureInfo.InvariantCulture, "{0}-{1} / {2}", shownFrom, shownTo, total);
			return Pick("玩家 " + text, "玩家 " + text, "Players " + text);
		}

		internal static string Total(int total)
		{
			return Pick("玩家 " + total, "玩家 " + total, "Players " + total);
		}

		internal static string Distance(float meters, bool metric)
		{
			string text = meters.ToString((meters < 100f) ? "0.0" : "0", CultureInfo.InvariantCulture);
			return Pick("距离 ", "距離 ", "Dist ") + (metric ? (text + "m") : text);
		}

		internal static string Cooldown(float remaining)
		{
			string text = remaining.ToString("0.0", CultureInfo.InvariantCulture);
			if (!IsChinese)
			{
				return "Cooldown " + text + "s";
			}
			if (!IsTraditional)
			{
				return "冷却中 " + text + "s";
			}
			return "冷卻中 " + text + "s";
		}

		internal static string SentGoTo(string target)
		{
			return Pick("已传送到 " + target, "已傳送到 " + target, "Teleported to " + target);
		}

		internal static string SentBring(string target)
		{
			return Pick("已把 " + target + " 拉过来", "已把 " + target + " 拉過來", "Pulled " + target + " to you");
		}
	}
	internal static class STText
	{
		private const string UnknownName = "???";

		internal static string RawName(Character character)
		{
			if ((Object)(object)character == (Object)null)
			{
				return null;
			}
			string characterName = character.characterName;
			if (!string.IsNullOrWhiteSpace(characterName))
			{
				return characterName;
			}
			PhotonView photonView = ((MonoBehaviourPun)character).photonView;
			if (photonView == null)
			{
				return null;
			}
			Player owner = photonView.Owner;
			if (owner == null)
			{
				return null;
			}
			return owner.NickName;
		}

		internal static string Display(string raw)
		{
			string text = STMarkup.Clean(raw).Trim();
			if (text.Length != 0)
			{
				return text;
			}
			return "???";
		}

		internal static string PlayerName(Character character)
		{
			return Display(RawName(character));
		}
	}
	internal static class STTextWidth
	{
		internal const int EllipsisUnits = 64;

		internal static string Truncate(string value, int maxUnits)
		{
			if (string.IsNullOrEmpty(value) || Measure(value) <= maxUnits)
			{
				return value;
			}
			int num = maxUnits - 64;
			int num2 = 0;
			int length = 0;
			TextElementEnumerator textElementEnumerator = StringInfo.GetTextElementEnumerator(value);
			while (textElementEnumerator.MoveNext())
			{
				string text = (string)textElementEnumerator.Current;
				num2 += ElementWidth(text);
				if (num2 > num)
				{
					break;
				}
				length = textElementEnumerator.ElementIndex + text.Length;
			}
			return value.Substring(0, length) + "..";
		}

		internal static int Measure(string value)
		{
			if (string.IsNullOrEmpty(value))
			{
				return 0;
			}
			int num = 0;
			TextElementEnumerator textElementEnumerator = StringInfo.GetTextElementEnumerator(value);
			while (textElementEnumerator.MoveNext())
			{
				num += ElementWidth((string)textElementEnumerator.Current);
			}
			return num;
		}

		private static int ElementWidth(string element)
		{
			if (element.Length >= 2 && char.IsHighSurrogate(element[0]))
			{
				return 100;
			}
			char c = element[0];
			if (IsWide(c))
			{
				return 100;
			}
			switch (c)
			{
			case 'm':
			case 'w':
				return 85;
			case 'M':
			case 'W':
				return 90;
			case '!':
			case ',':
			case '.':
			case ':':
			case ';':
			case 'I':
			case 'i':
			case 'j':
			case 'l':
			case '|':
				return 32;
			default:
				if (c >= 'A' && c <= 'Z')
				{
					return 68;
				}
				if (c >= 'a' && c <= 'z')
				{
					return 55;
				}
				if (c >= '0' && c <= '9')
				{
					return 60;
				}
				if (c == ' ')
				{
					return 50;
				}
				if (c >= '\u0080')
				{
					return 62;
				}
				return 45;
			}
		}

		private static bool IsWide(char c)
		{
			if (c < 'ᄀ')
			{
				return false;
			}
			if ((c >= '\u200b' && c <= '\u200f') || (c >= '\u202a' && c <= '\u202e') || (c >= '\u2066' && c <= '\u2069'))
			{
				return false;
			}
			if ((c < 'ᄀ' || c > 'ᅟ') && (c < '⺀' || c > '〾') && (c < 'ぁ' || c > '㏿') && (c < '㐀' || c > '䶿') && (c < '一' || c > '鿿') && (c < 'ꀀ' || c > '\ua4cf') && (c < '가' || c > '힣') && (c < '豈' || c > '\ufaff') && (c < '︰' || c > '\ufe6f') && (c < '\uff00' || c > '⦆'))
			{
				if (c >= '¢')
				{
					return c <= '₩';
				}
				return false;
			}
			return true;
		}
	}
	internal static class STUI
	{
		private static TMP_FontAsset _font;

		private static int _uiLayer = -1;

		internal static TMP_FontAsset ResolveFont()
		{
			if ((Object)(object)_font != (Object)null)
			{
				return _font;
			}
			GUIManager instance = GUIManager.instance;
			if ((Object)(object)instance != (Object)null)
			{
				_font = FontFrom(instance.interactNameText) ?? FontFrom(instance.interactPromptText) ?? FontFrom(instance.itemPromptMain) ?? FontFrom(instance.spectatingNameText);
			}
			if ((Object)(object)_font == (Object)null)
			{
				TextMeshProUGUI[] array = Object.FindObjectsByType<TextMeshProUGUI>((FindObjectsSortMode)0);
				for (int i = 0; i < array.Length; i++)
				{
					if ((Object)(object)array[i] != (Object)null && (Object)(object)((TMP_Text)array[i]).font != (Object)null)
					{
						_font = ((TMP_Text)array[i]).font;
						break;
					}
				}
			}
			if ((Object)(object)_font == (Object)null)
			{
				_font = TMP_Settings.defaultFontAsset;
			}
			if ((Object)(object)_font == (Object)null)
			{
				STLog.Warn("没有找到可用的 TMP 字体,面板文字可能不显示。");
			}
			return _font;
		}

		private static float MaxLineHeightRatio(TMP_FontAsset font)
		{
			float num = RatioOf(font);
			if ((Object)(object)font != (Object)null && font.fallbackFontAssetTable != null)
			{
				for (int i = 0; i < font.fallbackFontAssetTable.Count; i++)
				{
					TMP_FontAsset val = font.fallbackFontAssetTable[i];
					if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)font)
					{
						num = Mathf.Max(num, RatioOf(val));
					}
				}
			}
			return num;
		}

		private static float RatioOf(TMP_FontAsset font)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)font == (Object)null))
			{
				FaceInfo faceInfo = ((TMP_Asset)font).faceInfo;
				if (!(((FaceInfo)(ref faceInfo)).pointSize <= 0f))
				{
					faceInfo = ((TMP_Asset)font).faceInfo;
					float lineHeight = ((FaceInfo)(ref faceInfo)).lineHeight;
					faceInfo = ((TMP_Asset)font).faceInfo;
					return lineHeight / ((FaceInfo)(ref faceInfo)).pointSize;
				}
			}
			return 1.6f;
		}

		internal static float RowHeightFor(float fontSize)
		{
			float num = Mathf.Clamp(MaxLineHeightRatio(ResolveFont()), 1.2f, 2.2f);
			return Mathf.Ceil(fontSize * num) + 4f;
		}

		private static TMP_FontAsset FontFrom(TextMeshProUGUI text)
		{
			if (!((Object)(object)text != (Object)null))
			{
				return null;
			}
			return ((TMP_Text)text).font;
		}

		internal static RectTransform Rect(GameObject go)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			return (RectTransform)go.transform;
		}

		private static GameObject NewUIObject(string name, Transform parent)
		{
			//IL_0014: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			if (_uiLayer < 0)
			{
				int num = LayerMask.NameToLayer("UI");
				_uiLayer = ((num >= 0) ? num : 5);
			}
			val.layer = _uiLayer;
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			((Transform)val2).localScale = Vector3.one;
			((Transform)val2).localRotation = Quaternion.identity;
			val2.anchoredPosition3D = Vector3.zero;
			return val;
		}

		internal static RectTransform CreateContainer(string name, Transform parent)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			return (RectTransform)NewUIObject(name, parent).transform;
		}

		internal static Image CreateRect(string name, Transform parent, Color color)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Image obj = NewUIObject(name, parent).AddComponent<Image>();
			((Graphic)obj).color = color;
			((Graphic)obj).raycastTarget = false;
			return obj;
		}

		internal static Image CreateImage(string name, Transform parent, Sprite sprite, Type type, Color color)
		{
			//IL_0002: 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)
			Image obj = CreateRect(name, parent, color);
			obj.sprite = sprite;
			obj.type = type;
			return obj;
		}

		internal static TextMeshProUGUI CreateText(string name, Transform parent, float fontSize, TextAlignmentOptions alignment, Color color)
		{
			//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_004f: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI val = NewUIObject(name, parent).AddComponent<TextMeshProUGUI>();
			TMP_FontAsset val2 = ResolveFont();
			if ((Object)(object)val2 != (Object)null)
			{
				((TMP_Text)val).font = val2;
			}
			((TMP_Text)val).fontSize = fontSize;
			((TMP_Text)val).enableAutoSizing = false;
			((TMP_Text)val).alignment = alignment;
			((Graphic)val).color = color;
			((TMP_Text)val).richText = false;
			((Graphic)val).raycastTarget = false;
			((TMP_Text)val).margin = Vector4.zero;
			((TMP_Text)val).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)val).overflowMode = (TextOverflowModes)0;
			return val;
		}

		internal static void Stretch(RectTransform rect)
		{
			//IL_0001: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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)
			rect.anchorMin = Vector2.zero;
			rect.anchorMax = Vector2.one;
			rect.pivot = new Vector2(0.5f, 0.5f);
			rect.offsetMin = Vector2.zero;
			rect.offsetMax = Vector2.zero;
		}

		internal static void SetTopLeft(RectTransform rect, float x, float y, float width, float height)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			rect.anchorMin = new Vector2(0f, 1f);
			rect.anchorMax = new Vector2(0f, 1f);
			rect.pivot = new Vector2(0f, 1f);
			rect.sizeDelta = new Vector2(width, height);
			rect.anchoredPosition = new Vector2(x, 0f - y);
		}

		internal static void SetTopCenter(RectTransform rect, float y, float width, float height)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			rect.anchorMin = new Vector2(0.5f, 1f);
			rect.anchorMax = new Vector2(0.5f, 1f);
			rect.pivot = new Vector2(0.5f, 1f);
			rect.sizeDelta = new Vector2(width, height);
			rect.anchoredPosition = new Vector2(0f, 0f - y);
		}

		internal static void SetTopRight(RectTransform rect, float xFromRight, float y, float width, float height)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			rect.anchorMin = new Vector2(1f, 1f);
			rect.anchorMax = new Vector2(1f, 1f);
			rect.pivot = new Vector2(1f, 1f);
			rect.sizeDelta = new Vector2(width, height);
			rect.anchoredPosition = new Vector2(0f - xFromRight, 0f - y);
		}

		internal static void SetStretchRow(RectTransform rect, float padLeft, float padRight, float y, float height)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			rect.anchorMin = new Vector2(0f, 1f);
			rect.anchorMax = new Vector2(1f, 1f);
			rect.pivot = new Vector2(0.5f, 1f);
			rect.offsetMin = new Vector2(padLeft, 0f - y - height);
			rect.offsetMax = new Vector2(0f - padRight, 0f - y);
		}

		internal static void SetBottomRow(RectTransform rect, float padLeft, float padRight, float y, float height)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			rect.anchorMin = new Vector2(0f, 0f);
			rect.anchorMax = new Vector2(1f, 0f);
			rect.pivot = new Vector2(0.5f, 0f);
			rect.offsetMin = new Vector2(padLeft, y);
			rect.offsetMax = new Vector2(0f - padRight, y + height);
		}
	}
	internal enum TeleportFailure
	{
		None,
		Unavailable,
		MoverDead,
		AnchorUnknown,
		Busy,
		Cooldown
	}
	internal static class TeleportService
	{
		private const int RingSamples = 8;

		private const float ClearanceRadius = 0.35f;

		private const float GroundProbeDistance = 4f;

		private const float DeathVoidHeight = 3000f;

		private static float _lastTeleportTime = -999f;

		internal static float CooldownRemaining
		{
			get
			{
				float num = _lastTeleportTime + STConfig.CooldownSeconds.Value - Time.unscaledTime;
				if (!(num > 0f))
				{
					return 0f;
				}
				return num;
			}
		}

		internal static bool IsPositionReady(Character character)
		{
			if ((Object)(object)character == (Object)null || character.refs == null)
			{
				return false;
			}
			CharacterRagdoll ragdoll = character.refs.ragdoll;
			if ((Object)(object)ragdoll == (Object)null || ragdoll.partDict == null)
			{
				return false;
			}
			return ragdoll.partDict.ContainsKey((BodypartType)2);
		}

		internal static Vector3 AnchorPosition(Character character)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return character.GetSpectatePosition();
		}

		internal static TeleportFailure Validate(Character mover, Character anchor)
		{
			if ((Object)(object)mover == (Object)null || (Object)(object)anchor == (Object)null || (Object)(object)mover == (Object)(object)anchor)
			{
				return TeleportFailure.Unavailable;
			}
			if (!PhotonNetwork.InRoom)
			{
				return TeleportFailure.Unavailable;
			}
			PhotonView photonView = ((MonoBehaviourPun)mover).photonView;
			if ((Object)(object)photonView == (Object)null || photonView.ViewID < 1)
			{
				return TeleportFailure.Unavailable;
			}
			if ((Object)(object)mover.data != (Object)null && mover.data.dead)
			{
				return TeleportFailure.MoverDead;
			}
			if (!TryGetAnchorPosition(anchor, out var _))
			{
				return TeleportFailure.AnchorUnknown;
			}
			if (mover.warping || anchor.warping)
			{
				return TeleportFailure.Busy;
			}
			if (!(CooldownRemaining > 0f))
			{
				return TeleportFailure.None;
			}
			return TeleportFailure.Cooldown;
		}

		internal static string Describe(TeleportFailure failure, Character mover)
		{
			switch (failure)
			{
			case TeleportFailure.MoverDead:
				if (!((Object)(object)mover != (Object)null) || !mover.IsLocal)
				{
					return STStrings.MoverDead;
				}
				return STStrings.SelfDead;
			case TeleportFailure.AnchorUnknown:
				return STStrings.AnchorUnknown;
			case TeleportFailure.Busy:
				return STStrings.Busy;
			case TeleportFailure.Cooldown:
				return STStrings.Cooldown(CooldownRemaining);
			default:
				return STStrings.Unavailable;
			}
		}

		internal static bool Teleport(Character mover, Character anchor, out string message)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			TeleportFailure teleportFailure = Validate(mover, anchor);
			if (teleportFailure != TeleportFailure.None)
			{
				message = Describe(teleportFailure, mover);
				return false;
			}
			if (!TryGetAnchorPosition(anchor, out var position))
			{
				message = STStrings.AnchorUnknown;
				return false;
			}
			Vector3 val = ResolveArrivalPoint(mover, anchor, position);
			((MonoBehaviourPun)mover).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true });
			_lastTeleportTime = Time.unscaledTime;
			STLog.Info($"Warp {mover.characterName} -> {val} (anchor {anchor.characterName})");
			message = null;
			return true;
		}

		internal static bool TryGetAnchorPosition(Character anchor, out Vector3 position)
		{
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			position = Vector3.zero;
			if (!IsPositionReady(anchor))
			{
				return false;
			}
			position = AnchorPosition(anchor);
			if ((Object)(object)anchor.data != (Object)null && anchor.data.dead && (((Vector3)(ref position)).sqrMagnitude < 1f || position.y > 3000f))
			{
				return false;
			}
			return true;
		}

		private static Vector3 ResolveArrivalPoint(Character mover, Character anchor, Vector3 anchorPosition)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp(STConfig.ArrivalOffset.Value, 0.5f, 6f);
			Vector3 val = PreferredDirection(mover, anchor, anchorPosition);
			float num2 = 45f;
			for (int i = 0; i < 2; i++)
			{
				bool flag = i == 0;
				for (int j = 0; j < 8; j++)
				{
					Vector3 val2 = Quaternion.AngleAxis(num2 * (float)j, Vector3.up) * val;
					Vector3 val3 = anchorPosition + val2 * num;
					if (IsClear(anchorPosition, val3) && (!flag || HasGroundBelow(val3)))
					{
						return val3;
					}
				}
			}
			return anchorPosition + Vector3.up * 0.25f;
		}

		private static Vector3 PreferredDirection(Character mover, Character anchor, Vector3 anchorPosition)
		{
			//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_0007: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = AnchorPosition(mover) - anchorPosition;
			val.y = 0f;
			if (((Vector3)(ref val)).sqrMagnitude > 0.0001f)
			{
				return ((Vector3)(ref val)).normalized;
			}
			if ((Object)(object)anchor.data != (Object)null)
			{
				Vector3 lookDirection = anchor.data.lookDirection;
				lookDirection.y = 0f;
				if (((Vector3)(ref lookDirection)).sqrMagnitude > 0.0001f)
				{
					return ((Vector3)(ref lookDirection)).normalized;
				}
			}
			return Vector3.forward;
		}

		private static bool IsClear(Vector3 anchorPosition, Vector3 candidate)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			LayerMask terrainMapMask = HelperFunctions.terrainMapMask;
			if (Physics.CheckSphere(candidate, 0.35f, LayerMask.op_Implicit(terrainMapMask), (QueryTriggerInteraction)1))
			{
				return false;
			}
			Vector3 val = candidate - anchorPosition;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (magnitude < 0.01f)
			{
				return false;
			}
			return !Physics.Raycast(anchorPosition, val / magnitude, magnitude, LayerMask.op_Implicit(terrainMapMask), (QueryTriggerInteraction)1);